1
# This file is a Tcl script to test the Windows specific behavior of
2
# labels, buttons, checkbuttons, and radiobuttons in Tk (i.e., all the
3
# widgets defined in tkWinButton.c). It is organized in the standard
4
# fashion for Tcl tests.
6
# Copyright (c) 1994 The Regents of the University of California.
7
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
9
# See the file "license.terms" for information on usage and redistribution
10
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12
# RCS: @(#) $Id: winButton.test,v 1.3 1998/09/14 18:23:53 stanton Exp $
14
if {$tcl_platform(platform)!="windows"} {
18
if {[lsearch [image types] test] < 0} {
19
puts "This application hasn't been compiled with the \"test\""
20
puts "image, so I can't run this test. Are you sure you're using"
21
puts "tktest instead of wish?"
25
if {[info procs test] != "test"} {
29
foreach i [winfo children .] {
35
proc bogusTrace args {
41
eval image delete [image names]
42
image create test image1
44
button .b -text Button
45
checkbutton .c -text Checkbutton
46
radiobutton .r -text Radiobutton
50
test winbutton-1.1 {TkpComputeButtonGeometry procedure} {
51
eval destroy [winfo children .]
52
image create test image1
53
image1 changed 0 0 0 0 60 40
54
label .b1 -image image1 -bd 4 -padx 0 -pady 2
55
button .b2 -image image1 -bd 4 -padx 0 -pady 2
56
checkbutton .b3 -image image1 -bd 4 -padx 1 -pady 1
57
radiobutton .b4 -image image1 -bd 4 -padx 2 -pady 0
60
list [winfo reqwidth .b1] [winfo reqheight .b1] \
61
[winfo reqwidth .b2] [winfo reqheight .b2] \
62
[winfo reqwidth .b3] [winfo reqheight .b3] \
63
[winfo reqwidth .b4] [winfo reqheight .b4]
64
} {68 48 71 51 96 50 96 50}
65
test winbutton-1.2 {TkpComputeButtonGeometry procedure} {
66
eval destroy [winfo children .]
67
label .b1 -bitmap question -bd 3 -padx 0 -pady 2
68
button .b2 -bitmap question -bd 3 -padx 0 -pady 2
69
checkbutton .b3 -bitmap question -bd 3 -padx 1 -pady 1
70
radiobutton .b4 -bitmap question -bd 3 -padx 2 -pady 0
73
list [winfo reqwidth .b1] [winfo reqheight .b1] \
74
[winfo reqwidth .b2] [winfo reqheight .b2] \
75
[winfo reqwidth .b3] [winfo reqheight .b3] \
76
[winfo reqwidth .b4] [winfo reqheight .b4]
77
} {23 33 26 36 51 35 51 35}
78
test winbutton-1.3 {TkpComputeButtonGeometry procedure} {
79
eval destroy [winfo children .]
80
label .b1 -bitmap question -bd 3 -highlightthickness 4
81
button .b2 -bitmap question -bd 3 -highlightthickness 0
82
checkbutton .b3 -bitmap question -bd 3 -highlightthickness 1 \
84
radiobutton .b4 -bitmap question -bd 3 -indicatoron false
87
list [winfo reqwidth .b1] [winfo reqheight .b1] \
88
[winfo reqwidth .b2] [winfo reqheight .b2] \
89
[winfo reqwidth .b3] [winfo reqheight .b3] \
90
[winfo reqwidth .b4] [winfo reqheight .b4]
91
} {31 41 24 34 26 36 26 36}
92
test winbutton-1.4 {TkpComputeButtonGeometry procedure} {nonPortable} {
93
eval destroy [winfo children .]
94
label .b1 -text Xagqpim -bd 2 -padx 0 -pady 2 -font {{MS Sans Serif} 8}
95
button .b2 -text Xagqpim -bd 2 -padx 0 -pady 2 -font {{MS Sans Serif} 8}
96
checkbutton .b3 -text Xagqpim -bd 2 -padx 1 -pady 1 -font {{MS Sans Serif} 8}
97
radiobutton .b4 -text Xagqpim -bd 2 -padx 2 -pady 0 -font {{MS Sans Serif} 8}
100
list [winfo reqwidth .b1] [winfo reqheight .b1] \
101
[winfo reqwidth .b2] [winfo reqheight .b2] \
102
[winfo reqwidth .b3] [winfo reqheight .b3] \
103
[winfo reqwidth .b4] [winfo reqheight .b4]
104
} {58 24 67 33 88 30 90 28}
105
test winbutton-1.5 {TkpComputeButtonGeometry procedure} {nonPortable} {
106
eval destroy [winfo children .]
107
label .l1 -text "This is a long string that will wrap around on several lines.\n\nIt also has a blank line (above)." -wraplength 1.5i -padx 0 -pady 0
110
list [winfo reqwidth .l1] [winfo reqheight .l1]
112
test winbutton-1.6 {TkpComputeButtonGeometry procedure} {nonPortable} {
113
eval destroy [winfo children .]
114
label .l1 -text "This is a long string without wrapping.\n\nIt also has a blank line (above)." -padx 0 -pady 0
117
list [winfo reqwidth .l1] [winfo reqheight .l1]
119
test winbutton-1.7 {TkpComputeButtonGeometry procedure} {nonPortable} {
120
eval destroy [winfo children .]
121
label .b1 -text Xagqpim -bd 2 -padx 0 -pady 2 -width 10
122
button .b2 -text Xagqpim -bd 2 -padx 0 -pady 2 -height 5
123
checkbutton .b3 -text Xagqpim -bd 2 -padx 1 -pady 1 -width 20 -height 2
124
radiobutton .b4 -text Xagqpim -bd 2 -padx 2 -pady 0 -width 4
127
list [winfo reqwidth .b1] [winfo reqheight .b1] \
128
[winfo reqwidth .b2] [winfo reqheight .b2] \
129
[winfo reqwidth .b3] [winfo reqheight .b3] \
130
[winfo reqwidth .b4] [winfo reqheight .b4]
131
} {74 24 67 97 174 46 64 28}
132
test winbutton-1.8 {TkpComputeButtonGeometry procedure} {nonPortable} {
133
eval destroy [winfo children .]
134
label .b1 -text Xagqpim -bd 2 -padx 0 -pady 2 \
135
-highlightthickness 4
136
button .b2 -text Xagqpim -bd 2 -padx 0 -pady 2 \
137
-highlightthickness 0
138
checkbutton .b3 -text Xagqpim -bd 2 -padx 1 -pady 1 \
139
-highlightthickness 1 -indicatoron no
140
radiobutton .b4 -text Xagqpim -bd 2 -padx 2 -pady 0 -indicatoron 0
143
list [winfo reqwidth .b1] [winfo reqheight .b1] \
144
[winfo reqwidth .b2] [winfo reqheight .b2] \
145
[winfo reqwidth .b3] [winfo reqheight .b3] \
146
[winfo reqwidth .b4] [winfo reqheight .b4]
147
} {66 32 65 31 69 31 71 29}
148
test winbutton-1.9 {TkpComputeButtonGeometry procedure} {
149
eval destroy [winfo children .]
150
button .b2 -bitmap question -default normal
151
list [winfo reqwidth .b2] [winfo reqheight .b2]
154
eval destroy [winfo children .]