[vala/0.44] tests: Add "default-handler with base-access" signal test to increase coverage
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.44] tests: Add "default-handler with base-access" signal test to increase coverage
- Date: Thu, 7 Nov 2019 11:18:46 +0000 (UTC)
commit a476dc552cdb0afba4e4239051ce10c0987009f0
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 f7f9b2974..357ba6924 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -88,6 +88,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]