diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2002-09-30 13:42:24 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2002-09-30 13:42:24 (GMT) |
commit | 215b48f50b57d1e5b5857936236dae45f6f9af83 (patch) | |
tree | 124846f2dcff74b7175ff58e60340057201dd9f9 /tests | |
parent | 118ce59be7642a9ffb4b76067ae5196515b0ef26 (diff) | |
download | tk-215b48f50b57d1e5b5857936236dae45f6f9af83.zip tk-215b48f50b57d1e5b5857936236dae45f6f9af83.tar.gz tk-215b48f50b57d1e5b5857936236dae45f6f9af83.tar.bz2 |
Incremental transfers of UTF8_STRING selections should now work; Tk will now
tag them with the right size and only transfer complete UTF8 characters.
Previously, things only worked when the transfer could only happen in one go,
and even then not always. [Bug 614650, reported by Reinhard Max]
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unixSelect.test | 65 |
1 files changed, 64 insertions, 1 deletions
diff --git a/tests/unixSelect.test b/tests/unixSelect.test index cc93902..7fe26bc 100644 --- a/tests/unixSelect.test +++ b/tests/unixSelect.test @@ -9,7 +9,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: unixSelect.test,v 1.4 2002/07/13 20:28:36 dgp Exp $ +# RCS: @(#) $Id: unixSelect.test,v 1.5 2002/09/30 13:42:25 dkf Exp $ package require tcltest 2.1 namespace import -force tcltest::configure @@ -233,6 +233,69 @@ test unixSelect-1.10 {TkSelGetSelection procedure: INCR i18n text} {unixOnly} { list [string equal [string repeat x 3999]\u00fc[string repeat x 4000] $x] \ [string length $x] [string bytelength $x] } {1 8000 8001} +# Now some tests to make sure that the right thing is done when +# transferring UTF8 selections, to prevent [Bug 614650] and its ilk +# from rearing its ugly head again. +test unixSelect-1.11 {TkSelGetSelection procedure: INCR i18n text, utf-8} {unixOnly} { + setupbg + dobg { + entry .e; pack .e; update + .e insert 0 [string repeat x 3999]\u00fc + .e selection range 0 end + } + set x [selection get -type UTF8_STRING] + cleanupbg + list [string equal [string repeat x 3999]\u00fc $x] \ + [string length $x] [string bytelength $x] +} {1 4000 4001} +test unixSelect-1.12 {TkSelGetSelection procedure: INCR i18n text, utf-8} {unixOnly} { + setupbg + dobg { + entry .e; pack .e; update + .e insert 0 \u00fc[string repeat x 3999] + .e selection range 0 end + } + set x [selection get -type UTF8_STRING] + cleanupbg + list [string equal \u00fc[string repeat x 3999] $x] \ + [string length $x] [string bytelength $x] +} {1 4000 4001} +test unixSelect-1.13 {TkSelGetSelection procedure: INCR i18n text, utf-8} {unixOnly} { + setupbg + dobg { + entry .e; pack .e; update + .e insert 0 [string repeat x 3999]\u00fc[string repeat x 4000] + .e selection range 0 end + } + set x [selection get -type UTF8_STRING] + cleanupbg + list [string equal [string repeat x 3999]\u00fc[string repeat x 4000] $x] \ + [string length $x] [string bytelength $x] +} {1 8000 8001} +test unixSelect-1.14 {TkSelGetSelection procedure: simple i18n text, utf-8} {unixOnly} { + setupbg + entry .e + pack .e + update + .e insert 0 [encoding convertfrom identity \u00fcber\u0444] + .e selection range 0 end + set result [dobg {string bytelength [selection get -type UTF8_STRING]}] + cleanupbg + destroy .e + set result +} {5} +test unixSelect-1.15 {TkSelGetSelection procedure: simple i18n text, utf-8} {unixOnly} { + setupbg + dobg { + entry .e; pack .e; update + .e insert 0 \u00fc\u0444 + .e selection range 0 end + } + set x [selection get -type UTF8_STRING] + cleanupbg + list [string equal \u00fc\u0444 $x] \ + [string length $x] [string bytelength $x] +} {1 2 4} # cleanup ::tcltest::cleanupTests |