File: 19_overlay.t

package info (click to toggle)
libwx-perl 0.9702-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 3,240 kB
  • ctags: 1,812
  • sloc: cpp: 8,988; perl: 6,366; makefile: 38; ansic: 1
file content (43 lines) | stat: -rw-r--r-- 1,047 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
#!/usr/bin/perl -w

use strict;
use Wx;
use lib './t';
use Tests_Helper qw(in_frame);
use if !defined(&Wx::Overlay::new) => 'Test::More' => skip_all => 'no Overlay';
use Test::More 'tests' => 1;

# test will crash if creation / destruction does not happen as
# we expect

sub run_overlay_tests {
    my $self = shift;
    # Wx::Overlay real usage test
    $self->{wx_overlay} = Wx::Overlay->new;
    run_mouse_captured_drawing($self);
    run_mouse_captured_drawing($self);
    run_mouse_release($self);
    ok(1, 'Test completed');
}

sub run_mouse_captured_drawing {
    my $self = shift;
    my $dc = Wx::ClientDC->new( $self );
    my $olay = Wx::DCOverlay->new($self->{wx_overlay}, $dc);
    $dc->DrawLine(1,1,10,10);
}


sub run_mouse_release {
    my $self = shift;
    {
        # dc scope MUST be narrower than Reset call to overlay
        my $dc = Wx::ClientDC->new( $self );
        my $olay = Wx::DCOverlay->new($self->{wx_overlay}, $dc);
        $olay->Clear;
    }
    $self->{wx_overlay}->Reset;
}

in_frame(\&run_overlay_tests);