/* * AppleCommander - An Apple ][ image utility. * Copyright (C) 2002 by Robert Greene * robgreene at users.sourceforge.net * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package com.webcodepro.applecommander.storage; import com.webcodepro.applecommander.storage.FormattedDisk.DiskUsage; import com.webcodepro.applecommander.storage.filters.ApplesoftFileFilter; import com.webcodepro.applecommander.storage.filters.BinaryFileFilter; import com.webcodepro.applecommander.storage.filters.GraphicsFileFilter; import com.webcodepro.applecommander.storage.filters.IntegerBasicFileFilter; import com.webcodepro.applecommander.storage.filters.TextFileFilter; import java.io.IOException; import java.util.List; import junit.framework.TestCase; /** * Test Disk and FormattedDisk for read. *

* Date created: Oct 3, 2002 11:35:26 PM * @author Rob Greene */ public class DiskHelperTest extends TestCase { public DiskHelperTest(String name) { super(name); } public static void main(String[] args) { junit.textui.TestRunner.run(DiskHelperTest.class); } public void testLoadDos33() throws IOException { FormattedDisk[] disks = showDirectory("C:/My Apple2/Disks/DOS 3.3.po"); assertApplesoftFile(disks[0], "HELLO"); assertIntegerFile(disks[0], "ANIMALS"); assertTextFile(disks[0], "APPLE PROMS"); assertBinaryFile(disks[0], "BOOT13"); } public void testLoadMaster() throws IOException { showDirectory("C:/My Apple2/Disks/MASTER.DSK"); } public void testLoadGalacticAttack1() throws IOException { showDirectory("C:/My Apple2/Disks/galatt.dsk"); } public void testLoadProdos() throws IOException { FormattedDisk[] disks = showDirectory("C:/My Apple2/Disks/Prodos.dsk"); assertApplesoftFile(disks[0], "COPY.ME"); assertBinaryFile(disks[0], "SETTINGS"); assertBinaryFile(disks[0], "PRODOS"); } public void testLoadMarbleMadness() throws IOException { showDirectory("C:/My Apple2/Disks/Marble Madness (1985)(Electronic Arts).2mg"); } public void testLoadHd1() throws IOException { showDirectory("C:/My Apple2/ApplePC/hd1.hdv"); } public void testRdosBoot() throws IOException { showDirectory("C:/My Apple2/Disks/RDOSboot.dsk"); } public void testSsiSave() throws IOException { showDirectory("C:/My Apple2/Disks/SSIsave.dsk"); } public void testPhan2d1() throws IOException { FormattedDisk[] disks = showDirectory("C:/My Apple2/Disks/phan2d1.dsk"); assertApplesoftFile(disks[0], "PHANTASIE II"); assertBinaryFile(disks[0], "TWN21"); assertTextFile(disks[0], "ITEM"); assertGraphicsFile(disks[0], "ICE DRAGON"); } public void testPhan2d2() throws IOException { showDirectory("C:/My Apple2/Disks/phan2d2.dsk"); } public void testPhantasie1() throws IOException { showDirectory("C:/My Apple2/Disks/Phantasie1.dsk"); } public void testPhantasie2() throws IOException { showDirectory("C:/My Apple2/Disks/Phantasie2.dsk"); } public void testCavernsOfFreitag() throws IOException { FormattedDisk[] disks = showDirectory("C:/My Apple2/Disks/CavernsOfFreitag.dsk"); assertGraphicsFile(disks[0], "TITLE.PIC"); } public void testUniDosD3110() throws IOException { showDirectory("C:/My Apple2/Disks/UniDOS/D3110.dsk"); } public void testUniDosD3151() throws IOException { showDirectory("C:/My Apple2/Disks/UniDOS/D3151.dsk"); } protected FormattedDisk[] showDirectory(String imageName) throws IOException { Disk disk = new Disk(imageName); FormattedDisk[] formattedDisks = disk.getFormattedDisks(); for (int i=0; i 0 && i % 80 == 0) System.out.println(); usage.next(); System.out.print(usage.isFree() ? "." : "U"); i++; } System.out.println(); } else { for (int y=dimensions[0]-1; y>=0; y--) { for (int x=0; x