diff options
Diffstat (limited to 'tests/interactive')
-rw-r--r-- | tests/interactive/Makefile.am | 9 | ||||
-rw-r--r-- | tests/interactive/redhand.png | bin | 0 -> 8250 bytes | |||
-rw-r--r-- | tests/interactive/test-script-signals.json | 68 | ||||
-rw-r--r-- | tests/interactive/test-script.json | 74 | ||||
-rw-r--r-- | tests/interactive/test-state-script.c | 2 |
5 files changed, 149 insertions, 4 deletions
diff --git a/tests/interactive/Makefile.am b/tests/interactive/Makefile.am index 8e87edf44..8bea2bcad 100644 --- a/tests/interactive/Makefile.am +++ b/tests/interactive/Makefile.am @@ -148,7 +148,7 @@ test_interactive_SOURCES = test-main.c $(UNIT_TESTS) nodist_test_interactive_SOURCES = test-unit-names.h test_interactive_CFLAGS = $(CLUTTER_CFLAGS) $(GDK_PIXBUF_CFLAGS) test_interactive_CPPFLAGS = \ - -DTESTS_DATADIR=\""$(abs_top_srcdir)/tests/data"\" \ + -DTESTS_DATADIR=\""$(abs_srcdir)"\" \ -DG_DISABLE_SINGLE_INCLUDES \ -DGLIB_DISABLE_DEPRECATION_WARNINGS \ -DCOGL_DISABLE_DEPRECATION_WARNINGS \ @@ -161,8 +161,11 @@ test_interactive_LDFLAGS = -export-dynamic test_interactive_LDADD = $(CLUTTER_LIBS) $(GDK_PIXBUF_LIBS) $(common_ldadd) -lm EXTRA_DIST = \ - wrapper.sh.in \ - $(top_builddir)/build/win32/test-unit-names.h + wrapper.sh.in \ + $(top_builddir)/build/win32/test-unit-names.h \ + test-script.json \ + test-script-signals.json \ + redhand.png DISTCLEANFILES = wrapper.sh .gitignore test-unit-names.h diff --git a/tests/interactive/redhand.png b/tests/interactive/redhand.png Binary files differnew file mode 100644 index 000000000..c07d8acd3 --- /dev/null +++ b/tests/interactive/redhand.png diff --git a/tests/interactive/test-script-signals.json b/tests/interactive/test-script-signals.json new file mode 100644 index 000000000..0d3f6bd25 --- /dev/null +++ b/tests/interactive/test-script-signals.json @@ -0,0 +1,68 @@ +[ + { + "id" : "button", + "type" : "ClutterRectangle", + + "width" : "16 em", + "height" : "6 em", + + "color" : "rgb(255, 0, 0)", + "opacity" : 128, + + "scale-gravity" : "center", + + "reactive" : true, + + "signals" : [ + { + "name" : "button-press-event", + "handler" : "on_button_press" + }, + { "name" : "enter-event", "states" : "button-states", "target-state" : "hover" }, + { "name" : "leave-event", "states" : "button-states", "target-state" : "base" }, + { "name" : "button-press-event", "states" : "button-states", "target-state" : "active" }, + { "name" : "button-release-event", "states" : "button-states", "target-state" : "hover" } + ] + }, + + { + "id" : "button-states", + "type" : "ClutterState", + + "duration" : 250, + + "transitions" : [ + { + "source" : null, + "target" : "base", + + "keys" : [ + [ "button", "opacity", "linear", 128 ], + [ "button", "scale-x", "ease-in-cubic", 1.0 ], + [ "button", "scale-y", "ease-in-cubic", 1.0 ], + [ "button", "color", "linear", "rgb(255, 0, 0)" ] + ] + }, + { + "source" : null, + "target" : "hover", + + "keys" : [ + [ "button", "opacity", "linear", 255 ], + [ "button", "scale-x", "ease-out-bounce", 1.4 ], + [ "button", "scale-y", "ease-out-bounce", 1.4 ], + [ "button", "color", "linear", "rgb(0, 255, 0)" ] + ] + }, + { + "source" : null, + "target" : "active", + + "keys" : [ + [ "button", "opacity", "linear", 255 ], + [ "button", "color", "linear", "rgb(0, 0, 255)" ] + ] + } + ] + } +] diff --git a/tests/interactive/test-script.json b/tests/interactive/test-script.json new file mode 100644 index 000000000..54d4fb457 --- /dev/null +++ b/tests/interactive/test-script.json @@ -0,0 +1,74 @@ +{ + "My Scene" : { + "id" : "main-stage", + "type" : "ClutterStage", + "title" : { "translatable" : true, "string" : "ClutterScript test" }, + "color" : "white", + "signals" : [ + { "name" : "key-press-event", "handler" : "clutter_main_quit" }, + { "name" : "destroy", "handler" : "clutter_main_quit" } + ], + "children" : [ + { + "id" : "red-button", + "type" : "ClutterRectangle", + "color" : "#ff0000ff", + "x" : 50, "y" : 50, "width" : 100, "height" : 100, + "reactive" : true, + "rotation" : [ + { "z-axis" : [ 45.0, [ 75, 75 ] ] } + ], + "behaviours" : [ "fade-behaviour", "path-behaviour" ] + }, + { + "id" : "green-button", + "type" : "ClutterRectangle", + "color" : "#00ff00ff", + "border-width" : 5, + "border-color" : "#00cc00ff", + "position" : [ 200.0, 50.0 ], + "size" : { "width" : 100.0, "height" : 100.0 }, + "depth" : -200.0, + "reactive" : true, + "signals" : [ + { "name" : "button-press-event", "handler" : "clutter_main_quit" } + ] + }, + { + "id" : "red-hand", + "type" : "ClutterTexture", + "filename" : "redhand.png", + "position" : { "x" : 100.0, "y" : 100.0 }, + "width" : "20 mm", + "keep-aspect-ratio" : true, + "anchor-x" : "5 em", + "anchor-y" : "5 pt", + "opacity" : 100, + "behaviours" : [ "rotate-behaviour", "fade-behaviour" ] + }, + { + "id" : "red-hand-clone", + "type" : "ClutterClone", + "source" : "red-hand", + "position" : [ 250.0, 150.0 ], + "opacity" : 100 + }, + { + "id" : "label", + "type" : "ClutterText", + "x" : 50, + "y" : 200, + "text" : { "translatable" : true, "string" : "Clutter Script" }, + "font-name" : "Sans 24px", + "color" : "black", + "line-alignment" : "center", + "line-wrap" : false, + "ellipsize" : "none", + "rotation" : [ + { "y-axis" : [ 60.0, [ 275, 100 ] ] }, + { "z-axis" : [ 45.0, [ 75, 75 ] ] } + ] + } + ] + } +} diff --git a/tests/interactive/test-state-script.c b/tests/interactive/test-state-script.c index e777d89bc..34b1b8789 100644 --- a/tests/interactive/test-state-script.c +++ b/tests/interactive/test-state-script.c @@ -4,7 +4,7 @@ #include <clutter/clutter.h> -#define TEST_STATE_SCRIPT_FILE TESTS_DATADIR G_DIR_SEPARATOR_S "test-script-signals.json" +#define TEST_STATE_SCRIPT_FILE "test-script-signals.json" gboolean on_button_press (ClutterActor *actor, |