[clutter] conformance/invariants: Test that visibility is not recursive



commit 7d64693de265e0d00e783b7ae164abd06d75a68d
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Mon Mar 5 17:45:23 2012 +0000

    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.

 tests/conform/actor-invariants.c  |   42 +++++++++++++++++++++++++++++++++++++
 tests/conform/test-conform-main.c |    1 +
 2 files changed, 43 insertions(+), 0 deletions(-)
---
diff --git a/tests/conform/actor-invariants.c b/tests/conform/actor-invariants.c
index 5553abb..893dfa4 100644
--- a/tests/conform/actor-invariants.c
+++ b/tests/conform/actor-invariants.c
@@ -123,6 +123,48 @@ actor_mapped (TestConformSimpleFixture *fixture,
 }
 
 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
 actor_realize_not_recursive (TestConformSimpleFixture *fixture,
                              gconstpointer             data)
 {
diff --git a/tests/conform/test-conform-main.c b/tests/conform/test-conform-main.c
index 6852b11..a47be11 100644
--- a/tests/conform/test-conform-main.c
+++ b/tests/conform/test-conform-main.c
@@ -152,6 +152,7 @@ main (int argc, char **argv)
 
   TEST_CONFORM_SIMPLE ("/actor/invariants", actor_initial_state);
   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_realize_not_recursive);
   TEST_CONFORM_SIMPLE ("/actor/invariants", actor_map_recursive);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]