mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +00:00
testsuite: Add tests for gtk4-builder-tool validate
This commit is contained in:
parent
44b36b6321
commit
403a70ca89
@ -5,7 +5,7 @@ bash = find_program('bash', required : false)
|
||||
if bash.found()
|
||||
test_env = environment()
|
||||
|
||||
foreach t : ['simplify', 'simplify-3to4', 'settings']
|
||||
foreach t : ['simplify', 'simplify-3to4', 'validate', 'settings']
|
||||
if get_option('install-tests')
|
||||
configure_file(output: t,
|
||||
input: '@0@.in'.format(t),
|
||||
@ -44,4 +44,5 @@ if get_option('install-tests')
|
||||
|
||||
install_subdir('simplify-data', install_dir: testexecdir)
|
||||
install_subdir('simplify-data-3to4', install_dir: testexecdir)
|
||||
install_subdir('validate-data', install_dir: testexecdir)
|
||||
endif
|
||||
|
1
testsuite/tools/validate-data/invalid1.expected
Normal file
1
testsuite/tools/validate-data/invalid1.expected
Normal file
@ -0,0 +1 @@
|
||||
invalid1.ui:3:1 <child> is not a valid tag here
|
5
testsuite/tools/validate-data/invalid1.ui
Normal file
5
testsuite/tools/validate-data/invalid1.ui
Normal file
@ -0,0 +1,5 @@
|
||||
<interface>
|
||||
<child>
|
||||
<object class="GtkLabel"/>
|
||||
</child>
|
||||
</interface>
|
1
testsuite/tools/validate-data/invalid2.expected
Normal file
1
testsuite/tools/validate-data/invalid2.expected
Normal file
@ -0,0 +1 @@
|
||||
invalid2.ui:4:1 <object> is not a valid tag here
|
6
testsuite/tools/validate-data/invalid2.ui
Normal file
6
testsuite/tools/validate-data/invalid2.ui
Normal file
@ -0,0 +1,6 @@
|
||||
<interface>
|
||||
<object class="GtkBox">
|
||||
<object class="GtkButton">
|
||||
</object>
|
||||
</object>
|
||||
</interface>
|
1
testsuite/tools/validate-data/invalid3.expected
Normal file
1
testsuite/tools/validate-data/invalid3.expected
Normal file
@ -0,0 +1 @@
|
||||
invalid3.ui:3:1 <object> requires attribute 'class'
|
4
testsuite/tools/validate-data/invalid3.ui
Normal file
4
testsuite/tools/validate-data/invalid3.ui
Normal file
@ -0,0 +1,4 @@
|
||||
<interface>
|
||||
<object>
|
||||
</object>
|
||||
</interface>
|
1
testsuite/tools/validate-data/invalid4.expected
Normal file
1
testsuite/tools/validate-data/invalid4.expected
Normal file
@ -0,0 +1 @@
|
||||
Gtk-WARNING: Failed to find accessible property “text”: Could not parse enum: 'text'
|
7
testsuite/tools/validate-data/invalid4.ui
Normal file
7
testsuite/tools/validate-data/invalid4.ui
Normal file
@ -0,0 +1,7 @@
|
||||
<interface>
|
||||
<object class="GtkBox">
|
||||
<accessibility>
|
||||
<property name="text">Download</property>
|
||||
</accessibility>
|
||||
</object>
|
||||
</interface>
|
0
testsuite/tools/validate-data/valid1.expected
Normal file
0
testsuite/tools/validate-data/valid1.expected
Normal file
3
testsuite/tools/validate-data/valid1.ui
Normal file
3
testsuite/tools/validate-data/valid1.ui
Normal file
@ -0,0 +1,3 @@
|
||||
<interface>
|
||||
<object class="GtkLabel"/>
|
||||
</interface>
|
0
testsuite/tools/validate-data/valid2.expected
Normal file
0
testsuite/tools/validate-data/valid2.expected
Normal file
4
testsuite/tools/validate-data/valid2.ui
Normal file
4
testsuite/tools/validate-data/valid2.ui
Normal file
@ -0,0 +1,4 @@
|
||||
<interface>
|
||||
<template class="GtkEmojiChooser" parent="GtkPopover">
|
||||
</template>
|
||||
</interface>
|
35
testsuite/tools/validate.in
Executable file
35
testsuite/tools/validate.in
Executable file
@ -0,0 +1,35 @@
|
||||
#! /bin/bash
|
||||
|
||||
GTK_BUILDER_TOOL=${GTK_BUILDER_TOOL:-gtk4-builder-tool}
|
||||
TEST_DATA_DIR=${G_TEST_SRCDIR:-.}/validate-data
|
||||
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"
|
||||
diff="$TEST_RESULT_DIR/$name.diff"
|
||||
ref="$TEST_RESULT_DIR/$name.ref"
|
||||
|
||||
cd $TEST_DATA_DIR
|
||||
|
||||
$GTK_BUILDER_TOOL validate $(basename $t) 2>$result
|
||||
|
||||
cd $OLDPWD
|
||||
|
||||
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))
|
||||
done
|
Loading…
Reference in New Issue
Block a user