2019-05-05 15:23:59 +00:00
|
|
|
#! /bin/bash
|
|
|
|
|
2019-11-29 14:51:35 +00:00
|
|
|
GTK_BUILDER_TOOL=${GTK_BUILDER_TOOL:-gtk4-builder-tool}
|
2020-03-13 19:11:07 +00:00
|
|
|
TEST_DATA_DIR=${G_TEST_SRCDIR:-.}/simplify-data-3to4
|
2021-07-28 17:21:03 +00:00
|
|
|
TEST_RESULT_DIR=${TEST_RESULT_DIR:-/tmp}/simplify-3to4
|
|
|
|
|
|
|
|
mkdir -p "$TEST_RESULT_DIR"
|
2019-05-05 15:23:59 +00:00
|
|
|
|
|
|
|
shopt -s nullglob
|
|
|
|
TESTS=( "$TEST_DATA_DIR"/*.ui )
|
|
|
|
|
2020-11-01 15:33:53 +00:00
|
|
|
echo "1..$((2 * ${#TESTS[*]}))"
|
2019-05-05 15:23:59 +00:00
|
|
|
|
|
|
|
I=1
|
|
|
|
for t in ${TESTS[*]}; do
|
|
|
|
name=$(basename $t .ui)
|
|
|
|
expected="$TEST_DATA_DIR/$name.expected"
|
|
|
|
result="$TEST_RESULT_DIR/$name.out"
|
2020-11-01 15:33:53 +00:00
|
|
|
result2="$TEST_RESULT_DIR/$name.out2"
|
2019-05-05 15:23:59 +00:00
|
|
|
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))
|
2020-11-01 15:33:53 +00:00
|
|
|
|
|
|
|
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))
|
2019-05-05 15:23:59 +00:00
|
|
|
done
|