mirror of
https://github.com/brl/mutter.git
synced 2024-11-29 03:20:46 -05:00
conform: Add named object property unit for ClutterScript
We should exercise the resolution of the object properties containing a string pointing to an object previously defined using ClutterScript.
This commit is contained in:
parent
c3e640e6e3
commit
7d842079ca
1
.gitignore
vendored
1
.gitignore
vendored
@ -228,6 +228,7 @@ TAGS
|
|||||||
/tests/conform/test-script-implicit-alpha
|
/tests/conform/test-script-implicit-alpha
|
||||||
/tests/conform/test-script-object-property
|
/tests/conform/test-script-object-property
|
||||||
/tests/conform/test-script-animation
|
/tests/conform/test-script-animation
|
||||||
|
/tests/conform/test-script-named-object
|
||||||
/tests/micro-bench/test-text-perf
|
/tests/micro-bench/test-text-perf
|
||||||
/tests/micro-bench/test-text
|
/tests/micro-bench/test-text
|
||||||
/tests/micro-bench/test-picking
|
/tests/micro-bench/test-picking
|
||||||
|
@ -174,6 +174,7 @@ main (int argc, char **argv)
|
|||||||
TEST_CONFORM_SIMPLE ("/script", test_script_implicit_alpha);
|
TEST_CONFORM_SIMPLE ("/script", test_script_implicit_alpha);
|
||||||
TEST_CONFORM_SIMPLE ("/script", test_script_object_property);
|
TEST_CONFORM_SIMPLE ("/script", test_script_object_property);
|
||||||
TEST_CONFORM_SIMPLE ("/script", test_script_animation);
|
TEST_CONFORM_SIMPLE ("/script", test_script_animation);
|
||||||
|
TEST_CONFORM_SIMPLE ("/script", test_script_named_object);
|
||||||
|
|
||||||
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_fixed);
|
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_fixed);
|
||||||
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_backface_culling);
|
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_backface_culling);
|
||||||
|
@ -257,6 +257,34 @@ test_script_object_property (TestConformSimpleFixture *fixture,
|
|||||||
g_free (test_file);
|
g_free (test_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
test_script_named_object (TestConformSimpleFixture *fixture,
|
||||||
|
gconstpointer dummy)
|
||||||
|
{
|
||||||
|
ClutterScript *script = clutter_script_new ();
|
||||||
|
ClutterLayoutManager *manager;
|
||||||
|
GObject *actor = NULL;
|
||||||
|
GError *error = NULL;
|
||||||
|
gchar *test_file;
|
||||||
|
|
||||||
|
test_file = clutter_test_get_data_file ("test-script-named-object.json");
|
||||||
|
clutter_script_load_from_file (script, test_file, &error);
|
||||||
|
if (g_test_verbose () && error)
|
||||||
|
g_print ("Error: %s", error->message);
|
||||||
|
g_assert (error == NULL);
|
||||||
|
|
||||||
|
actor = clutter_script_get_object (script, "test");
|
||||||
|
g_assert (CLUTTER_IS_BOX (actor));
|
||||||
|
|
||||||
|
manager = clutter_box_get_layout_manager (CLUTTER_BOX (actor));
|
||||||
|
g_assert (CLUTTER_IS_BOX_LAYOUT (manager));
|
||||||
|
g_assert (clutter_box_layout_get_vertical (CLUTTER_BOX_LAYOUT (manager)));
|
||||||
|
|
||||||
|
g_object_unref (script);
|
||||||
|
clutter_actor_destroy (CLUTTER_ACTOR (actor));
|
||||||
|
g_free (test_file);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
test_script_animation (TestConformSimpleFixture *fixture,
|
test_script_animation (TestConformSimpleFixture *fixture,
|
||||||
gconstpointer dummy)
|
gconstpointer dummy)
|
||||||
|
@ -1,9 +1,19 @@
|
|||||||
NULL =
|
NULL =
|
||||||
|
|
||||||
EXTRA_DIST = \
|
json_files = \
|
||||||
redhand.png \
|
test-script-animation.json \
|
||||||
redhand_alpha.png \
|
test-script-child.json \
|
||||||
light0.png \
|
test-script-implicit-alpha.json \
|
||||||
test-script.json \
|
test-script.json \
|
||||||
test-script-single.json \
|
test-script-named-object.json \
|
||||||
|
test-script-object-property.json \
|
||||||
|
test-script-single.json \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
png_files = \
|
||||||
|
redhand.png \
|
||||||
|
redhand_alpha.png \
|
||||||
|
light0.png \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
EXTRA_DIST = $(json_files) $(png_files)
|
||||||
|
22
tests/data/test-script-named-object.json
Normal file
22
tests/data/test-script-named-object.json
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id" : "layout",
|
||||||
|
"type" : "ClutterBoxLayout",
|
||||||
|
"vertical" : true,
|
||||||
|
"spacing" : 12,
|
||||||
|
"pack-start" : false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id" : "test",
|
||||||
|
"type" : "ClutterBox",
|
||||||
|
"layout-manager" : "layout",
|
||||||
|
"children" : [
|
||||||
|
{
|
||||||
|
"id" : "child-1",
|
||||||
|
"type" : "ClutterRectangle",
|
||||||
|
"width" : "3 em",
|
||||||
|
"height" : "3 em"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
Loading…
Reference in New Issue
Block a user