diff options
author | andreask <andreask> | 2013-01-22 19:30:43 (GMT) |
---|---|---|
committer | andreask <andreask> | 2013-01-22 19:30:43 (GMT) |
commit | 48c9fcb7281cc6aa076113db874c7ae0e105795d (patch) | |
tree | 7187940ff056462bfa41705a2ce04d0ed07d424e /tests/menuDraw.test | |
parent | 41f5d19540b0b3f053da352e1569c9a4ed019dd5 (diff) | |
download | tk-contrib_patrick_fradin_code_cleanup.zip tk-contrib_patrick_fradin_code_cleanup.tar.gz tk-contrib_patrick_fradin_code_cleanup.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/menuDraw.test')
-rw-r--r-- | tests/menuDraw.test | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/tests/menuDraw.test b/tests/menuDraw.test index bb632c6..42514f2 100644 --- a/tests/menuDraw.test +++ b/tests/menuDraw.test @@ -19,7 +19,6 @@ test menuDraw-1.1 {TkMenuInitializeDrawingFields} -setup { deleteWindows } -result {.m1} - test menuDraw-2.1 {TkIntializeMenuEntryDrawingFields} -setup { deleteWindows } -body { @@ -29,7 +28,6 @@ test menuDraw-2.1 {TkIntializeMenuEntryDrawingFields} -setup { deleteWindows } -result {} - test menuDraw-3.1 {TkMenuFreeDrawOptions} -setup { deleteWindows } -body { @@ -37,7 +35,6 @@ test menuDraw-3.1 {TkMenuFreeDrawOptions} -setup { destroy .m1 } -result {} - test menuDraw-4.1 {TkMenuEntryFreeDrawOptions} -setup { deleteWindows } -body { @@ -54,7 +51,6 @@ test menuDraw-4.2 {TkMenuEntryFreeDrawOptions} -setup { destroy .m1 } -result {} - test menuDraw-5.1 {TkMenuConfigureDrawOptions - new menu} -setup { deleteWindows } -body { @@ -66,7 +62,7 @@ test menuDraw-5.2 {TkMenuConfigureDrawOptions - old menu} -setup { deleteWindows } -body { menu .m1 - .m1 configure -fg red + .m1 configure -foreground red } -cleanup { deleteWindows } -result {} @@ -78,7 +74,6 @@ test menuDraw-5.3 {TkMenuConfigureDrawOptions - no disabledFg} -setup { deleteWindows } -result {.m1} - test menuDraw-6.1 {TkMenuConfigureEntryDrawOptions - no tkfont specified} -setup { deleteWindows } -body { @@ -218,7 +213,6 @@ test menuDraw-6.16 {TkMenuConfigureEntryDrawOptions - indicatorGC disposal} -set deleteWindows } -result {} - test menuDraw-7.1 {TkEventuallyRecomputeMenu} -setup { deleteWindows } -body { @@ -241,7 +235,6 @@ test menuDraw-7.2 {TkEventuallyRecomputeMenu - update pending} -setup { deleteWindows } -result {} - test menuDraw-8.1 {TkRecomputeMenu} -constraints { win userInteraction } -setup { @@ -255,11 +248,10 @@ test menuDraw-8.1 {TkRecomputeMenu} -constraints { deleteWindows } -result {} - test menuDraw-9.1 {TkEventuallyRedrawMenu - entry test} -setup { deleteWindows } -body { - catch {unset foo} + unset -nocomplain foo menu .m1 set foo 0 .m1 add radiobutton -variable foo -label test @@ -319,7 +311,6 @@ test menuDraw-10.4 {ComputeMenuGeometry - resize not necessary} -setup { deleteWindows } -result {} - test menuDraw-11.1 {TkMenuSelectImageProc - entry selected; redraw not pending} -constraints { testImageType } -setup { @@ -475,7 +466,6 @@ test menuDraw-12.7 {Display menu - extra space at end of menu} -setup { deleteWindows } -result {} - test menuDraw-13.1 {TkMenuEventProc - Expose} -setup { deleteWindows } -body { @@ -517,7 +507,6 @@ test menuDraw-13.5 {TkMenuEventProc - nothing pending} -setup { destroy .m1 } -result {} - test menuDraw-14.1 {TkMenuImageProc} -constraints testImageType -setup { deleteWindows } -body { @@ -542,7 +531,6 @@ test menuDraw-14.2 {TkMenuImageProc} -constraints testImageType -setup { deleteWindows } -result {} - test menuDraw-15.1 {TkPostTearoffMenu - Basic posting} -setup { deleteWindows } -body { @@ -565,7 +553,7 @@ test menuDraw-15.2 {TkPostTearoffMenu - Deactivation} -setup { test menuDraw-15.3 {TkPostTearoffMenu - post command} -setup { deleteWindows } -body { - catch {unset foo} + unset -nocomplain foo menu .m1 -postcommand "set foo .m1" .m1 add command -label "foo" list [catch {tk::TearOffMenu .m1 40 40}] [set foo] [unset foo] [destroy .m1] @@ -598,7 +586,6 @@ test menuDraw-15.6 {TkPostTearoffMenu - tearoff off right} -setup { deleteWindows } -returnCodes ok -match glob -result * - test menuDraw-16.1 {TkPostSubmenu} -constraints nonUnixUserInteraction -setup { deleteWindows } -body { @@ -673,7 +660,6 @@ test menuDraw-16.6 {TkPostSubMenu} -constraints { deleteWindows } -result {} - test menuDraw-17.1 {AdjustMenuCoords - menubar} -constraints unix -setup { deleteWindows } -body { @@ -683,7 +669,7 @@ test menuDraw-17.1 {AdjustMenuCoords - menubar} -constraints unix -setup { .m2 add command -label foo . configure -menu .m1 foreach w [winfo children .] { - if {[$w cget -type] == "menubar"} { + if {[$w cget -type] eq "menubar"} { break } } |