valiadate: Add a test for setting/checking (timed) properties
authorThibault Saunier <tsaunier@igalia.com>
Wed, 10 Jun 2020 21:18:49 +0000 (17:18 -0400)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 22 Jun 2020 17:20:32 +0000 (17:20 +0000)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-devtools/-/merge_requests/207>

validate/gst/validate/gst-validate-scenario.c
validate/tests/launcher_tests/check_set_props_and_time_props.validatetest [new file with mode: 0644]

index ce7630d..c7080da 100644 (file)
@@ -1186,7 +1186,7 @@ _set_timed_value (GQuark field_id, const GValue * gvalue,
   if (G_VALUE_HOLDS_DOUBLE (gvalue))
     value = g_value_get_double (gvalue);
   else if (G_VALUE_HOLDS_INT (gvalue))
-    value = g_value_get_int (gvalue);
+    value = (gdouble) g_value_get_int (gvalue);
   else {
     GST_VALIDATE_REPORT (scenario, SCENARIO_ACTION_EXECUTION_ERROR,
         "Invalid value type for property '%s': %s",
diff --git a/validate/tests/launcher_tests/check_set_props_and_time_props.validatetest b/validate/tests/launcher_tests/check_set_props_and_time_props.validatetest
new file mode 100644 (file)
index 0000000..2c49e8e
--- /dev/null
@@ -0,0 +1,54 @@
+meta,
+    handles-states=true,
+    args = {
+        "videotestsrc pattern=blue ! compositor name=c ! video/x-raw,width=100,height=100,framerate=10/1 ! $(videosink) videotestsrc pattern=green ! c.",
+    }
+
+# Start with the green stream on the top left corner and the blue on in the bottom right
+set-timed-value-properties, timestamp=0.0, source-type=GstTriggerControlSource, binding-type=direct-absolute,
+    c.sink_0::xpos=50,
+    c.sink_0::ypos=50,
+    c.sink_0::width=50,
+    c.sink_0::height=50,
+    c.sink_1::xpos=0,
+    c.sink_1::ypos=0,
+    c.sink_1::width=50,
+    c.sink_1::height=50
+
+# And invert it after 1 second of playback
+set-timed-value-properties, timestamp=1.0, source-type=GstTriggerControlSource, binding-type=direct-absolute,
+    c.sink_0::xpos=0,
+    c.sink_0::ypos=0,
+    c.sink_1::xpos=50,
+    c.sink_1::ypos=50
+
+play
+crank-clock, expected-time=0.0
+check-properties,
+    c.sink_0::xpos=50,
+    c.sink_0::ypos=50,
+    c.sink_1::xpos=0,
+    c.sink_1::ypos=0
+
+crank-clock, repeat=5
+check-position, expected-position=0.5
+check-properties,
+    c.sink_0::xpos=50,
+    c.sink_0::ypos=50,
+    c.sink_1::xpos=0,
+    c.sink_1::ypos=0
+
+crank-clock, repeat=5
+check-position, expected-position=1.0
+check-properties,
+    c.sink_0::xpos=0,
+    c.sink_0::ypos=0,
+    c.sink_1::xpos=50,
+    c.sink_1::ypos=50
+
+set-properties, c.sink_0::xpos=50, c.sink_0::ypos=50, c.sink_1::xpos=0, c.sink_1::ypos=0
+check-properties, c.sink_0::xpos=50, c.sink_0::ypos=50, c.sink_1::xpos=0, c.sink_1::ypos=0
+
+set-properties, c::latency=50.0
+check-properties, c::latency=50.0
+stop
\ No newline at end of file