Search in sources :

Example 1 with ActionRef

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

the class ProducerConfigTest method testExportsImports.

/**
 * Test exports imports.
 */
@Test
public 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);
    Assert.assertEquals(refs, ActionsConfig.imports(new Xml(media)));
    Assert.assertEquals(refs, ActionsConfig.imports(new Configurer(media)));
    Assert.assertTrue(media.getFile().delete());
}
Also used : Xml(com.b3dgs.lionengine.io.Xml) Media(com.b3dgs.lionengine.Media) Configurer(com.b3dgs.lionengine.game.Configurer) ActionRef(com.b3dgs.lionengine.game.ActionRef) Test(org.junit.Test)

Example 2 with ActionRef

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

the class ProducerConfigTest method testCancelOnRef.

/**
 * Test cancel flag is not used on child reference.
 */
@Test
public void testCancelOnRef() {
    final ActionRef ref = new ActionRef("ref", true, new ArrayList<ActionRef>());
    final Collection<ActionRef> refs = Arrays.asList(new ActionRef("test", false, Arrays.asList(ref)));
    final Xml root = new Xml("test");
    root.add(ActionsConfig.exports(refs));
    final Media media = Medias.create("producer.xml");
    root.save(media);
    Assert.assertNotEquals(refs, ActionsConfig.imports(new Xml(media)));
    Assert.assertNotEquals(refs, ActionsConfig.imports(new Configurer(media)));
    Assert.assertTrue(media.getFile().delete());
}
Also used : Xml(com.b3dgs.lionengine.io.Xml) Media(com.b3dgs.lionengine.Media) Configurer(com.b3dgs.lionengine.game.Configurer) ActionRef(com.b3dgs.lionengine.game.ActionRef) Test(org.junit.Test)

Aggregations

Media (com.b3dgs.lionengine.Media)2 ActionRef (com.b3dgs.lionengine.game.ActionRef)2 Configurer (com.b3dgs.lionengine.game.Configurer)2 Xml (com.b3dgs.lionengine.io.Xml)2 Test (org.junit.Test)2