2007-10-09 Emmanuele Bassi <ebassi@openedhand.com>
* 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().
This commit is contained in:
parent
b0569d0f27
commit
b1ed23e0df
@ -1,3 +1,10 @@
|
||||
2007-10-09 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* 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 <ebassi@openedhand.com>
|
||||
|
||||
* clutter/clutter-script.c (clutter_script_get_object): Construct
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
52
tests/test-script.json
Normal file
52
tests/test-script.json
Normal file
@ -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" ]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user