[vala/0.40] tests: Add "gtktemplate" test to increase coverage
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.40] tests: Add "gtktemplate" test to increase coverage
- Date: Mon, 11 Jan 2021 09:56:06 +0000 (UTC)
commit ef4402da46e3c2b626406f06f62072d6d2c57816
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sun Jan 3 16:32:22 2021 +0100
tests: Add "gtktemplate" test to increase coverage
Backported from 0.48
configure.ac | 1 +
tests/Makefile.am | 1 +
tests/gtktemplate/Makefile.am | 22 +++++++++++++
tests/gtktemplate/gtktemplate.gresource.xml | 6 ++++
tests/gtktemplate/gtktemplate.ui | 48 +++++++++++++++++++++++++++++
tests/gtktemplate/gtktemplate.vala | 16 ++++++++++
6 files changed, 94 insertions(+)
---
diff --git a/configure.ac b/configure.ac
index de371b216..ae490df77 100644
--- a/configure.ac
+++ b/configure.ac
@@ -167,6 +167,7 @@ AC_CONFIG_FILES([Makefile
tests/Makefile
tests/fastvapi/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 2c6fee3bc..36e09469e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -3,6 +3,7 @@ NULL =
SUBDIRS = \
fastvapi \
girwriter \
+ gtktemplate \
$(NULL)
AM_CPPFLAGS = \
diff --git a/tests/gtktemplate/Makefile.am b/tests/gtktemplate/Makefile.am
new file mode 100644
index 000000000..6cd454e9d
--- /dev/null
+++ b/tests/gtktemplate/Makefile.am
@@ -0,0 +1,22 @@
+NULL =
+
+check-gtktemplate: $(top_builddir)/compiler/valac
+ G_DEBUG=fatal-warnings $(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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/example/">
+ <file preprocess="xml-stripblanks">gtktemplate.ui</file>
+ </gresource>
+</gresources>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface>
+ <requires lib="gtk+" version="3.10"/>
+ <template class="GtkTemplateTest" parent="GtkApplicationWindow">
+ <property name="can_focus">False</property>
+ <property name="title" translatable="yes">GtkTemplate</property>
+ <property name="default_width">300</property>
+ <property name="default_height">200</property>
+ <property name="show_menubar">False</property>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkButton" id="button0">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked" handler="on_clicked_cb" swapped="yes"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="activate" handler="on_activate_cb" swapped="yes"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </template>
+</interface>
diff --git a/tests/gtktemplate/gtktemplate.vala b/tests/gtktemplate/gtktemplate.vala
new file mode 100644
index 000000000..520fb5508
--- /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;
+
+ [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) {
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]