Debian Codegraph @

t/rotext.t

raw
1 #!/usr/bin/perl -w
2 # -*- perl -*-
3
4 #
5 # $Id: $
6 # Author: Slaven Rezic
7 #
8
9 use strict;
10
11 use Tk;
12
13 BEGIN {
14 if (!eval q{
15 use Test::More;
16 1;
17 }) {
18 print "1..0 # skip: no Test::More module\n";
19 exit;
20 }
21 }
22
23 plan tests => 8;
24
25 use_ok("Tk::ROText");
26
27 my $mw = tkinit;
28
29 {
30 my $ro = $mw->ROText;
31 isa_ok($ro, "Tk::ROText");
32 isa_ok($ro, "Tk::Text");
33 $ro->destroy;
34 }
35
36 {
37 my $ro = $mw->ROText;
38 my $txt = $mw->Text;
39 is($ro->cget(-background), $txt->cget(-background), "Text and ROText have same background color");
40 is($ro->cget(-foreground), $txt->cget(-foreground), "Text and ROText have same foreground color");
41 }
42
43 {
44 my $ro = $mw->ROText(-background => "red", -foreground => "green");
45 is($ro->cget(-background), "red", "Setting -background worked");
46 is($ro->cget(-foreground), "green", "Setting -foreground worked");
47 }
48
49 $mw->optionAdd("*background", "yellow");
50
51 {
52 my $ro = $mw->ROText;
53 is($ro->cget(-background), "yellow", "Setting -background via optionDB worked");
54 }
55
56 __END__