use of com.b3dgs.lionengine.Xml in project lionengine by b3dgs.
the class CollisionConfigTest method testNoNode.
/**
* Test no node.
*/
@Test
void testNoNode() {
final Xml root = new Xml(Constant.XML_PREFIX + FeaturableConfig.NODE_FEATURABLE);
assertTrue(CollisionConfig.imports(root).getCollisions().isEmpty());
}
use of com.b3dgs.lionengine.Xml in project lionengine by b3dgs.
the class UtilActionnable method createAction.
/**
* Create a default action.
*
* @param description The description.
* @param area The button.
* @return The temp media.
*/
public static Media createAction(String description, Area area) {
final Media media = Medias.create("action.xml");
final String name = "name";
final ActionConfig action = new ActionConfig(name, description, (int) area.getX(), (int) area.getY(), area.getWidth(), area.getHeight());
final Xml root = new Xml("test");
root.add(ActionConfig.exports(action));
root.save(media);
return media;
}
use of com.b3dgs.lionengine.Xml in project lionengine by b3dgs.
the class AttackerModelTest method testNoConfig.
/**
* Test without config.
*/
@Test
void testNoConfig() {
final Media media = UtilTransformable.createMedia(AttackerModelTest.class);
final Xml xml = new Xml(media);
xml.save(media);
final AttackerModel attacker = new AttackerModel(services, new Setup(media));
assertTrue(attacker.getAttackDamages() == 0);
assertTrue(media.getFile().delete());
}
use of com.b3dgs.lionengine.Xml in project lionengine by b3dgs.
the class ProducerModelTest method createMedia.
/**
* Create default media.
*
* @return The default media.
*/
private static Media createMedia() {
final Media media = UtilSetup.createMedia(Featurable.class);
final Xml root = new Xml("test");
root.add(ActionsConfig.exports(Collections.emptyList()));
root.save(media);
return media;
}
use of com.b3dgs.lionengine.Xml in project lionengine by b3dgs.
the class LaunchableConfigTest 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 Xml root = new Xml("test");
root.add(LaunchableConfig.exports(launchable));
final Media media = Medias.create("launchable.xml");
root.save(media);
assertEquals(launchable, LaunchableConfig.imports(new Xml(media).getChild(LaunchableConfig.NODE_LAUNCHABLE)));
assertTrue(media.getFile().delete());
}
Aggregations