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.
73 lines
1.2 KiB
73 lines
1.2 KiB
13 years ago
|
BEGIN { print "1..6\n" }
|
||
|
|
||
|
package MyApp;
|
||
13 years ago
|
use TQt;
|
||
|
use TQt::isa('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
|
this->connect(this, TQT_SIGNAL 'bar(int)', TQT_SLOT 'foo(int)');
|
||
|
this->connect(this, TQT_SIGNAL 'aboutToQuit()', TQT_SLOT 'baz()');
|
||
13 years ago
|
}
|
||
|
|
||
|
sub foo
|
||
|
{
|
||
|
# 1) testing correct inheritance of sig/slots
|
||
|
print +($_[0] == 3) ? "ok 1\n" : "not ok\n";
|
||
|
}
|
||
|
|
||
|
sub baz
|
||
|
{
|
||
|
print "ok 3\n";
|
||
|
}
|
||
|
|
||
|
sub coincoin
|
||
|
{
|
||
|
print +(@_ == 2) ? "ok 5\n":"not ok\n";
|
||
|
print +(ref(this) eq " MySubApp") ? "ok 6\n":"not ok\n";
|
||
|
}
|
||
|
|
||
|
1;
|
||
|
|
||
|
package MySubApp;
|
||
13 years ago
|
use TQt;
|
||
|
use TQt::isa('MyApp');
|
||
13 years ago
|
|
||
|
|
||
|
sub NEW
|
||
|
{
|
||
|
shift->SUPER::NEW(@_);
|
||
|
emit foo(3);
|
||
|
}
|
||
|
|
||
|
sub baz
|
||
|
{
|
||
|
# 2) testing further inheritance of sig/slots
|
||
|
print "ok 2\n";
|
||
|
# 3) testing Perl to Perl SUPER
|
||
|
SUPER->baz();
|
||
|
# 4) 5) 6) testing non-qualified enum calls vs. Perl method/static calls
|
||
|
eval { &blue }; print !$@ ? "ok 4\n":"not ok\n";
|
||
|
coincoin("a","b");
|
||
|
}
|
||
|
|
||
|
1;
|
||
|
|
||
|
package main;
|
||
|
|
||
13 years ago
|
use TQt;
|
||
13 years ago
|
use MySubApp;
|
||
|
|
||
|
$a = 0;
|
||
|
$a = MySubApp(\@ARGV);
|
||
|
|
||
13 years ago
|
TQt::Timer::singleShot( 300, TQt::app(), TQT_SLOT "quit()" );
|
||
13 years ago
|
|
||
13 years ago
|
exit TQt::app()->exec;
|