[tests] Add unit for Clone behaviour
A clone actor should not modify the state of its source, so we need to check that it's not breaking any invariant.
This commit is contained in:
parent
795e005566
commit
abac520f0c
2
.gitignore
vendored
2
.gitignore
vendored
@ -206,6 +206,8 @@ TAGS
|
||||
/tests/conform/test-color-to-string
|
||||
/tests/conform/test-units-constructors
|
||||
/tests/conform/test-units-string
|
||||
/tests/conform/test-premult
|
||||
/tests/conform/test-clone-no-map
|
||||
/tests/conform/test-conformance-result.xml
|
||||
/tests/micro-bench/test-text-perf
|
||||
/tests/micro-bench/test-text
|
||||
|
@ -222,3 +222,37 @@ test_show_on_set_parent (TestConformSimpleFixture *fixture,
|
||||
clutter_actor_destroy (actor);
|
||||
clutter_actor_destroy (group);
|
||||
}
|
||||
|
||||
void
|
||||
test_clone_no_map (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
{
|
||||
ClutterActor *stage;
|
||||
ClutterActor *group;
|
||||
ClutterActor *actor;
|
||||
ClutterActor *clone;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
|
||||
group = clutter_group_new ();
|
||||
actor = clutter_rectangle_new ();
|
||||
|
||||
clutter_actor_hide (group);
|
||||
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (group), actor);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
|
||||
|
||||
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (group)));
|
||||
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (actor)));
|
||||
|
||||
clone = clutter_clone_new (group);
|
||||
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), clone);
|
||||
|
||||
g_assert (CLUTTER_ACTOR_IS_MAPPED (clone));
|
||||
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (group)));
|
||||
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (actor)));
|
||||
|
||||
clutter_actor_destroy (CLUTTER_ACTOR (clone));
|
||||
clutter_actor_destroy (CLUTTER_ACTOR (group));
|
||||
}
|
||||
|
@ -125,6 +125,7 @@ main (int argc, char **argv)
|
||||
TEST_CONFORM_SIMPLE ("/invariants", test_map_recursive);
|
||||
TEST_CONFORM_SIMPLE ("/invariants", test_mapped);
|
||||
TEST_CONFORM_SIMPLE ("/invariants", test_show_on_set_parent);
|
||||
TEST_CONFORM_SIMPLE ("/invariants", test_clone_no_map);
|
||||
|
||||
TEST_CONFORM_SIMPLE ("/vertex-buffer", test_vertex_buffer_contiguous);
|
||||
TEST_CONFORM_SIMPLE ("/vertex-buffer", test_vertex_buffer_interleved);
|
||||
|
Loading…
Reference in New Issue
Block a user