summaryrefslogtreecommitdiffstats
path: root/tests/spinbox.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/spinbox.test')
-rw-r--r--tests/spinbox.test23
1 files changed, 19 insertions, 4 deletions
diff --git a/tests/spinbox.test b/tests/spinbox.test
index 206a61d..1f2bdac 100644
--- a/tests/spinbox.test
+++ b/tests/spinbox.test
@@ -2607,10 +2607,25 @@ test spinbox-8.18 {DeleteChars procedure} -setup {
.e insert 0 "xyzzy"
update
.e delete 2 4
- winfo reqwidth .e
-} -cleanup {
- destroy .e
-} -result {42}
+ # To check that deletion actually happened we measure the new width
+ # of the widget, based on the measuring width of the remaining text ("xyy")
+ # in the widget. For that purpose we have to mirror the code in tkEntry.c
+ # for computation of the reqwidth
+ # note: XPAD corresponds to the hardcoded #define XPAD 1
+ set XPAD 1
+ set buttonWidth [expr { [font measure [.e cget -font] "0"] + 2 * (1 + $XPAD) }]
+ if {$buttonWidth < 11} {
+ set buttonWidth 11
+ }
+ set expected [expr { [font measure [.e cget -font] "xyy"] \
+ + 2 * ( [.e cget -borderwidth] + \
+ [.e cget -highlightthickness] + $XPAD ) \
+ + $buttonWidth } ]
+ expr {[winfo reqwidth .e] == $expected}
+} -cleanup {
+ destroy .e
+ unset XPAD buttonWidth expected
+} -result {1}
test spinbox-9.1 {SpinboxValueChanged procedure} -setup {
unset -nocomplain x