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/wm.test | |
parent | 41f5d19540b0b3f053da352e1569c9a4ed019dd5 (diff) | |
download | tk-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/wm.test')
-rw-r--r-- | tests/wm.test | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/tests/wm.test b/tests/wm.test index 1aa0779..26b398a 100644 --- a/tests/wm.test +++ b/tests/wm.test @@ -33,13 +33,15 @@ proc stdWindow {} { # proc raiseDelay {} { - after 100; update + after 100 + update } # How to carry out a small delay while processing events proc eventDelay {{delay 200}} { - after $delay "set done 1" ; vwait done + after $delay "set done 1" + vwait done } deleteWindows @@ -304,7 +306,7 @@ test wm-attributes-1.4.0 {setting/unsetting fullscreen does not change the focus deleteWindows } -result {. . .} test wm-attributes-1.4.1 {setting fullscreen does not generate FocusIn on wrapper create} -setup { - catch {unset focusin} + unset -nocomplain focusin } -constraints win -body { focus -force . toplevel .t @@ -441,10 +443,8 @@ test wm-attributes-1.5.5 {fullscreen stackorder} -setup { deleteWindows } -result {{. .a .b .c} {. .a .b .c} {. .a .b .c}} - stdWindow - ### wm colormapwindows ### test wm-colormapwindows-1.1 {usage} -returnCodes error -body { wm colormapwindows @@ -523,7 +523,7 @@ test wm-deiconify-1.3 {usage} -returnCodes error -body { test wm-deiconify-1.4 {usage} -setup { destroy .icon } -body { - toplevel .icon -width 50 -height 50 -bg red + toplevel .icon -width 50 -height 50 -background red wm iconwindow .t .icon wm deiconify .icon } -returnCodes error -cleanup { @@ -926,7 +926,7 @@ test wm-iconwindow-1.4 {usage} -setup { test wm-iconwindow-1.5 {usage} -setup { destroy .icon .t2 } -body { - toplevel .icon -width 50 -height 50 -bg green + toplevel .icon -width 50 -height 50 -background green toplevel .t2 wm geom .t2 -0+0 wm iconwindow .t2 .icon @@ -940,7 +940,7 @@ test wm-iconwindow-2.1 {setting and reading values} -setup { set result {} } -body { lappend result [wm iconwindow .t] - toplevel .icon -width 50 -height 50 -bg green + toplevel .icon -width 50 -height 50 -background green wm iconwindow .t .icon lappend result [wm iconwindow .t] wm iconwindow .t {} @@ -1540,14 +1540,13 @@ test wm-stackorder-5.3 {An overrideredirect window\ test wm-stackorder-6.1 {An embedded toplevel does not\ appear in the stacking order} -body { toplevel .real -container 1 - toplevel .embd -bg blue -use [winfo id .real] + toplevel .embd -background blue -use [winfo id .real] update wm stackorder . } -cleanup { deleteWindows } -result {. .real} - stdWindow ### wm title ### @@ -1572,15 +1571,18 @@ test wm-title-2.1 {setting and reading values} -setup { ### wm transient ### test wm-transient-1.1 {usage} -returnCodes error -body { - catch {destroy .t} ; toplevel .t + destroy .t + toplevel .t wm transient .t 1 2 } -result {wrong # args: should be "wm transient window ?master?"} test wm-transient-1.2 {usage} -returnCodes error -body { - catch {destroy .t} ; toplevel .t + destroy .t + toplevel .t wm transient .t foo } -result {bad window path name "foo"} test wm-transient-1.3 {usage} -returnCodes error -body { - catch {destroy .t} ; toplevel .t + destroy .t + toplevel .t wm transient foo .t } -result {bad window path name "foo"} deleteWindows @@ -1593,7 +1595,7 @@ test wm-transient-1.4 {usage} -returnCodes error -body { deleteWindows } -result {can't iconify ".subject": it is a transient} test wm-transient-1.5 {usage} -returnCodes error -body { - toplevel .icon -bg blue + toplevel .icon -background blue toplevel .top wm iconwindow .top .icon toplevel .dummy @@ -1602,7 +1604,7 @@ test wm-transient-1.5 {usage} -returnCodes error -body { deleteWindows } -result {can't make ".icon" a transient: it is an icon for .top} test wm-transient-1.6 {usage} -returnCodes error -body { - toplevel .icon -bg blue + toplevel .icon -background blue toplevel .top wm iconwindow .top .icon toplevel .dummy @@ -2286,8 +2288,7 @@ test wm-forget-1.4 "pack into unmapped toplevel causes crash" -body { deleteWindows cleanupTests -catch {unset results} -catch {unset focusin} +unset -nocomplain results focusin return # Local variables: |