File: 04_threads.t

package info (click to toggle)
libwx-perl 1%3A0.9909-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,912 kB
  • sloc: cpp: 9,728; perl: 8,182; ansic: 626; makefile: 41
file content (53 lines) | stat: -rwxr-xr-x 1,473 bytes parent folder | download | duplicates (7)
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
#!/usr/bin/perl -w

use strict;
use Config;
use if !$Config{useithreads} => 'Test::More' => skip_all => 'no threads';
use threads;

use Wx qw(:everything);
use if !Wx::wxTHREADS, 'Test::More' => skip_all => 'No thread support';
use Test::More tests => 4;
use Wx::DND;

my $app = Wx::App->new( sub { 1 } );
my $datafrmt = Wx::DataFormat->newUser( 'MyFormat' );
my $datafrmt2 = Wx::DataFormat->newUser( 'MyFormat' );
my $dosimple = Wx::DataObjectSimple->new( $datafrmt );
my $dosimple2 = Wx::DataObjectSimple->new( $datafrmt );
my $docomposite = Wx::DataObjectComposite->new;
my $docomposite2 = Wx::DataObjectComposite->new;
my $dotext = Wx::TextDataObject->new( 'Foo' );
my $dotext2 = Wx::TextDataObject->new( 'Foo' );
my $dobitmap = Wx::BitmapDataObject->new;
my $dobitmap2 = Wx::BitmapDataObject->new;
my $domy = MyDataObject->new( $datafrmt );
my $domy2 = MyDataObject->new( $datafrmt );
my $domy3 = MyDataObject->new( $datafrmt );
my $dropt = Wx::wxMOTIF ? undef : Wx::DropTarget->new;
my $dropt2 = Wx::wxMOTIF ? undef : Wx::DropTarget->new;

$docomposite->Add( $dotext );
$docomposite->Add( $domy3 );

undef $datafrmt2;
undef $dosimple2;
undef $domy2;
# undef $domy3; # causes a 'scalar leaked'
undef $dropt2;
undef $dobitmap2;
undef $docomposite2;

my $t = threads->create
  ( sub {
        ok( 1, 'In thread' );
    } );
ok( 1, 'Before join' );
$t->join;
ok( 1, 'After join' );

END { ok( 1, 'At END' ) };

package MyDataObject;

use base qw(Wx::PlDataObjectSimple);