summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2018-02-10 14:53:23 (GMT)
committerfvogel <fvogelnew1@free.fr>2018-02-10 14:53:23 (GMT)
commit5e303e807463e38d0eeae4a46c666a5771ecf998 (patch)
tree293ea6a9e38403ca87e59f04c60892c7b62019c6 /tests
parenteb43c80f1395097a55840d6a33819e5a51545f1c (diff)
parentf03f24b4fea573c6aa66e02273d26795202380c2 (diff)
downloadtk-5e303e807463e38d0eeae4a46c666a5771ecf998.zip
tk-5e303e807463e38d0eeae4a46c666a5771ecf998.tar.gz
tk-5e303e807463e38d0eeae4a46c666a5771ecf998.tar.bz2
merge core-8-6-branch
Diffstat (limited to 'tests')
-rw-r--r--tests/text.test108
-rw-r--r--tests/textTag.test1
2 files changed, 107 insertions, 2 deletions
diff --git a/tests/text.test b/tests/text.test
index 07192e8..5b688f1 100644
--- a/tests/text.test
+++ b/tests/text.test
@@ -6395,9 +6395,9 @@ test text-27.14a {<<Modified>> virtual event - propagation to peers} -body {
} -cleanup {
destroy .t .tt
} -result {4}
-test text-27.15 {<<Selection>> virtual event} -body {
+test text-27.15 {<<Selection>> virtual event on sel tagging} -body {
set ::retval no_selection
- pack [text .t -undo 1]
+ pack [text .t]
bind .t <<Selection>> "set ::retval selection_changed"
update idletasks
.t insert end "nothing special\n"
@@ -6407,6 +6407,110 @@ test text-27.15 {<<Selection>> virtual event} -body {
} -cleanup {
destroy .t
} -result {selection_changed}
+test text-27.15a {<<Selection>> virtual event on sel removal} -body {
+ set ::retval no_selection
+ pack [text .t]
+ .t insert end "nothing special\n"
+ .t tag add sel 1.0 1.1
+ bind .t <<Selection>> "set ::retval selection_changed"
+ update idletasks
+ .t tag remove 1.0 end
+ update
+ set ::retval
+} -cleanup {
+ destroy .t
+} -result {selection_changed}
+test text-27.15b {<<Selection>> virtual event on <<PasteSelection>> inside widget selection} -body {
+ pack [text .t]
+ .t insert end "There is a selection in this text widget,\n"
+ .t insert end "and it will be impacted by the <<PasteSelection>> event received.\n"
+ .t insert end "Therefore a <<Selection>> event must fire back."
+ .t tag add sel 1.0 1.28
+ bind .t <<Selection>> "set ::retval <<Selection>>_fired"
+ update
+ set ::retval no_<<Selection>>_event_fired
+ event generate .t <<PasteSelection>> -x 15 -y 3
+ update
+ set ::retval
+} -cleanup {
+ destroy .t
+} -result {<<Selection>>_fired}
+test text-27.15c {No <<Selection>> virtual event on <<PasteSelection>> outside widget selection} -body {
+ pack [text .t]
+ .t insert end "There is a selection in this text widget,\n"
+ .t insert end "but it will not be impacted by the <<PasteSelection>> event received."
+ .t tag add sel 1.0 1.28
+ bind .t <<Selection>> "set ::retval <<Selection>>_fired"
+ update
+ set ::retval no_<<Selection>>_event_fired
+ event generate .t <<PasteSelection>> -x 15 -y 80
+ update
+ set ::retval
+} -cleanup {
+ destroy .t
+} -result {no_<<Selection>>_event_fired}
+test text-27.15d {<<Selection>> virtual event on <Delete> with cursor inside selection} -body {
+ pack [text .t]
+ .t insert end "There is a selection in this text widget,\n"
+ .t insert end "and it will be impacted by the <Delete> event received.\n"
+ .t insert end "Therefore a <<Selection>> event must fire back."
+ .t tag add sel 1.0 1.28
+ bind .t <<Selection>> "set ::retval <<Selection>>_fired"
+ update
+ set ::retval no_<<Selection>>_event_fired
+ .t mark set insert 1.15
+ focus .t
+ event generate .t <Delete>
+ update
+ set ::retval
+} -cleanup {
+ destroy .t
+} -result {<<Selection>>_fired}
+test text-27.15e {No <<Selection>> virtual event on <Delete> with cursor outside selection} -body {
+ pack [text .t]
+ .t insert end "There is a selection in this text widget,\n"
+ .t insert end "but it will not be impacted by the <Delete> event received."
+ .t tag add sel 1.0 1.28
+ bind .t <<Selection>> "set ::retval <<Selection>>_fired"
+ update
+ set ::retval no_<<Selection>>_event_fired
+ .t mark set insert 2.15
+ focus .t
+ event generate .t <Delete>
+ update
+ set ::retval
+} -cleanup {
+ destroy .t
+} -result {no_<<Selection>>_event_fired}
+test text-27.15f {<<Selection>> virtual event on <<Cut>> with a widget selection} -body {
+ pack [text .t]
+ .t insert end "There is a selection in this text widget,\n"
+ .t insert end "and it will be impacted by the <<Cut>> event received.\n"
+ .t insert end "Therefore a <<Selection>> event must fire back."
+ .t tag add sel 1.0 1.28
+ bind .t <<Selection>> "set ::retval <<Selection>>_fired"
+ update
+ set ::retval no_<<Selection>>_event_fired
+ event generate .t <<Cut>>
+ update
+ set ::retval
+} -cleanup {
+ destroy .t
+} -result {<<Selection>>_fired}
+test text-27.15g {No <<Selection>> virtual event on <<Cut>> without widget selection} -body {
+ pack [text .t]
+ .t insert end "There is a selection in this text widget,\n"
+ .t insert end "and it will be impacted by the <<Cut>> event received.\n"
+ .t insert end "Therefore a <<Selection>> event must fire back."
+ bind .t <<Selection>> "set ::retval <<Selection>>_fired"
+ update
+ set ::retval no_<<Selection>>_event_fired
+ event generate .t <<Cut>>
+ update
+ set ::retval
+} -cleanup {
+ destroy .t
+} -result {no_<<Selection>>_event_fired}
test text-27.16 {-maxundo configuration option} -body {
text .t -undo 1 -autoseparators 1 -maxundo 2
pack .t
diff --git a/tests/textTag.test b/tests/textTag.test
index ddbaa3b..9bab5fb 100644
--- a/tests/textTag.test
+++ b/tests/textTag.test
@@ -1746,6 +1746,7 @@ test textTag-18.1 {TkTextPickCurrent tag bindings} -setup {
text .t -width 30 -height 4 -relief sunken -borderwidth 10 \
-highlightthickness 10 -pady 2
pack .t
+ update ; # map the window, otherwise -warp can't be done
.t insert end " Tag here " TAG " no tag here"
.t tag configure TAG -borderwidth 4 -relief raised