summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@linux.intel.com>2009-09-16 15:55:30 +0100
committerEmmanuele Bassi <ebassi@linux.intel.com>2009-10-14 11:31:29 +0100
commit8b2088a91787562c01d5b8184f1f2b2f1d225371 (patch)
tree329964720203469d7a0695bcc95b6787243f335a
parent431a63d04adc40dfd719563c4f9978324f618b4e (diff)
downloadclutter-8b2088a91787562c01d5b8184f1f2b2f1d225371.tar.gz
[layout, tests] Use variants for child packing in Box
There are three potential variants to add a child inside a Box with a BinLayout: - clutter_box_pack(), a variadic argument function which allows passing arbitrary LayoutMeta properties and values; - clutter_bin_layout_add(), which uses the backpointer to the container from the LayoutManager and sets the layout properties directly without GValue (de)marshalling - clutter_container_add_actor() and clutter_bin_layout_set_alignment(), similar to the clutter_bin_layout_add() function above, but split in two The test-box interactive test should exercise all three variants.
-rw-r--r--tests/interactive/test-box.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/tests/interactive/test-box.c b/tests/interactive/test-box.c
index d2d6c5bf3..777c8e28b 100644
--- a/tests/interactive/test-box.c
+++ b/tests/interactive/test-box.c
@@ -117,10 +117,13 @@ test_box_main (int argc, char *argv[])
clutter_actor_set_name (box, "box");
rect = make_background (&bg_color, 200, 200);
+
+ /* first method: use clutter_box_pack() */
clutter_box_pack (CLUTTER_BOX (box), rect,
"x-align", CLUTTER_BIN_ALIGNMENT_FILL,
"y-align", CLUTTER_BIN_ALIGNMENT_FILL,
NULL);
+
clutter_actor_lower_bottom (rect);
clutter_actor_set_name (rect, "background");
@@ -135,10 +138,12 @@ test_box_main (int argc, char *argv[])
g_error ("Unable to create texture: %s", error->message);
clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (tex), TRUE);
- clutter_box_pack (CLUTTER_BOX (box), tex,
- "x-align", CLUTTER_BIN_ALIGNMENT_CENTER,
- "y-align", CLUTTER_BIN_ALIGNMENT_CENTER,
- NULL);
+
+ /* second method: use clutter_bin_layout_add() */
+ clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (layout), tex,
+ CLUTTER_BIN_ALIGNMENT_CENTER,
+ CLUTTER_BIN_ALIGNMENT_CENTER);
+
clutter_actor_raise (tex, rect);
clutter_actor_set_width (tex, 175);
clutter_actor_set_name (tex, "texture");
@@ -150,10 +155,13 @@ test_box_main (int argc, char *argv[])
224);
rect = clutter_rectangle_new_with_color (color);
- clutter_box_pack (CLUTTER_BOX (box), rect,
- "x-align", CLUTTER_BIN_ALIGNMENT_END,
- "y-align", CLUTTER_BIN_ALIGNMENT_END,
- NULL);
+
+ /* third method: container_add() and set_alignment() */
+ clutter_container_add_actor (CLUTTER_CONTAINER (box), rect);
+ clutter_bin_layout_set_alignment (CLUTTER_BIN_LAYOUT (layout), rect,
+ CLUTTER_BIN_ALIGNMENT_END,
+ CLUTTER_BIN_ALIGNMENT_END);
+
clutter_actor_set_size (rect, 50, 50);
clutter_actor_set_opacity (rect, 0);
clutter_actor_raise_top (rect);