use of mudmap2.backend.World in project mudmap2 by Neop.
the class WorldPanelTest method testIsPassive.
/**
* Test of isPassive method, of class WorldPanel.
*/
@Test
public void testIsPassive() {
System.out.println("isPassive");
WorldPanel instance = new WorldPanel(null, new World(), false);
assertFalse(instance.isPassive());
instance = new WorldPanel(null, new World(), true);
assertTrue(instance.isPassive());
}
use of mudmap2.backend.World in project mudmap2 by Neop.
the class WorldPanelTest method testGetSelectedPlace.
/**
* Test of getSelectedPlace method, of class WorldPanel.
*/
@Test
public void testGetSelectedPlace() {
try {
System.out.println("getSelectedPlace");
World world = new World();
Layer l = world.getNewLayer();
Place pl1 = new Place("BLa", 4, 6, l);
l.put(pl1);
Place pl2 = new Place("Blub", 7, 1, l);
l.put(pl2);
WorldPanel instance = new WorldPanel(null, world, false);
instance.pushPosition(new WorldCoordinate(l.getId(), 0, 0));
instance.setCursor(2, 3);
assertNull(instance.getSelectedPlace());
instance.setCursor(pl1.getX(), pl1.getY());
assertEquals(pl1, instance.getSelectedPlace());
instance.setCursor(pl2.getX(), pl2.getY());
assertEquals(pl2, instance.getSelectedPlace());
} catch (Layer.PlaceNotInsertedException ex) {
Logger.getLogger(WorldPanelTest.class.getName()).log(Level.SEVERE, null, ex);
}
}
use of mudmap2.backend.World in project mudmap2 by Neop.
the class WorldTabTest method testGetWorldPanel.
/**
* Test of getWorldPanel method, of class WorldTab.
*/
@Test
public void testGetWorldPanel() {
System.out.println("getWorldPanel");
WorldTab instance = new WorldTab(null, new World(), false);
assertNotNull(instance.getWorldPanel());
instance = new WorldTab(null, new World(), true);
assertNotNull(instance.getWorldPanel());
instance = new WorldTab(null, new World(), "", false);
assertNotNull(instance.getWorldPanel());
instance = new WorldTab(null, new World(), "", true);
assertNotNull(instance.getWorldPanel());
instance = new WorldTab(instance);
assertNotNull(instance.getWorldPanel());
}
use of mudmap2.backend.World in project mudmap2 by Neop.
the class WorldTabTest method testGetFilename.
/**
* Test of get/seFilename methods, of class WorldTab.
*/
@Test
public void testGetFilename() {
System.out.println("getFilename");
WorldTab instance = new WorldTab(null, new World(), false);
String filename = "/tmp/foobar/baz";
instance.setFilename(filename);
assertEquals(filename, instance.getFilename());
}
use of mudmap2.backend.World in project mudmap2 by Neop.
the class WorldFileList method readDirectory.
/**
* Get available worlds from filesystem
*/
public static void readDirectory() {
// get file list
File dir = new File(Environment.getWorldsDir());
File[] fileList = dir.listFiles();
if (fileList != null) {
// find world files in file list
for (File file : fileList) {
// exclude meta and backup files
if (!file.getName().equals("worlds") && !file.getName().endsWith("_meta") && !file.getName().endsWith(".backup") && !file.getName().endsWith(".bak") && file.isFile() && file.canRead()) {
// check if file is world file
WorldFileDefault worldFile = new WorldFileDefault(file.getPath());
try {
if (worldFile.canRead()) {
// is world file
String name = worldFile.readWorldName();
availableWorlds.put(file.getPath(), name);
}
} catch (FileNotFoundException ex) {
} catch (Exception ex) {
Logger.getLogger(WorldFileList.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
}
}
Aggregations