Skip to content

Commit 8a71e84

Browse files
committed
pack.test, scrollbar.test: correct "COMMON TEST SETUP" sections
1 parent 28bc69c commit 8a71e84

File tree

2 files changed

+19
-26
lines changed

2 files changed

+19
-26
lines changed

tests/pack.test

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -889,13 +889,10 @@ test pack-8.7 {insufficient space} -body {
889889
[winfo geometry .pack.c] [winfo ismapped .pack.c]
890890
} -result {20x30+0+0 1 30x30+20+0 1 50x30+20+0 0}
891891

892-
#
893-
# COMMON TEST SETUP
894-
#
895-
pack forget .pack.b
896-
update
897-
898-
test pack-8.8 {insufficient space} -body {
892+
test pack-8.8 {insufficient space} -setup {
893+
pack forget .pack.b
894+
update
895+
} -body {
899896
list [winfo geometry .pack.a] [winfo ismapped .pack.a] \
900897
[winfo geometry .pack.b] [winfo ismapped .pack.b] \
901898
[winfo geometry .pack.c] [winfo ismapped .pack.c]

tests/scrollbar.test

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -337,25 +337,22 @@ test scrollbar-3.41 {ScrollbarWidgetCmd procedure, "fraction" option} {
337337
format {%.6g} [.t.s fraction 100 0]
338338
} {0.5}
339339

340-
#
341-
# COMMON TEST SETUP
342-
#
343-
if {[testConstraint testmetrics]} {
344-
# Only Windows has [testmetrics]
345-
place configure .t.s -width [expr {2*[testmetrics cxhscroll .t.s]+1}]
346-
} else {
347-
if {[tk windowingsystem] eq "x11"} {
348-
place configure .t.s -width [expr {[winfo height .t.s] - 2*([.t.s cget -highlightthickness] + [.t.s cget -bd] + 1)}]
340+
test scrollbar-3.42 {ScrollbarWidgetCmd procedure, "fraction" option} -setup {
341+
if {[testConstraint testmetrics]} {
342+
# Only Windows has [testmetrics]
343+
place configure .t.s -width [expr {2*[testmetrics cxhscroll .t.s]+1}]
349344
} else {
350-
# macOS aqua
351-
place configure .t.s -width [expr {2*([.t.s cget -highlightthickness] + [.t.s cget -bd])}]
345+
if {[tk windowingsystem] eq "x11"} {
346+
place configure .t.s -width [expr {[winfo height .t.s] - 2*([.t.s cget -highlightthickness] + [.t.s cget -bd] + 1)}]
347+
} else {
348+
# macOS aqua
349+
place configure .t.s -width [expr {2*([.t.s cget -highlightthickness] + [.t.s cget -bd])}]
350+
}
352351
}
353-
}
354-
update
355-
356-
test scrollbar-3.42 {ScrollbarWidgetCmd procedure, "fraction" option} {
352+
update
353+
} -body {
357354
format {%.6g} [.t.s fraction 100 0]
358-
} 0
355+
} -result 0
359356

360357
#
361358
# COMMON TEST CLEANUP
@@ -721,10 +718,9 @@ test scrollbar-8.2 {TkScrollbarEventProc: recursive deletion} notAqua {
721718
} {1 0 1}
722719

723720
#
724-
# COMMON TEST SETUP
721+
# COMMON TEST CLEANUP
725722
#
726723

727-
set l [interp hidden]
728724
deleteWindows
729725

730726
test scrollbar-9.1 {scrollbar widget vs hidden commands} {
@@ -733,7 +729,7 @@ test scrollbar-9.1 {scrollbar widget vs hidden commands} {
733729
interp hide {} .s
734730
destroy .s
735731
list [winfo children .] [interp hidden]
736-
} [list {} $l]
732+
} [list {} [interp hidden]]
737733

738734
test scrollbar-10.1 {<MouseWheel> event on scrollbar} -setup {
739735
destroy .t .s

0 commit comments

Comments
 (0)