File: 2numentry.t

package info (click to toggle)
libtk-gbarr-perl 2.08-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 284 kB
  • sloc: perl: 1,875; makefile: 19
file content (48 lines) | stat: -rwxr-xr-x 988 bytes parent folder | download | duplicates (4)
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
44
45
46
47
48
use strict;
use vars '$loaded';

my $top;
BEGIN {
    if (!eval {
	require Tk;
	$top = MainWindow->new;
    }) {
	print "1..0 # skip cannot open DISPLAY\n";
	CORE::exit;
    }
}

BEGIN { $^W= 1; $| = 1; print "1..7\n"; }
END {print "not ok 1\n" unless $loaded;}
use Tk::NumEntry;
$loaded = 1;
my $ok = 1;
print "ok " . $ok++ . "\n";

my $ne;
eval {
    $ne = $top->NumEntry->pack;
};
if ($@) { print "not " } print "ok " . $ok++ . "\n";

eval {
    $top->NumEntry(-orient => "horizontal")->pack;
};
if ($@) { print "not " } print "ok " . $ok++ . "\n";

$ne->configure(-value => 1);
if ($ne->cget(-value) != 1) { print "not " } print "ok " . $ok++ . "\n";

$ne->incdec(1);
if ($ne->cget(-value) != 2) { print "not " } print "ok " . $ok++ . "\n";

$ne->incdec(-1);
if ($ne->cget(-value) != 1) { print "not " } print "ok " . $ok++ . "\n";

{
    my $ne2 = $top->NumEntry(-readonly => 1);
    if (!$ne2->isa("Tk::NumEntry")) { print "not " }
    print "ok " . $ok++ . "\n";
}

#Tk::MainLoop;