tests: Add WPF flip update tests
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Sun, 19 Jun 2016 22:15:31 +0000 (01:15 +0300)
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Mon, 20 Jun 2016 19:03:05 +0000 (22:03 +0300)
Test updating the vertical and horizontal flip controls during video
streaming.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
tests/vsp-unit-test-0012.sh [new file with mode: 0755]

diff --git a/tests/vsp-unit-test-0012.sh b/tests/vsp-unit-test-0012.sh
new file mode 100755 (executable)
index 0000000..a536ca9
--- /dev/null
@@ -0,0 +1,91 @@
+#!/bin/sh
+
+#
+# Test runtime modification of horizontal and vertical flipping on WPF.0.
+#
+
+source vsp-lib.sh
+
+features="rpf.0 wpf.0 wpf.0[control:'Vertical+Flip']"
+optional_features="wpf.0[control:'Horizontal+Flip']"
+
+directions="horizontal vertical"
+dir_horizontal_control="Horizontal+Flip"
+dir_horizontal_label="hflip"
+dir_vertical_control="Vertical+Flip"
+dir_vertical_label="vflip"
+
+format="RGB24"
+
+get_var() {
+       echo $(eval echo \$dir_$1_$2)
+}
+
+flip_control() {
+       local direction=$1
+       local value=$2
+       local control=$(get_var $direction control)
+
+       vsp1_set_control wpf.0 "$control" $value
+}
+
+reset_controls() {
+       # Reset all controls to their default value
+       local direction
+
+       for direction in $* ; do
+               flip_control $direction 0
+       done
+}
+
+test_flipping() {
+       local direction=$1
+       local label="$(get_var $direction label)"
+
+       test_start "$label"
+
+       pipe_configure rpf-wpf 0 0
+       format_configure rpf-wpf 0 0 ARGB32 1024x768 $format
+
+       vsp_runner rpf.0 --count=6 &
+       vsp_runner wpf.0 --count=6 --skip=0 --buffers=1 --pause=3 &
+
+       vsp_runner_wait wpf.0
+       result=$(compare_frames $label=0)
+
+       [ $result = fail ] && {
+               test_complete $result ;
+               return
+       }
+
+       flip_control $direction 1
+
+       vsp_runner_resume wpf.0
+       wait
+
+       result=$(compare_frames $label=1)
+
+       test_complete $result
+}
+
+test_main() {
+       # Check the supported directions and reset the associated controls
+       local supported_directions
+
+       for direction in $directions ; do
+               $(vsp1_has_feature "wpf.0[control:'$(get_var $direction control)']") && {
+                       supported_directions="$supported_directions $direction" ;
+                       flip_control $direction 0
+               }
+       done
+
+       local directions=$supported_directions
+
+       for direction in $directions ; do
+               reset_controls $directions
+               test_flipping $direction
+       done
+}
+
+test_init $0 "$features" "$optional_features"
+test_run