conformance/invariants: Test that visibility is not recursive

The show and hide methods should not recurse; that is the job of
show_all and hide_all, which are deprecated.
This commit is contained in:
Emmanuele Bassi 2012-03-05 17:45:23 +00:00
parent 720fbd3bec
commit 7d64693de2
2 changed files with 43 additions and 0 deletions

View File

@ -122,6 +122,48 @@ actor_mapped (TestConformSimpleFixture *fixture,
clutter_actor_destroy (stage); clutter_actor_destroy (stage);
} }
void
actor_visibility_not_recursive (TestConformSimpleFixture *fixture,
gconstpointer data)
{
ClutterActor *actor, *group;
ClutterActor *stage;
stage = clutter_stage_new ();
group = clutter_actor_new ();
actor = clutter_actor_new ();
clutter_actor_hide (group); /* don't show, so won't map */
clutter_actor_hide (actor); /* don't show, so won't map */
g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (stage)));
g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (group)));
g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (actor)));
clutter_actor_add_child (stage, group);
clutter_actor_add_child (group, actor);
clutter_actor_show (actor);
g_assert (CLUTTER_ACTOR_IS_VISIBLE (actor));
g_assert (!CLUTTER_ACTOR_IS_VISIBLE (group));
g_assert (!CLUTTER_ACTOR_IS_VISIBLE (stage));
clutter_actor_show (stage);
g_assert (CLUTTER_ACTOR_IS_VISIBLE (actor));
g_assert (!CLUTTER_ACTOR_IS_VISIBLE (group));
g_assert (CLUTTER_ACTOR_IS_VISIBLE (stage));
clutter_actor_hide (actor);
clutter_actor_hide (group);
clutter_actor_hide (stage);
g_assert (!CLUTTER_ACTOR_IS_VISIBLE (actor));
clutter_actor_show (stage);
g_assert (!CLUTTER_ACTOR_IS_VISIBLE (actor));
clutter_actor_destroy (stage);
}
void void
actor_realize_not_recursive (TestConformSimpleFixture *fixture, actor_realize_not_recursive (TestConformSimpleFixture *fixture,
gconstpointer data) gconstpointer data)

View File

@ -152,6 +152,7 @@ main (int argc, char **argv)
TEST_CONFORM_SIMPLE ("/actor/invariants", actor_initial_state); TEST_CONFORM_SIMPLE ("/actor/invariants", actor_initial_state);
TEST_CONFORM_SIMPLE ("/actor/invariants", actor_shown_not_parented); TEST_CONFORM_SIMPLE ("/actor/invariants", actor_shown_not_parented);
TEST_CONFORM_SIMPLE ("/actor/invariants", actor_visibility_not_recursive);
TEST_CONFORM_SIMPLE ("/actor/invariants", actor_realized); TEST_CONFORM_SIMPLE ("/actor/invariants", actor_realized);
TEST_CONFORM_SIMPLE ("/actor/invariants", actor_realize_not_recursive); TEST_CONFORM_SIMPLE ("/actor/invariants", actor_realize_not_recursive);
TEST_CONFORM_SIMPLE ("/actor/invariants", actor_map_recursive); TEST_CONFORM_SIMPLE ("/actor/invariants", actor_map_recursive);