use of ilargia.entitas.components.Position in project Entitas-Java by Rubentxu.
the class ContextTest method clearComponentPoolsTest.
@Test
public void clearComponentPoolsTest() {
Stack[] cpool = context.getComponentPools();
cpool[0] = new Stack<IComponent>();
cpool[0].push(new Position());
assertEquals(1, cpool[0].size());
context.clearComponentPools();
assertTrue(cpool[0].empty());
}
use of ilargia.entitas.components.Position in project Entitas-Java by Rubentxu.
the class ContextTest method clearComponentPoolTest.
@Test
public void clearComponentPoolTest() {
Stack[] cpool = context.getComponentPools();
cpool[0] = new Stack<IComponent>();
cpool[0].push(new Position());
assertEquals(1, cpool[0].size());
context.clearComponentPool(0);
assertTrue(cpool[0].empty());
}
use of ilargia.entitas.components.Position in project Entitas-Java by Rubentxu.
the class ContextTest method duplicateEntityIndexTest.
@Test(expected = ContextEntityIndexDoesAlreadyExistException.class)
public void duplicateEntityIndexTest() {
entity.addComponent(TestComponentIds.Position, new Position());
Group group = context.getGroup(TestMatcher.Position());
PrimaryEntityIndex<Entity, String> index = new PrimaryEntityIndex("", group, (e, c) -> new String[] { "positionEntities" });
context.addEntityIndex("duplicate", index);
context.addEntityIndex("duplicate", index);
}
use of ilargia.entitas.components.Position in project Entitas-Java by Rubentxu.
the class ContextTest method updateGroupsComponentAddedOrRemovedTest.
@Test
public void updateGroupsComponentAddedOrRemovedTest() {
Position position = new Position();
Group<TestEntity> group = context.getGroup(TestMatcher.Position());
group.OnEntityAdded((g, e, idx, pc) -> assertEquals(TestComponentIds.Position, idx));
entity.addComponent(TestComponentIds.Position, position);
context.updateGroupsComponentAddedOrRemoved(entity, TestComponentIds.Position, position, context._groupsForIndex);
context.updateGroupsComponentAddedOrRemoved(entity, TestComponentIds.Position, position, context._groupsForIndex);
//context.OnGroupCleared = (context, group)-> assertNull(context.OnEntityCreated);
}
use of ilargia.entitas.components.Position in project Entitas-Java by Rubentxu.
the class ContextTest method getGroupTest.
@Test
public void getGroupTest() {
entity.addComponent(TestComponentIds.Position, new Position());
Group group = context.getGroup(TestMatcher.Position());
assertEquals(1, group.getCount());
group = context.getGroup(TestMatcher.Position());
assertEquals(1, group.getCount());
}
Aggregations