[vala/0.50] tests: Add more invalid "GtkTemplate" tests to increase coverage
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.50] tests: Add more invalid "GtkTemplate" tests to increase coverage
- Date: Sun, 28 Feb 2021 08:58:19 +0000 (UTC)
commit ab9caaa5e043918cca34f3bf8cd700b84fafdbaf
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sun Jan 17 13:10:13 2021 +0100
tests: Add more invalid "GtkTemplate" tests to increase coverage
tests/Makefile.am | 9 +++++++++
tests/gtktemplate/gtkcallback-incompatible.test | 11 +++++++++++
tests/gtktemplate/gtkcallback-unknown.test | 11 +++++++++++
tests/gtktemplate/gtkchild-field-incompatible-type.test | 10 ++++++++++
tests/gtktemplate/gtkchild-field-unknown.test | 10 ++++++++++
tests/gtktemplate/gtkchild-property-not-automatic.test | 10 ++++++++++
tests/gtktemplate/gtkchild-property-unknown.test | 10 ++++++++++
tests/gtktemplate/gtkchild-without-gtktemplate.test | 9 +++++++++
tests/gtktemplate/gtktemplate-gtkwidget-subclass.test | 8 ++++++++
tests/gtktemplate/tests-extra-environment.sh | 2 ++
10 files changed, 90 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e0521dd98..5cb692f74 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -706,6 +706,14 @@ TESTS = \
gir/property-non-readable.test \
gir/symbol-type-csuffix.test \
gir/union.test \
+ gtktemplate/gtkcallback-incompatible.test \
+ gtktemplate/gtkcallback-unknown.test \
+ gtktemplate/gtkchild-field-incompatible-type.test \
+ gtktemplate/gtkchild-field-unknown.test \
+ gtktemplate/gtkchild-property-not-automatic.test \
+ gtktemplate/gtkchild-property-unknown.test \
+ gtktemplate/gtkchild-without-gtktemplate.test \
+ gtktemplate/gtktemplate-gtkwidget-subclass.test \
annotations/deprecated.vala \
annotations/description.vala \
annotations/noaccessormethod.test \
@@ -1147,6 +1155,7 @@ LINUX_TESTS += \
endif
EXTRA_DIST = \
+ gtktemplate/tests-extra-environment.sh \
linux/tests-extra-environment.sh \
nullability/tests-extra-environment.sh \
posix/tests-extra-environment.sh \
diff --git a/tests/gtktemplate/gtkcallback-incompatible.test b/tests/gtktemplate/gtkcallback-incompatible.test
new file mode 100644
index 000000000..226408ff1
--- /dev/null
+++ b/tests/gtktemplate/gtkcallback-incompatible.test
@@ -0,0 +1,11 @@
+Invalid Code
+
+[GtkTemplate (ui = "/org/example/gtktemplate.ui")]
+public class GtkTemplate : Gtk.ApplicationWindow {
+ [GtkCallback]
+ void on_clicked_cb (string s) {
+ }
+}
+
+void main () {
+}
diff --git a/tests/gtktemplate/gtkcallback-unknown.test b/tests/gtktemplate/gtkcallback-unknown.test
new file mode 100644
index 000000000..3158da85e
--- /dev/null
+++ b/tests/gtktemplate/gtkcallback-unknown.test
@@ -0,0 +1,11 @@
+Invalid Code
+
+[GtkTemplate (ui = "/org/example/gtktemplate.ui")]
+public class GtkTemplate : Gtk.ApplicationWindow {
+ [GtkCallback]
+ void on_unknown_cb (Gtk.Button button) {
+ }
+}
+
+void main () {
+}
diff --git a/tests/gtktemplate/gtkchild-field-incompatible-type.test
b/tests/gtktemplate/gtkchild-field-incompatible-type.test
new file mode 100644
index 000000000..1ce026135
--- /dev/null
+++ b/tests/gtktemplate/gtkchild-field-incompatible-type.test
@@ -0,0 +1,10 @@
+Invalid Code
+
+[GtkTemplate (ui = "/org/example/gtktemplate.ui")]
+public class GtkTemplate : Gtk.ApplicationWindow {
+ [GtkChild]
+ public unowned Gtk.Box button0;
+}
+
+void main () {
+}
diff --git a/tests/gtktemplate/gtkchild-field-unknown.test b/tests/gtktemplate/gtkchild-field-unknown.test
new file mode 100644
index 000000000..2e23ea0b4
--- /dev/null
+++ b/tests/gtktemplate/gtkchild-field-unknown.test
@@ -0,0 +1,10 @@
+Invalid Code
+
+[GtkTemplate (ui = "/org/example/gtktemplate.ui")]
+public class GtkTemplate : Gtk.ApplicationWindow {
+ [GtkChild]
+ public unowned Gtk.Button unknown;
+}
+
+void main () {
+}
diff --git a/tests/gtktemplate/gtkchild-property-not-automatic.test
b/tests/gtktemplate/gtkchild-property-not-automatic.test
new file mode 100644
index 000000000..e46cee574
--- /dev/null
+++ b/tests/gtktemplate/gtkchild-property-not-automatic.test
@@ -0,0 +1,10 @@
+Invalid Code
+
+[GtkTemplate (ui = "/org/example/gtktemplate.ui")]
+public class GtkTemplate : Gtk.ApplicationWindow {
+ [GtkChild]
+ public unowned Gtk.Button button0 { get { return null; } }
+}
+
+void main () {
+}
diff --git a/tests/gtktemplate/gtkchild-property-unknown.test
b/tests/gtktemplate/gtkchild-property-unknown.test
new file mode 100644
index 000000000..caa6218f3
--- /dev/null
+++ b/tests/gtktemplate/gtkchild-property-unknown.test
@@ -0,0 +1,10 @@
+Invalid Code
+
+[GtkTemplate (ui = "/org/example/gtktemplate.ui")]
+public class GtkTemplate : Gtk.ApplicationWindow {
+ [GtkChild]
+ public unowned Gtk.Button unknown { get; }
+}
+
+void main () {
+}
diff --git a/tests/gtktemplate/gtkchild-without-gtktemplate.test
b/tests/gtktemplate/gtkchild-without-gtktemplate.test
new file mode 100644
index 000000000..33d32ea4e
--- /dev/null
+++ b/tests/gtktemplate/gtkchild-without-gtktemplate.test
@@ -0,0 +1,9 @@
+Invalid Code
+
+public class GtkTemplate : Gtk.ApplicationWindow {
+ [GtkChild]
+ public unowned Gtk.Button button0;
+}
+
+void main () {
+}
diff --git a/tests/gtktemplate/gtktemplate-gtkwidget-subclass.test
b/tests/gtktemplate/gtktemplate-gtkwidget-subclass.test
new file mode 100644
index 000000000..bea1b3b86
--- /dev/null
+++ b/tests/gtktemplate/gtktemplate-gtkwidget-subclass.test
@@ -0,0 +1,8 @@
+Invalid Code
+
+[GtkTemplate (ui = "/org/example/gtktemplate.ui")]
+public class GtkTemplate : GLib.Object {
+}
+
+void main () {
+}
diff --git a/tests/gtktemplate/tests-extra-environment.sh b/tests/gtktemplate/tests-extra-environment.sh
new file mode 100644
index 000000000..6c805e648
--- /dev/null
+++ b/tests/gtktemplate/tests-extra-environment.sh
@@ -0,0 +1,2 @@
+PACKAGES="gtk+-3.0"
+VALAFLAGS="--gresources ${abs_srcdir}/gtktemplate/gtktemplate.gresource.xml"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]