diff --git a/ChangeLog b/ChangeLog index e840ec216..7db100126 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-10-09 Emmanuele Bassi + + * tests/Makefile.am: + * tests/test-script.c: + * tests/test-script.json: Move part of the UI definition into + its own file and exercise clutter_script_load_from_file(). + 2007-10-09 Emmanuele Bassi * clutter/clutter-script.c (clutter_script_get_object): Construct diff --git a/tests/Makefile.am b/tests/Makefile.am index 86ed85014..6c6aa4ba9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -26,4 +26,4 @@ test_timeline_SOURCES = test-timeline.c test_score_SOURCES = test-score.c test_script_SOURCES = test-script.c -EXTRA_DIST = redhand.png +EXTRA_DIST = redhand.png test-script.json diff --git a/tests/test-script.c b/tests/test-script.c index 29dcd931c..b9f26ec88 100644 --- a/tests/test-script.c +++ b/tests/test-script.c @@ -37,60 +37,6 @@ static const gchar *test_behaviour = " }" "]"; -static const gchar *test_ui = -"{" -" \"Scene\" : {" -" \"id\" : \"main-stage\"," -" \"type\" : \"ClutterStage\"," -" \"color\" : \"white\"," -" \"width\" : 500," -" \"height\" : 200," -" \"children\" : [" -" {" -" \"id\" : \"red-button\"," -" \"type\" : \"ClutterRectangle\"," -" \"color\" : \"#ff0000ff\"," -" \"x\" : 50," -" \"y\" : 50," -" \"width\" : 100," -" \"height\" : 100," -" \"visible\" : true," -" }," -" {" -" \"id\" : \"green-button\"," -" \"type\" : \"ClutterRectangle\"," -" \"color\" : \"#00ff00ff\"," -" \"x\" : 200," -" \"y\" : 50," -" \"width\" : 100," -" \"height\" : 100," -" \"visible\" : true," -" \"behaviours\" : [ \"fade-behaviour\" ]" -" }," -" {" -" \"id\" : \"blue-button\"," -" \"type\" : \"ClutterRectangle\"," -" \"color\" : \"#0000ffff\"," -" \"x\" : 350," -" \"y\" : 50," -" \"width\" : 100," -" \"height\" : 100," -" \"visible\" : true," -" }," -" {" -" \"id\" : \"red-hand\"," -" \"type\" : \"ClutterTexture\"," -" \"pixbuf\" : \"redhand.png\"," -" \"x\" : 50," -" \"y\" : 50," -" \"opacity\" : 100," -" \"visible\" : true," -" \"behaviours\" : [ \"rotate-behaviour\", \"fade-behaviour\" ]" -" }" -" ]" -" }" -"}"; - int main (int argc, char *argv[]) { @@ -113,7 +59,7 @@ main (int argc, char *argv[]) return EXIT_FAILURE; } - clutter_script_load_from_data (script, test_ui, -1, &error); + clutter_script_load_from_file (script, "test-script.json", &error); if (error) { g_print ("*** Error:\n" diff --git a/tests/test-script.json b/tests/test-script.json new file mode 100644 index 000000000..b5686b942 --- /dev/null +++ b/tests/test-script.json @@ -0,0 +1,52 @@ +{ + "My Scene" : { + "id" : "main-stage", + "type" : "ClutterStage", + "color" : "white", + "width" : 500, + "height" : 200, + "children" : [ + { + "id" : "red-button", + "type" : "ClutterRectangle", + "color" : "#ff0000ff", + "x" : 50, + "y" : 50, + "width" : 100, + "height" : 100, + "visible" : true, + }, + { + "id" : "green-button", + "type" : "ClutterRectangle", + "color" : "#00ff00ff", + "x" : 200, + "y" : 50, + "width" : 100, + "height" : 100, + "visible" : true, + "behaviours" : [ "fade-behaviour" ] + }, + { + "id" : "blue-button", + "type" : "ClutterRectangle", + "color" : "#0000ffff", + "x" : 350, + "y" : 50, + "width" : 100, + "height" : 100, + "visible" : true, + }, + { + "id" : "red-hand", + "type" : "ClutterTexture", + "pixbuf" : "redhand.png", + "x" : 50, + "y" : 50, + "opacity" : 100, + "visible" : true, + "behaviours" : [ "rotate-behaviour", "fade-behaviour" ] + } + ] + } +}