summaryrefslogtreecommitdiffstats
path: root/PerlTQt/t/d_sigslot.t
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-01-01 18:29:30 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-01-01 18:29:30 -0600
commitb2af005db21bd8fd068cb79b2ae700953128af2c (patch)
treeabd0ed633726bf0bbecb57d30e92836c31e02695 /PerlTQt/t/d_sigslot.t
parentc1b9383f2032d82db5eb8918dca885e37a901dde (diff)
downloadlibtqt-perl-b2af005db21bd8fd068cb79b2ae700953128af2c.tar.gz
libtqt-perl-b2af005db21bd8fd068cb79b2ae700953128af2c.zip
Move PerlQt
Diffstat (limited to 'PerlTQt/t/d_sigslot.t')
-rw-r--r--PerlTQt/t/d_sigslot.t49
1 files changed, 49 insertions, 0 deletions
diff --git a/PerlTQt/t/d_sigslot.t b/PerlTQt/t/d_sigslot.t
new file mode 100644
index 0000000..acd3c4a
--- /dev/null
+++ b/PerlTQt/t/d_sigslot.t
@@ -0,0 +1,49 @@
+BEGIN { print "1..3\n" }
+
+package MyApp;
+use TQt;
+use TQt::isa qw(TQt::Application);
+use TQt::slots
+ foo => ['int'],
+ baz => [];
+use TQt::signals
+ bar => ['int'];
+
+sub NEW {
+ shift->SUPER::NEW(@_);
+
+ # 1) testing correct subclassing of TQt::Application and this pointer
+ print +(ref(this) eq " MyApp")? "ok 1\n" : "not ok\n";
+
+ this->connect(this, TQT_SIGNAL 'bar(int)', TQT_SLOT 'foo(int)');
+
+ # 3) automatic quitting will test TQt sig to custom slot
+ this->connect(this, TQT_SIGNAL 'aboutToQuit()', TQT_SLOT 'baz()');
+
+ # 2) testing custom sig to custom slot
+ emit bar(3);
+}
+
+sub foo
+{
+ print +($_[0] == 3) ? "ok 2\n" : "not ok\n";
+}
+
+sub baz
+{
+ print "ok 3\n";
+}
+
+1;
+
+package main;
+
+use TQt;
+use MyApp;
+
+$a = 0;
+$a = MyApp(\@ARGV);
+
+TQt::Timer::singleShot( 300, TQt::app(), TQT_SLOT "quit()" );
+
+exit TQt::app()->exec;