use of com.b3dgs.lionengine.Xml in project lionengine by b3dgs.
the class LauncherConfigTest method testExportsImports.
/**
* Test exports imports.
*/
@Test
void testExportsImports() {
final LaunchableConfig launchable = new LaunchableConfig("media", "sfx", 10, 1, 2, new Force(1.0, 2.0));
final LauncherConfig launcher = new LauncherConfig(10, 10, true, Arrays.asList(launchable));
final Xml root = new Xml("test");
root.add(LauncherConfig.exports(launcher));
final Media media = Medias.create("launcher.xml");
root.save(media);
assertEquals(launcher, LauncherConfig.imports(new Xml(media).getChild(LauncherConfig.NODE_LAUNCHER)));
assertEquals(Arrays.asList(launcher), LauncherConfig.imports(new Configurer(media)));
assertTrue(media.getFile().delete());
}
use of com.b3dgs.lionengine.Xml in project lionengine by b3dgs.
the class UtilLaunchable method createLauncherMedia.
/**
* Create the media.
*
* @param launchableMedia The launchable.
* @param delay The desired delay.
* @return The media.
*/
public static Media createLauncherMedia(Media launchableMedia, int delay) {
final Media media = Medias.create("launcher.xml");
final LaunchableConfig launchableConfig = new LaunchableConfig(launchableMedia.getPath(), null, delay, 1, 2, new Force(1.0, 2.0));
final LauncherConfig launcherConfig = new LauncherConfig(0, 10, false, Arrays.asList(launchableConfig));
final Xml root = new Xml("test");
root.add(LauncherConfig.exports(launcherConfig));
root.add(LauncherConfig.exports(new LauncherConfig(1, 50, false, Arrays.asList(launchableConfig))));
root.save(media);
return media;
}
use of com.b3dgs.lionengine.Xml in project lionengine by b3dgs.
the class TileConfigTest method testExports.
/**
* Test exports.
*/
@Test
void testExports() {
final int number = 1;
final Xml nodeTile = TileConfig.exports(number);
assertEquals(number, nodeTile.getInteger(TileConfig.ATT_TILE_NUMBER));
}
use of com.b3dgs.lionengine.Xml in project lionengine by b3dgs.
the class StateConfigTest method testNoNode.
/**
* Test with no node.
*/
@Test
void testNoNode() {
final Xml root = new Xml("test");
assertFalse(StateConfig.imports(root).isPresent());
}
use of com.b3dgs.lionengine.Xml in project lionengine by b3dgs.
the class OriginConfig method exports.
/**
* Export the node from config.
*
* @param origin The origin reference (must not be <code>null</code>).
* @return The node.
* @throws LionEngineException If unable to write node.
*/
public static Xml exports(Origin origin) {
Check.notNull(origin);
final Xml node = new Xml(NODE_ORIGIN);
node.setText(origin.name());
return node;
}
Aggregations