summaryrefslogtreecommitdiffstats
path: root/tests/text.test
diff options
context:
space:
mode:
authorhobbs <hobbs>2007-12-13 00:29:53 (GMT)
committerhobbs <hobbs>2007-12-13 00:29:53 (GMT)
commit3d75268cfe0948ae13452dc01b24cdba45c80201 (patch)
tree33056fe3801033c058441541f2c75af12cf992b2 /tests/text.test
parent8f401244434ca3ab876d8efa799317d9e41c59f1 (diff)
downloadtk-3d75268cfe0948ae13452dc01b24cdba45c80201.zip
tk-3d75268cfe0948ae13452dc01b24cdba45c80201.tar.gz
tk-3d75268cfe0948ae13452dc01b24cdba45c80201.tar.bz2
* generic/tkText.c (DeleteIndexRange, TextEditCmd, UpdateDirtyFlag):
* tests/text.test (text-25.10.1,25.11.[12]): Don't require [update idle] to trigger Modified event [Bug 1809538] Modified virtual event should only fire on state change [Bug 1799782] Make sure we delete chars before triggering <<Modified>> [Bug 1737288]
Diffstat (limited to 'tests/text.test')
-rw-r--r--tests/text.test37
1 files changed, 36 insertions, 1 deletions
diff --git a/tests/text.test b/tests/text.test
index 6306373..de6f460 100644
--- a/tests/text.test
+++ b/tests/text.test
@@ -6,7 +6,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: text.test,v 1.47 2007/12/11 22:14:58 dkf Exp $
+# RCS: @(#) $Id: text.test,v 1.48 2007/12/13 00:29:53 hobbs Exp $
package require tcltest 2.1
eval tcltest::configure $argv
@@ -3041,6 +3041,21 @@ test text-25.10 {TextEditCmd procedure, set modified flag} {
.t edit modified 1
.t edit modified
} {1}
+test text-25.10.1 {TextEditCmd procedure, set modified flag repeat} {
+ catch {destroy .t}
+ text .t
+ pack .t
+ set ::retval {}
+ bind .t <<Modified>> "lappend ::retval modified"
+ # Shouldn't require [update idle] to trigger event [Bug 1809538]
+ lappend ::retval [.t edit modified]
+ .t edit modified 1
+ update idletasks
+ lappend ::retval [.t edit modified]
+ .t edit modified 1 ; # binding should only fire once [Bug 1799782]
+ update idletasks
+ lappend ::retval [.t edit modified]
+} {0 modified 1 1}
test text-25.11 {<<Modified>> virtual event} {
set ::retval unmodified
catch {destroy .t}
@@ -3051,6 +3066,26 @@ test text-25.11 {<<Modified>> virtual event} {
.t insert end "nothing special\n"
set ::retval
} {modified}
+test text-25.11.1 {<<Modified>> virtual event - insert before Modified} {
+ set ::retval {}
+ destroy .t
+ pack [text .t -undo 1]
+ bind .t <<Modified>> { set ::retval [.t get 1.0 end-1c] }
+ update idletasks
+ .t insert end "nothing special"
+ set ::retval
+} {nothing special}
+test text-25.11.2 {<<Modified>> virtual event - delete before Modified} {
+ # Bug 1737288, make sure we delete chars before triggering <<Modified>>
+ set ::retval {}
+ destroy .t
+ pack [text .t -undo 1]
+ bind .t <<Modified>> { set ::retval [.t get 1.0 end-1c] }
+ .t insert end "nothing special"
+ .t edit modified 0
+ .t delete 1.0 1.2
+ set ::retval
+} {thing special}
test text-25.12 {<<Selection>> virtual event} {
set ::retval no_selection
catch {destroy .t}