From 8ba64b8f0a7b6f3872802179e0854915201e07b4 Mon Sep 17 00:00:00 2001 From: Rico Tzschichholz Date: Sun, 17 Jan 2021 13:10:13 +0100 Subject: tests: Add more invalid "GtkTemplate" tests to increase coverage --- tests/Makefile.am | 8 ++++++++ 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 ++++++++ 9 files changed, 87 insertions(+) create mode 100644 tests/gtktemplate/gtkcallback-incompatible.test create mode 100644 tests/gtktemplate/gtkcallback-unknown.test create mode 100644 tests/gtktemplate/gtkchild-field-incompatible-type.test create mode 100644 tests/gtktemplate/gtkchild-field-unknown.test create mode 100644 tests/gtktemplate/gtkchild-property-not-automatic.test create mode 100644 tests/gtktemplate/gtkchild-property-unknown.test create mode 100644 tests/gtktemplate/gtkchild-without-gtktemplate.test create mode 100644 tests/gtktemplate/gtktemplate-gtkwidget-subclass.test diff --git a/tests/Makefile.am b/tests/Makefile.am index 8c001a099..9ee73d0e7 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -709,10 +709,18 @@ 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-assignment.test \ + gtktemplate/gtkchild-field-incompatible-type.test \ gtktemplate/gtkchild-field-out-assignment.test \ gtktemplate/gtkchild-field-ref-assignment.test \ + gtktemplate/gtkchild-field-unknown.test \ gtktemplate/gtkchild-property-assignment.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 \ 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 () { +} -- cgit v1.2.1