summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@linux.intel.com>2009-09-11 15:34:13 +0100
committerEmmanuele Bassi <ebassi@linux.intel.com>2009-10-14 11:27:19 +0100
commita1853892bae7c54d28a86e253e04c3753d65e159 (patch)
tree80f41554f2bcd1d0066dce06e440cbfb406da766
parent1061ebeac90a5b03a172aa649aa5a8b8cfb5b293 (diff)
downloadclutter-a1853892bae7c54d28a86e253e04c3753d65e159.tar.gz
[tests] Add a Box interactive test
-rw-r--r--.gitignore1
-rw-r--r--tests/interactive/Makefile.am3
-rw-r--r--tests/interactive/test-box.c47
3 files changed, 50 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 1ca16fe5a..e492b15a7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -133,6 +133,7 @@ TAGS
/tests/interactive/redhand_alpha.png
/tests/interactive/test-script.json
/tests/interactive/test-clutter-cairo-flowers
+/tests/interactive/test-box
/tests/conform/stamp-test-conformance
/tests/conform/test-anchors
/tests/conform/test-conformance
diff --git a/tests/interactive/Makefile.am b/tests/interactive/Makefile.am
index 9187b1e5d..3a2215f65 100644
--- a/tests/interactive/Makefile.am
+++ b/tests/interactive/Makefile.am
@@ -43,7 +43,8 @@ UNIT_TESTS = \
test-text.c \
test-text-field.c \
test-clutter-cairo-flowers.c \
- test-cogl-vertex-buffer.c
+ test-cogl-vertex-buffer.c \
+ test-box.c
if X11_TESTS
UNIT_TESTS += test-pixmap.c
diff --git a/tests/interactive/test-box.c b/tests/interactive/test-box.c
new file mode 100644
index 000000000..ecfa07a97
--- /dev/null
+++ b/tests/interactive/test-box.c
@@ -0,0 +1,47 @@
+#include <stdlib.h>
+#include <gmodule.h>
+#include <clutter/clutter.h>
+
+G_MODULE_EXPORT int
+test_box_main (int argc, char *argv[])
+{
+ ClutterActor *stage, *box, *rect;
+ ClutterLayoutManager *layout;
+ ClutterColor bg_color = { 0xcc, 0xcc, 0xcc, 0x99 };
+ ClutterColor *color;
+
+ clutter_init (&argc, &argv);
+
+ stage = clutter_stage_get_default ();
+ clutter_stage_set_title (CLUTTER_STAGE (stage), "Box test");
+ clutter_actor_set_size (stage, 320, 200);
+
+ layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER,
+ CLUTTER_BIN_ALIGNMENT_CENTER);
+
+ box = clutter_box_new (layout);
+ clutter_container_add_actor (CLUTTER_CONTAINER (stage), box);
+ clutter_actor_set_anchor_point_from_gravity (box, CLUTTER_GRAVITY_CENTER);
+ clutter_actor_set_position (box, 160, 100);
+
+ rect = clutter_rectangle_new_with_color (&bg_color);
+ clutter_container_add_actor (CLUTTER_CONTAINER (box), rect);
+ clutter_actor_set_size (rect, 100, 100);
+
+ color = clutter_color_new (g_random_int_range (0, 255),
+ g_random_int_range (0, 255),
+ g_random_int_range (0, 255),
+ 255);
+
+ rect = clutter_rectangle_new_with_color (color);
+ clutter_container_add_actor (CLUTTER_CONTAINER (box), rect);
+ clutter_actor_set_size (rect, 50, 50);
+
+ clutter_actor_show_all (stage);
+
+ clutter_main ();
+
+ clutter_color_free (color);
+
+ return EXIT_SUCCESS;
+}