~ubuntu-branches/ubuntu/saucy/padre/saucy-proposed

« back to all changes in this revision

Viewing changes to xt/threads.t

  • Committer: Package Import Robot
  • Author(s): Dominique Dumont, gregor herrmann, Dominique Dumont
  • Date: 2012-01-04 12:04:20 UTC
  • mfrom: (1.3.3)
  • Revision ID: package-import@ubuntu.com-20120104120420-i5oybqwf91m1d3il
Tags: 0.92.ds1-1
[ gregor herrmann ]
* Remove debian/source/local-options; abort-on-upstream-changes
  and unapply-patches are default in dpkg-source since 1.16.1.
* Swap order of alternative (build) dependencies after the perl
  5.14 transition.

[ Dominique Dumont ]
* Imported Upstream version 0.92.ds1
* removed fix-spelling patch (applied upstream)
* lintian-override: use wildcard to avoid listing a gazillion files
* updated size of some 'not-real-man-page' entries
* rules: remove dekstop cruft (replaced by a file provided in debian
  directory)
* control: removed Breaks statement. Add /me to uploaders. Updated
  dependencies
* rules: make sure that non-DFSG file (i.e. the cute butterfly, sigh)
  is not distributed

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl
2
 
 
3
 
# Create the task manager
4
 
 
5
 
use strict;
6
 
use warnings;
7
 
use Test::More;
8
 
use Time::HiRes ();
9
 
 
10
 
 
11
 
######################################################################
12
 
# This test requires a DISPLAY to run
13
 
BEGIN {
14
 
        unless ( $ENV{DISPLAY} or $^O eq 'MSWin32' ) {
15
 
                plan skip_all => 'Needs DISPLAY';
16
 
                exit 0;
17
 
        }
18
 
 
19
 
        plan tests => 16;
20
 
}
21
 
 
22
 
use Padre::Logger;
23
 
use Padre::TaskManager        ();
24
 
use Padre::Task::Addition     ();
25
 
use Padre::Wx::App            ();
26
 
use t::lib::Padre::NullWindow ();
27
 
 
28
 
use_ok('Test::NoWarnings');
29
 
 
30
 
# Do we start with no threads as expected
31
 
is( scalar( threads->list ), 0, 'No threads' );
32
 
 
33
 
 
34
 
 
35
 
 
36
 
 
37
 
######################################################################
38
 
# Basic Creation
39
 
 
40
 
SCOPE: {
41
 
        my $wxapp = Padre::Wx::App->new;
42
 
        isa_ok( $wxapp, 'Padre::Wx::App' );
43
 
 
44
 
        my $window = t::lib::Padre::NullWindow->new;
45
 
        isa_ok( $window, 't::lib::Padre::NullWindow' );
46
 
 
47
 
        my $manager = Padre::TaskManager->new( conduit => $window );
48
 
        isa_ok( $manager, 'Padre::TaskManager' );
49
 
        is( scalar( threads->list ), 0, 'No threads' );
50
 
 
51
 
        # Run the startup process
52
 
        ok( $manager->start, '->start ok' );
53
 
        Time::HiRes::sleep(1);
54
 
        is( scalar( threads->list ), 1, 'The master threads exists' );
55
 
 
56
 
        # Create the sample task
57
 
        my $addition = Padre::Task::Addition->new(
58
 
                x => 2,
59
 
                y => 3,
60
 
        );
61
 
        isa_ok( $addition, 'Padre::Task::Addition' );
62
 
 
63
 
        # Schedule the task (which should trigger it's execution)
64
 
        ok( $manager->schedule($addition), '->schedule ok' );
65
 
 
66
 
        # Only the prepare phase should run (for now)
67
 
        is( $addition->{prepare}, 1, '->{prepare} is false' );
68
 
        is( $addition->{run},     0, '->{run}     is false' );
69
 
        is( $addition->{finish},  0, '->{finish}  is false' );
70
 
 
71
 
        # Run the shutdown process
72
 
        ok( $manager->stop, '->stop ok' );
73
 
        Time::HiRes::sleep(5);
74
 
        is( scalar( threads->list ), 0, 'No threads' );
75
 
}