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/unixButton.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/unixButton.test')
-rw-r--r-- | tests/unixButton.test | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/tests/unixButton.test b/tests/unixButton.test index 137ef33..b69de3c 100644 --- a/tests/unixButton.test +++ b/tests/unixButton.test @@ -30,12 +30,10 @@ option add *Radiobutton.borderWidth 2 option add *Radiobutton.highlightThickness 2 option add *Radiobutton.font {Helvetica -12 bold} - -proc bogusTrace args { +proc bogusTrace {args} { error "trace aborted" } - test unixbutton-1.1 {TkpComputeButtonGeometry procedure} -constraints { unix testImageType } -setup { @@ -44,10 +42,10 @@ test unixbutton-1.1 {TkpComputeButtonGeometry procedure} -constraints { } -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 - radiobutton .b4 -image image1 -bd 4 -padx 2 -pady 0 + label .b1 -image image1 -borderwidth 4 -padx 0 -pady 2 + button .b2 -image image1 -borderwidth 4 -padx 0 -pady 2 + checkbutton .b3 -image image1 -borderwidth 4 -padx 1 -pady 1 + radiobutton .b4 -image image1 -borderwidth 4 -padx 2 -pady 0 pack .b1 .b2 .b3 .b4 update list [winfo reqwidth .b1] [winfo reqheight .b1] \ @@ -63,10 +61,10 @@ test unixbutton-1.2 {TkpComputeButtonGeometry procedure} -constraints { } -setup { 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 - radiobutton .b4 -bitmap question -bd 3 -padx 2 -pady 0 + label .b1 -bitmap question -borderwidth 3 -padx 0 -pady 2 + button .b2 -bitmap question -borderwidth 3 -padx 0 -pady 2 + checkbutton .b3 -bitmap question -borderwidth 3 -padx 1 -pady 1 + radiobutton .b4 -bitmap question -borderwidth 3 -padx 2 -pady 0 pack .b1 .b2 .b3 .b4 update list [winfo reqwidth .b1] [winfo reqheight .b1] \ @@ -81,11 +79,11 @@ test unixbutton-1.3 {TkpComputeButtonGeometry procedure} -constraints { } -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 \ + label .b1 -bitmap question -borderwidth 3 -highlightthickness 4 + button .b2 -bitmap question -borderwidth 3 -highlightthickness 0 + checkbutton .b3 -bitmap question -borderwidth 3 -highlightthickness 1 \ -indicatoron 0 - radiobutton .b4 -bitmap question -bd 3 -highlightthickness 1 \ + radiobutton .b4 -bitmap question -borderwidth 3 -highlightthickness 1 \ -indicatoron false pack .b1 .b2 .b3 .b4 update @@ -143,10 +141,10 @@ test unixbutton-1.7 {TkpComputeButtonGeometry procedure} -constraints { } -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 + label .b1 -text Xagqpim -borderwidth 2 -padx 0 -pady 2 -width 10 + button .b2 -text Xagqpim -borderwidth 2 -padx 0 -pady 2 -height 5 + checkbutton .b3 -text Xagqpim -borderwidth 2 -padx 1 -pady 1 -width 20 -height 2 + radiobutton .b4 -text Xagqpim -borderwidth 2 -padx 2 -pady 0 -width 4 pack .b1 .b2 .b3 .b4 update list [winfo reqwidth .b1] [winfo reqheight .b1] \ @@ -161,13 +159,13 @@ test unixbutton-1.8 {TkpComputeButtonGeometry procedure} -constraints { } -setup { deleteWindows } -body { - label .b1 -text Xagqpim -bd 2 -padx 0 -pady 2 \ + label .b1 -text Xagqpim -borderwidth 2 -padx 0 -pady 2 \ -highlightthickness 4 - button .b2 -text Xagqpim -bd 2 -padx 0 -pady 2 \ + button .b2 -text Xagqpim -borderwidth 2 -padx 0 -pady 2 \ -highlightthickness 0 - checkbutton .b3 -text Xagqpim -bd 2 -padx 1 -pady 1 \ + checkbutton .b3 -text Xagqpim -borderwidth 2 -padx 1 -pady 1 \ -highlightthickness 1 -indicatoron no - radiobutton .b4 -text Xagqpim -bd 2 -padx 2 -pady 0 -indicatoron 0 + radiobutton .b4 -text Xagqpim -borderwidth 2 -padx 2 -pady 0 -indicatoron 0 pack .b1 .b2 .b3 .b4 update list [winfo reqwidth .b1] [winfo reqheight .b1] \ @@ -208,12 +206,11 @@ test unixbutton-1.11 {TkpComputeButtonGeometry procedure} -constraints { deleteWindows } -result {27 37} - test unixbutton-2.1 {disabled coloring check, bug 669595} -constraints { unix } -setup { deleteWindows - catch {unset value} + unset -nocomplain value } -body { # this was just a visual bug, but at least this shows the visual set on 1 |