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 <ebassi@linux.intel.com>
This commit is contained in:
Bastian Winkler 2010-08-24 12:13:30 +02:00 committed by Emmanuele Bassi
parent cb58f1f68c
commit 870e7ddfad
2 changed files with 28 additions and 6 deletions

View File

@ -342,7 +342,7 @@ test_script_layout_property (TestConformSimpleFixture *fixture,
gconstpointer dummy G_GNUC_UNUSED) gconstpointer dummy G_GNUC_UNUSED)
{ {
ClutterScript *script = clutter_script_new (); ClutterScript *script = clutter_script_new ();
GObject *manager, *container, *actor; GObject *manager, *container, *actor1, *actor2;
GError *error = NULL; GError *error = NULL;
gchar *test_file; gchar *test_file;
gboolean x_fill, expand; gboolean x_fill, expand;
@ -359,23 +359,25 @@ test_script_layout_property (TestConformSimpleFixture *fixture,
g_assert (error == NULL); g_assert (error == NULL);
#endif #endif
manager = container = actor = NULL; manager = container = actor1 = actor2 = NULL;
clutter_script_get_objects (script, clutter_script_get_objects (script,
"manager", &manager, "manager", &manager,
"container", &container, "container", &container,
"actor", &actor, "actor-1", &actor1,
"actor-2", &actor2,
NULL); NULL);
g_assert (CLUTTER_IS_LAYOUT_MANAGER (manager)); g_assert (CLUTTER_IS_LAYOUT_MANAGER (manager));
g_assert (CLUTTER_IS_CONTAINER (container)); 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; x_fill = FALSE;
y_align = CLUTTER_BOX_ALIGNMENT_START; y_align = CLUTTER_BOX_ALIGNMENT_START;
expand = FALSE; expand = FALSE;
clutter_layout_manager_child_get (CLUTTER_LAYOUT_MANAGER (manager), clutter_layout_manager_child_get (CLUTTER_LAYOUT_MANAGER (manager),
CLUTTER_CONTAINER (container), CLUTTER_CONTAINER (container),
CLUTTER_ACTOR (actor), CLUTTER_ACTOR (actor1),
"x-fill", &x_fill, "x-fill", &x_fill,
"y-align", &y_align, "y-align", &y_align,
"expand", &expand, "expand", &expand,
@ -385,5 +387,20 @@ test_script_layout_property (TestConformSimpleFixture *fixture,
g_assert (y_align == CLUTTER_BOX_ALIGNMENT_CENTER); g_assert (y_align == CLUTTER_BOX_ALIGNMENT_CENTER);
g_assert (expand); 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); g_object_unref (script);
} }

View File

@ -6,10 +6,15 @@
"layout-manager" : "manager", "layout-manager" : "manager",
"children" : [ "children" : [
{ {
"id" : "actor", "type" : "ClutterRectangle", "id" : "actor-1", "type" : "ClutterRectangle",
"layout::x-fill" : true, "layout::x-fill" : true,
"layout::y-align" : "center", "layout::y-align" : "center",
"layout::expand" : true "layout::expand" : true
}, {
"id" : "actor-2", "type" : "ClutterRectangle",
"layout::x-fill" : false,
"layout::y-align" : "end",
"layout::expand" : false
} }
] ]
} }