You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
893 B
50 lines
893 B
13 years ago
|
BEGIN { print "1..3\n" }
|
||
|
|
||
|
package MyApp;
|
||
13 years ago
|
use TQt;
|
||
|
use TQt::isa qw(TQt::Application);
|
||
|
use TQt::slots
|
||
13 years ago
|
foo => ['int'],
|
||
|
baz => [];
|
||
13 years ago
|
use TQt::signals
|
||
13 years ago
|
bar => ['int'];
|
||
|
|
||
|
sub NEW {
|
||
|
shift->SUPER::NEW(@_);
|
||
|
|
||
13 years ago
|
# 1) testing correct subclassing of TQt::Application and this pointer
|
||
13 years ago
|
print +(ref(this) eq " MyApp")? "ok 1\n" : "not ok\n";
|
||
|
|
||
13 years ago
|
this->connect(this, TQT_SIGNAL 'bar(int)', TQT_SLOT 'foo(int)');
|
||
13 years ago
|
|
||
13 years ago
|
# 3) automatic quitting will test TQt sig to custom slot
|
||
|
this->connect(this, TQT_SIGNAL 'aboutToQuit()', TQT_SLOT 'baz()');
|
||
13 years ago
|
|
||
|
# 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;
|
||
|
|
||
13 years ago
|
use TQt;
|
||
13 years ago
|
use MyApp;
|
||
|
|
||
|
$a = 0;
|
||
|
$a = MyApp(\@ARGV);
|
||
|
|
||
13 years ago
|
TQt::Timer::singleShot( 300, TQt::app(), TQT_SLOT "quit()" );
|
||
13 years ago
|
|
||
13 years ago
|
exit TQt::app()->exec;
|