diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-12-18 03:08:08 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-12-18 03:08:08 -0600 |
commit | bcc95cd92ca12c1783464b8ada6816d430dc0e98 (patch) | |
tree | 4701c447365db5392df0174b4bb00b5b5c369da4 /PerlQt/t/d_sigslot.t | |
download | libtqt-perl-bcc95cd92ca12c1783464b8ada6816d430dc0e98.tar.gz libtqt-perl-bcc95cd92ca12c1783464b8ada6816d430dc0e98.zip |
Initial import of libqt-perl (not yet TQt compatible)
Diffstat (limited to 'PerlQt/t/d_sigslot.t')
-rw-r--r-- | PerlQt/t/d_sigslot.t | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/PerlQt/t/d_sigslot.t b/PerlQt/t/d_sigslot.t new file mode 100644 index 0000000..1b455e1 --- /dev/null +++ b/PerlQt/t/d_sigslot.t @@ -0,0 +1,49 @@ +BEGIN { print "1..3\n" } + +package MyApp; +use Qt; +use Qt::isa qw(Qt::Application); +use Qt::slots + foo => ['int'], + baz => []; +use Qt::signals + bar => ['int']; + +sub NEW { + shift->SUPER::NEW(@_); + + # 1) testing correct subclassing of Qt::Application and this pointer + print +(ref(this) eq " MyApp")? "ok 1\n" : "not ok\n"; + + this->connect(this, SIGNAL 'bar(int)', SLOT 'foo(int)'); + + # 3) automatic quitting will test Qt sig to custom slot + this->connect(this, SIGNAL 'aboutToQuit()', 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 Qt; +use MyApp; + +$a = 0; +$a = MyApp(\@ARGV); + +Qt::Timer::singleShot( 300, Qt::app(), SLOT "quit()" ); + +exit Qt::app()->exec; |