~ubuntu-branches/ubuntu/lucid/perl-tk/lucid

« back to all changes in this revision

Viewing changes to t/button.t

  • Committer: Bazaar Package Importer
  • Author(s): Colin Tuckley
  • Date: 2008-02-15 13:56:59 UTC
  • mfrom: (1.1.3 upstream) (4.1.1 hardy)
  • Revision ID: james.westby@ubuntu.com-20080215135659-ru2oqlykuju20fav
Tags: 1:804.028-1
* New Upstream Release (Closes: #463080).
* Update to Debhelper v5.
* Build with XFT=1 (Closes: #411129).

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
    }
16
16
}
17
17
 
18
 
BEGIN { plan tests => 3 }
 
18
BEGIN { plan tests => 5 }
19
19
 
20
20
my $mw = MainWindow->new;
21
21
$mw->geometry("+10+10");
22
22
 
23
23
{
24
24
    my $cb = $mw->Checkbutton->pack;
25
 
    is(ref $cb, "Tk::Checkbutton");
26
 
    is($cb->{Value}, undef);
 
25
    is(ref $cb, "Tk::Checkbutton", "It's a checkbutton");
 
26
    is($cb->{Value}, undef, "No value at beginning");
27
27
    $cb->select;
28
 
    is($cb->{Value}, 1);
 
28
    is($cb->{Value}, 1, "... but now");
 
29
}
 
30
 
 
31
{
 
32
    # new Button options
 
33
    my $f = $mw->Frame->pack(-fill => 'x');
 
34
    my $incr = 0;
 
35
    $f->Button(-text => "Repeat & ridge",
 
36
               -image => $mw->Photo(-file => Tk->findINC("Xcamel.gif")),
 
37
               -compound => 'left',
 
38
               -overrelief => 'ridge',
 
39
               -repeatdelay => 200,
 
40
               -repeatinterval => 100,
 
41
               -command => sub { $incr++ },
 
42
              )->pack(-side => 'left');
 
43
    $f->Label(-text => "increments:")->pack(-side => 'left');
 
44
    $f->Label(-textvariable => \$incr)->pack(-side => 'left');
 
45
    pass("Button with new options");
 
46
}
 
47
 
 
48
{
 
49
    # Label and -state
 
50
    my $f = $mw->Frame->pack(-fill => 'x');
 
51
    $f->Label(-state => "normal", -text => "normal: red on white",
 
52
              -background => 'white', -foreground => 'red')->pack(-fill => 'x');
 
53
    $f->Label(-state => "active", -text => "active: green on white",
 
54
              -activebackground => 'white', -activeforeground => 'green')->pack(-fill => 'x');
 
55
    $f->Label(-state => "disabled", -text => "disabled: blue on white",
 
56
              -background => 'white', -disabledforeground => 'blue')->pack(-fill => 'x');
 
57
    pass("Label with states");
 
58
}
 
59
 
 
60
if ($ENV{PERL_INTERACTIVE_TEST}) {
 
61
    MainLoop;
29
62
}
30
63
 
31
64
__END__