Add test for system with prefab and component
@@ -202,7 +202,57 @@ void test_EcsPeriodicSystem_tc_system_prefab(
void test_EcsPeriodicSystem_tc_system_prefab_component(
test_EcsPeriodicSystem this)
{
- /* Insert implementation */
+ Context ctx = {0};
+ EcsWorld *world = ecs_init();
+ ECS_COMPONENT(world, Foo);
+ ECS_COMPONENT(world, Bar);
+ ECS_COMPONENT(world, Hello);
+ ECS_PREFAB(world, MyPrefab, Foo);
+ ECS_FAMILY(world, MyFamily, MyPrefab, Bar);
+ ECS_SYSTEM(world, TestSystem, EcsPeriodic, Foo, Bar);
+
+ EcsHandle e1 = ecs_new(world, Foo_h);
+ EcsHandle e2 = ecs_new(world, Bar_h);
+ EcsHandle e3 = ecs_new(world, MyFamily_h);
+ EcsHandle e4 = ecs_new(world, MyFamily_h);
+ EcsHandle e5 = ecs_new(world, Hello_h);
+
+ test_assert(e1 != 0);
+ test_assert(e2 != 0);
+ test_assert(e3 != 0);
+ test_assert(e4 != 0);
+ test_assert(e5 != 0);
+
+ int *foo_1 = ecs_get(world, e1, Foo_h);
+ int *bar_2 = ecs_get(world, e2, Bar_h);
+ int *bar_3 = ecs_get(world, e3, Bar_h);
+ int *bar_4 = ecs_get(world, e4, Bar_h);
+ int *foo_prefab = ecs_get(world, MyPrefab_h, Foo_h);
+ int *hello_5 = ecs_get(world, e5, Hello_h);
+
+ *foo_1 = 10;
+ *bar_2 = 20;
+ *bar_3 = 40;
+ *bar_4 = 60;
+ *foo_prefab = 70;
+ *hello_5 = 80;
+
+ ecs_set_context(world, &ctx);
+
+ ecs_progress(world);
+
+ test_assertint(ctx.column_count, 2);
+ test_assertint(ctx.count, 2);
+ test_assert(ctx.entities[0] == e3);
+ test_assert(ctx.entities[1] == e4);
+ test_assertint(ctx.column[0][0], 70);
+ test_assertint(ctx.column[1][0], 40);
+ test_assertint(ctx.column[0][1], 70);
+ test_assertint(ctx.column[1][1], 60);
+ test_assertint(ctx.component[0], Foo_h);
+ test_assertint(ctx.component[1], Bar_h);
+
+ ecs_fini(world);
}
void test_EcsPeriodicSystem_tc_system_1_component_1_not(
