| 1 |
#!/usr/bin/perl -w |
| 2 |
# -*- perl -*- |
| 3 |
|
| 4 |
use strict; |
| 5 |
|
| 6 |
use Tk; |
| 7 |
|
| 8 |
BEGIN { |
| 9 |
if (!eval q{ |
| 10 |
use Test::More; |
| 11 |
1; |
| 12 |
}) { |
| 13 |
print "1..0 # skip: no Test::More module\n"; |
| 14 |
exit; |
| 15 |
} |
| 16 |
} |
| 17 |
|
| 18 |
plan tests => 8; |
| 19 |
|
| 20 |
use_ok("Tk::ColorEditor"); |
| 21 |
|
| 22 |
my $mw = tkinit; |
| 23 |
$mw->geometry("+10+10"); |
| 24 |
|
| 25 |
for (1..2) { |
| 26 |
my $c = $mw->ColorSelect->pack; |
| 27 |
isa_ok($c, "Tk::ColorSelect"); |
| 28 |
my $lb = $c->Subwidget("Names"); |
| 29 |
SKIP: { |
| 30 |
if (!$lb) { |
| 31 |
my @rgbTxtPath = $c->_rgbTxtPath; |
| 32 |
my $found = grep { -e $_ } @rgbTxtPath; |
| 33 |
# This is expexted on MSWin32 systems, and even not all |
| 34 |
# X11 systems install rgb.txt (seen on FreeBSD, where the |
| 35 |
# file is part of the x11/rgb package, which is not |
| 36 |
# mandatory for xorg) |
| 37 |
skip("No rgb.txt found on this system", 2) |
| 38 |
if !$found; |
| 39 |
} |
| 40 |
|
| 41 |
isa_ok($lb, "Tk::Listbox"); |
| 42 |
# This used to fail until Tk804.027_501: |
| 43 |
cmp_ok(scalar @{ $lb->get(0,"end") }, ">=", 10, "Some colors found in listbox"); |
| 44 |
} |
| 45 |
$c->destroy; |
| 46 |
} |
| 47 |
|
| 48 |
$mw->after(500, sub { $mw->destroy }); |
| 49 |
$mw->chooseColor; |
| 50 |
pass("chooseColor destroyed"); |
| 51 |
|
| 52 |
|
| 53 |
__END__ |