summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2016-11-30 21:51:25 (GMT)
committerfvogel <fvogelnew1@free.fr>2016-11-30 21:51:25 (GMT)
commitf6ae02081a36dad1e26012e93672927e885ed267 (patch)
tree018b005c9d20fb48273ed19c46c57dde6465c347
parent6164a3347a9671d17e6946868237e3e60000fcd9 (diff)
downloadtk-f6ae02081a36dad1e26012e93672927e885ed267.zip
tk-f6ae02081a36dad1e26012e93672927e885ed267.tar.gz
tk-f6ae02081a36dad1e26012e93672927e885ed267.tar.bz2
Fixed [3ee76e41c2] - New textTag test failures
-rw-r--r--tests/textTag.test42
1 files changed, 37 insertions, 5 deletions
diff --git a/tests/textTag.test b/tests/textTag.test
index 2df8c5a..a2b2d73 100644
--- a/tests/textTag.test
+++ b/tests/textTag.test
@@ -11,6 +11,19 @@ namespace import ::tcltest::*
eval tcltest::configure $argv
tcltest::loadTestedCommands
+set textWidgetFont {Courier 12}
+set bigFont {Helvetica 24}
+
+# what is needed is a specific font *size* because in some tests (that
+# will be constrained by haveFontSizes), a tag applying the $bigFont
+# will be set to some characters, which action has the effect of
+# changing what character is under the mouse pointer, which is the
+# purpose of the tests
+testConstraint haveFontSizes [expr {
+ [font actual $textWidgetFont -size] == 12 &&
+ [font actual $bigFont -size] == 24 }
+]
+
destroy .t
text .t -width 20 -height 10
@@ -19,7 +32,6 @@ update
.t debug on
wm geometry . {}
-set bigFont {Helvetica 24}
# The statements below reset the main window; it's needed if the window
# manager is mwm, to make mwm forget about a previous minimum size setting.
@@ -1313,9 +1325,13 @@ test textTag-16.1 {TkTextPickCurrent procedure} -setup {
lappend x [.t index current]
} -result {2.1 3.2 3.2 3.2 3.2 3.2 4.3}
-test textTag-16.2 {TkTextPickCurrent procedure} -setup {
+test textTag-16.2 {TkTextPickCurrent procedure} -constraints {
+ haveFontSizes
+} -setup {
.t tag delete {*}[.t tag names]
event generate {} <Motion> -warp 1 -x -1 -y -1; update
+ set curFont [.t cget -font]
+ .t configure -font $textWidgetFont
} -body {
.t tag configure big -font $bigFont
event gen .t <ButtonRelease-1> -state 0x100 -x $x1 -y $y1
@@ -1326,6 +1342,7 @@ test textTag-16.2 {TkTextPickCurrent procedure} -setup {
lappend x [.t index current]
} -cleanup {
.t tag delete big
+ .t configure -font $curFont
} -result {3.2 3.1}
test textTag-16.3 {TkTextPickCurrent procedure} -setup {
@@ -1381,11 +1398,15 @@ test textTag-16.4 {TkTextPickCurrent procedure} -setup {
.t tag delete {*}[.t tag names]
} -result {enter-a enter-b enter-c | leave-c leave-b}
-test textTag-16.5 {TkTextPickCurrent procedure} -setup {
+test textTag-16.5 {TkTextPickCurrent procedure} -constraints {
+ haveFontSizes
+} -setup {
foreach i {big a b c d} {
.t tag remove $i 1.0 end
}
event generate {} <Motion> -warp 1 -x -1 -y -1; update
+ set curFont [.t cget -font]
+ .t configure -font $textWidgetFont
} -body {
.t tag configure big -font $bigFont
event gen .t <Motion> -x $x1 -y $y1
@@ -1395,13 +1416,18 @@ test textTag-16.5 {TkTextPickCurrent procedure} -setup {
.t index current
} -cleanup {
.t tag delete a big
+ .t configure -font $curFont
} -result {3.2}
-test textTag-16.6 {TkTextPickCurrent procedure} -setup {
+test textTag-16.6 {TkTextPickCurrent procedure} -constraints {
+ haveFontSizes
+} -setup {
foreach i {big a b c d} {
.t tag remove $i 1.0 end
}
event generate {} <Motion> -warp 1 -x -1 -y -1; update
+ set curFont [.t cget -font]
+ .t configure -font $textWidgetFont
} -body {
.t tag configure big -font $bigFont
event gen .t <Motion> -x $x1 -y $y1
@@ -1412,13 +1438,18 @@ test textTag-16.6 {TkTextPickCurrent procedure} -setup {
.t index current
} -cleanup {
.t tag delete a big
+ .t configure -font $curFont
} -result {3.1}
-test textTag-16.7 {TkTextPickCurrent procedure} -setup {
+test textTag-16.7 {TkTextPickCurrent procedure} -constraints {
+ haveFontSizes
+} -setup {
foreach i {big a b c d} {
.t tag remove $i 1.0 end
}
event generate {} <Motion> -warp 1 -x -1 -y -1; update
+ set curFont [.t cget -font]
+ .t configure -font $textWidgetFont
} -body {
.t tag configure big -font $bigFont
.t tag bind a <Enter> {.t tag add big 3.0 3.2}
@@ -1432,6 +1463,7 @@ test textTag-16.7 {TkTextPickCurrent procedure} -setup {
.t index current
} -cleanup {
.t tag delete a big
+ .t configure -font $curFont
} -result {3.1}