File: e_sigslot_inherit.t

package info (click to toggle)
qt4-perl 4.5~~svn1145508-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 5,144 kB
  • ctags: 5,947
  • sloc: perl: 29,224; cpp: 18,849; xml: 98; makefile: 91; sh: 4
file content (77 lines) | stat: -rw-r--r-- 1,253 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package MyApp;

use Test::More;

use QtCore4;
use QtGui4;
use QtCore4::isa('Qt::Application');
use QtCore4::slots
        foo => ['int'],
        baz => [];
use QtCore4::signals
        bar => ['int'];

sub NEW {
     shift->SUPER::NEW(@_);
     this->connect(this, SIGNAL 'bar(int)', SLOT 'foo(int)');
     this->connect(this, SIGNAL 'aboutToQuit()', SLOT 'baz()');
}

sub foo {
    # 1) testing correct inheritance of sig/slots
    is($_[0], 3, 'Correct inheritance of sig/slots');
}

sub baz {
    ok( 1 );
}     

sub coincoin {
    is( scalar @_, 2);
    is( ref(this), ' MySubApp');
}

1;

package MySubApp;

use Test::More;

use QtCore4;
use QtGui4;
use QtCore4::isa('MyApp');

sub NEW 
{
    shift->SUPER::NEW(@_);
    emit foo(3);
}

sub baz
{
   # 2) testing further inheritance of sig/slots
   ok( 1, 'Further inheritance of sig/slots' );
   # 3) testing Perl to Perl SUPER
   this->SUPER::baz();
   # 4) 5) 6) testing non-qualified enum calls vs. Perl method/static calls
   ok( eval { Qt::blue } );
   ok( !$@ ) or diag( $@ );
   coincoin('a','b');
}

1;

package main;

use Test::More tests => 7;

use QtCore4;
use QtGui4;
use MySubApp;

$a = 0;
$a = MySubApp(\@ARGV);

Qt::Timer::singleShot( 300, qApp, SLOT "quit()" );

exit qApp->exec;