[vala/staging] tests: Add "default-handler with base-access" signal test to increase coverage



commit 91661e22b807f3ca90681fbec951ee23465fc575
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Thu Oct 17 13:00:15 2019 +0200

    tests: Add "default-handler with base-access" signal test to increase coverage

 tests/Makefile.am                         |  1 +
 tests/chainup/signal-default-handler.vala | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c22b4dc0b..6578f43ab 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -89,6 +89,7 @@ TESTS = \
        chainup/class-this-foo.vala \
        chainup/method-lambda-base.vala \
        chainup/no-chainup.vala \
+       chainup/signal-default-handler.vala \
        chainup/struct-base.vala \
        chainup/struct-base-foo.vala \
        chainup/struct-this.vala \
diff --git a/tests/chainup/signal-default-handler.vala b/tests/chainup/signal-default-handler.vala
new file mode 100644
index 000000000..0cf327859
--- /dev/null
+++ b/tests/chainup/signal-default-handler.vala
@@ -0,0 +1,21 @@
+bool reached = false;
+
+class Foo : Object {
+       public virtual signal void foo () {
+               reached = true;
+       }
+}
+
+class Bar : Foo {
+       public void bar () {
+               // Only execute default-handler without a signal emission
+               base.foo ();
+       }
+}
+
+void main () {
+       var bar = new Bar ();
+       bar.foo.connect (assert_not_reached);
+       bar.bar ();
+       assert (reached);
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]