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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
|
# This file is a Tcl script to test out the procedures in tkCanvWind.c,
# which implement canvas "window" items. It is organized in the standard
# fashion for Tcl tests.
#
# Copyright (c) 1997 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
# RCS: @(#) $Id: canvWind.test,v 1.3 1999/04/16 01:51:35 stanton Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
source [file join [pwd] [file dirname [info script]] defs.tcl]
}
foreach i [winfo children .] {
destroy $i
}
wm geometry . {}
raise .
test canvWind-1.1 {DisplayWinItem, windows off-screen vertically} {
catch {destroy .t}
toplevel .t
canvas .t.c -scrollregion {0 0 1000 800} -width 250 -height 200 -bd 2 \
-relief sunken -xscrollincrement 1 -yscrollincrement 1 \
-highlightthickness 1
pack .t.c -fill both -expand 1 -padx 20 -pady 20
wm geometry .t +0+0
set f .t.f
frame $f -width 80 -height 50 -bg red
.t.c create window 300 400 -window $f -anchor nw
.t.c xview moveto .3
.t.c yview moveto .50
update
set x [list [list [winfo ismapped $f] [winfo y $f]]]
.t.c yview scroll 52 units
update
lappend x [list [winfo ismapped $f] [winfo y $f]]
.t.c yview scroll 1 units
update
lappend x [list [winfo ismapped $f] [winfo y $f]]
.t.c yview scroll -255 units
update
lappend x [list [winfo ismapped $f] [winfo y $f]]
.t.c yview scroll -1 units
update
lappend x [list [winfo ismapped $f] [winfo y $f]]
} {{1 23} {1 -29} {0 -29} {1 225} {0 225}}
test canvWind-1.2 {DisplayWinItem, windows off-screen vertically} {
catch {destroy .t}
toplevel .t
canvas .t.c -scrollregion {0 0 1000 800} -width 250 -height 200 -bd 2 \
-relief sunken -xscrollincrement 1 -yscrollincrement 1 \
-highlightthickness 1
pack .t.c -fill both -expand 1 -padx 20 -pady 20
wm geometry .t +0+0
set f .t.c.f
frame $f -width 80 -height 50 -bg red
.t.c create window 300 400 -window $f -anchor nw
.t.c xview moveto .3
.t.c yview moveto .50
update
set x [list [list [winfo ismapped $f] [winfo y $f]]]
.t.c yview scroll 52 units
update
lappend x [list [winfo ismapped $f] [winfo y $f]]
.t.c yview scroll 1 units
update
lappend x [list [winfo ismapped $f] [winfo y $f]]
.t.c yview scroll -255 units
update
lappend x [list [winfo ismapped $f] [winfo y $f]]
.t.c yview scroll -1 units
update
lappend x [list [winfo ismapped $f] [winfo y $f]]
} {{1 3} {1 -49} {0 -49} {1 205} {0 205}}
test canvWind-1.3 {DisplayWinItem, windows off-screen horizontally} {
catch {destroy .t}
toplevel .t
canvas .t.c -scrollregion {0 0 1000 800} -width 250 -height 200 -bd 2 \
-relief sunken -xscrollincrement 1 -yscrollincrement 1 \
-highlightthickness 1
pack .t.c -fill both -expand 1 -padx 20 -pady 20
wm geometry .t +0+0
set f .t.f
frame $f -width 80 -height 50 -bg red
.t.c create window 300 400 -window $f -anchor nw
.t.c xview moveto .3
.t.c yview moveto .50
update
set x [list [list [winfo ismapped $f] [winfo x $f]]]
.t.c xview scroll 82 units
update
lappend x [list [winfo ismapped $f] [winfo x $f]]
.t.c xview scroll 1 units
update
lappend x [list [winfo ismapped $f] [winfo x $f]]
.t.c xview scroll -335 units
update
lappend x [list [winfo ismapped $f] [winfo x $f]]
.t.c xview scroll -1 units
update
lappend x [list [winfo ismapped $f] [winfo x $f]]
} {{1 23} {1 -59} {0 -59} {1 275} {0 275}}
test canvWind-1.4 {DisplayWinItem, windows off-screen horizontally} {
catch {destroy .t}
toplevel .t
canvas .t.c -scrollregion {0 0 1000 800} -width 250 -height 200 -bd 2 \
-relief sunken -xscrollincrement 1 -yscrollincrement 1 \
-highlightthickness 1
pack .t.c -fill both -expand 1 -padx 20 -pady 20
wm geometry .t +0+0
set f .t.c.f
frame $f -width 80 -height 50 -bg red
.t.c create window 300 400 -window $f -anchor nw
.t.c xview moveto .3
.t.c yview moveto .50
update
set x [list [list [winfo ismapped $f] [winfo x $f]]]
.t.c xview scroll 82 units
update
lappend x [list [winfo ismapped $f] [winfo x $f]]
.t.c xview scroll 1 units
update
lappend x [list [winfo ismapped $f] [winfo x $f]]
.t.c xview scroll -335 units
update
lappend x [list [winfo ismapped $f] [winfo x $f]]
.t.c xview scroll -1 units
update
lappend x [list [winfo ismapped $f] [winfo x $f]]
} {{1 3} {1 -79} {0 -79} {1 255} {0 255}}
catch {destroy .t}
# cleanup
::tcltest::cleanupTests
return
|