Search in sources :

Example 1 with Configurer

use of com.b3dgs.lionengine.game.Configurer in project lionengine by b3dgs.

the class ActionConfigTest method testExportsImports.

/**
 * Test exports imports.
 */
@Test
void testExportsImports() {
    final ActionConfig action = new ActionConfig("name", "description", 0, 1, 16, 32);
    final Xml root = new Xml("test");
    root.add(ActionConfig.exports(action));
    final Media media = Medias.create("action.xml");
    root.save(media);
    assertEquals(action, ActionConfig.imports(new Xml(media)));
    assertEquals(action, ActionConfig.imports(new Configurer(media)));
    assertTrue(media.getFile().delete());
}
Also used : Xml(com.b3dgs.lionengine.Xml) Media(com.b3dgs.lionengine.Media) Configurer(com.b3dgs.lionengine.game.Configurer) Test(org.junit.jupiter.api.Test)

Example 2 with Configurer

use of com.b3dgs.lionengine.game.Configurer in project lionengine by b3dgs.

the class ActionsConfigTest method testExportsImports.

/**
 * Test exports imports.
 */
@Test
void testExportsImports() {
    final ActionRef ref = new ActionRef("ref", false, new ArrayList<ActionRef>());
    final ActionRef ref2 = new ActionRef("ref", false, Arrays.asList(ref));
    final Collection<ActionRef> refs = Arrays.asList(new ActionRef("test", true, Arrays.asList(ref2)));
    final Xml root = new Xml("test");
    root.add(ActionsConfig.exports(refs));
    final Media media = Medias.create("producer.xml");
    root.save(media);
    assertEquals(refs, ActionsConfig.imports(new Xml(media), null));
    assertEquals(refs, ActionsConfig.imports(new Configurer(media), null));
    assertTrue(media.getFile().delete());
}
Also used : Xml(com.b3dgs.lionengine.Xml) Media(com.b3dgs.lionengine.Media) Configurer(com.b3dgs.lionengine.game.Configurer) Test(org.junit.jupiter.api.Test)

Example 3 with Configurer

use of com.b3dgs.lionengine.game.Configurer in project lionengine by b3dgs.

the class LayerableConfigTest method testExportsImports.

/**
 * Test exports imports.
 */
@Test
void testExportsImports() {
    final Xml root = new Xml("test");
    final LayerableConfig config = new LayerableConfig(0, 1);
    root.add(LayerableConfig.exports(config));
    final Media media = Medias.create("Object.xml");
    root.save(media);
    assertEquals(config, LayerableConfig.imports(new Xml(media)));
    assertEquals(config, LayerableConfig.imports(new Configurer(media)));
    assertTrue(media.getFile().delete());
}
Also used : Xml(com.b3dgs.lionengine.Xml) Media(com.b3dgs.lionengine.Media) Configurer(com.b3dgs.lionengine.game.Configurer) Test(org.junit.jupiter.api.Test)

Example 4 with Configurer

use of com.b3dgs.lionengine.game.Configurer in project lionengine by b3dgs.

the class ProducibleConfigTest method testExportsImports.

/**
 * Test exports imports.
 */
@Test
void testExportsImports() {
    final ProducibleConfig producible = new ProducibleConfig(1, 2, 3);
    final Xml root = new Xml("test");
    root.add(SizeConfig.exports(new SizeConfig(producible.getWidth(), producible.getHeight())));
    root.add(ProducibleConfig.exports(producible));
    final Media media = Medias.create("producible.xml");
    root.save(media);
    assertEquals(producible, ProducibleConfig.imports(new Xml(media)));
    assertEquals(producible, ProducibleConfig.imports(new Setup(media)));
    assertEquals(producible, ProducibleConfig.imports(new Configurer(media)));
    assertTrue(media.getFile().delete());
}
Also used : Xml(com.b3dgs.lionengine.Xml) Media(com.b3dgs.lionengine.Media) SizeConfig(com.b3dgs.lionengine.game.SizeConfig) Setup(com.b3dgs.lionengine.game.feature.Setup) Configurer(com.b3dgs.lionengine.game.Configurer) Test(org.junit.jupiter.api.Test)

Example 5 with Configurer

use of com.b3dgs.lionengine.game.Configurer in project lionengine by b3dgs.

the class AttackerConfigTest method testExportsImports.

/**
 * Test exports imports.
 */
@Test
void testExportsImports() {
    final AttackerConfig config = new AttackerConfig(1, 2, 3, 4, 5);
    final Xml root = new Xml("test");
    root.add(AttackerConfig.exports(config));
    final Media media = Medias.create("Object.xml");
    root.save(media);
    assertEquals(config, AttackerConfig.imports(new Xml(media)));
    assertEquals(config, AttackerConfig.imports(new Configurer(media)));
    assertTrue(media.getFile().delete());
}
Also used : Xml(com.b3dgs.lionengine.Xml) Media(com.b3dgs.lionengine.Media) Configurer(com.b3dgs.lionengine.game.Configurer) Test(org.junit.jupiter.api.Test)

Aggregations

Configurer (com.b3dgs.lionengine.game.Configurer)30 Media (com.b3dgs.lionengine.Media)27 Xml (com.b3dgs.lionengine.Xml)25 Test (org.junit.jupiter.api.Test)25 HashMap (java.util.HashMap)4 LionEngineException (com.b3dgs.lionengine.LionEngineException)3 Setup (com.b3dgs.lionengine.game.feature.Setup)3 Animation (com.b3dgs.lionengine.Animation)2 ViewerMock (com.b3dgs.lionengine.ViewerMock)2 ActionRef (com.b3dgs.lionengine.game.ActionRef)2 Services (com.b3dgs.lionengine.game.feature.Services)2 Collision (com.b3dgs.lionengine.game.feature.collidable.Collision)2 Xml (com.b3dgs.lionengine.io.Xml)2 Collection (java.util.Collection)2 Test (org.junit.Test)2 XmlReader (com.b3dgs.lionengine.XmlReader)1 Force (com.b3dgs.lionengine.game.Force)1 SizeConfig (com.b3dgs.lionengine.game.SizeConfig)1 DeviceAxis (com.b3dgs.lionengine.io.DeviceAxis)1 DeviceMapper (com.b3dgs.lionengine.io.DeviceMapper)1