-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#include <alia/flow/components.hpp> | ||
|
||
#include <flow/testing.hpp> | ||
|
||
TEST_CASE("animating components", "[flow][components]") | ||
{ | ||
clear_log(); | ||
|
||
int iteration = -1; | ||
|
||
component_container_ptr top(new component_container); | ||
component_container_ptr left(new component_container); | ||
component_container_ptr bottom(new component_container); | ||
component_container_ptr right(new component_container); | ||
|
||
alia::system sys; | ||
initialize_system(sys, [&](context ctx) { | ||
scoped_component_container scoped_top(ctx, &top); | ||
if (iteration == 0) | ||
mark_animating_component(ctx); | ||
{ | ||
scoped_component_container scoped_left(ctx, &left); | ||
if (iteration == 1) | ||
mark_animating_component(ctx); | ||
{ | ||
scoped_component_container scoped_bottom(ctx, &bottom); | ||
if (iteration == 2) | ||
mark_animating_component(ctx); | ||
} | ||
} | ||
{ | ||
scoped_component_container scoped_right(ctx, &right); | ||
if (iteration == 3) | ||
mark_animating_component(ctx); | ||
} | ||
}); | ||
|
||
refresh_system(sys); | ||
REQUIRE(!top->animating); | ||
REQUIRE(!left->animating); | ||
REQUIRE(!bottom->animating); | ||
REQUIRE(!right->animating); | ||
|
||
++iteration; | ||
refresh_system(sys); | ||
REQUIRE(top->animating); | ||
REQUIRE(!left->animating); | ||
REQUIRE(!bottom->animating); | ||
REQUIRE(!right->animating); | ||
|
||
++iteration; | ||
refresh_system(sys); | ||
REQUIRE(top->animating); | ||
REQUIRE(left->animating); | ||
REQUIRE(!bottom->animating); | ||
REQUIRE(!right->animating); | ||
|
||
++iteration; | ||
refresh_system(sys); | ||
REQUIRE(top->animating); | ||
REQUIRE(left->animating); | ||
REQUIRE(bottom->animating); | ||
REQUIRE(!right->animating); | ||
|
||
++iteration; | ||
refresh_system(sys); | ||
REQUIRE(top->animating); | ||
REQUIRE(!left->animating); | ||
REQUIRE(!bottom->animating); | ||
REQUIRE(right->animating); | ||
} |