Import Tk 8.6.6 (as of svn r86089)
This commit is contained in:
203
tests/winButton.test
Normal file
203
tests/winButton.test
Normal file
@@ -0,0 +1,203 @@
|
||||
# This file is a Tcl script to test the Windows specific behavior of
|
||||
# labels, buttons, checkbuttons, and radiobuttons in Tk (i.e., all the
|
||||
# widgets defined in tkWinButton.c). It is organized in the standard
|
||||
# fashion for Tcl tests.
|
||||
#
|
||||
# Copyright (c) 1994 The Regents of the University of California.
|
||||
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
|
||||
# Copyright (c) 1998-1999 by Scriptics Corporation.
|
||||
# All rights reserved.
|
||||
|
||||
package require tcltest 2.2
|
||||
namespace import ::tcltest::*
|
||||
tcltest::configure {*}$argv
|
||||
tcltest::loadTestedCommands
|
||||
imageInit
|
||||
|
||||
proc bogusTrace args {
|
||||
error "trace aborted"
|
||||
}
|
||||
option clear
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
test winbutton-1.1 {TkpComputeButtonGeometry procedure} -constraints {
|
||||
testImageType win nonPortable
|
||||
} -setup {
|
||||
# nonPortable because of [3e3e25f483]: on Win7 first started with a high DPI screen
|
||||
# the smallest size (i.e. 8) is not available for "MS Sans Serif" font
|
||||
deleteWindows
|
||||
} -body {
|
||||
image create test image1
|
||||
image1 changed 0 0 0 0 60 40
|
||||
label .b1 -image image1 -bd 4 -padx 0 -pady 2
|
||||
button .b2 -image image1 -bd 4 -padx 0 -pady 2
|
||||
checkbutton .b3 -image image1 -bd 4 -padx 1 -pady 1 \
|
||||
-font {{MS Sans Serif} 8}
|
||||
radiobutton .b4 -image image1 -bd 4 -padx 2 -pady 0 \
|
||||
-font {{MS Sans Serif} 8}
|
||||
pack .b1 .b2 .b3 .b4
|
||||
update
|
||||
# with patch 463234 with native L&F enabled, this returns:
|
||||
# {68 48 70 50 88 50 88 50}
|
||||
list [winfo reqwidth .b1] [winfo reqheight .b1] \
|
||||
[winfo reqwidth .b2] [winfo reqheight .b2] \
|
||||
[winfo reqwidth .b3] [winfo reqheight .b3] \
|
||||
[winfo reqwidth .b4] [winfo reqheight .b4]
|
||||
} -cleanup {
|
||||
deleteWindows
|
||||
image delete image1
|
||||
} -result {68 48 70 50 90 52 90 52}
|
||||
|
||||
test winbutton-1.2 {TkpComputeButtonGeometry procedure} -constraints {
|
||||
win nonPortable
|
||||
} -setup {
|
||||
# nonPortable because of [3e3e25f483]: on Win7 first started with a high DPI screen
|
||||
# the smallest size (i.e. 8) is not available for "MS Sans Serif" font
|
||||
deleteWindows
|
||||
} -body {
|
||||
label .b1 -bitmap question -bd 3 -padx 0 -pady 2
|
||||
button .b2 -bitmap question -bd 3 -padx 0 -pady 2
|
||||
checkbutton .b3 -bitmap question -bd 3 -padx 1 -pady 1 \
|
||||
-font {{MS Sans Serif} 8}
|
||||
radiobutton .b4 -bitmap question -bd 3 -padx 2 -pady 0 \
|
||||
-font {{MS Sans Serif} 8}
|
||||
pack .b1 .b2 .b3 .b4
|
||||
update
|
||||
# with patch 463234 with native L&F enabled, this returns:
|
||||
# {23 33 25 35 43 35 43 35}
|
||||
list [winfo reqwidth .b1] [winfo reqheight .b1] \
|
||||
[winfo reqwidth .b2] [winfo reqheight .b2] \
|
||||
[winfo reqwidth .b3] [winfo reqheight .b3] \
|
||||
[winfo reqwidth .b4] [winfo reqheight .b4]
|
||||
} -cleanup {
|
||||
deleteWindows
|
||||
} -result {23 33 25 35 45 37 45 37}
|
||||
|
||||
test winbutton-1.3 {TkpComputeButtonGeometry procedure} -constraints win -setup {
|
||||
deleteWindows
|
||||
} -body {
|
||||
label .b1 -bitmap question -bd 3 -highlightthickness 4
|
||||
button .b2 -bitmap question -bd 3 -highlightthickness 0
|
||||
checkbutton .b3 -bitmap question -bd 3 -highlightthickness 1 \
|
||||
-indicatoron 0
|
||||
radiobutton .b4 -bitmap question -bd 3 -indicatoron false
|
||||
pack .b1 .b2 .b3 .b4
|
||||
update
|
||||
# with patch 463234 with native L&F enabled, this returns:
|
||||
# {31 41 23 33 25 35 25 35}
|
||||
list [winfo reqwidth .b1] [winfo reqheight .b1] \
|
||||
[winfo reqwidth .b2] [winfo reqheight .b2] \
|
||||
[winfo reqwidth .b3] [winfo reqheight .b3] \
|
||||
[winfo reqwidth .b4] [winfo reqheight .b4]
|
||||
} -cleanup {
|
||||
deleteWindows
|
||||
} -result {31 41 23 33 27 37 27 37}
|
||||
|
||||
test winbutton-1.4 {TkpComputeButtonGeometry procedure} -constraints {
|
||||
win nonPortable
|
||||
} -setup {
|
||||
deleteWindows
|
||||
} -body {
|
||||
label .b1 -text Xagqpim -bd 2 -padx 0 -pady 2 -font {{MS Sans Serif} 8}
|
||||
button .b2 -text Xagqpim -bd 2 -padx 0 -pady 2 -font {{MS Sans Serif} 8}
|
||||
checkbutton .b3 -text Xagqpim -bd 2 -padx 1 -pady 1 -font {{MS Sans Serif} 8}
|
||||
radiobutton .b4 -text Xagqpim -bd 2 -padx 2 -pady 0 -font {{MS Sans Serif} 8}
|
||||
pack .b1 .b2 .b3 .b4
|
||||
update
|
||||
list [winfo reqwidth .b1] [winfo reqheight .b1] \
|
||||
[winfo reqwidth .b2] [winfo reqheight .b2] \
|
||||
[winfo reqwidth .b3] [winfo reqheight .b3] \
|
||||
[winfo reqwidth .b4] [winfo reqheight .b4]
|
||||
} -cleanup {
|
||||
deleteWindows
|
||||
} -result {58 24 67 33 88 30 90 28}
|
||||
|
||||
test winbutton-1.5 {TkpComputeButtonGeometry procedure} -constraints {
|
||||
win nonPortable
|
||||
} -setup {
|
||||
deleteWindows
|
||||
} -body {
|
||||
label .l1 -wraplength 1.5i -padx 0 -pady 0 \
|
||||
-text "This is a long string that will wrap around on several lines.\n\nIt also has a blank line (above)."
|
||||
pack .l1
|
||||
update
|
||||
list [winfo reqwidth .l1] [winfo reqheight .l1]
|
||||
} -cleanup {
|
||||
deleteWindows
|
||||
} -result {178 84}
|
||||
|
||||
test winbutton-1.6 {TkpComputeButtonGeometry procedure} -constraints {
|
||||
win nonPortable
|
||||
} -setup {
|
||||
deleteWindows
|
||||
} -body {
|
||||
label .l1 -padx 0 -pady 0 \
|
||||
-text "This is a long string without wrapping.\n\nIt also has a blank line (above)."
|
||||
pack .l1
|
||||
update
|
||||
list [winfo reqwidth .l1] [winfo reqheight .l1]
|
||||
} -cleanup {
|
||||
deleteWindows
|
||||
} -result {222 52}
|
||||
|
||||
test winbutton-1.7 {TkpComputeButtonGeometry procedure} -constraints {
|
||||
win nonPortable
|
||||
} -setup {
|
||||
deleteWindows
|
||||
} -body {
|
||||
label .b1 -text Xagqpim -bd 2 -padx 0 -pady 2 -width 10
|
||||
button .b2 -text Xagqpim -bd 2 -padx 0 -pady 2 -height 5
|
||||
checkbutton .b3 -text Xagqpim -bd 2 -padx 1 -pady 1 -width 20 -height 2
|
||||
radiobutton .b4 -text Xagqpim -bd 2 -padx 2 -pady 0 -width 4
|
||||
pack .b1 .b2 .b3 .b4
|
||||
update
|
||||
list [winfo reqwidth .b1] [winfo reqheight .b1] \
|
||||
[winfo reqwidth .b2] [winfo reqheight .b2] \
|
||||
[winfo reqwidth .b3] [winfo reqheight .b3] \
|
||||
[winfo reqwidth .b4] [winfo reqheight .b4]
|
||||
} -cleanup {
|
||||
deleteWindows
|
||||
} -result {74 24 67 97 174 46 64 28}
|
||||
|
||||
test winbutton-1.8 {TkpComputeButtonGeometry procedure} -constraints {
|
||||
win nonPortable
|
||||
} -setup {
|
||||
deleteWindows
|
||||
} -body {
|
||||
label .b1 -text Xagqpim -bd 2 -padx 0 -pady 2 \
|
||||
-highlightthickness 4
|
||||
button .b2 -text Xagqpim -bd 2 -padx 0 -pady 2 \
|
||||
-highlightthickness 0
|
||||
checkbutton .b3 -text Xagqpim -bd 2 -padx 1 -pady 1 \
|
||||
-highlightthickness 1 -indicatoron no
|
||||
radiobutton .b4 -text Xagqpim -bd 2 -padx 2 -pady 0 -indicatoron 0
|
||||
pack .b1 .b2 .b3 .b4
|
||||
update
|
||||
list [winfo reqwidth .b1] [winfo reqheight .b1] \
|
||||
[winfo reqwidth .b2] [winfo reqheight .b2] \
|
||||
[winfo reqwidth .b3] [winfo reqheight .b3] \
|
||||
[winfo reqwidth .b4] [winfo reqheight .b4]
|
||||
} -cleanup {
|
||||
deleteWindows
|
||||
} -result {66 32 65 31 69 31 71 29}
|
||||
|
||||
test winbutton-1.9 {TkpComputeButtonGeometry procedure} -constraints win -setup {
|
||||
deleteWindows
|
||||
} -body {
|
||||
button .b2 -bitmap question -default normal
|
||||
list [winfo reqwidth .b2] [winfo reqheight .b2]
|
||||
} -cleanup {
|
||||
deleteWindows
|
||||
} -result {23 33}
|
||||
|
||||
# cleanup
|
||||
imageFinish
|
||||
deleteWindows
|
||||
cleanupTests
|
||||
return
|
||||
|
||||
# Local variables:
|
||||
# mode: tcl
|
||||
# End:
|
||||
|
||||
Reference in New Issue
Block a user