forked from AuroraMiddleware/gtk
gtk-builder-tool: Add some tests
This commit is contained in:
parent
4f115ad940
commit
d22f351e28
@ -1912,6 +1912,7 @@ testsuite/css/parser/Makefile
|
||||
testsuite/gdk/Makefile
|
||||
testsuite/gtk/Makefile
|
||||
testsuite/reftests/Makefile
|
||||
testsuite/tools/Makefile
|
||||
docs/Makefile
|
||||
docs/reference/Makefile
|
||||
docs/reference/gdk/Makefile
|
||||
|
@ -1,6 +1,6 @@
|
||||
include $(top_srcdir)/Makefile.decl
|
||||
|
||||
SUBDIRS = gdk gtk a11y css reftests
|
||||
SUBDIRS = gdk gtk a11y css reftests tools
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
|
||||
|
26
testsuite/tools/Makefile.am
Normal file
26
testsuite/tools/Makefile.am
Normal file
@ -0,0 +1,26 @@
|
||||
include $(top_srcdir)/Makefile.decl
|
||||
|
||||
NULL =
|
||||
|
||||
test_simplify = \
|
||||
simplify/test1.ui simplify/test1.expected \
|
||||
simplify/test2.ui simplify/test2.expected \
|
||||
simplify/test3.ui simplify/test3.expected \
|
||||
simplify/test4.ui simplify/test4.expected \
|
||||
simplify/test5.ui simplify/test5.expected \
|
||||
simplify/test6.ui simplify/test6.expected \
|
||||
simplify/test7.ui simplify/test7.expected \
|
||||
simplify/test8.ui simplify/test8.expected \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DIST += \
|
||||
$(test_simplify)
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
GTK_BUILDER_TOOL="$(top_builddir)/gtk/gtk-builder-tool"
|
||||
|
||||
TEST_PROGS += \
|
||||
test-simplify \
|
||||
$(NULL)
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
5
testsuite/tools/simplify/test1.expected
Normal file
5
testsuite/tools/simplify/test1.expected
Normal file
@ -0,0 +1,5 @@
|
||||
<!-- default property gets stripped -->
|
||||
<interface>
|
||||
<object class="GtkWindow">
|
||||
</object>
|
||||
</interface>
|
6
testsuite/tools/simplify/test1.ui
Normal file
6
testsuite/tools/simplify/test1.ui
Normal file
@ -0,0 +1,6 @@
|
||||
<!-- default property gets stripped -->
|
||||
<interface>
|
||||
<object class="GtkWindow">
|
||||
<property name="visible">False</property>
|
||||
</object>
|
||||
</interface>
|
6
testsuite/tools/simplify/test2.expected
Normal file
6
testsuite/tools/simplify/test2.expected
Normal file
@ -0,0 +1,6 @@
|
||||
<!-- non-default property not stripped -->
|
||||
<interface>
|
||||
<object class="GtkWindow">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</interface>
|
6
testsuite/tools/simplify/test2.ui
Normal file
6
testsuite/tools/simplify/test2.ui
Normal file
@ -0,0 +1,6 @@
|
||||
<!-- non-default property not stripped -->
|
||||
<interface>
|
||||
<object class="GtkWindow">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</interface>
|
6
testsuite/tools/simplify/test3.expected
Normal file
6
testsuite/tools/simplify/test3.expected
Normal file
@ -0,0 +1,6 @@
|
||||
<!-- translatable property not stripped -->
|
||||
<interface>
|
||||
<object class="GtkWindow">
|
||||
<property name="visible" translatable="yes">False</property>
|
||||
</object>
|
||||
</interface>
|
6
testsuite/tools/simplify/test3.ui
Normal file
6
testsuite/tools/simplify/test3.ui
Normal file
@ -0,0 +1,6 @@
|
||||
<!-- translatable property not stripped -->
|
||||
<interface>
|
||||
<object class="GtkWindow">
|
||||
<property name="visible" translatable="yes">False</property>
|
||||
</object>
|
||||
</interface>
|
6
testsuite/tools/simplify/test4.expected
Normal file
6
testsuite/tools/simplify/test4.expected
Normal file
@ -0,0 +1,6 @@
|
||||
<!-- irrelevant comments and context are stripped -->
|
||||
<interface>
|
||||
<object class="GtkWindow">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</interface>
|
6
testsuite/tools/simplify/test4.ui
Normal file
6
testsuite/tools/simplify/test4.ui
Normal file
@ -0,0 +1,6 @@
|
||||
<!-- irrelevant comments and context are stripped -->
|
||||
<interface>
|
||||
<object class="GtkWindow">
|
||||
<property name="visible" comments="foo" context="bla">True</property>
|
||||
</object>
|
||||
</interface>
|
9
testsuite/tools/simplify/test5.expected
Normal file
9
testsuite/tools/simplify/test5.expected
Normal file
@ -0,0 +1,9 @@
|
||||
<!-- placeholders are stripped -->
|
||||
<interface>
|
||||
<object class="GtkWindow">
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
12
testsuite/tools/simplify/test5.ui
Normal file
12
testsuite/tools/simplify/test5.ui
Normal file
@ -0,0 +1,12 @@
|
||||
<!-- placeholders are stripped -->
|
||||
<interface>
|
||||
<object class="GtkWindow">
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
5
testsuite/tools/simplify/test6.expected
Normal file
5
testsuite/tools/simplify/test6.expected
Normal file
@ -0,0 +1,5 @@
|
||||
<!-- non-canonical property name works -->
|
||||
<interface>
|
||||
<object class="GtkWindow">
|
||||
</object>
|
||||
</interface>
|
6
testsuite/tools/simplify/test6.ui
Normal file
6
testsuite/tools/simplify/test6.ui
Normal file
@ -0,0 +1,6 @@
|
||||
<!-- non-canonical property name works -->
|
||||
<interface>
|
||||
<object class="GtkWindow">
|
||||
<property name="default_width">-1</property>
|
||||
</object>
|
||||
</interface>
|
8
testsuite/tools/simplify/test7.expected
Normal file
8
testsuite/tools/simplify/test7.expected
Normal file
@ -0,0 +1,8 @@
|
||||
<!-- default child property gets stripped -->
|
||||
<interface>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel"/>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
12
testsuite/tools/simplify/test7.ui
Normal file
12
testsuite/tools/simplify/test7.ui
Normal file
@ -0,0 +1,12 @@
|
||||
<!-- default child property gets stripped -->
|
||||
<interface>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
11
testsuite/tools/simplify/test8.expected
Normal file
11
testsuite/tools/simplify/test8.expected
Normal file
@ -0,0 +1,11 @@
|
||||
<!-- non-default child property remains -->
|
||||
<interface>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel"/>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
12
testsuite/tools/simplify/test8.ui
Normal file
12
testsuite/tools/simplify/test8.ui
Normal file
@ -0,0 +1,12 @@
|
||||
<!-- non-default child property remains -->
|
||||
<interface>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
27
testsuite/tools/test-simplify
Executable file
27
testsuite/tools/test-simplify
Executable file
@ -0,0 +1,27 @@
|
||||
#! /bin/sh
|
||||
|
||||
GTK_BUILDER_TOOL=${GTK_BUILDER_TOOL:-gtk-builder-tool}
|
||||
TEST_DATA_DIR=${TEST_DATA_DIR:-./simplify}
|
||||
TEST_RESULT_DIR=${TEST_RESULT_DIR:-/tmp}
|
||||
|
||||
shopt -s nullglob
|
||||
TESTS=( "$TEST_DATA_DIR"/*.ui )
|
||||
|
||||
echo "1..${#TESTS}"
|
||||
|
||||
I=1
|
||||
for t in ${TESTS[*]}; do
|
||||
name=$(basename $t .ui)
|
||||
expected="$TEST_DATA_DIR/$name.expected"
|
||||
result="$TEST_RESULT_DIR/$name.out"
|
||||
|
||||
$GTK_BUILDER_TOOL simplify $t 2>/dev/null >$result
|
||||
|
||||
if diff "$expected" "$result" > /dev/null; then
|
||||
echo "ok $I $name"
|
||||
else
|
||||
echo "not ok $I $name"
|
||||
fi
|
||||
|
||||
I=$((I+1))
|
||||
done
|
Loading…
Reference in New Issue
Block a user