From 6f7fb3744bbb4d1ee04d4e526d2ff7225c56c426 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Sun, 25 Apr 2010 20:07:26 -0500 Subject: [PATCH] Add testcases for and Bug #616102. --- gio/tests/Makefile.am | 48 ++++++++++++------- gio/tests/gschema-compile.c | 40 +++++++++------- .../array-default-not-in-choices.gschema.xml | 11 +++++ .../choice-missing-value.gschema.xml | 10 ++++ .../choices-wrong-type.gschema.xml | 8 ++++ .../default-not-in-choices.gschema.xml | 11 +++++ .../default-out-of-range.gschema.xml | 8 ++++ .../range-missing-max.gschema.xml | 8 ++++ .../range-missing-min.gschema.xml | 8 ++++ .../schema-tests/range-wrong-type.gschema.xml | 8 ++++ 10 files changed, 127 insertions(+), 33 deletions(-) create mode 100644 gio/tests/schema-tests/array-default-not-in-choices.gschema.xml create mode 100644 gio/tests/schema-tests/choice-missing-value.gschema.xml create mode 100644 gio/tests/schema-tests/choices-wrong-type.gschema.xml create mode 100644 gio/tests/schema-tests/default-not-in-choices.gschema.xml create mode 100644 gio/tests/schema-tests/default-out-of-range.gschema.xml create mode 100644 gio/tests/schema-tests/range-missing-max.gschema.xml create mode 100644 gio/tests/schema-tests/range-missing-min.gschema.xml create mode 100644 gio/tests/schema-tests/range-wrong-type.gschema.xml diff --git a/gio/tests/Makefile.am b/gio/tests/Makefile.am index ba8fa6f29..8be6313ce 100644 --- a/gio/tests/Makefile.am +++ b/gio/tests/Makefile.am @@ -150,23 +150,37 @@ gsettings_LDADD = $(progs_ldadd) gschema_compile_SOURCES = gschema-compile.c gschema_compile_LDADD = $(progs_ldadd) -EXTRA_DIST += \ - socket-common.c \ - org.gtk.test.gschema \ - org.gtk.test.gschema.xml \ - de.po \ - schema-tests/bad-type.gschema.xml \ - schema-tests/incomplete-list.gschema.xml \ - schema-tests/missing-quotes.gschema.xml \ - schema-tests/no-default.gschema.xml \ - schema-tests/wrong-category.gschema.xml \ - schema-tests/overflow.gschema.xml \ - schema-tests/bad-key.gschema.xml \ - schema-tests/bad-key2.gschema.xml \ - schema-tests/bad-key3.gschema.xml \ - schema-tests/bad-key4.gschema.xml \ - schema-tests/empty-key.gschema.xml - +EXTRA_DIST += \ + socket-common.c \ + org.gtk.test.gschema \ + org.gtk.test.gschema.xml \ + de.po \ + schema-tests/bad-type.gschema.xml \ + schema-tests/incomplete-list.gschema.xml \ + schema-tests/missing-quotes.gschema.xml \ + schema-tests/no-default.gschema.xml \ + schema-tests/wrong-category.gschema.xml \ + schema-tests/overflow.gschema.xml \ + schema-tests/bad-key.gschema.xml \ + schema-tests/bad-key2.gschema.xml \ + schema-tests/bad-key3.gschema.xml \ + schema-tests/bad-key4.gschema.xml \ + schema-tests/empty-key.gschema.xml \ + schema-tests/array-default-not-in-choices.gschema.xml \ + schema-tests/bad-type.gschema.xml \ + schema-tests/choice-missing-value.gschema.xml \ + schema-tests/choices-wrong-type.gschema.xml \ + schema-tests/default-not-in-choices.gschema.xml \ + schema-tests/default-out-of-range.gschema.xml \ + schema-tests/incomplete-list.gschema.xml \ + schema-tests/missing-quotes.gschema.xml \ + schema-tests/no-default.gschema.xml \ + schema-tests/overflow.gschema.xml \ + schema-tests/range-missing-max.gschema.xml \ + schema-tests/range-missing-min.gschema.xml \ + schema-tests/range-wrong-type.gschema.xml \ + schema-tests/wrong-category.gschema.xml + MISC_STUFF = gschemas.compiled test.mo test.mo: de.po diff --git a/gio/tests/gschema-compile.c b/gio/tests/gschema-compile.c index 67dbc1736..81ae4b70a 100644 --- a/gio/tests/gschema-compile.c +++ b/gio/tests/gschema-compile.c @@ -42,22 +42,30 @@ test_schema (gpointer data) } static const SchemaTest tests[] = { - { "no-default", NULL, "* is required in *" }, - { "missing-quotes", NULL, "*unknown keyword*" }, - { "incomplete-list", NULL, "*to follow array element*" }, - { "wrong-category", NULL, "*attribute 'l10n' invalid*" }, - { "bad-type", NULL, "*invalid GVariant type string*" }, - { "overflow", NULL, "*out of range*" }, - { "bad-key", NULL, "*invalid name*" }, - { "bad-key", "--allow-any-name", NULL }, - { "bad-key2", NULL, "*invalid name*" }, - { "bad-key2", "--allow-any-name", NULL }, - { "bad-key3", NULL, "*invalid name*" }, - { "bad-key3", "--allow-any-name", NULL }, - { "bad-key4", NULL, "*invalid name*" }, - { "bad-key4", "--allow-any-name", NULL }, - { "empty-key", NULL, "*empty names*" }, - { "empty-key", "--allow-any-name", "*empty names*" }, + { "no-default", NULL, "* is required in *" }, + { "missing-quotes", NULL, "*unknown keyword*" }, + { "incomplete-list", NULL, "*to follow array element*" }, + { "wrong-category", NULL, "*attribute 'l10n' invalid*" }, + { "bad-type", NULL, "*invalid GVariant type string*" }, + { "overflow", NULL, "*out of range*" }, + { "range-wrong-type", NULL, "* not allowed for keys of type*" }, + { "range-missing-min", NULL, "*element 'range' requires attribute 'min'*" }, + { "range-missing-max", NULL, "*element 'range' requires attribute 'max'*" }, + { "default-out-of-range", NULL, "* is not contained in the specified range*" }, + { "choices-wrong-type", NULL, "* not allowed for keys of type*" }, + { "choice-missing-value", NULL, "*element 'choice' requires attribute 'value'*" }, + { "default-not-in-choices", NULL, "* contains string not in *" }, + { "array-default-not-in-choices", NULL, "* contains string not in *" }, + { "bad-key", NULL, "*invalid name*" }, + { "bad-key", "--allow-any-name", NULL }, + { "bad-key2", NULL, "*invalid name*" }, + { "bad-key2", "--allow-any-name", NULL }, + { "bad-key3", NULL, "*invalid name*" }, + { "bad-key3", "--allow-any-name", NULL }, + { "bad-key4", NULL, "*invalid name*" }, + { "bad-key4", "--allow-any-name", NULL }, + { "empty-key", NULL, "*empty names*" }, + { "empty-key", "--allow-any-name", "*empty names*" } }; int diff --git a/gio/tests/schema-tests/array-default-not-in-choices.gschema.xml b/gio/tests/schema-tests/array-default-not-in-choices.gschema.xml new file mode 100644 index 000000000..b6fffc67d --- /dev/null +++ b/gio/tests/schema-tests/array-default-not-in-choices.gschema.xml @@ -0,0 +1,11 @@ + + + + + + + + ["first","last","second"] + + + diff --git a/gio/tests/schema-tests/choice-missing-value.gschema.xml b/gio/tests/schema-tests/choice-missing-value.gschema.xml new file mode 100644 index 000000000..d900fc5e1 --- /dev/null +++ b/gio/tests/schema-tests/choice-missing-value.gschema.xml @@ -0,0 +1,10 @@ + + + + + + + "a" + + + diff --git a/gio/tests/schema-tests/choices-wrong-type.gschema.xml b/gio/tests/schema-tests/choices-wrong-type.gschema.xml new file mode 100644 index 000000000..7e6f14ca1 --- /dev/null +++ b/gio/tests/schema-tests/choices-wrong-type.gschema.xml @@ -0,0 +1,8 @@ + + + + + (1,"a") + + + diff --git a/gio/tests/schema-tests/default-not-in-choices.gschema.xml b/gio/tests/schema-tests/default-not-in-choices.gschema.xml new file mode 100644 index 000000000..ec4a08d45 --- /dev/null +++ b/gio/tests/schema-tests/default-not-in-choices.gschema.xml @@ -0,0 +1,11 @@ + + + + + + + + "next-to-last" + + + diff --git a/gio/tests/schema-tests/default-out-of-range.gschema.xml b/gio/tests/schema-tests/default-out-of-range.gschema.xml new file mode 100644 index 000000000..8b3cbd37f --- /dev/null +++ b/gio/tests/schema-tests/default-out-of-range.gschema.xml @@ -0,0 +1,8 @@ + + + + + -1 + + + diff --git a/gio/tests/schema-tests/range-missing-max.gschema.xml b/gio/tests/schema-tests/range-missing-max.gschema.xml new file mode 100644 index 000000000..8e8bd55e2 --- /dev/null +++ b/gio/tests/schema-tests/range-missing-max.gschema.xml @@ -0,0 +1,8 @@ + + + + + 2 + + + diff --git a/gio/tests/schema-tests/range-missing-min.gschema.xml b/gio/tests/schema-tests/range-missing-min.gschema.xml new file mode 100644 index 000000000..f4de90c48 --- /dev/null +++ b/gio/tests/schema-tests/range-missing-min.gschema.xml @@ -0,0 +1,8 @@ + + + + + 2 + + + diff --git a/gio/tests/schema-tests/range-wrong-type.gschema.xml b/gio/tests/schema-tests/range-wrong-type.gschema.xml new file mode 100644 index 000000000..033767f8e --- /dev/null +++ b/gio/tests/schema-tests/range-wrong-type.gschema.xml @@ -0,0 +1,8 @@ + + + + + "a" + + +