summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2018-01-15 22:25:30 (GMT)
committerfvogel <fvogelnew1@free.fr>2018-01-15 22:25:30 (GMT)
commit20d035df8daad6946c62976f7c92c2e3e4109c67 (patch)
treebc76b2235d1152e3a97bcbecbce2f6183df82303
parent07a6cd2185de4b3d27104dad6178c841d0fcb4d9 (diff)
downloadtk-20d035df8daad6946c62976f7c92c2e3e4109c67.zip
tk-20d035df8daad6946c62976f7c92c2e3e4109c67.tar.gz
tk-20d035df8daad6946c62976f7c92c2e3e4109c67.tar.bz2
Add three (currently failing) tests text-27.15[abc] that will pass when <<Selection>> will fire from the text widget upon <<PasteSelection>>, <Delete> or <<Cut>>, when the text widget selection is impacted and it exports its selection (such events will therefore impact the PRIMARY selection, and this must trigger a <<Selection>> event)
-rw-r--r--tests/text.test51
1 files changed, 49 insertions, 2 deletions
diff --git a/tests/text.test b/tests/text.test
index 07192e8..9e8ed9b 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,53 @@ test text-27.15 {<<Selection>> virtual event} -body {
} -cleanup {
destroy .t
} -result {selection_changed}
+test text-27.15a {<<Selection>> virtual event on <<PasteSelection>>} -body {
+ pack [text .t -exportselection 1]
+ .t insert end "There is a PRIMARY selection in this text widget, "
+ .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.15b {<<Selection>> virtual event on <Delete>} -body {
+ pack [text .t -exportselection 1]
+ .t insert end "There is a PRIMARY selection in this text widget, "
+ .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.15c {<<Selection>> virtual event on <<Cut>>} -body {
+ pack [text .t -exportselection 1]
+ .t insert end "There is a PRIMARY selection in this text widget, "
+ .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.16 {-maxundo configuration option} -body {
text .t -undo 1 -autoseparators 1 -maxundo 2
pack .t