summaryrefslogtreecommitdiff
path: root/tests/interactive
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2013-12-12 14:36:16 +0000
committerEmmanuele Bassi <ebassi@gnome.org>2013-12-12 18:51:11 +0000
commit2a660fa298702111c192a7b51e2120799c9393de (patch)
tree0e6901b6ff654575101923a46901dc7b8d7bcd1b /tests/interactive
parentcee38c167281a349297daf8d700c6ef793c499a8 (diff)
downloadclutter-2a660fa298702111c192a7b51e2120799c9393de.tar.gz
Fully rework the conformance test suite
The current conformance test suite is suboptimal in many ways. All tests are built into the same binary, which makes adding new tests, builting tests, and running groups of tests much more awkward than it needs to be. The first issue, especially, raises the bar of contribution in a significant way, while the other two take their toll on the maintainer. All of these changes were introduced back when we had both Clutter and Cogl tests in tree, and because we were building the test suite for every single change; since then, Cogl moved out of tree with all its tests, and we build the conformance test suite only when running the `check` make target. This admittedly large-ish commit changes the way the conformance test suite works, taking advantage of the changes in the GTest API and test harness. First of all, all tests are now built separately, using their own test suite as defined by each separate file. All tests run under the TAP harness provided by GTest and Automake, to gather a proper report using the Test Anything Protocol without using the `gtester` harness and the `gtester-report` script. We also use the Makefile rules provided by GLib to vastly simplify the build environment for the conformance test suite. On top of the changes for the build and harness, we also provide new API for creating and running test suites for Clutter. The API is public, because the test suite has to use it, but it's minimal and mostly provides convenience wrappers around GTest that make writing test units for Clutter easier. This commit disables all tests in the conformance test suite, as well as moving the data files outside of the tests/data directory; the next few commits will re-establish the conformance test suite separately so we can check that everything works in a reliable way.
Diffstat (limited to 'tests/interactive')
-rw-r--r--tests/interactive/Makefile.am9
-rw-r--r--tests/interactive/redhand.pngbin0 -> 8250 bytes
-rw-r--r--tests/interactive/test-script-signals.json68
-rw-r--r--tests/interactive/test-script.json74
-rw-r--r--tests/interactive/test-state-script.c2
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
new file mode 100644
index 000000000..c07d8acd3
--- /dev/null
+++ b/tests/interactive/redhand.png
Binary files differ
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,