summaryrefslogtreecommitdiff
path: root/testsuite/tools/simplify-3to4
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tools/simplify-3to4')
-rwxr-xr-xtestsuite/tools/simplify-3to447
1 files changed, 47 insertions, 0 deletions
diff --git a/testsuite/tools/simplify-3to4 b/testsuite/tools/simplify-3to4
new file mode 100755
index 0000000000..0a97f1afd8
--- /dev/null
+++ b/testsuite/tools/simplify-3to4
@@ -0,0 +1,47 @@
+#! /bin/bash
+
+GTK_BUILDER_TOOL=${GTK_BUILDER_TOOL:-gtk4-builder-tool}
+TEST_DATA_DIR=${G_TEST_SRCDIR:-.}/simplify-data-3to4
+TEST_RESULT_DIR=${TEST_RESULT_DIR:-/tmp}/simplify-3to4
+
+mkdir -p "$TEST_RESULT_DIR"
+
+shopt -s nullglob
+TESTS=( "$TEST_DATA_DIR"/*.ui )
+
+echo "1..$((2 * ${#TESTS[*]}))"
+
+I=1
+for t in ${TESTS[*]}; do
+ name=$(basename $t .ui)
+ expected="$TEST_DATA_DIR/$name.expected"
+ result="$TEST_RESULT_DIR/$name.out"
+ result2="$TEST_RESULT_DIR/$name.out2"
+ diff="$TEST_RESULT_DIR/$name.diff"
+ ref="$TEST_RESULT_DIR/$name.ref"
+
+ $GTK_BUILDER_TOOL simplify --3to4 $t 2>/dev/null >$result
+
+ if diff -u "$expected" "$result" > "$diff"; then
+ echo "ok $I $name"
+ rm "$diff"
+ else
+ echo "not ok $I $name"
+ cp "$expected" "$ref"
+ fi
+
+ I=$((I+1))
+
+ cp $t $result2
+ $GTK_BUILDER_TOOL simplify --3to4 --replace $result2 2>/dev/null
+
+ if diff -u "$expected" "$result2" > "$diff"; then
+ echo "ok $I $name (--replace)"
+ rm "$diff"
+ else
+ echo "not ok $I $name (--replace)"
+ cp "$expected" "$ref"
+ fi
+
+ I=$((I+1))
+done