18
print "1..0 # skip: no Test::More module\n";
25
plan tests => $all_tests;
28
skip('Set $ENV{TEST_AUTHOR} to a true value to run.', $all_tests)
29
unless $ENV{TEST_AUTHOR};
32
$mw->geometry("+10+10");
33
my $l = $mw->Label(-text => "The Tk.xs test")->pack;
36
my $winid = $mw->PointToWindow(1,1);
37
ok(defined $winid, "PointToWindow: got window id <$winid>");
44
ok(Tk::BLACK, "Colors: Black");
45
ok(Tk::WHITE, "White");
46
ok(Tk::NORMAL_BG, "Normal bg");
47
ok(Tk::ACTIVE_BG, "Active bg");
48
ok(Tk::SELECT_BG, "Select bg");
49
ok(Tk::SELECT_FG, "Select fg");
50
ok(Tk::TROUGH, "Trough");
51
ok(Tk::INDICATOR, "Indicator");
52
ok(Tk::DISABLED, "Disabled");
56
is($mw->Count, 1, "Exactly one main window");
58
pass("Called pTk_Synchronize");
62
my $time_before = time;
63
my $timeofday = Tk::timeofday;
64
my $time_after = time;
65
cmp_ok($time_before-1, "<=", $timeofday, "Time of day");
66
cmp_ok($time_after+1, ">=", $timeofday);
70
my($x1,$y1) = $mw->GetPointerCoords;
71
my($x2,$y2) = $mw->pointerxy;
72
is($x1, $x2, "GetPointerCoords and pointerxy should get the same");
77
ok($mw->IsTopLevel, "IsTopLevel positive");
78
ok(!$l->IsTopLevel, "IsTopLevel negative");
79
ok($mw->IsWidget, "IsWidget positive on toplevel");
80
ok($l->IsWidget, "IsWidget positive on label");
81
my $l2 = $mw->Label; $l2->destroy;
82
ok(!$l2->IsWidget, "IsWidget negative (destroyed label)");
86
ok(!$mw->IsMapped, "Toplevel not yet mapped");
89
# From now on we have a mapped window
93
ok($mw->IsMapped, "Toplevel is now mapped");
97
my($x1,$y1) = $mw->WindowXY;
98
my($x2,$y2) = ($mw->rootx, $mw->rooty);
99
my($x3,$y3) = $mw->GetRootCoords;
101
is($x1,$x2, "WindowXY gets the same as rootx/rooty");
103
is("$x1/$y1", "$x3/$y3", "GetRootCoords also the same");
107
my $MYBITMAP = __PACKAGE__ . "::mybitmap";
108
my $hbits = pack("b8"x5,
114
$mw->DefineBitmap($MYBITMAP => 8,5, $hbits);
115
$mw->Label(-bitmap => $MYBITMAP)->pack;
116
pass("Using bitmap defined with DefineBitmap");
118
my $pixmapid = $mw->GetBitmap($MYBITMAP);
119
ok(defined $pixmapid, "GetBitmap returned <$pixmapid>");
120
my $invalid = $mw->GetBitmap("this_really_does_not_exist");
121
ok(!defined $invalid, "Invalid GetBitmap");
126
pass("Called XSync(0)");
128
pass("Called XSync(1)");
132
$mw->MoveWindow(11,11);
133
my($x1,$y1) = $mw->GetRootCoords;
134
is("$x1/$y1", "11/11", "MoveWindow on toplevel");
136
$mw->MoveToplevelWindow(12,12);
137
# no change in GetRootCoords here, is this intended?
138
pass("Called MoveToplevelWindow");
140
$mw->MoveResizeWindow(13,13,200,50);
141
pass("Called MoveResizeWindow");
143
$mw->ResizeWindow(100,50);
144
pass("Called ResizeWindow");
148
my $font = $l->cget(-font);
150
$font->PostscriptFontName($psname);
151
ok($psname, "Found postscript font name <$psname>");
155
local $TODO = "GetFocusWin does not seem to return anything";
156
isa_ok($mw->GetFocusWin, "Tk::Widget", "GetFocusWin returns a widget");
159
# missing: UnmanageGeometry, DisableButtonEvents, MakeAtom,
160
# SendClientMessage, GetVRootGeometry, Colormap, Display, ScreenNumber etc.