summaryrefslogtreecommitdiff
path: root/tests/vsp-unit-test-0012.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/vsp-unit-test-0012.sh')
-rwxr-xr-xtests/vsp-unit-test-0012.sh91
1 files changed, 91 insertions, 0 deletions
diff --git a/tests/vsp-unit-test-0012.sh b/tests/vsp-unit-test-0012.sh
new file mode 100755
index 0000000..a536ca9
--- /dev/null
+++ b/tests/vsp-unit-test-0012.sh
@@ -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