From: Rico Tzschichholz Date: Wed, 1 Aug 2018 15:29:22 +0000 (+0200) Subject: tests: Add "gtktemplate" test to increase coverage X-Git-Tag: 0.41.91~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da84af1c79860c932605c2bb9fab2701f28e1792;p=thirdparty%2Fvala.git tests: Add "gtktemplate" test to increase coverage --- diff --git a/configure.ac b/configure.ac index 62656404d..cc02d2863 100644 --- a/configure.ac +++ b/configure.ac @@ -163,6 +163,7 @@ AC_CONFIG_FILES([Makefile vapi/Makefile tests/Makefile tests/girwriter/Makefile + tests/gtktemplate/Makefile doc/Makefile doc/manual/Makefile doc/manual/version.xml diff --git a/tests/Makefile.am b/tests/Makefile.am index 800ee136f..d2bb37be6 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -2,6 +2,7 @@ NULL = SUBDIRS = \ girwriter \ + gtktemplate \ $(NULL) AM_CPPFLAGS = \ diff --git a/tests/gtktemplate/Makefile.am b/tests/gtktemplate/Makefile.am new file mode 100644 index 000000000..05dfd84eb --- /dev/null +++ b/tests/gtktemplate/Makefile.am @@ -0,0 +1,22 @@ +NULL = + +check-gtktemplate: $(top_builddir)/compiler/valac + $(top_builddir)/compiler/valac \ + -C \ + --vapidir $(top_srcdir)/vapi \ + --pkg gtk+-3.0 \ + --gresources $(srcdir)/gtktemplate.gresource.xml \ + $(srcdir)/gtktemplate.vala; \ + rm -f gtktemplate.c + +check: check-gtktemplate + +EXTRA_DIST = \ + gtktemplate.gresource.xml \ + gtktemplate.ui \ + gtktemplate.vala \ + $(NULL) + +CLEANFILES = \ + gtktemplate.c \ + $(NULL) diff --git a/tests/gtktemplate/gtktemplate.gresource.xml b/tests/gtktemplate/gtktemplate.gresource.xml new file mode 100644 index 000000000..aa9b08299 --- /dev/null +++ b/tests/gtktemplate/gtktemplate.gresource.xml @@ -0,0 +1,6 @@ + + + + gtktemplate.ui + + diff --git a/tests/gtktemplate/gtktemplate.ui b/tests/gtktemplate/gtktemplate.ui new file mode 100644 index 000000000..1546d9472 --- /dev/null +++ b/tests/gtktemplate/gtktemplate.ui @@ -0,0 +1,48 @@ + + + + + + diff --git a/tests/gtktemplate/gtktemplate.vala b/tests/gtktemplate/gtktemplate.vala new file mode 100644 index 000000000..fa6317ff0 --- /dev/null +++ b/tests/gtktemplate/gtktemplate.vala @@ -0,0 +1,16 @@ +[GtkTemplate (ui = "/org/example/gtktemplate.ui")] +public class GtkTemplate : Gtk.ApplicationWindow { + [GtkChild] + public Gtk.Button button0 { get; set; } + + [GtkChild (internal = true)] + public Gtk.Button button1; + + [GtkCallback] + void on_clicked_cb (Gtk.Button button) { + } + + [GtkCallback (name = "on_activate_cb")] + void on_something_cb (Gtk.Button button) { + } +}