use of ilargia.entitas.utils.TestEntity in project Entitas-Java by Rubentxu.
the class ContextTest method getReusableEntitiesCountTest.
@Test
public void getReusableEntitiesCountTest() {
TestEntity entity2 = context.createEntity();
assertEquals(0, context.getReusableEntitiesCount());
context.destroyEntity(entity2);
assertEquals(2, context.getReusableEntitiesCount());
}
use of ilargia.entitas.utils.TestEntity in project Entitas-Java by Rubentxu.
the class ContextTest method updateGroupsComponentReplacedTest.
@Test
public void updateGroupsComponentReplacedTest() {
Position position = new Position();
Position position2 = new Position();
Group<TestEntity> groupE = context.getGroup(TestMatcher.Position());
groupE.OnEntityUpdated((IGroup<TestEntity> group, final TestEntity entity, int index, IComponent previousComponent, IComponent nc) -> {
System.out.println("Removed...........");
assertEquals(position2, nc);
});
entity.addComponent(TestComponentIds.Position, position);
context.updateGroupsComponentReplaced(entity, TestComponentIds.Position, position, position2, context._groupsForIndex);
}
use of ilargia.entitas.utils.TestEntity in project Entitas-Java by Rubentxu.
the class EntityTest method setUp.
@Before
public void setUp() throws Exception {
createCollections();
_componentPools = new Stack[10];
EntitasCache cache = new EntitasCache();
entity = new TestEntity();
entity.initialize(0, 10, _componentPools, new ContextInfo("Test", TestComponentIds.componentNames(), TestComponentIds.componentTypes()));
entity.clearEventsListener();
entity.reactivate(0);
entity.addComponent(TestComponentIds.Position, new Position(100, 100));
entity.addComponent(TestComponentIds.View, new View(1));
}
use of ilargia.entitas.utils.TestEntity in project Entitas-Java by Rubentxu.
the class ContextTest method getRetainedEntitiesCountTest.
@Test
public void getRetainedEntitiesCountTest() {
TestEntity entity2 = context.createEntity();
entity.retain(new Object());
context.destroyEntity(entity);
assertEquals(1, context.getRetainedEntitiesCount());
context.destroyEntity(entity2);
assertEquals(1, context.getRetainedEntitiesCount());
}
use of ilargia.entitas.utils.TestEntity in project Entitas-Java by Rubentxu.
the class ContextTest method entityIsNotRetainedByOwnerExceptionTest.
@Test(expected = ContextDoesNotContainEntityException.class)
public void entityIsNotRetainedByOwnerExceptionTest() {
TestEntity entity2 = new TestEntity();
entity2.initialize(0, 100, null, null, null);
context.destroyEntity(entity2);
}
Aggregations