summaryrefslogtreecommitdiffstats
path: root/tests/unixSelect.test
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2008-10-30 21:50:08 (GMT)
committerdgp <dgp@users.sourceforge.net>2008-10-30 21:50:08 (GMT)
commit4dddde633cc58640988340836315bbb6b780b9da (patch)
treee365741580f6d5bb6e9c9d84dd49c304aa9e1a95 /tests/unixSelect.test
parentbc7cc1de3c6e12a43abe48282f8eeb413b3bb22a (diff)
downloadtk-4dddde633cc58640988340836315bbb6b780b9da.zip
tk-4dddde633cc58640988340836315bbb6b780b9da.tar.gz
tk-4dddde633cc58640988340836315bbb6b780b9da.tar.bz2
* tests/unixSelect.test: Revise the unixSelect-1.* tests so that
they test the ability of Tk's selection mechanism to faithfully pass valid Tcl values without corruption, and stop testing details of Tcl's internal encoding scheme. With this change, the Tk test suite no longer uses the identity encoding or [string bytelength].
Diffstat (limited to 'tests/unixSelect.test')
-rw-r--r--tests/unixSelect.test108
1 files changed, 41 insertions, 67 deletions
diff --git a/tests/unixSelect.test b/tests/unixSelect.test
index 08268b6..d2bcf50 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.11 2008/08/30 21:52:26 aniap Exp $
+# RCS: @(#) $Id: unixSelect.test,v 1.12 2008/10/30 21:50:08 dgp Exp $
package require tcltest 2.2
namespace import ::tcltest::*
@@ -117,13 +117,13 @@ test unixSelect-1.1 {TkSelGetSelection procedure: simple i18n text} -constraints
} -body {
pack [entry .e]
update
- .e insert 0 [encoding convertfrom identity \u00fcber]
+ .e insert 0 \u00fcber
.e selection range 0 end
- dobg {string bytelength [selection get]}
+ dobg {string length [selection get]}
} -cleanup {
cleanupbg
destroy .e
-} -result {5}
+} -result {4}
test unixSelect-1.2 {TkSelGetSelection procedure: simple i18n text, iso8859-1} -constraints {
unix
@@ -136,12 +136,10 @@ test unixSelect-1.2 {TkSelGetSelection procedure: simple i18n text, iso8859-1} -
.e insert 0 \u00fc\u0444
.e selection range 0 end
}
- set x [selection get]
- list [string equal \u00fc? $x] \
- [string length $x] [string bytelength $x]
+ selection get
} -cleanup {
cleanupbg
-} -result {1 2 3}
+} -result \u00fc?
test unixSelect-1.3 {TkSelGetSelection procedure: simple i18n text, iso2022} -constraints {
unix
@@ -156,13 +154,12 @@ test unixSelect-1.3 {TkSelGetSelection procedure: simple i18n text, iso2022} -co
set selInfo {}
set result [dobg {
set x [selection get -type COMPOUND_TEXT]
- list [string equal \u00fc\u0444 $x] \
- [string length $x] [string bytelength $x]
+ list [string equal \u00fc\u0444 $x] [string length $x]
}]
lappend result $selInfo
} -cleanup {
cleanupbg
-} -result {1 2 4 {COMPOUND_TEXT 0 4000}}
+} -result {1 2 {COMPOUND_TEXT 0 4000}}
test unixSelect-1.4 {TkSelGetSelection procedure: INCR i18n text, iso2022} -constraints {
unix
@@ -183,12 +180,12 @@ test unixSelect-1.4 {TkSelGetSelection procedure: INCR i18n text, iso2022} -cons
set x [selection get -type COMPOUND_TEXT]
list [string equal \
[string repeat x 3999]\u00fc\u0444[string repeat x 3999] $x] \
- [string length $x] [string bytelength $x]
+ [string length $x]
}]
lappend result $selInfo
} -cleanup {
cleanupbg
-} -result {1 8000 8002 {COMPOUND_TEXT 0 4000 COMPOUND_TEXT 4000 3999 COMPOUND_TEXT 7998 4000 COMPOUND_TEXT 0 4000 COMPOUND_TEXT 4000 3998 COMPOUND_TEXT 7997 4000}}
+} -result {1 8000 {COMPOUND_TEXT 0 4000 COMPOUND_TEXT 4000 3999 COMPOUND_TEXT 7998 4000 COMPOUND_TEXT 0 4000 COMPOUND_TEXT 4000 3998 COMPOUND_TEXT 7997 4000}}
test unixSelect-1.5 {TkSelGetSelection procedure: simple i18n text, iso2022} -constraints {
unix
@@ -203,26 +200,25 @@ test unixSelect-1.5 {TkSelGetSelection procedure: simple i18n text, iso2022} -co
set selInfo {}
set result [dobg {
set x [selection get -type COMPOUND_TEXT]
- list [string equal \u00fc\u0444 $x] \
- [string length $x] [string bytelength $x]
+ list [string equal \u00fc\u0444 $x] [string length $x]
}]
lappend result $selInfo
} -cleanup {
cleanupbg
-} -result {1 2 4 {COMPOUND_TEXT 0 4000}}
+} -result {1 2 {COMPOUND_TEXT 0 4000}}
test unixSelect-1.6 {TkSelGetSelection procedure: INCR i18n text} -constraints {
unix
} -setup {
setupbg
} -body {
- dobg "entry .e; pack .e; update
- .e insert 0 \[encoding convertfrom identity \\u00fcber\]$longValue
- .e selection range 0 end"
- string bytelength [selection get]
+ dobg [subst -nobackslashes {entry .e; pack .e; update
+ .e insert 0 \u00fcber$longValue
+ .e selection range 0 end}]
+ string length [selection get]
} -cleanup {
cleanupbg
-} -result [expr {5 + [string bytelength $longValue]}]
+} -result [expr {4 + [string length $longValue]}]
test unixSelect-1.7 {TkSelGetSelection procedure: INCR i18n text} -constraints {
unix
@@ -235,12 +231,10 @@ test unixSelect-1.7 {TkSelGetSelection procedure: INCR i18n text} -constraints {
.e insert 0 [string repeat x 3999]\u00fc
.e selection range 0 end
}
- set x [selection get]
- list [string equal [string repeat x 3999]\u00fc $x] \
- [string length $x] [string bytelength $x]
+ selection get
} -cleanup {
cleanupbg
-} -result {1 4000 4001}
+} -result [string repeat x 3999]\u00fc
test unixSelect-1.8 {TkSelGetSelection procedure: INCR i18n text} -constraints {
unix
@@ -253,12 +247,10 @@ test unixSelect-1.8 {TkSelGetSelection procedure: INCR i18n text} -constraints {
.e insert 0 \u00fc[string repeat x 3999]
.e selection range 0 end
}
- set x [selection get]
- list [string equal \u00fc[string repeat x 3999] $x] \
- [string length $x] [string bytelength $x]
+ selection get
} -cleanup {
cleanupbg
-} -result {1 4000 4001}
+} -result \u00fc[string repeat x 3999]
test unixSelect-1.9 {TkSelGetSelection procedure: INCR i18n text} -constraints {
unix
@@ -271,12 +263,10 @@ test unixSelect-1.9 {TkSelGetSelection procedure: INCR i18n text} -constraints {
.e insert 0 [string repeat x 3999]\u00fc[string repeat x 4000]
.e selection range 0 end
}
- set x [selection get]
- list [string equal [string repeat x 3999]\u00fc[string repeat x 4000] $x] \
- [string length $x] [string bytelength $x]
+ selection get
} -cleanup {
cleanupbg
-} -result {1 8000 8001}
+} -result [string repeat x 3999]\u00fc[string repeat x 4000]
# 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.
@@ -292,12 +282,10 @@ test unixSelect-1.10 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const
.e insert 0 [string repeat x 3999]\u00fc
.e selection range 0 end
}
- set x [selection get -type UTF8_STRING]
- list [string equal [string repeat x 3999]\u00fc $x] \
- [string length $x] [string bytelength $x]
+ selection get -type UTF8_STRING
} -cleanup {
cleanupbg
-} -result {1 4000 4001}
+} -result [string repeat x 3999]\u00fc
test unixSelect-1.11 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints {
unix
@@ -310,12 +298,10 @@ test unixSelect-1.11 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const
.e insert 0 \u00fc[string repeat x 3999]
.e selection range 0 end
}
- set x [selection get -type UTF8_STRING]
- list [string equal \u00fc[string repeat x 3999] $x] \
- [string length $x] [string bytelength $x]
+ selection get -type UTF8_STRING
} -cleanup {
cleanupbg
-} -result {1 4000 4001}
+} -result \u00fc[string repeat x 3999]
test unixSelect-1.12 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints {
unix
@@ -328,12 +314,10 @@ test unixSelect-1.12 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const
.e insert 0 [string repeat x 3999]\u00fc[string repeat x 4000]
.e selection range 0 end
}
- set x [selection get -type UTF8_STRING]
- list [string equal [string repeat x 3999]\u00fc[string repeat x 4000] $x] \
- [string length $x] [string bytelength $x]
+ selection get -type UTF8_STRING
} -cleanup {
cleanupbg
-} -result {1 8000 8001}
+} -result [string repeat x 3999]\u00fc[string repeat x 4000]
test unixSelect-1.13 {TkSelGetSelection procedure: simple i18n text, utf-8} -constraints {
unix
@@ -343,9 +327,9 @@ test unixSelect-1.13 {TkSelGetSelection procedure: simple i18n text, utf-8} -con
} -body {
pack [entry .e]
update
- .e insert 0 [encoding convertfrom identity \u00fcber\u0444]
+ .e insert 0 \u00fcber\u0444
.e selection range 0 end
- dobg {string bytelength [selection get -type UTF8_STRING]}
+ dobg {string length [selection get -type UTF8_STRING]}
} -cleanup {
destroy .e
cleanupbg
@@ -362,12 +346,10 @@ test unixSelect-1.14 {TkSelGetSelection procedure: simple i18n text, utf-8} -con
.e insert 0 \u00fc\u0444
.e selection range 0 end
}
- set x [selection get -type UTF8_STRING]
- list [string equal \u00fc\u0444 $x] \
- [string length $x] [string bytelength $x]
+ selection get -type UTF8_STRING
} -cleanup {
cleanupbg
-} -result {1 2 4}
+} -result \u00fc\u0444
test unixSelect-1.15 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints {
unix
@@ -380,12 +362,10 @@ test unixSelect-1.15 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const
.e insert 0 [string repeat [string repeat \u00c4\u00e4 50]\n 21]
.e selection range 0 end
}
- set x [selection get -type UTF8_STRING]
- list [string equal [string repeat [string repeat \u00c4\u00e4 50]\n 21] $x] \
- [string length $x] [string bytelength $x]
+ selection get -type UTF8_STRING
} -cleanup {
cleanupbg
-} -result {1 2121 4221}
+} -result [string repeat [string repeat \u00c4\u00e4 50]\n 21]
test unixSelect-1.16 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints {
unix
@@ -398,12 +378,10 @@ test unixSelect-1.16 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const
.e insert 0 i[string repeat [string repeat \u00c4\u00e4 50]\n 21]
.e selection range 0 end
}
- set x [selection get -type UTF8_STRING]
- list [string equal i[string repeat [string repeat \u00c4\u00e4 50]\n 21] $x] \
- [string length $x] [string bytelength $x]
+ selection get -type UTF8_STRING
} -cleanup {
cleanupbg
-} -result {1 2122 4222}
+} -result i[string repeat [string repeat \u00c4\u00e4 50]\n 21]
test unixSelect-1.17 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints {
unix
@@ -418,12 +396,10 @@ test unixSelect-1.17 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const
.t tag add sel 1.0 21.end+1c
}
after 10
- set x [selection get -type UTF8_STRING]
- list [string equal [string repeat [string repeat \u00c4\u00e4 50]\n 21] $x] \
- [string length $x] [string bytelength $x]
+ selection get -type UTF8_STRING
} -cleanup {
cleanupbg
-} -result {1 2121 4221}
+} -result [string repeat [string repeat \u00c4\u00e4 50]\n 21]
test unixSelect-1.18 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints {
unix
@@ -438,12 +414,10 @@ test unixSelect-1.18 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const
.t tag add sel 1.0 21.end+1c
}
after 10
- set x [selection get -type UTF8_STRING]
- list [string equal i[string repeat [string repeat \u00c4\u00e4 50]\n 21] $x] \
- [string length $x] [string bytelength $x]
+ selection get -type UTF8_STRING
} -cleanup {
cleanupbg
-} -result {1 2122 4222}
+} -result i[string repeat [string repeat \u00c4\u00e4 50]\n 21]
test unixSelect-1.19 {Automatic UTF8_STRING support for selection handle} -constraints {
unix