From 870e7ddfadaff366ca02e28cc464e704b77b3430 Mon Sep 17 00:00:00 2001 From: Bastian Winkler Date: Tue, 24 Aug 2010 12:13:30 +0200 Subject: [PATCH] test-script-parser: Add a second child to the container The script parser won't apply child and layout properties correctly with more than one children. http://bugzilla.clutter-project.org/show_bug.cgi?id=2285 Signed-off-by: Emmanuele Bassi --- tests/conform/test-script-parser.c | 27 ++++++++++++++++++++++----- tests/data/test-script-layout-property.json | 7 ++++++- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/tests/conform/test-script-parser.c b/tests/conform/test-script-parser.c index 8e6c5ff..c9301e2 100644 --- a/tests/conform/test-script-parser.c +++ b/tests/conform/test-script-parser.c @@ -342,7 +342,7 @@ test_script_layout_property (TestConformSimpleFixture *fixture, gconstpointer dummy G_GNUC_UNUSED) { ClutterScript *script = clutter_script_new (); - GObject *manager, *container, *actor; + GObject *manager, *container, *actor1, *actor2; GError *error = NULL; gchar *test_file; gboolean x_fill, expand; @@ -359,23 +359,25 @@ test_script_layout_property (TestConformSimpleFixture *fixture, g_assert (error == NULL); #endif - manager = container = actor = NULL; + manager = container = actor1 = actor2 = NULL; clutter_script_get_objects (script, "manager", &manager, "container", &container, - "actor", &actor, + "actor-1", &actor1, + "actor-2", &actor2, NULL); g_assert (CLUTTER_IS_LAYOUT_MANAGER (manager)); g_assert (CLUTTER_IS_CONTAINER (container)); - g_assert (CLUTTER_IS_ACTOR (actor)); + g_assert (CLUTTER_IS_ACTOR (actor1)); + g_assert (CLUTTER_IS_ACTOR (actor2)); x_fill = FALSE; y_align = CLUTTER_BOX_ALIGNMENT_START; expand = FALSE; clutter_layout_manager_child_get (CLUTTER_LAYOUT_MANAGER (manager), CLUTTER_CONTAINER (container), - CLUTTER_ACTOR (actor), + CLUTTER_ACTOR (actor1), "x-fill", &x_fill, "y-align", &y_align, "expand", &expand, @@ -385,5 +387,20 @@ test_script_layout_property (TestConformSimpleFixture *fixture, g_assert (y_align == CLUTTER_BOX_ALIGNMENT_CENTER); g_assert (expand); + x_fill = TRUE; + y_align = CLUTTER_BOX_ALIGNMENT_START; + expand = TRUE; + clutter_layout_manager_child_get (CLUTTER_LAYOUT_MANAGER (manager), + CLUTTER_CONTAINER (container), + CLUTTER_ACTOR (actor2), + "x-fill", &x_fill, + "y-align", &y_align, + "expand", &expand, + NULL); + + g_assert (x_fill == FALSE); + g_assert (y_align == CLUTTER_BOX_ALIGNMENT_END); + g_assert (expand == FALSE); + g_object_unref (script); } diff --git a/tests/data/test-script-layout-property.json b/tests/data/test-script-layout-property.json index 623916a..17e9f48 100644 --- a/tests/data/test-script-layout-property.json +++ b/tests/data/test-script-layout-property.json @@ -6,10 +6,15 @@ "layout-manager" : "manager", "children" : [ { - "id" : "actor", "type" : "ClutterRectangle", + "id" : "actor-1", "type" : "ClutterRectangle", "layout::x-fill" : true, "layout::y-align" : "center", "layout::expand" : true + }, { + "id" : "actor-2", "type" : "ClutterRectangle", + "layout::x-fill" : false, + "layout::y-align" : "end", + "layout::expand" : false } ] } -- 2.7.4