summaryrefslogtreecommitdiffstats
path: root/tests/spinbox.test
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2017-01-28 17:38:11 (GMT)
committerfvogel <fvogelnew1@free.fr>2017-01-28 17:38:11 (GMT)
commitac3c1f125c104ab506961d6653f0de098a056686 (patch)
treedd0fde4b21546c7e12721112864ceb79dbf0241e /tests/spinbox.test
parentd033d601736ea26760f95cc30695c80d4d19bafe (diff)
downloadtk-ac3c1f125c104ab506961d6653f0de098a056686.zip
tk-ac3c1f125c104ab506961d6653f0de098a056686.tar.gz
tk-ac3c1f125c104ab506961d6653f0de098a056686.tar.bz2
Make tests pass again after fixing [c0dbdd3ff3]: Tk Compatibility Fonts block access to system fontsbug_c0dbdd3ff3
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