summaryrefslogtreecommitdiffstats
path: root/tests/winMenu.test
diff options
context:
space:
mode:
authorandreask <andreask>2013-01-22 19:30:43 (GMT)
committerandreask <andreask>2013-01-22 19:30:43 (GMT)
commit48c9fcb7281cc6aa076113db874c7ae0e105795d (patch)
tree7187940ff056462bfa41705a2ce04d0ed07d424e /tests/winMenu.test
parent41f5d19540b0b3f053da352e1569c9a4ed019dd5 (diff)
downloadtk-48c9fcb7281cc6aa076113db874c7ae0e105795d.zip
tk-48c9fcb7281cc6aa076113db874c7ae0e105795d.tar.gz
tk-48c9fcb7281cc6aa076113db874c7ae0e105795d.tar.bz2
Contribution by Patrick Fradin <patrick.fradin@planar.com>contrib_patrick_fradin_code_cleanup
Quoting his mail: <pre> ========================================================== Hi Jeff, I spent some of my time to contribute to the TclTk community ! I'm in late for Christmas gift but like we said in French : "Mieux vaut tard que jamais". ;-) I've use TclDevKit 5.3.0 tclchecker to analyse TclTk code in Tcl and Tk library directories (library, tools and tests) to correct a lot of warnings and few errors. (encapsulate some expr, use 'chan xxx' instead of fconfigure, fileevent...) I've made some improvements too : Examples : - Use 'lassign' instead of many 'lindex' of 'foreach/break' loop. - Use 'in' or 'ni' operators instead of 'lsearch -exact' or to factorise some eq/ne && / || tests. - Use 'eq' or 'ne' to tests strings instead of '==' or '!='. - Use 'unset -nocomplain' to avoid 'catch {unset...}'. - Remove some useless catch around 'destroy' calls. - Use expand {*} instead of 'eval'. Don't touch a lot of code because I don't know all structs and lists. I think it could be a greater improvement to reduce 'eval' calls. Due to previous experience, I dot not change any indentation ! ;-) ========================================================== </pre>
Diffstat (limited to 'tests/winMenu.test')
-rw-r--r--tests/winMenu.test37
1 files changed, 4 insertions, 33 deletions
diff --git a/tests/winMenu.test b/tests/winMenu.test
index ce2069f..6fa115b 100644
--- a/tests/winMenu.test
+++ b/tests/winMenu.test
@@ -26,7 +26,6 @@ test winMenu-1.2 {GetNewID} -constraints win -setup {
destroy .m1
} -result {}
-
# Basically impossible to test menu IDs wrapping.
test winMenu-2.1 {FreeID} -constraints win -setup {
@@ -36,7 +35,6 @@ test winMenu-2.1 {FreeID} -constraints win -setup {
destroy .m1
} -returnCodes ok
-
test winMenu-3.1 {TkpNewMenu} -constraints win -setup {
destroy .m1
} -body {
@@ -51,7 +49,6 @@ test winMenu-3.2 {TkpNewMenu} -constraints win -setup {
list [catch {. configure -menu .m1} msg] $msg [. configure -menu ""] [catch {destroy .m1} msg2] $msg2
} -result {0 {} {} 0 {}}
-
test winMenu-4.1 {TkpDestroyMenu} -constraints win -setup {
destroy .m1
} -body {
@@ -67,7 +64,6 @@ test winMenu-4.2 {TkpDestroyMenu - help menu} -constraints win -setup {
list [catch {destroy .m1.system} msg] $msg [. configure -menu ""] [destroy .m1]
} -result {0 {} {} {}}
-
test winMenu-5.1 {TkpDestroyMenuEntry} -constraints win -setup {
destroy .m1
} -body {
@@ -78,7 +74,6 @@ test winMenu-5.1 {TkpDestroyMenuEntry} -constraints win -setup {
list [catch {.m1 delete 1} msg] $msg [destroy .m1]
} -result {0 {} {}}
-
test winMenu-6.1 {GetEntryText} -constraints win -setup {
destroy .m1
} -body {
@@ -303,7 +298,7 @@ test winMenu-7.13 {ReconfigureWindowsMenu - cascade missing} -constraints {
test winMenu-7.14 {ReconfigureWindowsMenu - cascade} -constraints win -setup {
destroy .m1
} -body {
- catch {destroy .m2}
+ destroy .m2
menu .m1 -tearoff 0
menu .m2
.m1 add cascade -menu .m2 -label Hello
@@ -421,7 +416,6 @@ test winMenu-8.6 {TkpPostMenu - update not pending} -constraints {
list [catch {.m1 post 40 40} msg] $msg [destroy .m1]
} -result {0 {} {}}
-
test winMenu-9.1 {TkpMenuNewEntry} -constraints win -setup {
destroy .m1
} -body {
@@ -429,7 +423,6 @@ test winMenu-9.1 {TkpMenuNewEntry} -constraints win -setup {
list [catch {.m1 add command} msg] $msg [destroy .m1]
} -result {0 {} {}}
-
test winMenu-10.1 {TkwinMenuProc} -constraints {
win userInteraction
} -setup {
@@ -448,7 +441,7 @@ test winMenu-11.1 {TkWinHandleMenuEvent - WM_INITMENU} -constraints {
} -setup {
destroy .m1
} -body {
- catch {unset foo}
+ unset -nocomplain foo
menu .m1 -postcommand "set foo test"
.m1 add command -label "winMenu-11.1: Hit ESCAPE."
list [.m1 post 40 40] [set foo] [unset foo] [destroy .m1]
@@ -458,7 +451,7 @@ test winMenu-11.2 {TkWinHandleMenuEvent - WM_COMMAND} -constraints {
} -setup {
destroy .m1
} -body {
- catch {unset foo}
+ unset -nocomplain foo
menu .m1
.m1 add checkbutton -variable foo -label "winMenu-11.2: Please select this menu item."
list [.m1 post 40 40] [update] [set foo] [unset foo] [destroy .m1]
@@ -468,7 +461,7 @@ test winMenu-11.3 {TkWinHandleMenuEvent - WM_COMMAND} -constraints {
} -setup {
destroy .m1
} -body {
- catch {unset foo}
+ unset -nocomplain foo
proc bgerror {args} {
global foo errorInfo
set foo [list $args $errorInfo]
@@ -531,7 +524,6 @@ test winMenu-11.8 {TkWinHandleMenuEvent - WM_INITMENU - not pending} -constraint
list [catch {.m1 post 40 40} msg] $msg [destroy .m1]
} -result {0 {} {}}
-
test winMenu-12.1 {TkpSetWindowMenuBar} -constraints win -setup {
destroy .m1
} -body {
@@ -561,12 +553,10 @@ test winMenu-12.3 {TkpSetWindowMenuBar - no update pending} -constraints {
list [catch {. configure -menu .m1} msg] $msg [. configure -menu ""] [destroy .m1]
} -result {0 {} {} {}}
-
test winMenu-13.1 {TkpSetMainMenubar - nothing to do} -constraints {
emptyTest win
} -body {}
-
test winMenu-14.1 {GetMenuIndicatorGeometry} -constraints win -setup {
destroy .m1
} -body {
@@ -584,7 +574,6 @@ test winMenu-14.2 {GetMenuIndicatorGeometry} -constraints win -setup {
destroy .m1
} -returnCodes ok
-
test winMenu-15.1 {GetMenuAccelGeometry} -constraints win -setup {
destroy .m1
} -body {
@@ -610,7 +599,6 @@ test winMenu-15.3 {GetMenuAccelGeometry} -constraints win -setup {
destroy .m1
} -returnCodes ok
-
test winMenu-16.1 {GetTearoffEntryGeometry} -constraints {
win userInteraction
} -setup {
@@ -621,7 +609,6 @@ test winMenu-16.1 {GetTearoffEntryGeometry} -constraints {
list [.m1 post 40 40] [destroy .m1]
} -result {{} {}}
-
test winMenu-17.1 {GetMenuSeparatorGeometry} -constraints win -setup {
destroy .m1
} -body {
@@ -656,7 +643,6 @@ test winMenu-18.2 {DrawWindowsSystemBitmap - right aligned} -constraints {
list [update] [destroy .m1]
} -result {{} {}}
-
test winMenu-19.1 {DrawMenuEntryIndicator - not checkbutton or radiobutton} -constraints {
win
} -setup {
@@ -721,7 +707,6 @@ test winMenu-19.6 {DrawMenuEntryIndicator - indicator not on} -constraints {
list [update] [destroy .m1]
} -result {{} {}}
-
test winMenu-20.1 {DrawMenuEntryAccelerator - disabled} -constraints win -setup {
destroy .m1
} -body {
@@ -770,7 +755,6 @@ test winMenu-20.5 {DrawMenuEntryAccelerator - cascade, drawArrow false} -constra
list [.m1 post 40 40] [destroy .m1]
} -result {{} {}}
-
test winMenu-21.1 {DrawMenuSeparator} -constraints win -setup {
destroy .m1
} -body {
@@ -780,7 +764,6 @@ test winMenu-21.1 {DrawMenuSeparator} -constraints win -setup {
list [update] [destroy .m1]
} -result {{} {}}
-
test winMenu-22.1 {DrawMenuUnderline} -constraints win -setup {
destroy .m1
} -body {
@@ -790,17 +773,14 @@ test winMenu-22.1 {DrawMenuUnderline} -constraints win -setup {
list [update] [destroy .m1]
} -result {{} {}}
-
test winMenu-23.1 {Don't know how to test MenuKeyBindProc} -constraints {
win emptyTest
} -body {}
-
test winMenu-24.1 {TkpInitializeMenuBindings called at boot time} -constraints {
win emptyTest
} -body {}
-
test winMenu-25.1 {DrawMenuEntryLabel - normal} -constraints win -setup {
destroy .m1
} -body {
@@ -830,7 +810,6 @@ test winMenu-25.3 {DrawMenuEntryLabel - disabled with no fg} -constraints {
list [update] [destroy .m1]
} -result {{} {}}
-
test winMenu-26.1 {TkpComputeMenubarGeometry} -constraints win -setup {
destroy .m1
} -body {
@@ -839,7 +818,6 @@ test winMenu-26.1 {TkpComputeMenubarGeometry} -constraints win -setup {
list [. configure -menu .m1] [. configure -menu ""] [destroy .m1]
} -result {{} {} {}}
-
test winMenu-27.1 {DrawTearoffEntry} -constraints {
win userInteraction
} -setup {
@@ -850,7 +828,6 @@ test winMenu-27.1 {DrawTearoffEntry} -constraints {
list [.m1 post 40 40] [destroy .m1]
} -result {{} {}}
-
test winMenu-28.1 {TkpConfigureMenuEntry - update pending} -constraints {
win
} -setup {
@@ -871,7 +848,6 @@ test winMenu-28.2 {TkpConfigureMenuEntry - update not pending} -constraints {
list [catch {.m1 add command -label Two} msg] $msg [destroy .m1]
} -result {0 {} {}}
-
test winMenu-29.1 {TkpDrawMenuEntry - gc for active and not strict motif} -constraints {
win
} -setup {
@@ -1094,7 +1070,6 @@ test winMenu-29.22 {TkpDrawMenuEntry - indicator} -constraints win -setup {
list [update] [destroy .m1]
} -result {{} {}}
-
test winMenu-30.1 {GetMenuLabelGeometry - image} -constraints {
testImageType win
} -setup {
@@ -1128,7 +1103,6 @@ test winMenu-30.4 {GetMenuLabelGeometry - text} -constraints win -setup {
list [update idletasks] [destroy .m1]
} -result {{} {}}
-
test winMenu-31.1 {DrawMenuEntryBackground} -constraints win -setup {
destroy .m1
} -body {
@@ -1147,7 +1121,6 @@ test winMenu-31.2 {DrawMenuEntryBackground} -constraints win -setup {
list [update] [destroy .m1]
} -result {{} {}}
-
test winMenu-32.1 {TkpComputeStandardMenuGeometry - no entries} -constraints {
win
} -setup {
@@ -1346,7 +1319,6 @@ test winMenu-32.19 {TkpComputeStandardMenuGeometry - three columns} -constraints
list [update idletasks] [destroy .m1]
} -result {{} {}}
-
test winMenu-33.1 {TkpNotifyTopLevelCreate - no menu yet} -constraints {
win
} -setup {
@@ -1369,7 +1341,6 @@ test winMenu-33.2 {TkpNotifyTopLevelCreate - menu} -constraints win -setup {
list [update idletasks] [destroy .m1] [destroy .t2]
} -result {{} {} {}}
-
test winMenu-34.1 {TkpMenuInit called at boot time} -constraints {
emptyTest win
} -body {}