1 |
578 |
markom |
# This file is a Tcl script to test the code in the file tkTextDisp.c.
|
2 |
|
|
# This file is organized in the standard fashion for Tcl tests.
|
3 |
|
|
#
|
4 |
|
|
# Copyright (c) 1994 The Regents of the University of California.
|
5 |
|
|
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
|
6 |
|
|
#
|
7 |
|
|
# See the file "license.terms" for information on usage and redistribution
|
8 |
|
|
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
9 |
|
|
#
|
10 |
|
|
# RCS: @(#) $Id: textDisp.test,v 1.1.1.1 2002-01-16 10:26:00 markom Exp $
|
11 |
|
|
|
12 |
|
|
if {[string compare test [info procs test]] == 1} {
|
13 |
|
|
source defs
|
14 |
|
|
if {$testConfig(fonts) == 0} {
|
15 |
|
|
puts "skipping font-sensitive tests"
|
16 |
|
|
}
|
17 |
|
|
}
|
18 |
|
|
|
19 |
|
|
# The procedure below is used as the scrolling command for the text;
|
20 |
|
|
# it just saves the scrolling information in a variable "scrollInfo".
|
21 |
|
|
|
22 |
|
|
proc scroll args {
|
23 |
|
|
global scrollInfo
|
24 |
|
|
set scrollInfo $args
|
25 |
|
|
}
|
26 |
|
|
|
27 |
|
|
# The procedure below is used to generate errors during scrolling commands.
|
28 |
|
|
|
29 |
|
|
proc scrollError args {
|
30 |
|
|
error "scrolling error"
|
31 |
|
|
}
|
32 |
|
|
|
33 |
|
|
# Create entries in the option database to be sure that geometry options
|
34 |
|
|
# like border width have predictable values.
|
35 |
|
|
|
36 |
|
|
option add *Text.borderWidth 2
|
37 |
|
|
option add *Text.highlightThickness 2
|
38 |
|
|
|
39 |
|
|
# The frame .f is needed to make sure that the overall window is always
|
40 |
|
|
# fairly wide, even if the text window is very narrow. This is needed
|
41 |
|
|
# because some window managers don't allow the overall width of a window
|
42 |
|
|
# to get very narrow.
|
43 |
|
|
|
44 |
|
|
foreach i [winfo child .] {
|
45 |
|
|
destroy $i
|
46 |
|
|
}
|
47 |
|
|
frame .f -width 100 -height 20
|
48 |
|
|
pack append . .f left
|
49 |
|
|
|
50 |
|
|
if {$tcl_platform(platform) == "windows"} {
|
51 |
|
|
set fixedFont {Courier -14}
|
52 |
|
|
} else {
|
53 |
|
|
set fixedFont {Courier -12}
|
54 |
|
|
}
|
55 |
|
|
set fixedHeight [font metrics $fixedFont -linespace]
|
56 |
|
|
set fixedWidth [font measure $fixedFont m]
|
57 |
|
|
|
58 |
|
|
set varFont {Times -14}
|
59 |
|
|
set bigFont {Helvetica -24}
|
60 |
|
|
text .t -font $fixedFont -width 20 -height 10 -yscrollcommand scroll
|
61 |
|
|
pack append . .t {top expand fill}
|
62 |
|
|
.t tag configure big -font $bigFont
|
63 |
|
|
.t debug on
|
64 |
|
|
wm geometry . {}
|
65 |
|
|
|
66 |
|
|
# The statements below reset the main window; it's needed if the window
|
67 |
|
|
# manager is mwm to make mwm forget about a previous minimum size setting.
|
68 |
|
|
|
69 |
|
|
wm withdraw .
|
70 |
|
|
wm minsize . 1 1
|
71 |
|
|
wm positionfrom . user
|
72 |
|
|
wm deiconify .
|
73 |
|
|
update
|
74 |
|
|
|
75 |
|
|
# Some window managers (like olwm under SunOS 4.1.3) misbehave in a way
|
76 |
|
|
# that tends to march windows off the top and left of the screen. If
|
77 |
|
|
# this happens, some tests will fail because parts of the window will
|
78 |
|
|
# not need to be displayed (because they're off-screen). To keep this
|
79 |
|
|
# from happening, move the window if it's getting near the left or top
|
80 |
|
|
# edges of the screen.
|
81 |
|
|
|
82 |
|
|
if {([winfo rooty .] < 50) || ([winfo rootx .] < 50)} {
|
83 |
|
|
wm geom . +50+50
|
84 |
|
|
}
|
85 |
|
|
test textDisp-1.1 {GetStyle procedure, priorities and tab stops} {
|
86 |
|
|
.t delete 1.0 end
|
87 |
|
|
.t insert 1.0 "x\ty"
|
88 |
|
|
.t tag delete x y z
|
89 |
|
|
.t tag configure x -tabs {50}
|
90 |
|
|
.t tag configure y -foreground black
|
91 |
|
|
.t tag configure z -tabs {70}
|
92 |
|
|
.t tag add x 1.0 1.end
|
93 |
|
|
.t tag add y 1.0 1.end
|
94 |
|
|
.t tag add z 1.0 1.end
|
95 |
|
|
update idletasks
|
96 |
|
|
set x [lindex [.t bbox 1.2] 0]
|
97 |
|
|
.t tag configure z -tabs {}
|
98 |
|
|
lappend x [lindex [.t bbox 1.2] 0]
|
99 |
|
|
.t tag configure z -tabs {30}
|
100 |
|
|
.t tag raise x
|
101 |
|
|
update idletasks
|
102 |
|
|
lappend x [lindex [.t bbox 1.2] 0]
|
103 |
|
|
} {75 55 55}
|
104 |
|
|
.t tag delete x y z
|
105 |
|
|
test textDisp-1.2 {GetStyle procedure, wrapmode} {fonts} {
|
106 |
|
|
.t configure -wrap char
|
107 |
|
|
.t delete 1.0 end
|
108 |
|
|
.t insert 1.0 "abcd\nefg hijkl mnop qrstuv wxyz"
|
109 |
|
|
.t tag configure x -wrap word
|
110 |
|
|
.t tag configure y -wrap none
|
111 |
|
|
.t tag raise y
|
112 |
|
|
update
|
113 |
|
|
set result [list [.t bbox 2.20]]
|
114 |
|
|
.t tag add x 2.0 2.1
|
115 |
|
|
lappend result [.t bbox 2.20]
|
116 |
|
|
.t tag add y 1.end 2.2
|
117 |
|
|
lappend result [.t bbox 2.20]
|
118 |
|
|
} {{5 31 7 13} {40 31 7 13} {}}
|
119 |
|
|
.t tag delete x y
|
120 |
|
|
|
121 |
|
|
test textDisp-2.1 {LayoutDLine, basics} {
|
122 |
|
|
.t configure -wrap char
|
123 |
|
|
.t delete 1.0 end
|
124 |
|
|
.t insert 1.0 "This is some sample text for testing."
|
125 |
|
|
list [.t bbox 1.19] [.t bbox 1.20]
|
126 |
|
|
} [list [list [expr 5 + $fixedWidth * 19] 5 $fixedWidth $fixedHeight] [list 5 [expr 5 + $fixedHeight] $fixedWidth $fixedHeight]]
|
127 |
|
|
test textDisp-2.2 {LayoutDLine, basics} {fonts} {
|
128 |
|
|
.t configure -wrap char
|
129 |
|
|
.t delete 1.0 end
|
130 |
|
|
.t insert 1.0 "This isx some sample text for testing."
|
131 |
|
|
list [.t bbox 1.19] [.t bbox 1.20]
|
132 |
|
|
} {{138 5 7 13} {5 18 7 13}}
|
133 |
|
|
test textDisp-2.3 {LayoutDLine, basics} {fonts} {
|
134 |
|
|
.t configure -wrap char
|
135 |
|
|
.t delete 1.0 end
|
136 |
|
|
.t insert 1.0 "This isxxx some sample text for testing."
|
137 |
|
|
list [.t bbox 1.19] [.t bbox 1.20]
|
138 |
|
|
} {{138 5 7 13} {5 18 7 13}}
|
139 |
|
|
test textDisp-2.4 {LayoutDLine, word wrap} {fonts} {
|
140 |
|
|
.t configure -wrap word
|
141 |
|
|
.t delete 1.0 end
|
142 |
|
|
.t insert 1.0 "This is some sample text for testing."
|
143 |
|
|
list [.t bbox 1.19] [.t bbox 1.20]
|
144 |
|
|
} {{138 5 7 13} {5 18 7 13}}
|
145 |
|
|
test textDisp-2.5 {LayoutDLine, word wrap} {fonts} {
|
146 |
|
|
.t configure -wrap word
|
147 |
|
|
.t delete 1.0 end
|
148 |
|
|
.t insert 1.0 "This isx some sample text for testing."
|
149 |
|
|
list [.t bbox 1.13] [.t bbox 1.14] [.t bbox 1.19]
|
150 |
|
|
} {{96 5 49 13} {5 18 7 13} {40 18 7 13}}
|
151 |
|
|
test textDisp-2.6 {LayoutDLine, word wrap} {fonts} {
|
152 |
|
|
.t configure -wrap word
|
153 |
|
|
.t delete 1.0 end
|
154 |
|
|
.t insert 1.0 "This isxxx some sample text for testing."
|
155 |
|
|
list [.t bbox 1.15] [.t bbox 1.16]
|
156 |
|
|
} {{110 5 35 13} {5 18 7 13}}
|
157 |
|
|
test textDisp-2.7 {LayoutDLine, marks and tags} {fonts} {
|
158 |
|
|
.t configure -wrap word
|
159 |
|
|
.t delete 1.0 end
|
160 |
|
|
.t insert 1.0 "This isxxx some sample text for testing."
|
161 |
|
|
.t tag add foo 1.4 1.6
|
162 |
|
|
.t mark set insert 1.8
|
163 |
|
|
list [.t bbox 1.2] [.t bbox 1.5] [.t bbox 1.11]
|
164 |
|
|
} {{19 5 7 13} {40 5 7 13} {82 5 7 13}}
|
165 |
|
|
foreach m [.t mark names] {
|
166 |
|
|
catch {.t mark unset $m}
|
167 |
|
|
}
|
168 |
|
|
scan [wm geom .] %dx%d width height
|
169 |
|
|
test textDisp-2.8 {LayoutDLine, extra chunk at end of dline} {fonts} {
|
170 |
|
|
wm geom . [expr $width+1]x$height
|
171 |
|
|
update
|
172 |
|
|
.t configure -wrap char
|
173 |
|
|
.t delete 1.0 end
|
174 |
|
|
.t insert 1.0 "This isxx some sample text for testing."
|
175 |
|
|
.t mark set foo 1.20
|
176 |
|
|
list [.t bbox 1.19] [.t bbox 1.20]
|
177 |
|
|
} {{138 5 8 13} {5 18 7 13}}
|
178 |
|
|
wm geom . {}
|
179 |
|
|
update
|
180 |
|
|
test textDisp-2.9 {LayoutDLine, marks and tags} {fonts} {
|
181 |
|
|
.t configure -wrap word
|
182 |
|
|
.t delete 1.0 end
|
183 |
|
|
.t insert 1.0 "This is a very_very_long_word_that_wraps."
|
184 |
|
|
list [.t bbox 1.9] [.t bbox 1.10] [.t bbox 1.25]
|
185 |
|
|
} {{68 5 77 13} {5 18 7 13} {110 18 7 13}}
|
186 |
|
|
test textDisp-2.10 {LayoutDLine, marks and tags} {fonts} {
|
187 |
|
|
.t configure -wrap word
|
188 |
|
|
.t delete 1.0 end
|
189 |
|
|
.t insert 1.0 "This is a very_very_long_word_that_wraps."
|
190 |
|
|
.t tag add foo 1.13
|
191 |
|
|
.t tag add foo 1.15
|
192 |
|
|
.t tag add foo 1.17
|
193 |
|
|
.t tag add foo 1.19
|
194 |
|
|
list [.t bbox 1.9] [.t bbox 1.10] [.t bbox 1.25]
|
195 |
|
|
} {{68 5 77 13} {5 18 7 13} {110 18 7 13}}
|
196 |
|
|
test textDisp-2.11 {LayoutDLine, newline width} {fonts} {
|
197 |
|
|
.t configure -wrap char
|
198 |
|
|
.t delete 1.0 end
|
199 |
|
|
.t insert 1.0 "a\nbb\nccc\ndddd"
|
200 |
|
|
list [.t bbox 2.2] [.t bbox 3.3]
|
201 |
|
|
} {{19 18 126 13} {26 31 119 13}}
|
202 |
|
|
test textDisp-2.12 {LayoutDLine, justification} {fonts} {
|
203 |
|
|
.t configure -wrap char
|
204 |
|
|
.t delete 1.0 end
|
205 |
|
|
.t insert 1.0 "\na\nbb\nccc\ndddd"
|
206 |
|
|
.t tag configure x -justify center
|
207 |
|
|
.t tag add x 1.0 end
|
208 |
|
|
.t tag add y 3.0 3.2
|
209 |
|
|
list [.t bbox 1.0] [.t bbox 2.0] [.t bbox 4.0] [.t bbox 4.2]
|
210 |
|
|
} {{75 5 70 13} {71 18 7 13} {64 44 7 13} {78 44 7 13}}
|
211 |
|
|
test textDisp-2.13 {LayoutDLine, justification} {fonts} {
|
212 |
|
|
.t configure -wrap char
|
213 |
|
|
.t delete 1.0 end
|
214 |
|
|
.t insert 1.0 "\na\nbb\nccc\ndddd"
|
215 |
|
|
.t tag configure x -justify right
|
216 |
|
|
.t tag add x 1.0 end
|
217 |
|
|
.t tag add y 3.0 3.2
|
218 |
|
|
list [.t bbox 1.0] [.t bbox 2.0] [.t bbox 4.0] [.t bbox 4.2]
|
219 |
|
|
} {{145 5 0 13} {138 18 7 13} {124 44 7 13} {138 44 7 13}}
|
220 |
|
|
test textDisp-2.14 {LayoutDLine, justification} {fonts} {
|
221 |
|
|
.t configure -wrap char
|
222 |
|
|
.t delete 1.0 end
|
223 |
|
|
.t insert 1.0 "\na\nbb\nccc\ndddd"
|
224 |
|
|
.t tag configure x -justify center
|
225 |
|
|
.t tag add x 2.0 3.1
|
226 |
|
|
.t tag configure y -justify right
|
227 |
|
|
.t tag add y 3.0 4.0
|
228 |
|
|
.t tag raise y
|
229 |
|
|
list [.t bbox 2.0] [.t bbox 3.0] [.t bbox 3.end] [.t bbox 4.0]
|
230 |
|
|
} {{71 18 7 13} {131 31 7 13} {145 31 0 13} {5 44 7 13}}
|
231 |
|
|
test textDisp-2.15 {LayoutDLine, justification} {fonts} {
|
232 |
|
|
.t configure -wrap char
|
233 |
|
|
.t delete 1.0 end
|
234 |
|
|
.t insert 1.0 "\na\nbb\nccc\ndddd"
|
235 |
|
|
.t tag configure x -justify center
|
236 |
|
|
.t tag add x 2.0 3.1
|
237 |
|
|
.t tag configure y -justify right
|
238 |
|
|
.t tag add y 3.0 4.0
|
239 |
|
|
.t tag lower y
|
240 |
|
|
list [.t bbox 2.0] [.t bbox 3.0] [.t bbox 3.end] [.t bbox 4.0]
|
241 |
|
|
} {{71 18 7 13} {68 31 7 13} {82 31 63 13} {5 44 7 13}}
|
242 |
|
|
test textDisp-2.16 {LayoutDLine, justification} {fonts} {
|
243 |
|
|
.t configure -wrap word
|
244 |
|
|
.t delete 1.0 end
|
245 |
|
|
.t insert 1.0 "Lots of long words, enough to force word wrap\nThen\nmore lines"
|
246 |
|
|
.t tag configure x -justify center
|
247 |
|
|
.t tag add x 1.1 1.20
|
248 |
|
|
.t tag add x 1.21 1.end
|
249 |
|
|
list [.t bbox 1.0] [.t bbox 1.20] [.t bbox 1.36] [.t bbox 2.0]
|
250 |
|
|
} {{5 5 7 13} {5 18 7 13} {43 31 7 13} {5 44 7 13}}
|
251 |
|
|
test textDisp-2.17 {LayoutDLine, justification} {fonts} {
|
252 |
|
|
.t configure -wrap word
|
253 |
|
|
.t delete 1.0 end
|
254 |
|
|
.t insert 1.0 "Lots of long words, enough to force word wrap\nThen\nmore lines"
|
255 |
|
|
.t tag configure x -justify center
|
256 |
|
|
.t tag add x 1.20
|
257 |
|
|
list [.t bbox 1.0] [.t bbox 1.20] [.t bbox 1.36] [.t bbox 2.0]
|
258 |
|
|
} {{5 5 7 13} {19 18 7 13} {5 31 7 13} {5 44 7 13}}
|
259 |
|
|
test textDisp-2.18 {LayoutDLine, justification} {fonts} {
|
260 |
|
|
.t configure -wrap none
|
261 |
|
|
.t delete 1.0 end
|
262 |
|
|
.t insert 1.0 "Lots of long words, enough to extend out of the window\n"
|
263 |
|
|
.t insert end "Then\nmore lines\nThat are shorter"
|
264 |
|
|
.t tag configure x -justify center
|
265 |
|
|
.t tag configure y -justify right
|
266 |
|
|
.t tag add x 2.0
|
267 |
|
|
.t tag add y 3.0
|
268 |
|
|
.t xview scroll 5 units
|
269 |
|
|
list [.t bbox 2.0] [.t bbox 3.0]
|
270 |
|
|
} {{26 18 7 13} {40 31 7 13}}
|
271 |
|
|
.t tag delete x
|
272 |
|
|
.t tag delete y
|
273 |
|
|
test textDisp-2.19 {LayoutDLine, margins} {fonts} {
|
274 |
|
|
.t configure -wrap word
|
275 |
|
|
.t delete 1.0 end
|
276 |
|
|
.t insert 1.0 "Lots of long words, enough to force word wrap\nThen\nmore lines"
|
277 |
|
|
.t tag configure x -lmargin1 20 -lmargin2 40 -rmargin 15
|
278 |
|
|
.t tag add x 1.0 end
|
279 |
|
|
list [.t bbox 1.0] [.t bbox 1.12] [.t bbox 1.13] [.t bbox 2.0]
|
280 |
|
|
} {{25 5 7 13} {109 5 36 13} {45 18 7 13} {25 70 7 13}}
|
281 |
|
|
test textDisp-2.20 {LayoutDLine, margins} {fonts} {
|
282 |
|
|
.t configure -wrap word
|
283 |
|
|
.t delete 1.0 end
|
284 |
|
|
.t insert 1.0 "Lots of long words, enough to force word wrap\nThen\nmore lines"
|
285 |
|
|
.t tag configure x -lmargin1 20 -lmargin2 10 -rmargin 3
|
286 |
|
|
.t tag configure y -lmargin1 15 -lmargin2 5 -rmargin 0
|
287 |
|
|
.t tag raise y
|
288 |
|
|
.t tag add x 1.0 end
|
289 |
|
|
.t tag add y 1.13
|
290 |
|
|
list [.t bbox 1.0] [.t bbox 1.13] [.t bbox 1.30] [.t bbox 2.0]
|
291 |
|
|
} {{25 5 7 13} {10 18 7 13} {15 31 7 13} {25 44 7 13}}
|
292 |
|
|
test textDisp-2.21 {LayoutDLine, margins} {fonts} {
|
293 |
|
|
.t configure -wrap word
|
294 |
|
|
.t delete 1.0 end
|
295 |
|
|
.t insert 1.0 "Sample text"
|
296 |
|
|
.t tag configure x -lmargin1 80 -lmargin2 80 -rmargin 100
|
297 |
|
|
.t tag add x 1.0 end
|
298 |
|
|
list [.t bbox 1.0] [.t bbox 1.1] [.t bbox 1.2]
|
299 |
|
|
} {{85 5 60 13} {85 18 60 13} {85 31 60 13}}
|
300 |
|
|
.t tag delete x
|
301 |
|
|
.t tag delete y
|
302 |
|
|
test textDisp-2.22 {LayoutDLine, spacing options} {fonts} {
|
303 |
|
|
.t configure -wrap word
|
304 |
|
|
.t delete 1.0 end
|
305 |
|
|
.t tag delete x y
|
306 |
|
|
.t insert end "Short line\nLine 2 is long enough "
|
307 |
|
|
.t insert end "to wrap around a couple of times"
|
308 |
|
|
.t insert end "\nLine 3\nLine 4"
|
309 |
|
|
set i [.t dlineinfo 1.0]
|
310 |
|
|
set b1 [expr [lindex $i 1] + [lindex $i 4]]
|
311 |
|
|
set i [.t dlineinfo 2.0]
|
312 |
|
|
set b2 [expr [lindex $i 1] + [lindex $i 4]]
|
313 |
|
|
set i [.t dlineinfo 2.end]
|
314 |
|
|
set b3 [expr [lindex $i 1] + [lindex $i 4]]
|
315 |
|
|
set i [.t dlineinfo 3.0]
|
316 |
|
|
set b4 [expr [lindex $i 1] + [lindex $i 4]]
|
317 |
|
|
.t configure -spacing1 2 -spacing2 1 -spacing3 3
|
318 |
|
|
set i [.t dlineinfo 1.0]
|
319 |
|
|
set b1 [expr [lindex $i 1] + [lindex $i 4] - $b1]
|
320 |
|
|
set i [.t dlineinfo 2.0]
|
321 |
|
|
set b2 [expr [lindex $i 1] + [lindex $i 4] - $b2]
|
322 |
|
|
set i [.t dlineinfo 2.end]
|
323 |
|
|
set b3 [expr [lindex $i 1] + [lindex $i 4] - $b3]
|
324 |
|
|
set i [.t dlineinfo 3.0]
|
325 |
|
|
set b4 [expr [lindex $i 1] + [lindex $i 4] - $b4]
|
326 |
|
|
list $b1 $b2 $b3 $b4
|
327 |
|
|
} {2 7 10 15}
|
328 |
|
|
.t configure -spacing1 0 -spacing2 0 -spacing3 0
|
329 |
|
|
test textDisp-2.23 {LayoutDLine, spacing options} {fonts} {
|
330 |
|
|
.t configure -wrap word
|
331 |
|
|
.t delete 1.0 end
|
332 |
|
|
.t tag delete x y
|
333 |
|
|
.t insert end "Short line\nLine 2 is long enough "
|
334 |
|
|
.t insert end "to wrap around a couple of times"
|
335 |
|
|
.t insert end "\nLine 3\nLine 4"
|
336 |
|
|
set i [.t dlineinfo 1.0]
|
337 |
|
|
set b1 [expr [lindex $i 1] + [lindex $i 4]]
|
338 |
|
|
set i [.t dlineinfo 2.0]
|
339 |
|
|
set b2 [expr [lindex $i 1] + [lindex $i 4]]
|
340 |
|
|
set i [.t dlineinfo 2.end]
|
341 |
|
|
set b3 [expr [lindex $i 1] + [lindex $i 4]]
|
342 |
|
|
set i [.t dlineinfo 3.0]
|
343 |
|
|
set b4 [expr [lindex $i 1] + [lindex $i 4]]
|
344 |
|
|
.t configure -spacing1 4 -spacing2 4 -spacing3 4
|
345 |
|
|
.t tag configure x -spacing1 1 -spacing2 2 -spacing3 3
|
346 |
|
|
.t tag add x 1.0 end
|
347 |
|
|
.t tag configure y -spacing1 0 -spacing2 3
|
348 |
|
|
.t tag add y 2.19 end
|
349 |
|
|
.t tag raise y
|
350 |
|
|
set i [.t dlineinfo 1.0]
|
351 |
|
|
set b1 [expr [lindex $i 1] + [lindex $i 4] - $b1]
|
352 |
|
|
set i [.t dlineinfo 2.0]
|
353 |
|
|
set b2 [expr [lindex $i 1] + [lindex $i 4] - $b2]
|
354 |
|
|
set i [.t dlineinfo 2.end]
|
355 |
|
|
set b3 [expr [lindex $i 1] + [lindex $i 4] - $b3]
|
356 |
|
|
set i [.t dlineinfo 3.0]
|
357 |
|
|
set b4 [expr [lindex $i 1] + [lindex $i 4] - $b4]
|
358 |
|
|
list $b1 $b2 $b3 $b4
|
359 |
|
|
} {1 5 13 16}
|
360 |
|
|
.t configure -spacing1 0 -spacing2 0 -spacing3 0
|
361 |
|
|
test textDisp-2.24 {LayoutDLine, tabs, saving from first chunk} {fonts} {
|
362 |
|
|
.t delete 1.0 end
|
363 |
|
|
.t tag delete x y
|
364 |
|
|
.t tag configure x -tabs 70
|
365 |
|
|
.t tag configure y -tabs 80
|
366 |
|
|
.t insert 1.0 "ab\tcde"
|
367 |
|
|
.t tag add x 1.0 end
|
368 |
|
|
.t tag add y 1.1 end
|
369 |
|
|
lindex [.t bbox 1.3] 0
|
370 |
|
|
} {75}
|
371 |
|
|
test textDisp-2.25 {LayoutDLine, tabs, breaking chunks at tabs} {fonts} {
|
372 |
|
|
.t delete 1.0 end
|
373 |
|
|
.t tag delete x
|
374 |
|
|
.t tag configure x -tabs {30 60 90 120}
|
375 |
|
|
.t insert 1.0 "a\tb\tc\td\te"
|
376 |
|
|
.t mark set dummy1 1.1
|
377 |
|
|
.t mark set dummy2 1.2
|
378 |
|
|
.t tag add x 1.0 end
|
379 |
|
|
list [lindex [.t bbox 1.2] 0] [lindex [.t bbox 1.4] 0] \
|
380 |
|
|
[lindex [.t bbox 1.6] 0] [lindex [.t bbox 1.8] 0]
|
381 |
|
|
} {35 65 95 125}
|
382 |
|
|
test textDisp-2.26 {LayoutDLine, tabs, breaking chunks at tabs} {fonts} {
|
383 |
|
|
.t delete 1.0 end
|
384 |
|
|
.t tag delete x
|
385 |
|
|
.t tag configure x -tabs {30 60 90 120} -justify right
|
386 |
|
|
.t insert 1.0 "a\tb\tc\td\te"
|
387 |
|
|
.t mark set dummy1 1.1
|
388 |
|
|
.t mark set dummy2 1.2
|
389 |
|
|
.t tag add x 1.0 end
|
390 |
|
|
list [lindex [.t bbox 1.2] 0] [lindex [.t bbox 1.4] 0] \
|
391 |
|
|
[lindex [.t bbox 1.6] 0] [lindex [.t bbox 1.8] 0]
|
392 |
|
|
} {117 124 131 138}
|
393 |
|
|
test textDisp-2.27 {LayoutDLine, tabs, calling AdjustForTab} {fonts} {
|
394 |
|
|
.t delete 1.0 end
|
395 |
|
|
.t tag delete x
|
396 |
|
|
.t tag configure x -tabs {30 60}
|
397 |
|
|
.t insert 1.0 "a\tb\tcd"
|
398 |
|
|
.t tag add x 1.0 end
|
399 |
|
|
list [lindex [.t bbox 1.2] 0] [lindex [.t bbox 1.4] 0]
|
400 |
|
|
} {35 65}
|
401 |
|
|
test textDisp-2.28 {LayoutDLine, tabs, running out of space in dline} {fonts} {
|
402 |
|
|
.t delete 1.0 end
|
403 |
|
|
.t insert 1.0 "a\tb\tc\td"
|
404 |
|
|
.t bbox 1.6
|
405 |
|
|
} {5 18 7 13}
|
406 |
|
|
test textDisp-2.29 {LayoutDLine, tabs, running out of space in dline} {fonts} {
|
407 |
|
|
.t delete 1.0 end
|
408 |
|
|
.t insert 1.0 "a\tx\tabcd"
|
409 |
|
|
.t bbox 1.4
|
410 |
|
|
} {117 5 7 13}
|
411 |
|
|
test textDisp-2.30 {LayoutDLine, tabs, running out of space in dline} {fonts} {
|
412 |
|
|
.t delete 1.0 end
|
413 |
|
|
.t insert 1.0 "a\tx\tabc"
|
414 |
|
|
.t bbox 1.4
|
415 |
|
|
} {117 5 7 13}
|
416 |
|
|
|
417 |
|
|
test textDisp-3.1 {different character sizes} {fonts} {
|
418 |
|
|
.t configure -wrap word
|
419 |
|
|
.t delete 1.0 end
|
420 |
|
|
.t insert end "Some sample text, including both large\n"
|
421 |
|
|
.t insert end "characters and\nsmall\n"
|
422 |
|
|
.t insert end "abc\nd\ne\nfghij"
|
423 |
|
|
.t tag add big 1.5 1.10
|
424 |
|
|
.t tag add big 2.11 2.14
|
425 |
|
|
list [.t bbox 1.1] [.t bbox 1.6] [.t dlineinfo 1.0] [.t dlineinfo 3.0]
|
426 |
|
|
} {{12 17 7 13} {52 5 13 27} {5 5 114 27 22} {5 85 35 13 10}}
|
427 |
|
|
|
428 |
|
|
.t configure -wrap char
|
429 |
|
|
test textDisp-4.1 {UpdateDisplayInfo, basic} {fonts} {
|
430 |
|
|
.t delete 1.0 end
|
431 |
|
|
.t insert end "Line 1\nLine 2\nLine 3\n"
|
432 |
|
|
update
|
433 |
|
|
.t delete 2.0 2.end
|
434 |
|
|
.t insert 2.0 "New Line 2"
|
435 |
|
|
update
|
436 |
|
|
list [.t bbox 1.0] [.t bbox 2.0] [.t bbox 3.0] $tk_textRelayout
|
437 |
|
|
} {{5 5 7 13} {5 18 7 13} {5 31 7 13} 2.0}
|
438 |
|
|
test textDisp-4.2 {UpdateDisplayInfo, re-use tail of text line} {fonts} {
|
439 |
|
|
.t delete 1.0 end
|
440 |
|
|
.t insert end "Line 1\nLine 2 is so long that it wraps around\nLine 3"
|
441 |
|
|
update
|
442 |
|
|
.t mark set x 2.21
|
443 |
|
|
.t delete 2.2
|
444 |
|
|
.t insert 2.0 X
|
445 |
|
|
update
|
446 |
|
|
list [.t bbox 2.0] [.t bbox x] [.t bbox 3.0] $tk_textRelayout
|
447 |
|
|
} {{5 18 7 13} {12 31 7 13} {5 44 7 13} {2.0 2.20}}
|
448 |
|
|
test textDisp-4.3 {UpdateDisplayInfo, tail of text line shifts} {fonts} {
|
449 |
|
|
.t delete 1.0 end
|
450 |
|
|
.t insert end "Line 1\nLine 2 is so long that it wraps around\nLine 3"
|
451 |
|
|
update
|
452 |
|
|
.t mark set x 2.21
|
453 |
|
|
.t delete 2.2
|
454 |
|
|
update
|
455 |
|
|
list [.t bbox 2.0] [.t bbox x] [.t bbox 3.0] $tk_textRelayout
|
456 |
|
|
} {{5 18 7 13} {5 31 7 13} {5 44 7 13} {2.0 2.20}}
|
457 |
|
|
.t mark unset x
|
458 |
|
|
test textDisp-4.4 {UpdateDisplayInfo, wrap-mode "none"} {fonts} {
|
459 |
|
|
.t configure -wrap none
|
460 |
|
|
.t delete 1.0 end
|
461 |
|
|
.t insert end "Line 1\nLine 2 is so long that it wraps around\nLine 3"
|
462 |
|
|
update
|
463 |
|
|
list [.t bbox 2.0] [.t bbox 2.25] [.t bbox 3.0] $tk_textRelayout
|
464 |
|
|
} {{5 18 7 13} {} {5 31 7 13} {1.0 2.0 3.0}}
|
465 |
|
|
test textDisp-4.5 {UpdateDisplayInfo, tiny window} {fonts} {
|
466 |
|
|
wm geom . 103x$height
|
467 |
|
|
update
|
468 |
|
|
.t configure -wrap none
|
469 |
|
|
.t delete 1.0 end
|
470 |
|
|
.t insert end "Line 1\nLine 2 is so long that it wraps around\nLine 3"
|
471 |
|
|
update
|
472 |
|
|
list [.t bbox 2.0] [.t bbox 2.1] [.t bbox 3.0] $tk_textRelayout
|
473 |
|
|
} {{5 18 1 13} {} {5 31 1 13} {1.0 2.0 3.0}}
|
474 |
|
|
test textDisp-4.6 {UpdateDisplayInfo, tiny window} {
|
475 |
|
|
# This test was failing on Windows because the title bar on .
|
476 |
|
|
# was a certain minimum size and it was interfering with the size
|
477 |
|
|
# requested. The "overrideredirect" gets rid of the titlebar so
|
478 |
|
|
# the toplevel can shrink to the appropriate size. On Unix, setting
|
479 |
|
|
# the overrideredirect on "." confuses the window manager and
|
480 |
|
|
# causes subsequent tests to fail.
|
481 |
|
|
|
482 |
|
|
if {$tcl_platform(platform) == "windows"} {
|
483 |
|
|
wm overrideredirect . 1
|
484 |
|
|
}
|
485 |
|
|
frame .f2 -width 20 -height 100
|
486 |
|
|
pack before .f .f2 top
|
487 |
|
|
wm geom . 103x103
|
488 |
|
|
update
|
489 |
|
|
.t configure -wrap none -borderwidth 2
|
490 |
|
|
.t delete 1.0 end
|
491 |
|
|
.t insert end "Line 1\nLine 2 is so long that it wraps around\nLine 3"
|
492 |
|
|
update
|
493 |
|
|
set x [list [.t bbox 1.0] [.t bbox 2.0] $tk_textRelayout]
|
494 |
|
|
wm overrideredirect . 0
|
495 |
|
|
update
|
496 |
|
|
set x
|
497 |
|
|
} {{5 5 1 1} {} 1.0}
|
498 |
|
|
catch {destroy .f2}
|
499 |
|
|
.t configure -borderwidth 0 -wrap char
|
500 |
|
|
wm geom . {}
|
501 |
|
|
update
|
502 |
|
|
test textDisp-4.7 {UpdateDisplayInfo, filling in extra vertical space} {
|
503 |
|
|
# This test was failing on Windows because the title bar on .
|
504 |
|
|
# was a certain minimum size and it was interfering with the size
|
505 |
|
|
# requested. The "overrideredirect" gets rid of the titlebar so
|
506 |
|
|
# the toplevel can shrink to the appropriate size. On Unix, setting
|
507 |
|
|
# the overrideredirect on "." confuses the window manager and
|
508 |
|
|
# causes subsequent tests to fail.
|
509 |
|
|
|
510 |
|
|
if {$tcl_platform(platform) == "windows"} {
|
511 |
|
|
wm overrideredirect . 1
|
512 |
|
|
}
|
513 |
|
|
.t delete 1.0 end
|
514 |
|
|
.t insert end "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17"
|
515 |
|
|
.t yview 1.0
|
516 |
|
|
update
|
517 |
|
|
.t yview 16.0
|
518 |
|
|
update
|
519 |
|
|
set x [list [.t index @0,0] $tk_textRelayout $tk_textRedraw]
|
520 |
|
|
wm overrideredirect . 0
|
521 |
|
|
update
|
522 |
|
|
set x
|
523 |
|
|
} {8.0 {16.0 17.0 15.0 14.0 13.0 12.0 11.0 10.0 9.0 8.0} {8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0}}
|
524 |
|
|
test textDisp-4.8 {UpdateDisplayInfo, filling in extra vertical space} {
|
525 |
|
|
.t delete 1.0 end
|
526 |
|
|
.t insert end "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17"
|
527 |
|
|
.t yview 16.0
|
528 |
|
|
update
|
529 |
|
|
.t delete 5.0 14.0
|
530 |
|
|
update
|
531 |
|
|
set x [list [.t index @0,0] $tk_textRelayout $tk_textRedraw]
|
532 |
|
|
} {1.0 {5.0 4.0 3.0 2.0 1.0} {1.0 2.0 3.0 4.0 5.0 eof}}
|
533 |
|
|
test textDisp-4.9 {UpdateDisplayInfo, filling in extra vertical space} {fonts} {
|
534 |
|
|
.t delete 1.0 end
|
535 |
|
|
.t insert end "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17"
|
536 |
|
|
.t yview 16.0
|
537 |
|
|
update
|
538 |
|
|
.t delete 15.0 end
|
539 |
|
|
list [.t bbox 7.0] [.t bbox 12.0]
|
540 |
|
|
} {{3 29 7 13} {3 94 7 13}}
|
541 |
|
|
test textDisp-4.10 {UpdateDisplayInfo, filling in extra vertical space} {
|
542 |
|
|
.t delete 1.0 end
|
543 |
|
|
.t insert end "1\n2\n3\n4\n5\nLine 6 is such a long line that it wraps around.\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17"
|
544 |
|
|
.t yview end
|
545 |
|
|
update
|
546 |
|
|
.t delete 13.0 end
|
547 |
|
|
update
|
548 |
|
|
list [.t index @0,0] $tk_textRelayout $tk_textRedraw
|
549 |
|
|
} {5.0 {12.0 7.0 6.40 6.20 6.0 5.0} {5.0 6.0 6.20 6.40 7.0 12.0}}
|
550 |
|
|
test textDisp-4.11 {UpdateDisplayInfo, filling in extra vertical space} {
|
551 |
|
|
.t delete 1.0 end
|
552 |
|
|
.t insert end "1\n2\n3\n4\n5\nLine 6 is such a long line that it wraps around, not once but really quite a few times.\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17"
|
553 |
|
|
.t yview end
|
554 |
|
|
update
|
555 |
|
|
.t delete 14.0 end
|
556 |
|
|
update
|
557 |
|
|
list [.t index @0,0] $tk_textRelayout $tk_textRedraw
|
558 |
|
|
} {6.40 {13.0 7.0 6.80 6.60 6.40} {6.40 6.60 6.80 7.0 13.0}}
|
559 |
|
|
test textDisp-4.12 {UpdateDisplayInfo, filling in extra vertical space} {
|
560 |
|
|
.t delete 1.0 end
|
561 |
|
|
.t insert end "1\n2\n3\n4\n5\n7\n8\n9\n10\n11\n12"
|
562 |
|
|
button .b -text "Test" -bd 2 -highlightthickness 2
|
563 |
|
|
.t window create 3.end -window .b
|
564 |
|
|
.t yview moveto 1
|
565 |
|
|
update
|
566 |
|
|
.t yview moveto 0
|
567 |
|
|
update
|
568 |
|
|
.t yview moveto 1
|
569 |
|
|
update
|
570 |
|
|
winfo ismapped .b
|
571 |
|
|
} {0}
|
572 |
|
|
.t configure -wrap word
|
573 |
|
|
.t delete 1.0 end
|
574 |
|
|
.t insert end "Line 1\nLine 2\nLine 3\nLine 4\nLine 5\nLine 6\nLine 7\n"
|
575 |
|
|
.t insert end "Line 8\nLine 9\nLine 10\nLine 11\nLine 12\nLine 13\n"
|
576 |
|
|
.t insert end "Line 14\nLine 15\nLine 16"
|
577 |
|
|
.t tag delete x
|
578 |
|
|
.t tag configure x -relief raised -borderwidth 2 -background white
|
579 |
|
|
test textDisp-4.13 {UpdateDisplayInfo, special handling for top/bottom lines} {
|
580 |
|
|
.t tag add x 1.0 end
|
581 |
|
|
.t yview 1.0
|
582 |
|
|
update
|
583 |
|
|
.t yview scroll 3 units
|
584 |
|
|
update
|
585 |
|
|
list $tk_textRelayout $tk_textRedraw
|
586 |
|
|
} {{11.0 12.0 13.0} {4.0 10.0 11.0 12.0 13.0}}
|
587 |
|
|
test textDisp-4.14 {UpdateDisplayInfo, special handling for top/bottom lines} {
|
588 |
|
|
.t tag remove x 1.0 end
|
589 |
|
|
.t yview 1.0
|
590 |
|
|
update
|
591 |
|
|
.t yview scroll 3 units
|
592 |
|
|
update
|
593 |
|
|
list $tk_textRelayout $tk_textRedraw
|
594 |
|
|
} {{11.0 12.0 13.0} {11.0 12.0 13.0}}
|
595 |
|
|
test textDisp-4.15 {UpdateDisplayInfo, special handling for top/bottom lines} {
|
596 |
|
|
.t tag add x 1.0 end
|
597 |
|
|
.t yview 4.0
|
598 |
|
|
update
|
599 |
|
|
.t yview scroll -2 units
|
600 |
|
|
update
|
601 |
|
|
list $tk_textRelayout $tk_textRedraw
|
602 |
|
|
} {{2.0 3.0} {2.0 3.0 4.0 11.0}}
|
603 |
|
|
test textDisp-4.16 {UpdateDisplayInfo, special handling for top/bottom lines} {
|
604 |
|
|
.t tag remove x 1.0 end
|
605 |
|
|
.t yview 4.0
|
606 |
|
|
update
|
607 |
|
|
.t yview scroll -2 units
|
608 |
|
|
update
|
609 |
|
|
list $tk_textRelayout $tk_textRedraw
|
610 |
|
|
} {{2.0 3.0} {2.0 3.0}}
|
611 |
|
|
test textDisp-4.17 {UpdateDisplayInfo, horizontal scrolling} {fonts} {
|
612 |
|
|
.t configure -wrap none
|
613 |
|
|
.t delete 1.0 end
|
614 |
|
|
.t insert end "Short line 1\nLine 2 is long enough to scroll horizontally"
|
615 |
|
|
.t insert end "\nLine 3\nLine 4"
|
616 |
|
|
update
|
617 |
|
|
.t xview scroll 3 units
|
618 |
|
|
update
|
619 |
|
|
list $tk_textRelayout $tk_textRedraw [.t bbox 2.0] [.t bbox 2.5] \
|
620 |
|
|
[.t bbox 2.23]
|
621 |
|
|
} {{} {1.0 2.0 3.0 4.0} {} {17 16 7 13} {}}
|
622 |
|
|
test textDisp-4.18 {UpdateDisplayInfo, horizontal scrolling} {fonts} {
|
623 |
|
|
.t configure -wrap none
|
624 |
|
|
.t delete 1.0 end
|
625 |
|
|
.t insert end "Short line 1\nLine 2 is long enough to scroll horizontally"
|
626 |
|
|
.t insert end "\nLine 3\nLine 4"
|
627 |
|
|
update
|
628 |
|
|
.t xview scroll 100 units
|
629 |
|
|
update
|
630 |
|
|
list $tk_textRelayout $tk_textRedraw [.t bbox 2.25]
|
631 |
|
|
} {{} {1.0 2.0 3.0 4.0} {10 16 7 13}}
|
632 |
|
|
test textDisp-4.19 {UpdateDisplayInfo, horizontal scrolling} {fonts} {
|
633 |
|
|
.t configure -wrap none
|
634 |
|
|
.t delete 1.0 end
|
635 |
|
|
.t insert end "Short line 1\nLine 2 is long enough to scroll horizontally"
|
636 |
|
|
.t insert end "\nLine 3\nLine 4"
|
637 |
|
|
update
|
638 |
|
|
.t xview moveto 0
|
639 |
|
|
.t xview scroll -10 units
|
640 |
|
|
update
|
641 |
|
|
list $tk_textRelayout $tk_textRedraw [.t bbox 2.5]
|
642 |
|
|
} {{} {1.0 2.0 3.0 4.0} {38 16 7 13}}
|
643 |
|
|
test textDisp-4.20 {UpdateDisplayInfo, horizontal scrolling} {fonts} {
|
644 |
|
|
.t configure -wrap none
|
645 |
|
|
.t delete 1.0 end
|
646 |
|
|
.t insert end "Short line 1\nLine 2 is long enough to scroll horizontally"
|
647 |
|
|
.t insert end "\nLine 3\nLine 4"
|
648 |
|
|
.t xview moveto 0.0
|
649 |
|
|
.t xview scroll 100 units
|
650 |
|
|
update
|
651 |
|
|
.t delete 2.30 2.44
|
652 |
|
|
update
|
653 |
|
|
list $tk_textRelayout $tk_textRedraw [.t bbox 2.25]
|
654 |
|
|
} {2.0 {1.0 2.0 3.0 4.0} {108 16 7 13}}
|
655 |
|
|
test textDisp-4.21 {UpdateDisplayInfo, horizontal scrolling} {fonts} {
|
656 |
|
|
.t configure -wrap none
|
657 |
|
|
.t delete 1.0 end
|
658 |
|
|
.t insert end "Short line 1\nLine 2 is long enough to scroll horizontally"
|
659 |
|
|
.t insert end "\nLine 3\nLine 4"
|
660 |
|
|
.t xview moveto .9
|
661 |
|
|
update
|
662 |
|
|
.t xview moveto .6
|
663 |
|
|
update
|
664 |
|
|
list $tk_textRelayout $tk_textRedraw
|
665 |
|
|
} {{} {}}
|
666 |
|
|
test textDisp-4.22 {UpdateDisplayInfo, no horizontal scrolling except for -wrap none} {fonts} {
|
667 |
|
|
.t configure -wrap none
|
668 |
|
|
.t delete 1.0 end
|
669 |
|
|
.t insert end "Short line 1\nLine 2 is long enough to scroll horizontally"
|
670 |
|
|
.t insert end "\nLine 3\nLine 4"
|
671 |
|
|
.t xview scroll 25 units
|
672 |
|
|
update
|
673 |
|
|
.t configure -wrap word
|
674 |
|
|
list [.t bbox 2.0] [.t bbox 2.16]
|
675 |
|
|
} {{3 16 7 13} {10 29 7 13}}
|
676 |
|
|
test textDisp-4.23 {UpdateDisplayInfo, no horizontal scrolling except for -wrap none} {fonts} {
|
677 |
|
|
.t configure -wrap none
|
678 |
|
|
.t delete 1.0 end
|
679 |
|
|
.t insert end "Short line 1\nLine 2 is long enough to scroll horizontally"
|
680 |
|
|
.t insert end "\nLine 3\nLine 4"
|
681 |
|
|
.t xview scroll 25 units
|
682 |
|
|
update
|
683 |
|
|
.t configure -wrap char
|
684 |
|
|
list [.t bbox 2.0] [.t bbox 2.16]
|
685 |
|
|
} {{3 16 7 13} {115 16 7 13}}
|
686 |
|
|
|
687 |
|
|
test textDisp-5.1 {DisplayDLine, handling of spacing} {fonts} {
|
688 |
|
|
.t configure -wrap char
|
689 |
|
|
.t delete 1.0 end
|
690 |
|
|
.t insert 1.0 "abcdefghijkl\nmnopqrstuvwzyz"
|
691 |
|
|
.t tag configure spacing -spacing1 8 -spacing3 2
|
692 |
|
|
.t tag add spacing 1.0 end
|
693 |
|
|
frame .t.f1 -width 10 -height 4 -bg black
|
694 |
|
|
frame .t.f2 -width 10 -height 4 -bg black
|
695 |
|
|
frame .t.f3 -width 10 -height 4 -bg black
|
696 |
|
|
frame .t.f4 -width 10 -height 4 -bg black
|
697 |
|
|
.t window create 1.3 -window .t.f1 -align top
|
698 |
|
|
.t window create 1.7 -window .t.f2 -align center
|
699 |
|
|
.t window create 2.1 -window .t.f3 -align bottom
|
700 |
|
|
.t window create 2.10 -window .t.f4 -align baseline
|
701 |
|
|
update
|
702 |
|
|
list [winfo geometry .t.f1] [winfo geometry .t.f2] \
|
703 |
|
|
[winfo geometry .t.f3] [winfo geometry .t.f4]
|
704 |
|
|
} {10x4+24+11 10x4+55+15 10x4+10+43 10x4+76+40}
|
705 |
|
|
.t tag delete spacing
|
706 |
|
|
|
707 |
|
|
# Although the following test produces a useful result, its main
|
708 |
|
|
# effect is to produce a core dump if Tk doesn't handle display
|
709 |
|
|
# relayout that occurs during redisplay.
|
710 |
|
|
|
711 |
|
|
test textDisp-5.2 {DisplayDLine, line resizes during display} {
|
712 |
|
|
.t delete 1.0 end
|
713 |
|
|
frame .t.f -width 20 -height 20 -bd 2 -relief raised
|
714 |
|
|
bind .t.f {.t.f configure -width 30 -height 30}
|
715 |
|
|
.t window create insert -window .t.f
|
716 |
|
|
update
|
717 |
|
|
list [winfo width .t.f] [winfo height .t.f]
|
718 |
|
|
} {30 30}
|
719 |
|
|
|
720 |
|
|
.t configure -wrap char
|
721 |
|
|
test textDisp-6.1 {scrolling in DisplayText, scroll up} {
|
722 |
|
|
.t delete 1.0 end
|
723 |
|
|
.t insert 1.0 "Line 1"
|
724 |
|
|
foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
|
725 |
|
|
.t insert end "\nLine $i"
|
726 |
|
|
}
|
727 |
|
|
update
|
728 |
|
|
.t delete 2.0 3.0
|
729 |
|
|
update
|
730 |
|
|
list $tk_textRelayout $tk_textRedraw
|
731 |
|
|
} {{2.0 10.0} {2.0 10.0}}
|
732 |
|
|
test textDisp-6.2 {scrolling in DisplayText, scroll down} {
|
733 |
|
|
.t delete 1.0 end
|
734 |
|
|
.t insert 1.0 "Line 1"
|
735 |
|
|
foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
|
736 |
|
|
.t insert end "\nLine $i"
|
737 |
|
|
}
|
738 |
|
|
update
|
739 |
|
|
.t insert 2.0 "New Line 2\n"
|
740 |
|
|
update
|
741 |
|
|
list $tk_textRelayout $tk_textRedraw
|
742 |
|
|
} {{2.0 3.0} {2.0 3.0}}
|
743 |
|
|
test textDisp-6.3 {scrolling in DisplayText, multiple scrolls} {
|
744 |
|
|
.t configure -wrap char
|
745 |
|
|
.t delete 1.0 end
|
746 |
|
|
.t insert 1.0 "Line 1"
|
747 |
|
|
foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
|
748 |
|
|
.t insert end "\nLine $i"
|
749 |
|
|
}
|
750 |
|
|
update
|
751 |
|
|
.t insert 2.end "is so long that it wraps"
|
752 |
|
|
.t insert 4.end "is so long that it wraps"
|
753 |
|
|
update
|
754 |
|
|
list $tk_textRelayout $tk_textRedraw
|
755 |
|
|
} {{2.0 2.20 4.0 4.20} {2.0 2.20 4.0 4.20}}
|
756 |
|
|
test textDisp-6.4 {scrolling in DisplayText, scrolls interfere} {
|
757 |
|
|
.t configure -wrap char
|
758 |
|
|
.t delete 1.0 end
|
759 |
|
|
.t insert 1.0 "Line 1"
|
760 |
|
|
foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
|
761 |
|
|
.t insert end "\nLine $i"
|
762 |
|
|
}
|
763 |
|
|
update
|
764 |
|
|
.t insert 2.end "is so long that it wraps around, not once but three times"
|
765 |
|
|
.t insert 4.end "is so long that it wraps"
|
766 |
|
|
update
|
767 |
|
|
list $tk_textRelayout $tk_textRedraw
|
768 |
|
|
} {{2.0 2.20 2.40 2.60 4.0 4.20} {2.0 2.20 2.40 2.60 4.0 4.20 6.0}}
|
769 |
|
|
test textDisp-6.5 {scrolling in DisplayText, scroll source obscured} {nonPortable} {
|
770 |
|
|
.t configure -wrap char
|
771 |
|
|
frame .f2 -bg red
|
772 |
|
|
place .f2 -in .t -relx 0.5 -rely 0.5 -relwidth 0.5 -relheight 0.5
|
773 |
|
|
.t delete 1.0 end
|
774 |
|
|
.t insert 1.0 "Line 1 is so long that it wraps around, a couple of times"
|
775 |
|
|
foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
|
776 |
|
|
.t insert end "\nLine $i"
|
777 |
|
|
}
|
778 |
|
|
update
|
779 |
|
|
.t delete 1.6 1.end
|
780 |
|
|
update
|
781 |
|
|
destroy .f2
|
782 |
|
|
list $tk_textRelayout $tk_textRedraw
|
783 |
|
|
} {{1.0 9.0 10.0} {1.0 4.0 5.0 9.0 10.0}}
|
784 |
|
|
test textDisp-6.6 {scrolling in DisplayText, Expose events after scroll} {unixOnly nonPortable} {
|
785 |
|
|
# this test depends on all of the expose events being handled at once
|
786 |
|
|
.t configure -wrap char
|
787 |
|
|
frame .f2 -bg #ff0000
|
788 |
|
|
place .f2 -in .t -relx 0.2 -rely 0.5 -relwidth 0.5 -relheight 0.5
|
789 |
|
|
.t configure -bd 2 -relief raised
|
790 |
|
|
.t delete 1.0 end
|
791 |
|
|
.t insert 1.0 "Line 1 is so long that it wraps around, a couple of times"
|
792 |
|
|
foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
|
793 |
|
|
.t insert end "\nLine $i"
|
794 |
|
|
}
|
795 |
|
|
update
|
796 |
|
|
.t delete 1.6 1.end
|
797 |
|
|
destroy .f2
|
798 |
|
|
update
|
799 |
|
|
list $tk_textRelayout $tk_textRedraw
|
800 |
|
|
} {{1.0 9.0 10.0} {borders 1.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0}}
|
801 |
|
|
.t configure -bd 0
|
802 |
|
|
test textDisp-6.7 {DisplayText, vertical scrollbar updates} {
|
803 |
|
|
.t configure -wrap char
|
804 |
|
|
.t delete 1.0 end
|
805 |
|
|
update
|
806 |
|
|
set scrollInfo
|
807 |
|
|
} {0 1}
|
808 |
|
|
test textDisp-6.8 {DisplayText, vertical scrollbar updates} {
|
809 |
|
|
.t configure -wrap char
|
810 |
|
|
.t delete 1.0 end
|
811 |
|
|
.t insert 1.0 "Line 1"
|
812 |
|
|
update
|
813 |
|
|
set scrollInfo "unchanged"
|
814 |
|
|
foreach i {2 3 4 5 6 7 8 9 10 11 12 13} {
|
815 |
|
|
.t insert end "\nLine $i"
|
816 |
|
|
}
|
817 |
|
|
update
|
818 |
|
|
set scrollInfo
|
819 |
|
|
} {0 0.769231}
|
820 |
|
|
.t configure -yscrollcommand {} -xscrollcommand scroll
|
821 |
|
|
test textDisp-6.9 {DisplayText, horizontal scrollbar updates} {
|
822 |
|
|
.t configure -wrap none
|
823 |
|
|
.t delete 1.0 end
|
824 |
|
|
update
|
825 |
|
|
set scrollInfo unchanged
|
826 |
|
|
.t insert end xxxxxxxxx\n
|
827 |
|
|
.t insert end xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n
|
828 |
|
|
.t insert end xxxxxxxxxxxxxxxxxxxxxxxxxx
|
829 |
|
|
update
|
830 |
|
|
set scrollInfo
|
831 |
|
|
} {0 0.363636}
|
832 |
|
|
|
833 |
|
|
# The following group of tests is marked non-portable because
|
834 |
|
|
# they result in a lot of extra redisplay under Ultrix. I don't
|
835 |
|
|
# know why this is so.
|
836 |
|
|
|
837 |
|
|
.t configure -bd 2 -relief raised -wrap char
|
838 |
|
|
.t delete 1.0 end
|
839 |
|
|
.t insert 1.0 "Line 1 is so long that it wraps around, a couple of times"
|
840 |
|
|
foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
|
841 |
|
|
.t insert end "\nLine $i"
|
842 |
|
|
}
|
843 |
|
|
test textDisp-7.1 {TkTextRedrawRegion} {nonPortable} {
|
844 |
|
|
frame .f2 -bg #ff0000
|
845 |
|
|
place .f2 -in .t -relx 0.2 -relwidth 0.6 -rely 0.22 -relheight 0.55
|
846 |
|
|
update
|
847 |
|
|
destroy .f2
|
848 |
|
|
update
|
849 |
|
|
list $tk_textRelayout $tk_textRedraw
|
850 |
|
|
} {{} {1.40 2.0 3.0 4.0 5.0 6.0}}
|
851 |
|
|
test textDisp-7.2 {TkTextRedrawRegion} {nonPortable} {
|
852 |
|
|
frame .f2 -bg #ff0000
|
853 |
|
|
place .f2 -in .t -relx 0 -relwidth 0.5 -rely 0 -relheight 0.5
|
854 |
|
|
update
|
855 |
|
|
destroy .f2
|
856 |
|
|
update
|
857 |
|
|
list $tk_textRelayout $tk_textRedraw
|
858 |
|
|
} {{} {borders 1.0 1.20 1.40 2.0 3.0}}
|
859 |
|
|
test textDisp-7.3 {TkTextRedrawRegion} {nonPortable} {
|
860 |
|
|
frame .f2 -bg #ff0000
|
861 |
|
|
place .f2 -in .t -relx 0.5 -relwidth 0.5 -rely 0.5 -relheight 0.5
|
862 |
|
|
update
|
863 |
|
|
destroy .f2
|
864 |
|
|
update
|
865 |
|
|
list $tk_textRelayout $tk_textRedraw
|
866 |
|
|
} {{} {borders 4.0 5.0 6.0 7.0 8.0}}
|
867 |
|
|
test textDisp-7.4 {TkTextRedrawRegion} {nonPortable} {
|
868 |
|
|
frame .f2 -bg #ff0000
|
869 |
|
|
place .f2 -in .t -relx 0.4 -relwidth 0.2 -rely 0 -relheight 0.2 \
|
870 |
|
|
-bordermode ignore
|
871 |
|
|
update
|
872 |
|
|
destroy .f2
|
873 |
|
|
update
|
874 |
|
|
list $tk_textRelayout $tk_textRedraw
|
875 |
|
|
} {{} {borders 1.0 1.20}}
|
876 |
|
|
test textDisp-7.5 {TkTextRedrawRegion} {nonPortable} {
|
877 |
|
|
frame .f2 -bg #ff0000
|
878 |
|
|
place .f2 -in .t -relx 0.4 -relwidth 0.2 -rely 1.0 -relheight 0.2 \
|
879 |
|
|
-anchor s -bordermode ignore
|
880 |
|
|
update
|
881 |
|
|
destroy .f2
|
882 |
|
|
update
|
883 |
|
|
list $tk_textRelayout $tk_textRedraw
|
884 |
|
|
} {{} {borders 7.0 8.0}}
|
885 |
|
|
test textDisp-7.6 {TkTextRedrawRegion} {nonPortable} {
|
886 |
|
|
frame .f2 -bg #ff0000
|
887 |
|
|
place .f2 -in .t -relx 0 -relwidth 0.2 -rely 0.55 -relheight 0.2 \
|
888 |
|
|
-anchor w -bordermode ignore
|
889 |
|
|
update
|
890 |
|
|
destroy .f2
|
891 |
|
|
update
|
892 |
|
|
list $tk_textRelayout $tk_textRedraw
|
893 |
|
|
} {{} {borders 3.0 4.0 5.0}}
|
894 |
|
|
test textDisp-7.7 {TkTextRedrawRegion} {nonPortable} {
|
895 |
|
|
frame .f2 -bg #ff0000
|
896 |
|
|
place .f2 -in .t -relx 1.0 -relwidth 0.2 -rely 0.55 -relheight 0.2 \
|
897 |
|
|
-anchor e -bordermode ignore
|
898 |
|
|
update
|
899 |
|
|
destroy .f2
|
900 |
|
|
update
|
901 |
|
|
list $tk_textRelayout $tk_textRedraw
|
902 |
|
|
} {{} {borders 3.0 4.0 5.0}}
|
903 |
|
|
test textDisp-7.8 {TkTextRedrawRegion} {nonPortable} {
|
904 |
|
|
.t delete 1.0 end
|
905 |
|
|
.t insert 1.0 "Line 1\nLine 2\nLine 3\nLine 4\nLine 5\nLine 6\n"
|
906 |
|
|
frame .f2 -bg #ff0000
|
907 |
|
|
place .f2 -in .t -relx 0.0 -relwidth 0.4 -rely 0.35 -relheight 0.4 \
|
908 |
|
|
-anchor nw -bordermode ignore
|
909 |
|
|
update
|
910 |
|
|
destroy .f2
|
911 |
|
|
update
|
912 |
|
|
list $tk_textRelayout $tk_textRedraw
|
913 |
|
|
} {{} {borders 4.0 5.0 6.0 7.0 eof}}
|
914 |
|
|
.t configure -bd 0
|
915 |
|
|
|
916 |
|
|
test textDisp-8.1 {TkTextChanged: redisplay whole lines} {fonts} {
|
917 |
|
|
.t configure -wrap word
|
918 |
|
|
.t delete 1.0 end
|
919 |
|
|
.t insert 1.0 "Line 1\nLine 2 is so long that it wraps around, two times"
|
920 |
|
|
foreach i {3 4 5 6 7 8 9 10 11 12 13 14 15} {
|
921 |
|
|
.t insert end "\nLine $i"
|
922 |
|
|
}
|
923 |
|
|
update
|
924 |
|
|
.t delete 2.36 2.38
|
925 |
|
|
update
|
926 |
|
|
list $tk_textRelayout $tk_textRedraw [.t bbox 2.32]
|
927 |
|
|
} {{2.0 2.18 2.38} {2.0 2.18 2.38} {101 29 7 13}}
|
928 |
|
|
.t configure -wrap char
|
929 |
|
|
test textDisp-8.2 {TkTextChanged, redisplay whole lines} {
|
930 |
|
|
.t delete 1.0 end
|
931 |
|
|
.t insert 1.0 "Line 1 is so long that it wraps around, two times"
|
932 |
|
|
foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
|
933 |
|
|
.t insert end "\nLine $i"
|
934 |
|
|
}
|
935 |
|
|
update
|
936 |
|
|
.t insert 1.2 xx
|
937 |
|
|
update
|
938 |
|
|
list $tk_textRelayout $tk_textRedraw
|
939 |
|
|
} {{1.0 1.20 1.40} {1.0 1.20 1.40}}
|
940 |
|
|
test textDisp-8.3 {TkTextChanged} {
|
941 |
|
|
.t delete 1.0 end
|
942 |
|
|
.t insert 1.0 "Line 1 is so long that it wraps around, two times"
|
943 |
|
|
foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
|
944 |
|
|
.t insert end "\nLine $i"
|
945 |
|
|
}
|
946 |
|
|
update
|
947 |
|
|
.t insert 2.0 xx
|
948 |
|
|
update
|
949 |
|
|
list $tk_textRelayout $tk_textRedraw
|
950 |
|
|
} {2.0 2.0}
|
951 |
|
|
test textDisp-8.4 {TkTextChanged} {
|
952 |
|
|
.t delete 1.0 end
|
953 |
|
|
.t insert 1.0 "Line 1 is so long that it wraps around, two times"
|
954 |
|
|
foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
|
955 |
|
|
.t insert end "\nLine $i"
|
956 |
|
|
}
|
957 |
|
|
update
|
958 |
|
|
.t delete 1.5
|
959 |
|
|
update
|
960 |
|
|
list $tk_textRelayout $tk_textRedraw
|
961 |
|
|
} {{1.0 1.20 1.40} {1.0 1.20 1.40}}
|
962 |
|
|
test textDisp-8.5 {TkTextChanged} {
|
963 |
|
|
.t delete 1.0 end
|
964 |
|
|
.t insert 1.0 "Line 1 is so long that it wraps around, two times"
|
965 |
|
|
foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
|
966 |
|
|
.t insert end "\nLine $i"
|
967 |
|
|
}
|
968 |
|
|
update
|
969 |
|
|
.t delete 1.40 1.44
|
970 |
|
|
update
|
971 |
|
|
list $tk_textRelayout $tk_textRedraw
|
972 |
|
|
} {{1.0 1.20 1.40} {1.0 1.20 1.40}}
|
973 |
|
|
test textDisp-8.6 {TkTextChanged} {
|
974 |
|
|
.t delete 1.0 end
|
975 |
|
|
.t insert 1.0 "Line 1 is so long that it wraps around, two times"
|
976 |
|
|
foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
|
977 |
|
|
.t insert end "\nLine $i"
|
978 |
|
|
}
|
979 |
|
|
update
|
980 |
|
|
.t delete 1.41 1.44
|
981 |
|
|
update
|
982 |
|
|
list $tk_textRelayout $tk_textRedraw
|
983 |
|
|
} {{1.0 1.20 1.40} {1.0 1.20 1.40}}
|
984 |
|
|
test textDisp-8.7 {TkTextChanged} {
|
985 |
|
|
.t delete 1.0 end
|
986 |
|
|
.t insert 1.0 "Line 1 is so long that it wraps around, two times"
|
987 |
|
|
foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
|
988 |
|
|
.t insert end "\nLine $i"
|
989 |
|
|
}
|
990 |
|
|
update
|
991 |
|
|
.t delete 1.2 1.end
|
992 |
|
|
update
|
993 |
|
|
list $tk_textRelayout $tk_textRedraw
|
994 |
|
|
} {{1.0 9.0 10.0} {1.0 9.0 10.0}}
|
995 |
|
|
test textDisp-8.8 {TkTextChanged} {
|
996 |
|
|
.t delete 1.0 end
|
997 |
|
|
.t insert 1.0 "Line 1 is so long that it wraps around, two times"
|
998 |
|
|
foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
|
999 |
|
|
.t insert end "\nLine $i"
|
1000 |
|
|
}
|
1001 |
|
|
update
|
1002 |
|
|
.t delete 2.2
|
1003 |
|
|
update
|
1004 |
|
|
list $tk_textRelayout $tk_textRedraw
|
1005 |
|
|
} {2.0 2.0}
|
1006 |
|
|
test textDisp-8.9 {TkTextChanged} {
|
1007 |
|
|
.t delete 1.0 end
|
1008 |
|
|
.t insert 1.0 "Line 1 is so long that it wraps around, two times"
|
1009 |
|
|
foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
|
1010 |
|
|
.t insert end "\nLine $i"
|
1011 |
|
|
}
|
1012 |
|
|
update
|
1013 |
|
|
.t delete 2.0 3.0
|
1014 |
|
|
update
|
1015 |
|
|
list $tk_textRelayout $tk_textRedraw
|
1016 |
|
|
} {{2.0 8.0} {2.0 8.0}}
|
1017 |
|
|
test textDisp-8.10 {TkTextChanged} {
|
1018 |
|
|
.t configure -wrap char
|
1019 |
|
|
.t delete 1.0 end
|
1020 |
|
|
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4"
|
1021 |
|
|
.t tag add big 2.19
|
1022 |
|
|
update
|
1023 |
|
|
.t delete 2.19
|
1024 |
|
|
update
|
1025 |
|
|
set tk_textRedraw
|
1026 |
|
|
} {2.0 2.20 eof}
|
1027 |
|
|
test textDisp-8.11 {TkTextChanged, scrollbar notification when changes are off-screen} {
|
1028 |
|
|
.t delete 1.0 end
|
1029 |
|
|
.t insert end "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n"
|
1030 |
|
|
.t configure -yscrollcommand scroll
|
1031 |
|
|
update
|
1032 |
|
|
set scrollInfo ""
|
1033 |
|
|
.t insert end "a\nb\nc\n"
|
1034 |
|
|
update
|
1035 |
|
|
.t configure -yscrollcommand ""
|
1036 |
|
|
set scrollInfo
|
1037 |
|
|
} {0 0.625}
|
1038 |
|
|
|
1039 |
|
|
test textDisp-9.1 {TkTextRedrawTag} {
|
1040 |
|
|
.t configure -wrap char
|
1041 |
|
|
.t delete 1.0 end
|
1042 |
|
|
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4"
|
1043 |
|
|
update
|
1044 |
|
|
.t tag add big 2.2 2.4
|
1045 |
|
|
update
|
1046 |
|
|
list $tk_textRelayout $tk_textRedraw
|
1047 |
|
|
} {{2.0 2.18} {2.0 2.18}}
|
1048 |
|
|
test textDisp-9.2 {TkTextRedrawTag} {fonts} {
|
1049 |
|
|
.t configure -wrap char
|
1050 |
|
|
.t delete 1.0 end
|
1051 |
|
|
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4"
|
1052 |
|
|
update
|
1053 |
|
|
.t tag add big 1.2 2.4
|
1054 |
|
|
update
|
1055 |
|
|
list $tk_textRelayout $tk_textRedraw
|
1056 |
|
|
} {{1.0 2.0 2.17} {1.0 2.0 2.17}}
|
1057 |
|
|
test textDisp-9.3 {TkTextRedrawTag} {
|
1058 |
|
|
.t configure -wrap char
|
1059 |
|
|
.t delete 1.0 end
|
1060 |
|
|
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4"
|
1061 |
|
|
update
|
1062 |
|
|
.t tag add big 2.2 2.4
|
1063 |
|
|
.t tag remove big 1.0 end
|
1064 |
|
|
update
|
1065 |
|
|
list $tk_textRelayout $tk_textRedraw
|
1066 |
|
|
} {2.0 2.0}
|
1067 |
|
|
test textDisp-9.4 {TkTextRedrawTag} {
|
1068 |
|
|
.t configure -wrap char
|
1069 |
|
|
.t delete 1.0 end
|
1070 |
|
|
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4"
|
1071 |
|
|
update
|
1072 |
|
|
.t tag add big 2.2 2.20
|
1073 |
|
|
.t tag remove big 1.0 end
|
1074 |
|
|
update
|
1075 |
|
|
list $tk_textRelayout $tk_textRedraw
|
1076 |
|
|
} {2.0 2.0}
|
1077 |
|
|
test textDisp-9.5 {TkTextRedrawTag} {
|
1078 |
|
|
.t configure -wrap char
|
1079 |
|
|
.t delete 1.0 end
|
1080 |
|
|
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4"
|
1081 |
|
|
update
|
1082 |
|
|
.t tag add big 2.2 2.end
|
1083 |
|
|
.t tag remove big 1.0 end
|
1084 |
|
|
update
|
1085 |
|
|
list $tk_textRelayout $tk_textRedraw
|
1086 |
|
|
} {{2.0 2.20} {2.0 2.20}}
|
1087 |
|
|
test textDisp-9.6 {TkTextRedrawTag} {
|
1088 |
|
|
.t configure -wrap char
|
1089 |
|
|
.t delete 1.0 end
|
1090 |
|
|
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4"
|
1091 |
|
|
update
|
1092 |
|
|
.t tag add big 2.2 3.5
|
1093 |
|
|
.t tag remove big 1.0 end
|
1094 |
|
|
update
|
1095 |
|
|
list $tk_textRelayout $tk_textRedraw
|
1096 |
|
|
} {{2.0 2.20 3.0} {2.0 2.20 3.0}}
|
1097 |
|
|
test textDisp-9.7 {TkTextRedrawTag} {
|
1098 |
|
|
.t configure -wrap char
|
1099 |
|
|
.t delete 1.0 end
|
1100 |
|
|
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4"
|
1101 |
|
|
.t tag add big 2.19
|
1102 |
|
|
update
|
1103 |
|
|
.t tag remove big 2.19
|
1104 |
|
|
update
|
1105 |
|
|
set tk_textRedraw
|
1106 |
|
|
} {2.0 2.20 eof}
|
1107 |
|
|
test textDisp-9.8 {TkTextRedrawTag} {fonts} {
|
1108 |
|
|
.t configure -wrap char
|
1109 |
|
|
.t delete 1.0 end
|
1110 |
|
|
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4"
|
1111 |
|
|
.t tag add big 1.0 2.0
|
1112 |
|
|
update
|
1113 |
|
|
.t tag add big 2.0 2.5
|
1114 |
|
|
update
|
1115 |
|
|
set tk_textRedraw
|
1116 |
|
|
} {2.0 2.17}
|
1117 |
|
|
test textDisp-9.9 {TkTextRedrawTag} {fonts} {
|
1118 |
|
|
.t configure -wrap char
|
1119 |
|
|
.t delete 1.0 end
|
1120 |
|
|
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4"
|
1121 |
|
|
.t tag add big 1.0 2.0
|
1122 |
|
|
update
|
1123 |
|
|
.t tag add big 1.5 2.5
|
1124 |
|
|
update
|
1125 |
|
|
set tk_textRedraw
|
1126 |
|
|
} {2.0 2.17}
|
1127 |
|
|
test textDisp-9.10 {TkTextRedrawTag} {
|
1128 |
|
|
.t configure -wrap char
|
1129 |
|
|
.t delete 1.0 end
|
1130 |
|
|
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4"
|
1131 |
|
|
.t tag add big 1.0 2.0
|
1132 |
|
|
update
|
1133 |
|
|
set tk_textRedraw {none}
|
1134 |
|
|
.t tag add big 1.3 1.5
|
1135 |
|
|
update
|
1136 |
|
|
set tk_textRedraw
|
1137 |
|
|
} {none}
|
1138 |
|
|
test textDisp-9.11 {TkTextRedrawTag} {
|
1139 |
|
|
.t configure -wrap char
|
1140 |
|
|
.t delete 1.0 end
|
1141 |
|
|
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4"
|
1142 |
|
|
.t tag add big 1.0 2.0
|
1143 |
|
|
update
|
1144 |
|
|
.t tag add big 1.0 2.0
|
1145 |
|
|
update
|
1146 |
|
|
set tk_textRedraw
|
1147 |
|
|
} {}
|
1148 |
|
|
|
1149 |
|
|
test textDisp-10.1 {TkTextRelayoutWindow} {
|
1150 |
|
|
.t configure -wrap char
|
1151 |
|
|
.t delete 1.0 end
|
1152 |
|
|
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4"
|
1153 |
|
|
update
|
1154 |
|
|
.t configure -bg black
|
1155 |
|
|
update
|
1156 |
|
|
list $tk_textRelayout $tk_textRedraw
|
1157 |
|
|
} {{1.0 2.0 2.20 3.0 3.20 4.0} {borders 1.0 2.0 2.20 3.0 3.20 4.0 eof}}
|
1158 |
|
|
.t configure -bg [lindex [.t configure -bg] 3]
|
1159 |
|
|
test textDisp-10.2 {TkTextRelayoutWindow} {
|
1160 |
|
|
toplevel .top -width 300 -height 200
|
1161 |
|
|
wm geometry .top +0+0
|
1162 |
|
|
text .top.t -font $fixedFont -width 20 -height 10 -relief raised -bd 2
|
1163 |
|
|
place .top.t -x 0 -y 0 -width 20 -height 20
|
1164 |
|
|
.top.t insert end "First line"
|
1165 |
|
|
.top.t see insert
|
1166 |
|
|
tkwait visibility .top.t
|
1167 |
|
|
place .top.t -width 150 -height 100
|
1168 |
|
|
update
|
1169 |
|
|
.top.t index @0,0
|
1170 |
|
|
} {1.0}
|
1171 |
|
|
catch {destroy .top}
|
1172 |
|
|
|
1173 |
|
|
.t delete 1.0 end
|
1174 |
|
|
.t insert end "Line 1"
|
1175 |
|
|
for {set i 2} {$i <= 200} {incr i} {
|
1176 |
|
|
.t insert end "\nLine $i"
|
1177 |
|
|
}
|
1178 |
|
|
update
|
1179 |
|
|
test textDisp-11.1 {TkTextSetYView} {
|
1180 |
|
|
.t yview 30.0
|
1181 |
|
|
update
|
1182 |
|
|
.t index @0,0
|
1183 |
|
|
} {30.0}
|
1184 |
|
|
test textDisp-11.2 {TkTextSetYView} {
|
1185 |
|
|
.t yview 30.0
|
1186 |
|
|
update
|
1187 |
|
|
.t yview 32.0
|
1188 |
|
|
update
|
1189 |
|
|
list [.t index @0,0] $tk_textRedraw
|
1190 |
|
|
} {32.0 {40.0 41.0}}
|
1191 |
|
|
test textDisp-11.3 {TkTextSetYView} {
|
1192 |
|
|
.t yview 30.0
|
1193 |
|
|
update
|
1194 |
|
|
.t yview 28.0
|
1195 |
|
|
update
|
1196 |
|
|
list [.t index @0,0] $tk_textRedraw
|
1197 |
|
|
} {28.0 {28.0 29.0}}
|
1198 |
|
|
test textDisp-11.4 {TkTextSetYView} {
|
1199 |
|
|
.t yview 30.0
|
1200 |
|
|
update
|
1201 |
|
|
.t yview 31.4
|
1202 |
|
|
update
|
1203 |
|
|
list [.t index @0,0] $tk_textRedraw
|
1204 |
|
|
} {31.0 40.0}
|
1205 |
|
|
test textDisp-11.5 {TkTextSetYView} {
|
1206 |
|
|
.t yview 30.0
|
1207 |
|
|
update
|
1208 |
|
|
set tk_textRedraw {}
|
1209 |
|
|
.t yview -pickplace 31.0
|
1210 |
|
|
update
|
1211 |
|
|
list [.t index @0,0] $tk_textRedraw
|
1212 |
|
|
} {30.0 {}}
|
1213 |
|
|
test textDisp-11.6 {TkTextSetYView} {
|
1214 |
|
|
.t yview 30.0
|
1215 |
|
|
update
|
1216 |
|
|
set tk_textRedraw {}
|
1217 |
|
|
.t yview -pickplace 28.0
|
1218 |
|
|
update
|
1219 |
|
|
list [.t index @0,0] $tk_textRedraw
|
1220 |
|
|
} {28.0 {28.0 29.0}}
|
1221 |
|
|
test textDisp-11.7 {TkTextSetYView} {
|
1222 |
|
|
.t yview 30.0
|
1223 |
|
|
update
|
1224 |
|
|
set tk_textRedraw {}
|
1225 |
|
|
.t yview -pickplace 26.0
|
1226 |
|
|
update
|
1227 |
|
|
list [.t index @0,0] $tk_textRedraw
|
1228 |
|
|
} {22.0 {22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0}}
|
1229 |
|
|
test textDisp-11.8 {TkTextSetYView} {
|
1230 |
|
|
.t yview 30.0
|
1231 |
|
|
update
|
1232 |
|
|
set tk_textRedraw {}
|
1233 |
|
|
.t yview -pickplace 41.0
|
1234 |
|
|
update
|
1235 |
|
|
list [.t index @0,0] $tk_textRedraw
|
1236 |
|
|
} {32.0 {40.0 41.0}}
|
1237 |
|
|
test textDisp-11.9 {TkTextSetYView} {
|
1238 |
|
|
.t yview 30.0
|
1239 |
|
|
update
|
1240 |
|
|
set tk_textRedraw {}
|
1241 |
|
|
.t yview -pickplace 43.0
|
1242 |
|
|
update
|
1243 |
|
|
list [.t index @0,0] $tk_textRedraw
|
1244 |
|
|
} {39.0 {40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0}}
|
1245 |
|
|
test textDisp-11.10 {TkTextSetYView} {
|
1246 |
|
|
.t yview 30.0
|
1247 |
|
|
update
|
1248 |
|
|
set tk_textRedraw {}
|
1249 |
|
|
.t yview 10000.0
|
1250 |
|
|
update
|
1251 |
|
|
list [.t index @0,0] $tk_textRedraw
|
1252 |
|
|
} {191.0 {191.0 192.0 193.0 194.0 195.0 196.0 197.0 198.0 199.0 200.0}}
|
1253 |
|
|
test textDisp-11.11 {TkTextSetYView} {
|
1254 |
|
|
.t yview 195.0
|
1255 |
|
|
update
|
1256 |
|
|
set tk_textRedraw {}
|
1257 |
|
|
.t yview 197.0
|
1258 |
|
|
update
|
1259 |
|
|
list [.t index @0,0] $tk_textRedraw
|
1260 |
|
|
} {191.0 {191.0 192.0 193.0 194.0 195.0 196.0}}
|
1261 |
|
|
test textDisp-11.12 {TkTextSetYView, wrapped line is off-screen} {
|
1262 |
|
|
.t insert 10.0 "Long line with enough text to wrap\n"
|
1263 |
|
|
.t yview 1.0
|
1264 |
|
|
update
|
1265 |
|
|
set tk_textRedraw {}
|
1266 |
|
|
.t see 10.30
|
1267 |
|
|
update
|
1268 |
|
|
list [.t index @0,0] $tk_textRedraw
|
1269 |
|
|
} {2.0 10.20}
|
1270 |
|
|
.t delete 10.0 11.0
|
1271 |
|
|
test textDisp-11.13 {TkTestSetYView, partially-visible last line} {
|
1272 |
|
|
catch {destroy .top}
|
1273 |
|
|
toplevel .top
|
1274 |
|
|
wm geometry .top +0+0
|
1275 |
|
|
text .top.t -width 20 -height 5
|
1276 |
|
|
pack .top.t
|
1277 |
|
|
.top.t insert end "Line 1"
|
1278 |
|
|
for {set i 2} {$i <= 100} {incr i} {
|
1279 |
|
|
.top.t insert end "\nLine $i"
|
1280 |
|
|
}
|
1281 |
|
|
update
|
1282 |
|
|
scan [wm geometry .top] "%dx%d" w2 h2
|
1283 |
|
|
wm geometry .top ${w2}x[expr $h2-2]
|
1284 |
|
|
update
|
1285 |
|
|
.top.t yview 1.0
|
1286 |
|
|
update
|
1287 |
|
|
set tk_textRedraw {}
|
1288 |
|
|
.top.t see 5.0
|
1289 |
|
|
update
|
1290 |
|
|
list [.top.t index @0,0] $tk_textRedraw
|
1291 |
|
|
} {2.0 {5.0 6.0}}
|
1292 |
|
|
catch {destroy .top}
|
1293 |
|
|
toplevel .top
|
1294 |
|
|
wm geometry .top +0+0
|
1295 |
|
|
text .top.t -width 30 -height 3
|
1296 |
|
|
pack .top.t
|
1297 |
|
|
.top.t insert end "Line 1"
|
1298 |
|
|
for {set i 2} {$i <= 20} {incr i} {
|
1299 |
|
|
.top.t insert end "\nLine $i"
|
1300 |
|
|
}
|
1301 |
|
|
update
|
1302 |
|
|
test textDisp-11.14 {TkTextSetYView, only a few lines visible} {
|
1303 |
|
|
.top.t yview 5.0
|
1304 |
|
|
update
|
1305 |
|
|
.top.t see 10.0
|
1306 |
|
|
.top.t index @0,0
|
1307 |
|
|
} {8.0}
|
1308 |
|
|
test textDisp-11.15 {TkTextSetYView, only a few lines visible} {
|
1309 |
|
|
.top.t yview 5.0
|
1310 |
|
|
update
|
1311 |
|
|
.top.t see 11.0
|
1312 |
|
|
.top.t index @0,0
|
1313 |
|
|
} {10.0}
|
1314 |
|
|
test textDisp-11.16 {TkTextSetYView, only a few lines visible} {
|
1315 |
|
|
.top.t yview 8.0
|
1316 |
|
|
update
|
1317 |
|
|
.top.t see 5.0
|
1318 |
|
|
.top.t index @0,0
|
1319 |
|
|
} {5.0}
|
1320 |
|
|
test textDisp-11.17 {TkTextSetYView, only a few lines visible} {
|
1321 |
|
|
.top.t yview 8.0
|
1322 |
|
|
update
|
1323 |
|
|
.top.t see 4.0
|
1324 |
|
|
.top.t index @0,0
|
1325 |
|
|
} {3.0}
|
1326 |
|
|
destroy .top
|
1327 |
|
|
|
1328 |
|
|
.t configure -wrap word
|
1329 |
|
|
.t delete 50.0 51.0
|
1330 |
|
|
.t insert 50.0 "This is a long line, one that will wrap around twice.\n"
|
1331 |
|
|
test textDisp-12.1 {MeasureUp} {
|
1332 |
|
|
.t yview 100.0
|
1333 |
|
|
update
|
1334 |
|
|
.t yview -pickplace 52.0
|
1335 |
|
|
update
|
1336 |
|
|
.t index @0,0
|
1337 |
|
|
} {50.0}
|
1338 |
|
|
test textDisp-12.2 {MeasureUp} {
|
1339 |
|
|
.t yview 100.0
|
1340 |
|
|
update
|
1341 |
|
|
.t yview -pickplace 53.0
|
1342 |
|
|
update
|
1343 |
|
|
.t index @0,0
|
1344 |
|
|
} {50.15}
|
1345 |
|
|
test textDisp-12.3 {MeasureUp} {
|
1346 |
|
|
.t yview 100.0
|
1347 |
|
|
update
|
1348 |
|
|
.t yview -pickplace 50.10
|
1349 |
|
|
update
|
1350 |
|
|
.t index @0,0
|
1351 |
|
|
} {46.0}
|
1352 |
|
|
.t configure -wrap none
|
1353 |
|
|
test textDisp-12.4 {MeasureUp} {
|
1354 |
|
|
.t yview 100.0
|
1355 |
|
|
update
|
1356 |
|
|
.t yview -pickplace 53.0
|
1357 |
|
|
update
|
1358 |
|
|
.t index @0,0
|
1359 |
|
|
} {49.0}
|
1360 |
|
|
test textDisp-12.5 {MeasureUp} {
|
1361 |
|
|
.t yview 100.0
|
1362 |
|
|
update
|
1363 |
|
|
.t yview -pickplace 50.10
|
1364 |
|
|
update
|
1365 |
|
|
.t index @0,0
|
1366 |
|
|
} {46.0}
|
1367 |
|
|
|
1368 |
|
|
.t configure -wrap none
|
1369 |
|
|
.t delete 1.0 end
|
1370 |
|
|
for {set i 1} {$i < 99} {incr i} {
|
1371 |
|
|
.t insert end "Line $i\n"
|
1372 |
|
|
}
|
1373 |
|
|
.t insert end "Line 100"
|
1374 |
|
|
.t insert 30.end { is quite long, so that it flows way off the end of the window and we can use it to test out the horizontal positioning features of the "see" command.}
|
1375 |
|
|
test textDisp-13.1 {TkTextSeeCmd procedure} {
|
1376 |
|
|
list [catch {.t see} msg] $msg
|
1377 |
|
|
} {1 {wrong # args: should be ".t see index"}}
|
1378 |
|
|
test textDisp-13.2 {TkTextSeeCmd procedure} {
|
1379 |
|
|
list [catch {.t see a b} msg] $msg
|
1380 |
|
|
} {1 {wrong # args: should be ".t see index"}}
|
1381 |
|
|
test textDisp-13.3 {TkTextSeeCmd procedure} {
|
1382 |
|
|
list [catch {.t see badIndex} msg] $msg
|
1383 |
|
|
} {1 {bad text index "badIndex"}}
|
1384 |
|
|
test textDisp-13.4 {TkTextSeeCmd procedure} {
|
1385 |
|
|
.t xview moveto 0
|
1386 |
|
|
.t yview moveto 0
|
1387 |
|
|
update
|
1388 |
|
|
.t see 4.2
|
1389 |
|
|
.t index @0,0
|
1390 |
|
|
} {1.0}
|
1391 |
|
|
test textDisp-13.5 {TkTextSeeCmd procedure} {
|
1392 |
|
|
.t configure -wrap char
|
1393 |
|
|
.t xview moveto 0
|
1394 |
|
|
.t yview moveto 0
|
1395 |
|
|
update
|
1396 |
|
|
.t see 12.1
|
1397 |
|
|
.t index @0,0
|
1398 |
|
|
} {3.0}
|
1399 |
|
|
test textDisp-13.6 {TkTextSeeCmd procedure} {
|
1400 |
|
|
.t configure -wrap char
|
1401 |
|
|
.t xview moveto 0
|
1402 |
|
|
.t yview moveto 0
|
1403 |
|
|
update
|
1404 |
|
|
.t see 30.50
|
1405 |
|
|
set x [.t index @0,0]
|
1406 |
|
|
.t configure -wrap none
|
1407 |
|
|
set x
|
1408 |
|
|
} {28.0}
|
1409 |
|
|
test textDisp-13.7 {TkTextSeeCmd procedure} {fonts} {
|
1410 |
|
|
.t xview moveto 0
|
1411 |
|
|
.t yview moveto 0
|
1412 |
|
|
.t tag add sel 30.20
|
1413 |
|
|
.t tag add sel 30.40
|
1414 |
|
|
update
|
1415 |
|
|
.t see 30.50
|
1416 |
|
|
set x [list [.t bbox 30.50]]
|
1417 |
|
|
.t see 30.39
|
1418 |
|
|
lappend x [.t bbox 30.39]
|
1419 |
|
|
.t see 30.38
|
1420 |
|
|
lappend x [.t bbox 30.38]
|
1421 |
|
|
.t see 30.20
|
1422 |
|
|
lappend x [.t bbox 30.20]
|
1423 |
|
|
} {{73 55 7 13} {3 55 7 13} {3 55 7 13} {73 55 7 13}}
|
1424 |
|
|
test textDisp-13.8 {TkTextSeeCmd procedure} {fonts} {
|
1425 |
|
|
.t xview moveto 0
|
1426 |
|
|
.t yview moveto 0
|
1427 |
|
|
.t tag add sel 30.20
|
1428 |
|
|
.t tag add sel 30.50
|
1429 |
|
|
update
|
1430 |
|
|
.t see 30.50
|
1431 |
|
|
set x [list [.t bbox 30.50]]
|
1432 |
|
|
.t see 30.60
|
1433 |
|
|
lappend x [.t bbox 30.60]
|
1434 |
|
|
.t see 30.65
|
1435 |
|
|
lappend x [.t bbox 30.65]
|
1436 |
|
|
.t see 30.90
|
1437 |
|
|
lappend x [.t bbox 30.90]
|
1438 |
|
|
} {{73 55 7 13} {136 55 7 13} {136 55 7 13} {73 55 7 13}}
|
1439 |
|
|
test textDisp-13.9 {TkTextSeeCmd procedure} {fonts} {
|
1440 |
|
|
wm geom . [expr $width-2]x$height
|
1441 |
|
|
.t xview moveto 0
|
1442 |
|
|
.t yview moveto 0
|
1443 |
|
|
.t tag add sel 30.20
|
1444 |
|
|
.t tag add sel 30.50
|
1445 |
|
|
update
|
1446 |
|
|
.t see 30.50
|
1447 |
|
|
set x [list [.t bbox 30.50]]
|
1448 |
|
|
.t see 30.60
|
1449 |
|
|
lappend x [.t bbox 30.60]
|
1450 |
|
|
.t see 30.65
|
1451 |
|
|
lappend x [.t bbox 30.65]
|
1452 |
|
|
.t see 30.90
|
1453 |
|
|
lappend x [.t bbox 30.90]
|
1454 |
|
|
} {{80 55 7 13} {136 55 7 13} {136 55 7 13} {80 55 7 13}}
|
1455 |
|
|
wm geom . {}
|
1456 |
|
|
|
1457 |
|
|
.t configure -wrap none
|
1458 |
|
|
test textDisp-14.1 {TkTextXviewCmd procedure} {
|
1459 |
|
|
.t delete 1.0 end
|
1460 |
|
|
update
|
1461 |
|
|
.t insert end xxxxxxxxx\n
|
1462 |
|
|
.t insert end "xxxxx xxxxxxxxxxx xxxx xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx\n"
|
1463 |
|
|
.t insert end "xxxx xxxxxxxxx xxxxxxxxxxxxx"
|
1464 |
|
|
.t xview moveto .5
|
1465 |
|
|
.t xview
|
1466 |
|
|
} {0.5 0.857143}
|
1467 |
|
|
.t configure -wrap char
|
1468 |
|
|
test textDisp-14.2 {TkTextXviewCmd procedure} {
|
1469 |
|
|
.t delete 1.0 end
|
1470 |
|
|
update
|
1471 |
|
|
.t insert end xxxxxxxxx\n
|
1472 |
|
|
.t insert end "xxxxx\n"
|
1473 |
|
|
.t insert end "xxxx"
|
1474 |
|
|
.t xview
|
1475 |
|
|
} {0 1}
|
1476 |
|
|
.t configure -wrap none
|
1477 |
|
|
test textDisp-14.3 {TkTextXviewCmd procedure} {
|
1478 |
|
|
.t delete 1.0 end
|
1479 |
|
|
update
|
1480 |
|
|
.t insert end xxxxxxxxx\n
|
1481 |
|
|
.t insert end "xxxxx\n"
|
1482 |
|
|
.t insert end "xxxx"
|
1483 |
|
|
.t xview
|
1484 |
|
|
} {0 1}
|
1485 |
|
|
test textDisp-14.4 {TkTextXviewCmd procedure} {
|
1486 |
|
|
list [catch {.t xview moveto} msg] $msg
|
1487 |
|
|
} {1 {wrong # args: should be ".t xview moveto fraction"}}
|
1488 |
|
|
test textDisp-14.5 {TkTextXviewCmd procedure} {
|
1489 |
|
|
list [catch {.t xview moveto a b} msg] $msg
|
1490 |
|
|
} {1 {wrong # args: should be ".t xview moveto fraction"}}
|
1491 |
|
|
test textDisp-14.6 {TkTextXviewCmd procedure} {
|
1492 |
|
|
list [catch {.t xview moveto a} msg] $msg
|
1493 |
|
|
} {1 {expected floating-point number but got "a"}}
|
1494 |
|
|
test textDisp-14.7 {TkTextXviewCmd procedure} {
|
1495 |
|
|
.t delete 1.0 end
|
1496 |
|
|
.t insert end xxxxxxxxx\n
|
1497 |
|
|
.t insert end "xxxxx xxxxxxxxxxx xxxx xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx\n"
|
1498 |
|
|
.t insert end "xxxx xxxxxxxxx xxxxxxxxxxxxx"
|
1499 |
|
|
.t xview moveto .3
|
1500 |
|
|
.t xview
|
1501 |
|
|
} {0.303571 0.660714}
|
1502 |
|
|
test textDisp-14.8 {TkTextXviewCmd procedure} {
|
1503 |
|
|
.t delete 1.0 end
|
1504 |
|
|
.t insert end xxxxxxxxx\n
|
1505 |
|
|
.t insert end "xxxxx xxxxxxxxxxx xxxx xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx\n"
|
1506 |
|
|
.t insert end "xxxx xxxxxxxxx xxxxxxxxxxxxx"
|
1507 |
|
|
.t xview moveto -.4
|
1508 |
|
|
.t xview
|
1509 |
|
|
} {0 0.357143}
|
1510 |
|
|
test textDisp-14.9 {TkTextXviewCmd procedure} {
|
1511 |
|
|
.t delete 1.0 end
|
1512 |
|
|
.t insert end xxxxxxxxx\n
|
1513 |
|
|
.t insert end "xxxxx xxxxxxxxxxx xxxx xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx\n"
|
1514 |
|
|
.t insert end "xxxx xxxxxxxxx xxxxxxxxxxxxx"
|
1515 |
|
|
.t xview m 1.4
|
1516 |
|
|
.t xview
|
1517 |
|
|
} {0.642857 1}
|
1518 |
|
|
test textDisp-14.10 {TkTextXviewCmd procedure} {
|
1519 |
|
|
list [catch {.t xview scroll a} msg] $msg
|
1520 |
|
|
} {1 {wrong # args: should be ".t xview scroll number units|pages"}}
|
1521 |
|
|
test textDisp-14.11 {TkTextXviewCmd procedure} {
|
1522 |
|
|
list [catch {.t xview scroll a b c} msg] $msg
|
1523 |
|
|
} {1 {wrong # args: should be ".t xview scroll number units|pages"}}
|
1524 |
|
|
test textDisp-14.12 {TkTextXviewCmd procedure} {
|
1525 |
|
|
list [catch {.t xview scroll gorp units} msg] $msg
|
1526 |
|
|
} {1 {expected integer but got "gorp"}}
|
1527 |
|
|
test textDisp-14.13 {TkTextXviewCmd procedure} {
|
1528 |
|
|
.t delete 1.0 end
|
1529 |
|
|
.t insert end xxxxxxxxx\n
|
1530 |
|
|
.t insert end "a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9\n"
|
1531 |
|
|
.t insert end "xxxx xxxxxxxxx xxxxxxxxxxxxx"
|
1532 |
|
|
.t xview moveto 0
|
1533 |
|
|
.t xview scroll 2 p
|
1534 |
|
|
set x [.t index @0,22]
|
1535 |
|
|
.t xview scroll -1 p
|
1536 |
|
|
lappend x [.t index @0,22]
|
1537 |
|
|
.t xview scroll -2 pages
|
1538 |
|
|
lappend x [.t index @0,22]
|
1539 |
|
|
} {2.36 2.18 2.0}
|
1540 |
|
|
test textDisp-14.14 {TkTextXviewCmd procedure} {
|
1541 |
|
|
.t delete 1.0 end
|
1542 |
|
|
.t insert end xxxxxxxxx\n
|
1543 |
|
|
.t insert end "a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9\n"
|
1544 |
|
|
.t insert end "xxxx xxxxxxxxx xxxxxxxxxxxxx"
|
1545 |
|
|
.t xview moveto 0
|
1546 |
|
|
.t xview scroll 21 u
|
1547 |
|
|
set x [.t index @0,22]
|
1548 |
|
|
.t xview scroll -1 u
|
1549 |
|
|
lappend x [.t index @0,22]
|
1550 |
|
|
.t xview scroll 100 units
|
1551 |
|
|
lappend x [.t index @0,22]
|
1552 |
|
|
.t xview scroll -15 units
|
1553 |
|
|
lappend x [.t index @0,22]
|
1554 |
|
|
} {2.21 2.20 2.99 2.84}
|
1555 |
|
|
test textDisp-14.15 {TkTextXviewCmd procedure} {
|
1556 |
|
|
list [catch {.t xview scroll 14 globs} msg] $msg
|
1557 |
|
|
} {1 {bad argument "globs": must be units or pages}}
|
1558 |
|
|
test textDisp-14.16 {TkTextXviewCmd procedure} {
|
1559 |
|
|
list [catch {.t xview flounder} msg] $msg
|
1560 |
|
|
} {1 {unknown option "flounder": must be moveto or scroll}}
|
1561 |
|
|
|
1562 |
|
|
.t configure -wrap char
|
1563 |
|
|
.t delete 1.0 end
|
1564 |
|
|
for {set i 1} {$i < 99} {incr i} {
|
1565 |
|
|
.t insert end "Line $i\n"
|
1566 |
|
|
}
|
1567 |
|
|
.t insert end "Line 100"
|
1568 |
|
|
.t delete 50.0 51.0
|
1569 |
|
|
.t insert 50.0 "This is a long line, one that will wrap around twice.\n"
|
1570 |
|
|
test textDisp-15.1 {ScrollByLines procedure, scrolling backwards} {
|
1571 |
|
|
.t yview 45.0
|
1572 |
|
|
update
|
1573 |
|
|
.t yview scroll -3 units
|
1574 |
|
|
.t index @0,0
|
1575 |
|
|
} {42.0}
|
1576 |
|
|
test textDisp-15.2 {ScrollByLines procedure, scrolling backwards} {
|
1577 |
|
|
.t yview 51.0
|
1578 |
|
|
update
|
1579 |
|
|
.t yview scroll -2 units
|
1580 |
|
|
.t index @0,0
|
1581 |
|
|
} {50.20}
|
1582 |
|
|
test textDisp-15.3 {ScrollByLines procedure, scrolling backwards} {
|
1583 |
|
|
.t yview 51.0
|
1584 |
|
|
update
|
1585 |
|
|
.t yview scroll -4 units
|
1586 |
|
|
.t index @0,0
|
1587 |
|
|
} {49.0}
|
1588 |
|
|
test textDisp-15.4 {ScrollByLines procedure, scrolling backwards} {
|
1589 |
|
|
.t yview 50.20
|
1590 |
|
|
update
|
1591 |
|
|
.t yview scroll -2 units
|
1592 |
|
|
.t index @0,0
|
1593 |
|
|
} {49.0}
|
1594 |
|
|
test textDisp-15.5 {ScrollByLines procedure, scrolling backwards} {
|
1595 |
|
|
.t yview 50.40
|
1596 |
|
|
update
|
1597 |
|
|
.t yview scroll -2 units
|
1598 |
|
|
.t index @0,0
|
1599 |
|
|
} {50.0}
|
1600 |
|
|
test textDisp-15.6 {ScrollByLines procedure, scrolling backwards} {
|
1601 |
|
|
.t yview 3.2
|
1602 |
|
|
update
|
1603 |
|
|
.t yview scroll -5 units
|
1604 |
|
|
.t index @0,0
|
1605 |
|
|
} {1.0}
|
1606 |
|
|
test textDisp-15.7 {ScrollByLines procedure, scrolling forwards} {
|
1607 |
|
|
.t yview 48.0
|
1608 |
|
|
update
|
1609 |
|
|
.t yview scroll 4 units
|
1610 |
|
|
.t index @0,0
|
1611 |
|
|
} {50.40}
|
1612 |
|
|
|
1613 |
|
|
.t configure -wrap char
|
1614 |
|
|
.t delete 1.0 end
|
1615 |
|
|
.t insert insert "Line 1"
|
1616 |
|
|
for {set i 2} {$i <= 200} {incr i} {
|
1617 |
|
|
.t insert end "\nLine $i"
|
1618 |
|
|
}
|
1619 |
|
|
.t tag add big 100.0 105.0
|
1620 |
|
|
.t insert 151.end { has a lot of extra text, so that it wraps around on the screen several times over.}
|
1621 |
|
|
.t insert 153.end { also has enoug extra text to wrap.}
|
1622 |
|
|
update
|
1623 |
|
|
test textDisp-16.1 {TkTextYviewCmd procedure} {
|
1624 |
|
|
.t yview 21.0
|
1625 |
|
|
set x [.t yview]
|
1626 |
|
|
.t yview 1.0
|
1627 |
|
|
set x
|
1628 |
|
|
} {0.1 0.15}
|
1629 |
|
|
test textDisp-16.2 {TkTextYviewCmd procedure} {
|
1630 |
|
|
list [catch {.t yview 2 3} msg] $msg
|
1631 |
|
|
} {1 {unknown option "2": must be moveto or scroll}}
|
1632 |
|
|
test textDisp-16.3 {TkTextYviewCmd procedure} {
|
1633 |
|
|
list [catch {.t yview -pickplace} msg] $msg
|
1634 |
|
|
} {1 {wrong # args: should be ".t yview -pickplace lineNum|index"}}
|
1635 |
|
|
test textDisp-16.4 {TkTextYviewCmd procedure} {
|
1636 |
|
|
list [catch {.t yview -pickplace 2 3} msg] $msg
|
1637 |
|
|
} {1 {wrong # args: should be ".t yview -pickplace lineNum|index"}}
|
1638 |
|
|
test textDisp-16.5 {TkTextYviewCmd procedure} {
|
1639 |
|
|
list [catch {.t yview -bogus 2} msg] $msg
|
1640 |
|
|
} {1 {unknown option "-bogus": must be moveto or scroll}}
|
1641 |
|
|
test textDisp-16.6 {TkTextYviewCmd procedure, integer position} {
|
1642 |
|
|
.t yview 100.0
|
1643 |
|
|
update
|
1644 |
|
|
.t yview 98
|
1645 |
|
|
.t index @0,0
|
1646 |
|
|
} {99.0}
|
1647 |
|
|
test textDisp-16.7 {TkTextYviewCmd procedure} {
|
1648 |
|
|
.t yview 2.0
|
1649 |
|
|
.t yv -pickplace 13.0
|
1650 |
|
|
.t index @0,0
|
1651 |
|
|
} {4.0}
|
1652 |
|
|
test textDisp-16.8 {TkTextYviewCmd procedure} {
|
1653 |
|
|
list [catch {.t yview bad_mark_name} msg] $msg
|
1654 |
|
|
} {1 {bad text index "bad_mark_name"}}
|
1655 |
|
|
test textDisp-16.9 {TkTextYviewCmd procedure, "moveto" option} {
|
1656 |
|
|
list [catch {.t yview moveto a b} msg] $msg
|
1657 |
|
|
} {1 {wrong # args: should be ".t yview moveto fraction"}}
|
1658 |
|
|
test textDisp-16.10 {TkTextYviewCmd procedure, "moveto" option} {
|
1659 |
|
|
list [catch {.t yview moveto gorp} msg] $msg
|
1660 |
|
|
} {1 {expected floating-point number but got "gorp"}}
|
1661 |
|
|
test textDisp-16.11 {TkTextYviewCmd procedure, "moveto" option} {
|
1662 |
|
|
.t yview moveto 0.5
|
1663 |
|
|
.t index @0,0
|
1664 |
|
|
} {101.0}
|
1665 |
|
|
test textDisp-16.12 {TkTextYviewCmd procedure, "moveto" option} {
|
1666 |
|
|
.t yview moveto -1
|
1667 |
|
|
.t index @0,0
|
1668 |
|
|
} {1.0}
|
1669 |
|
|
test textDisp-16.13 {TkTextYviewCmd procedure, "moveto" option} {
|
1670 |
|
|
.t yview moveto 1.1
|
1671 |
|
|
.t index @0,0
|
1672 |
|
|
} {191.0}
|
1673 |
|
|
test textDisp-16.14 {TkTextYviewCmd procedure, "moveto" option} {
|
1674 |
|
|
.t yview moveto .75
|
1675 |
|
|
.t index @0,0
|
1676 |
|
|
} {151.0}
|
1677 |
|
|
test textDisp-16.15 {TkTextYviewCmd procedure, "moveto" option} {
|
1678 |
|
|
.t yview moveto .752
|
1679 |
|
|
.t index @0,0
|
1680 |
|
|
} {151.20}
|
1681 |
|
|
test textDisp-16.16 {TkTextYviewCmd procedure, "moveto" option} {
|
1682 |
|
|
.t yview moveto .754
|
1683 |
|
|
.t index @0,0
|
1684 |
|
|
} {151.60}
|
1685 |
|
|
test textDisp-16.17 {TkTextYviewCmd procedure, "moveto" option} {
|
1686 |
|
|
.t yview moveto .755
|
1687 |
|
|
.t index @0,0
|
1688 |
|
|
} {152.0}
|
1689 |
|
|
test textDisp-16.18 {TkTextYviewCmd procedure, "moveto" roundoff} {fonts} {
|
1690 |
|
|
catch {destroy .top1}
|
1691 |
|
|
toplevel .top1
|
1692 |
|
|
wm geometry .top1 +0+0
|
1693 |
|
|
text .top1.t -height 3 -width 4 -wrap none -setgrid 1 -padx 6 \
|
1694 |
|
|
-spacing3 6
|
1695 |
|
|
.top1.t insert end "1\n2\n3\n4\n5\n6"
|
1696 |
|
|
pack .top1.t
|
1697 |
|
|
update
|
1698 |
|
|
.top1.t yview moveto 0.3333
|
1699 |
|
|
set result [.top1.t yview]
|
1700 |
|
|
destroy .top1
|
1701 |
|
|
set result
|
1702 |
|
|
} {0.333333 0.833333}
|
1703 |
|
|
test textDisp-16.19 {TkTextYviewCmd procedure, "scroll" option} {
|
1704 |
|
|
list [catch {.t yview scroll a} msg] $msg
|
1705 |
|
|
} {1 {wrong # args: should be ".t yview scroll number units|pages"}}
|
1706 |
|
|
test textDisp-16.20 {TkTextYviewCmd procedure, "scroll" option} {
|
1707 |
|
|
list [catch {.t yview scroll a b c} msg] $msg
|
1708 |
|
|
} {1 {wrong # args: should be ".t yview scroll number units|pages"}}
|
1709 |
|
|
test textDisp-16.21 {TkTextYviewCmd procedure, "scroll" option} {
|
1710 |
|
|
list [catch {.t yview scroll badInt bogus} msg] $msg
|
1711 |
|
|
} {1 {expected integer but got "badInt"}}
|
1712 |
|
|
test textDisp-16.22 {TkTextYviewCmd procedure, "scroll" option, back pages} {
|
1713 |
|
|
.t yview 50.0
|
1714 |
|
|
update
|
1715 |
|
|
.t yview scroll -1 pages
|
1716 |
|
|
.t index @0,0
|
1717 |
|
|
} {42.0}
|
1718 |
|
|
test textDisp-16.23 {TkTextYviewCmd procedure, "scroll" option, back pages} {
|
1719 |
|
|
.t yview 50.0
|
1720 |
|
|
update
|
1721 |
|
|
.t yview scroll -3 p
|
1722 |
|
|
.t index @0,0
|
1723 |
|
|
} {26.0}
|
1724 |
|
|
test textDisp-16.24 {TkTextYviewCmd procedure, "scroll" option, back pages} {
|
1725 |
|
|
.t yview 5.0
|
1726 |
|
|
update
|
1727 |
|
|
.t yview scroll -3 p
|
1728 |
|
|
.t index @0,0
|
1729 |
|
|
} {1.0}
|
1730 |
|
|
test textDisp-16.25 {TkTextYviewCmd procedure, "scroll" option, back pages} {
|
1731 |
|
|
.t configure -height 1
|
1732 |
|
|
update
|
1733 |
|
|
.t yview 50.0
|
1734 |
|
|
update
|
1735 |
|
|
.t yview scroll -1 pages
|
1736 |
|
|
set x [.t index @0,0]
|
1737 |
|
|
.t configure -height 10
|
1738 |
|
|
update
|
1739 |
|
|
set x
|
1740 |
|
|
} {49.0}
|
1741 |
|
|
test textDisp-16.26 {TkTextYviewCmd procedure, "scroll" option, forward pages} {
|
1742 |
|
|
.t yview 50.0
|
1743 |
|
|
update
|
1744 |
|
|
.t yview scroll 1 pages
|
1745 |
|
|
.t index @0,0
|
1746 |
|
|
} {58.0}
|
1747 |
|
|
test textDisp-16.27 {TkTextYviewCmd procedure, "scroll" option, forward pages} {
|
1748 |
|
|
.t yview 50.0
|
1749 |
|
|
update
|
1750 |
|
|
.t yview scroll 2 pages
|
1751 |
|
|
.t index @0,0
|
1752 |
|
|
} {66.0}
|
1753 |
|
|
test textDisp-16.28 {TkTextYviewCmd procedure, "scroll" option, forward pages} {fonts} {
|
1754 |
|
|
.t yview 98.0
|
1755 |
|
|
update
|
1756 |
|
|
.t yview scroll 1 page
|
1757 |
|
|
.t index @0,0
|
1758 |
|
|
} {103.0}
|
1759 |
|
|
test textDisp-16.29 {TkTextYviewCmd procedure, "scroll" option, forward pages} {
|
1760 |
|
|
.t configure -height 1
|
1761 |
|
|
update
|
1762 |
|
|
.t yview 50.0
|
1763 |
|
|
update
|
1764 |
|
|
.t yview scroll 1 pages
|
1765 |
|
|
set x [.t index @0,0]
|
1766 |
|
|
.t configure -height 10
|
1767 |
|
|
update
|
1768 |
|
|
set x
|
1769 |
|
|
} {51.0}
|
1770 |
|
|
test textDisp-16.30 {TkTextYviewCmd procedure, "scroll units" option} {
|
1771 |
|
|
.t yview 45.0
|
1772 |
|
|
update
|
1773 |
|
|
.t yview scroll -3 units
|
1774 |
|
|
.t index @0,0
|
1775 |
|
|
} {42.0}
|
1776 |
|
|
test textDisp-16.31 {TkTextYviewCmd procedure, "scroll units" option} {
|
1777 |
|
|
.t yview 149.0
|
1778 |
|
|
update
|
1779 |
|
|
.t yview scroll 4 units
|
1780 |
|
|
.t index @0,0
|
1781 |
|
|
} {151.40}
|
1782 |
|
|
test textDisp-16.32 {TkTextYviewCmd procedure} {
|
1783 |
|
|
list [catch {.t yview scroll 12 bogoids} msg] $msg
|
1784 |
|
|
} {1 {bad argument "bogoids": must be units or pages}}
|
1785 |
|
|
test textDisp-16.33 {TkTextYviewCmd procedure} {
|
1786 |
|
|
list [catch {.t yview bad_arg 1 2} msg] $msg
|
1787 |
|
|
} {1 {unknown option "bad_arg": must be moveto or scroll}}
|
1788 |
|
|
|
1789 |
|
|
.t delete 1.0 end
|
1790 |
|
|
foreach i {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
|
1791 |
|
|
.t insert end "\nLine $i 11111 $i 22222 $i 33333 $i 44444 $i 55555"
|
1792 |
|
|
.t insert end " $i 66666 $i 77777 $i 88888 $i"
|
1793 |
|
|
}
|
1794 |
|
|
.t configure -wrap none
|
1795 |
|
|
test textDisp-17.1 {TkTextScanCmd procedure} {
|
1796 |
|
|
list [catch {.t scan a b} msg] $msg
|
1797 |
|
|
} {1 {wrong # args: should be ".t scan mark|dragto x y"}}
|
1798 |
|
|
test textDisp-17.2 {TkTextScanCmd procedure} {
|
1799 |
|
|
list [catch {.t scan a b c d} msg] $msg
|
1800 |
|
|
} {1 {wrong # args: should be ".t scan mark|dragto x y"}}
|
1801 |
|
|
test textDisp-17.3 {TkTextScanCmd procedure} {
|
1802 |
|
|
list [catch {.t scan stupid b 20} msg] $msg
|
1803 |
|
|
} {1 {expected integer but got "b"}}
|
1804 |
|
|
test textDisp-17.4 {TkTextScanCmd procedure} {
|
1805 |
|
|
list [catch {.t scan stupid -2 bogus} msg] $msg
|
1806 |
|
|
} {1 {expected integer but got "bogus"}}
|
1807 |
|
|
test textDisp-17.5 {TkTextScanCmd procedure} {
|
1808 |
|
|
list [catch {.t scan stupid 123 456} msg] $msg
|
1809 |
|
|
} {1 {bad scan option "stupid": must be mark or dragto}}
|
1810 |
|
|
test textDisp-17.6 {TkTextScanCmd procedure} {fonts} {
|
1811 |
|
|
.t yview 1.0
|
1812 |
|
|
.t xview moveto 0
|
1813 |
|
|
.t scan mark 40 60
|
1814 |
|
|
.t scan dragto 35 55
|
1815 |
|
|
.t index @0,0
|
1816 |
|
|
} {4.7}
|
1817 |
|
|
test textDisp-17.7 {TkTextScanCmd procedure} {fonts} {
|
1818 |
|
|
.t yview 10.0
|
1819 |
|
|
.t xview moveto 0
|
1820 |
|
|
.t xview scroll 20 units
|
1821 |
|
|
.t scan mark -10 60
|
1822 |
|
|
.t scan dragto -5 65
|
1823 |
|
|
.t index @0,0
|
1824 |
|
|
set x [.t index @0,0]
|
1825 |
|
|
.t scan dragto 0 70
|
1826 |
|
|
list $x [.t index @0,0]
|
1827 |
|
|
} {7.13 3.6}
|
1828 |
|
|
test textDisp-17.8 {TkTextScanCmd procedure} {fonts} {
|
1829 |
|
|
.t yview 1.0
|
1830 |
|
|
.t xview moveto 0
|
1831 |
|
|
.t scan mark 0 60
|
1832 |
|
|
.t scan dragto 30 100
|
1833 |
|
|
.t scan dragto 25 95
|
1834 |
|
|
.t index @0,0
|
1835 |
|
|
} {4.7}
|
1836 |
|
|
test textDisp-17.9 {TkTextScanCmd procedure} {fonts} {
|
1837 |
|
|
.t yview end
|
1838 |
|
|
.t xview moveto 0
|
1839 |
|
|
.t xview scroll 100 units
|
1840 |
|
|
.t scan mark 90 60
|
1841 |
|
|
.t scan dragto 10 0
|
1842 |
|
|
.t scan dragto 15 5
|
1843 |
|
|
.t index @0,0
|
1844 |
|
|
} {18.44}
|
1845 |
|
|
.t configure -wrap word
|
1846 |
|
|
test textDisp-17.10 {TkTextScanCmd procedure, word wrapping} {fonts} {
|
1847 |
|
|
.t yview 10.0
|
1848 |
|
|
.t scan mark -10 60
|
1849 |
|
|
.t scan dragto -5 65
|
1850 |
|
|
set x [.t index @0,0]
|
1851 |
|
|
.t scan dragto 0 70
|
1852 |
|
|
list $x [.t index @0,0]
|
1853 |
|
|
} {9.31 8.47}
|
1854 |
|
|
|
1855 |
|
|
.t configure -xscrollcommand scroll -yscrollcommand {}
|
1856 |
|
|
test textDisp-18.1 {GetXView procedure} {
|
1857 |
|
|
.t configure -wrap none
|
1858 |
|
|
.t delete 1.0 end
|
1859 |
|
|
.t insert end xxxxxxxxx\n
|
1860 |
|
|
.t insert end xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n
|
1861 |
|
|
.t insert end xxxxxxxxxxxxxxxxxxxxxxxxxx
|
1862 |
|
|
update
|
1863 |
|
|
set scrollInfo
|
1864 |
|
|
} {0 0.363636}
|
1865 |
|
|
test textDisp-18.2 {GetXView procedure} {
|
1866 |
|
|
.t configure -wrap char
|
1867 |
|
|
.t delete 1.0 end
|
1868 |
|
|
.t insert end xxxxxxxxx\n
|
1869 |
|
|
.t insert end xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n
|
1870 |
|
|
.t insert end xxxxxxxxxxxxxxxxxxxxxxxxxx
|
1871 |
|
|
update
|
1872 |
|
|
set scrollInfo
|
1873 |
|
|
} {0 1}
|
1874 |
|
|
test textDisp-18.3 {GetXView procedure} {
|
1875 |
|
|
.t configure -wrap none
|
1876 |
|
|
.t delete 1.0 end
|
1877 |
|
|
update
|
1878 |
|
|
set scrollInfo
|
1879 |
|
|
} {0 1}
|
1880 |
|
|
test textDisp-18.4 {GetXView procedure} {
|
1881 |
|
|
.t configure -wrap none
|
1882 |
|
|
.t delete 1.0 end
|
1883 |
|
|
.t insert end xxxxxxxxx\n
|
1884 |
|
|
.t insert end xxxxxx\n
|
1885 |
|
|
.t insert end xxxxxxxxxxxxxxxxx
|
1886 |
|
|
update
|
1887 |
|
|
set scrollInfo
|
1888 |
|
|
} {0 1}
|
1889 |
|
|
test textDisp-18.5 {GetXView procedure} {
|
1890 |
|
|
.t configure -wrap none
|
1891 |
|
|
.t delete 1.0 end
|
1892 |
|
|
.t insert end xxxxxxxxx\n
|
1893 |
|
|
.t insert end xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n
|
1894 |
|
|
.t insert end xxxxxxxxxxxxxxxxxxxxxxxxxx
|
1895 |
|
|
.t xview scroll 31 units
|
1896 |
|
|
update
|
1897 |
|
|
set scrollInfo
|
1898 |
|
|
} {0.563636 0.927273}
|
1899 |
|
|
test textDisp-18.6 {GetXView procedure} {
|
1900 |
|
|
.t configure -wrap none
|
1901 |
|
|
.t delete 1.0 end
|
1902 |
|
|
.t insert end xxxxxxxxx\n
|
1903 |
|
|
.t insert end "xxxxx xxxxxxxxxxx xxxx xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx\n"
|
1904 |
|
|
.t insert end "xxxx xxxxxxxxx xxxxxxxxxxxxx"
|
1905 |
|
|
.t xview moveto 0
|
1906 |
|
|
.t xview scroll 31 units
|
1907 |
|
|
update
|
1908 |
|
|
set x {}
|
1909 |
|
|
lappend x $scrollInfo
|
1910 |
|
|
.t configure -wrap char
|
1911 |
|
|
update
|
1912 |
|
|
lappend x $scrollInfo
|
1913 |
|
|
.t configure -wrap word
|
1914 |
|
|
update
|
1915 |
|
|
lappend x $scrollInfo
|
1916 |
|
|
.t configure -wrap none
|
1917 |
|
|
update
|
1918 |
|
|
lappend x $scrollInfo
|
1919 |
|
|
} {{0.553571 0.910714} {0 1} {0 1} {0 0.357143}}
|
1920 |
|
|
test textDisp-18.7 {GetXView procedure} {
|
1921 |
|
|
.t configure -wrap none
|
1922 |
|
|
.t delete 1.0 end
|
1923 |
|
|
update
|
1924 |
|
|
set scrollInfo unchanged
|
1925 |
|
|
.t insert end xxxxxx\n
|
1926 |
|
|
.t insert end xxx
|
1927 |
|
|
update
|
1928 |
|
|
set scrollInfo
|
1929 |
|
|
} {unchanged}
|
1930 |
|
|
test textDisp-18.8 {GetXView procedure} {
|
1931 |
|
|
proc bgerror msg {
|
1932 |
|
|
global x errorInfo
|
1933 |
|
|
set x [list $msg $errorInfo]
|
1934 |
|
|
}
|
1935 |
|
|
proc bogus args {
|
1936 |
|
|
error "bogus scroll proc"
|
1937 |
|
|
}
|
1938 |
|
|
.t configure -wrap none
|
1939 |
|
|
.t delete 1.0 end
|
1940 |
|
|
.t insert end xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n
|
1941 |
|
|
update
|
1942 |
|
|
.t delete 1.0 end
|
1943 |
|
|
.t configure -xscrollcommand scrollError
|
1944 |
|
|
update
|
1945 |
|
|
set x
|
1946 |
|
|
} {{scrolling error} {scrolling error
|
1947 |
|
|
while executing
|
1948 |
|
|
"error "scrolling error""
|
1949 |
|
|
(procedure "scrollError" line 2)
|
1950 |
|
|
invoked from within
|
1951 |
|
|
"scrollError 0 1"
|
1952 |
|
|
(horizontal scrolling command executed by text)}}
|
1953 |
|
|
catch {rename bgerror {}}
|
1954 |
|
|
catch {rename bogus {}}
|
1955 |
|
|
.t configure -xscrollcommand {} -yscrollcommand scroll
|
1956 |
|
|
|
1957 |
|
|
.t configure -xscrollcommand {} -yscrollcommand scroll
|
1958 |
|
|
test textDisp-19.1 {GetYView procedure} {
|
1959 |
|
|
.t configure -wrap char
|
1960 |
|
|
.t delete 1.0 end
|
1961 |
|
|
update
|
1962 |
|
|
set scrollInfo
|
1963 |
|
|
} {0 1}
|
1964 |
|
|
test textDisp-19.2 {GetYView procedure} {
|
1965 |
|
|
.t configure -wrap char
|
1966 |
|
|
.t delete 1.0 end
|
1967 |
|
|
update
|
1968 |
|
|
set scrollInfo "unchanged"
|
1969 |
|
|
.t insert 1.0 "Line1\nLine2"
|
1970 |
|
|
update
|
1971 |
|
|
set scrollInfo
|
1972 |
|
|
} {unchanged}
|
1973 |
|
|
test textDisp-19.3 {GetYView procedure} {
|
1974 |
|
|
.t configure -wrap char
|
1975 |
|
|
.t delete 1.0 end
|
1976 |
|
|
update
|
1977 |
|
|
set scrollInfo "unchanged"
|
1978 |
|
|
.t insert 1.0 "Line 1\nLine 2 is so long that it wraps around\nLine 3"
|
1979 |
|
|
update
|
1980 |
|
|
set scrollInfo
|
1981 |
|
|
} {unchanged}
|
1982 |
|
|
test textDisp-19.4 {GetYView procedure} {
|
1983 |
|
|
.t configure -wrap char
|
1984 |
|
|
.t delete 1.0 end
|
1985 |
|
|
.t insert 1.0 "Line 1"
|
1986 |
|
|
update
|
1987 |
|
|
set scrollInfo "unchanged"
|
1988 |
|
|
foreach i {2 3 4 5 6 7 8 9 10 11 12 13} {
|
1989 |
|
|
.t insert end "\nLine $i"
|
1990 |
|
|
}
|
1991 |
|
|
update
|
1992 |
|
|
set scrollInfo
|
1993 |
|
|
} {0 0.769231}
|
1994 |
|
|
test textDisp-19.5 {GetYView procedure} {
|
1995 |
|
|
.t configure -wrap char
|
1996 |
|
|
.t delete 1.0 end
|
1997 |
|
|
.t insert 1.0 "Line 1"
|
1998 |
|
|
foreach i {2 3 4 5 6 7 8 9 10 11 12 13} {
|
1999 |
|
|
.t insert end "\nLine $i"
|
2000 |
|
|
}
|
2001 |
|
|
.t insert 2.end " is really quite long; in fact it's so long that it wraps three times"
|
2002 |
|
|
update
|
2003 |
|
|
set x $scrollInfo
|
2004 |
|
|
} {0 0.538462}
|
2005 |
|
|
test textDisp-19.6 {GetYView procedure} {
|
2006 |
|
|
.t configure -wrap char
|
2007 |
|
|
.t delete 1.0 end
|
2008 |
|
|
.t insert 1.0 "Line 1"
|
2009 |
|
|
foreach i {2 3 4 5 6 7 8 9 10 11 12 13} {
|
2010 |
|
|
.t insert end "\nLine $i"
|
2011 |
|
|
}
|
2012 |
|
|
.t insert 2.end " is really quite long; in fact it's so long that it wraps three times"
|
2013 |
|
|
.t yview 4.0
|
2014 |
|
|
update
|
2015 |
|
|
set x $scrollInfo
|
2016 |
|
|
} {0.230769 1}
|
2017 |
|
|
test textDisp-19.7 {GetYView procedure} {
|
2018 |
|
|
.t configure -wrap char
|
2019 |
|
|
.t delete 1.0 end
|
2020 |
|
|
.t insert 1.0 "Line 1"
|
2021 |
|
|
foreach i {2 3 4 5 6 7 8 9 10 11 12 13} {
|
2022 |
|
|
.t insert end "\nLine $i"
|
2023 |
|
|
}
|
2024 |
|
|
.t insert 2.end " is really quite long; in fact it's so long that it wraps three times"
|
2025 |
|
|
.t yview 2.26
|
2026 |
|
|
update
|
2027 |
|
|
set x $scrollInfo
|
2028 |
|
|
} {0.097166 0.692308}
|
2029 |
|
|
test textDisp-19.8 {GetYView procedure} {
|
2030 |
|
|
.t configure -wrap char
|
2031 |
|
|
.t delete 1.0 end
|
2032 |
|
|
.t insert 1.0 "Line 1"
|
2033 |
|
|
foreach i {2 3 4 5 6 7 8 9 10 11 12 13} {
|
2034 |
|
|
.t insert end "\nLine $i"
|
2035 |
|
|
}
|
2036 |
|
|
.t insert 10.end " is really quite long; in fact it's so long that it wraps three times"
|
2037 |
|
|
.t yview 2.0
|
2038 |
|
|
update
|
2039 |
|
|
set x $scrollInfo
|
2040 |
|
|
} {0.0769231 0.732268}
|
2041 |
|
|
test textDisp-19.9 {GetYView procedure} {
|
2042 |
|
|
.t configure -wrap char
|
2043 |
|
|
.t delete 1.0 end
|
2044 |
|
|
.t insert 1.0 "Line 1"
|
2045 |
|
|
foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
|
2046 |
|
|
.t insert end "\nLine $i"
|
2047 |
|
|
}
|
2048 |
|
|
.t yview 3.0
|
2049 |
|
|
update
|
2050 |
|
|
set scrollInfo
|
2051 |
|
|
} {0.133333 0.8}
|
2052 |
|
|
test textDisp-19.10 {GetYView procedure} {
|
2053 |
|
|
.t configure -wrap char
|
2054 |
|
|
.t delete 1.0 end
|
2055 |
|
|
.t insert 1.0 "Line 1"
|
2056 |
|
|
foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
|
2057 |
|
|
.t insert end "\nLine $i"
|
2058 |
|
|
}
|
2059 |
|
|
.t yview 11.0
|
2060 |
|
|
update
|
2061 |
|
|
set scrollInfo
|
2062 |
|
|
} {0.333333 1}
|
2063 |
|
|
test textDisp-19.11 {GetYView procedure} {
|
2064 |
|
|
.t configure -wrap word
|
2065 |
|
|
.t delete 1.0 end
|
2066 |
|
|
.t insert 1.0 "Line 1"
|
2067 |
|
|
foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
|
2068 |
|
|
.t insert end "\nLine $i"
|
2069 |
|
|
}
|
2070 |
|
|
.t insert end "\nThis last line wraps around four "
|
2071 |
|
|
.t insert end "times with a bit left on the last line."
|
2072 |
|
|
.t yview insert
|
2073 |
|
|
update
|
2074 |
|
|
set scrollInfo
|
2075 |
|
|
} {0.625 1}
|
2076 |
|
|
test textDisp-19.12 {GetYView procedure, partially visible last line} {
|
2077 |
|
|
catch {destroy .top}
|
2078 |
|
|
toplevel .top
|
2079 |
|
|
wm geometry .top +0+0
|
2080 |
|
|
text .top.t -width 40 -height 5
|
2081 |
|
|
pack .top.t -expand yes -fill both
|
2082 |
|
|
.top.t insert end "Line 1\nLine 2\nLine 3\nLine 4\nLine 5"
|
2083 |
|
|
update
|
2084 |
|
|
scan [wm geom .top] %dx%d twidth theight
|
2085 |
|
|
wm geom .top ${twidth}x[expr $theight - 3]
|
2086 |
|
|
update
|
2087 |
|
|
.top.t yview
|
2088 |
|
|
} {0 0.8}
|
2089 |
|
|
test textDisp-19.13 {GetYView procedure, partially visible last line} {fonts} {
|
2090 |
|
|
catch {destroy .top}
|
2091 |
|
|
toplevel .top
|
2092 |
|
|
wm geometry .top +0+0
|
2093 |
|
|
text .top.t -width 40 -height 5
|
2094 |
|
|
pack .top.t -expand yes -fill both
|
2095 |
|
|
.top.t insert end "Line 1\nLine 2\nLine 3\nLine 4 has enough text to wrap around at least once"
|
2096 |
|
|
update
|
2097 |
|
|
scan [wm geom .top] %dx%d twidth theight
|
2098 |
|
|
wm geom .top ${twidth}x[expr $theight - 3]
|
2099 |
|
|
update
|
2100 |
|
|
.top.t yview
|
2101 |
|
|
} {0 0.942308}
|
2102 |
|
|
catch {destroy .top}
|
2103 |
|
|
test textDisp-19.14 {GetYView procedure} {
|
2104 |
|
|
.t configure -wrap word
|
2105 |
|
|
.t delete 1.0 end
|
2106 |
|
|
.t insert 1.0 "Line 1"
|
2107 |
|
|
foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
|
2108 |
|
|
.t insert end "\nLine $i"
|
2109 |
|
|
}
|
2110 |
|
|
.t insert end "\nThis last line wraps around four "
|
2111 |
|
|
.t insert end "times with a bit left on the last line."
|
2112 |
|
|
update
|
2113 |
|
|
set scrollInfo "unchanged"
|
2114 |
|
|
.t mark set insert 3.0
|
2115 |
|
|
.t tag configure x -background red
|
2116 |
|
|
.t tag add x 1.0 5.0
|
2117 |
|
|
update
|
2118 |
|
|
.t tag delete x
|
2119 |
|
|
set scrollInfo
|
2120 |
|
|
} {unchanged}
|
2121 |
|
|
test textDisp-19.15 {GetYView procedure} {
|
2122 |
|
|
.t configure -wrap word
|
2123 |
|
|
.t delete 1.0 end
|
2124 |
|
|
.t insert 1.0 "Line 1"
|
2125 |
|
|
foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
|
2126 |
|
|
.t insert end "\nLine $i"
|
2127 |
|
|
}
|
2128 |
|
|
.t insert end "\nThis last line wraps around four "
|
2129 |
|
|
.t insert end "times with a bit left on the last line."
|
2130 |
|
|
update
|
2131 |
|
|
.t configure -yscrollcommand scrollError
|
2132 |
|
|
proc bgerror args {
|
2133 |
|
|
global x errorInfo errorCode
|
2134 |
|
|
set x [list $args $errorInfo $errorCode]
|
2135 |
|
|
}
|
2136 |
|
|
.t delete 1.0 end
|
2137 |
|
|
update
|
2138 |
|
|
rename bgerror {}
|
2139 |
|
|
.t configure -yscrollcommand scroll
|
2140 |
|
|
set x
|
2141 |
|
|
} {{{scrolling error}} {scrolling error
|
2142 |
|
|
while executing
|
2143 |
|
|
"error "scrolling error""
|
2144 |
|
|
(procedure "scrollError" line 2)
|
2145 |
|
|
invoked from within
|
2146 |
|
|
"scrollError 0 1"
|
2147 |
|
|
(vertical scrolling command executed by text)} NONE}
|
2148 |
|
|
|
2149 |
|
|
.t delete 1.0 end
|
2150 |
|
|
.t insert end "Line 1"
|
2151 |
|
|
for {set i 2} {$i <= 200} {incr i} {
|
2152 |
|
|
.t insert end "\nLine $i"
|
2153 |
|
|
}
|
2154 |
|
|
.t configure -wrap word
|
2155 |
|
|
.t delete 50.0 51.0
|
2156 |
|
|
.t insert 50.0 "This is a long line, one that will wrap around twice.\n"
|
2157 |
|
|
test textDisp-20.1 {FindDLine} {fonts} {
|
2158 |
|
|
.t yview 48.0
|
2159 |
|
|
list [.t dlineinfo 46.0] [.t dlineinfo 47.0] [.t dlineinfo 49.0] \
|
2160 |
|
|
[.t dlineinfo 58.0]
|
2161 |
|
|
} {{} {} {3 16 49 13 10} {}}
|
2162 |
|
|
test textDisp-20.2 {FindDLine} {fonts} {
|
2163 |
|
|
.t yview 100.0
|
2164 |
|
|
.t yview -pickplace 53.0
|
2165 |
|
|
list [.t dlineinfo 50.0] [.t dlineinfo 50.14] [.t dlineinfo 50.15]
|
2166 |
|
|
} {{} {} {3 3 140 13 10}}
|
2167 |
|
|
test textDisp-20.3 {FindDLine} {fonts} {
|
2168 |
|
|
.t yview 100.0
|
2169 |
|
|
.t yview 49.0
|
2170 |
|
|
list [.t dlineinfo 50.0] [.t dlineinfo 50.20] [.t dlineinfo 57.0]
|
2171 |
|
|
} {{3 16 105 13 10} {3 29 140 13 10} {}}
|
2172 |
|
|
test textDisp-20.4 {FindDLine} {fonts} {
|
2173 |
|
|
.t yview 100.0
|
2174 |
|
|
.t yview 42.0
|
2175 |
|
|
list [.t dlineinfo 50.0] [.t dlineinfo 50.20] [.t dlineinfo 50.40]
|
2176 |
|
|
} {{3 107 105 13 10} {3 120 140 13 10} {}}
|
2177 |
|
|
.t config -wrap none
|
2178 |
|
|
test textDisp-20.5 {FindDLine} {fonts} {
|
2179 |
|
|
.t yview 100.0
|
2180 |
|
|
.t yview 48.0
|
2181 |
|
|
list [.t dlineinfo 50.0] [.t dlineinfo 50.20] [.t dlineinfo 50.40]
|
2182 |
|
|
} {{3 29 371 13 10} {3 29 371 13 10} {3 29 371 13 10}}
|
2183 |
|
|
|
2184 |
|
|
.t config -wrap word
|
2185 |
|
|
test textDisp-21.1 {TkTextPixelIndex} {fonts} {
|
2186 |
|
|
.t yview 48.0
|
2187 |
|
|
list [.t index @-10,-10] [.t index @6,6] [.t index @22,6] \
|
2188 |
|
|
[.t index @102,6] [.t index @38,55] [.t index @44,67]
|
2189 |
|
|
} {48.0 48.0 48.2 48.7 50.40 50.40}
|
2190 |
|
|
.t insert end \n
|
2191 |
|
|
test textDisp-21.2 {TkTextPixelIndex} {fonts} {
|
2192 |
|
|
.t yview 195.0
|
2193 |
|
|
list [.t index @11,70] [.t index @11,84] [.t index @11,102] \
|
2194 |
|
|
[.t index @11,1002]
|
2195 |
|
|
} {197.1 198.1 199.1 201.0}
|
2196 |
|
|
test textDisp-21.3 {TkTextPixelIndex, horizontal scrolling} {fonts} {
|
2197 |
|
|
.t configure -wrap none
|
2198 |
|
|
.t delete 1.0 end
|
2199 |
|
|
.t insert end "12345\n"
|
2200 |
|
|
.t insert end "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
2201 |
|
|
.t xview scroll 2 units
|
2202 |
|
|
list [.t index @-5,7] [.t index @5,7] [.t index @33,20]
|
2203 |
|
|
} {1.2 1.2 2.6}
|
2204 |
|
|
|
2205 |
|
|
.t delete 1.0 end
|
2206 |
|
|
.t insert end "Line 1"
|
2207 |
|
|
for {set i 2} {$i <= 200} {incr i} {
|
2208 |
|
|
.t insert end "\nLine $i"
|
2209 |
|
|
}
|
2210 |
|
|
.t configure -wrap word
|
2211 |
|
|
.t delete 50.0 51.0
|
2212 |
|
|
.t insert 50.0 "This is a long line, one that will wrap around twice.\n"
|
2213 |
|
|
update
|
2214 |
|
|
.t tag add x 50.1
|
2215 |
|
|
test textDisp-22.1 {TkTextCharBbox} {fonts} {
|
2216 |
|
|
.t config -wrap word
|
2217 |
|
|
.t yview 48.0
|
2218 |
|
|
list [.t bbox 47.2] [.t bbox 48.0] [.t bbox 50.5] [.t bbox 50.40] \
|
2219 |
|
|
[.t bbox 58.0]
|
2220 |
|
|
} {{} {3 3 7 13} {38 29 7 13} {38 55 7 13} {}}
|
2221 |
|
|
test textDisp-22.2 {TkTextCharBbox} {fonts} {
|
2222 |
|
|
.t config -wrap none
|
2223 |
|
|
.t yview 48.0
|
2224 |
|
|
list [.t bbox 50.5] [.t bbox 50.40] [.t bbox 57.0]
|
2225 |
|
|
} {{38 29 7 13} {} {3 120 7 13}}
|
2226 |
|
|
test textDisp-22.3 {TkTextCharBbox, cut-off lines} {fonts} {
|
2227 |
|
|
.t config -wrap char
|
2228 |
|
|
.t yview 10.0
|
2229 |
|
|
wm geom . ${width}x[expr $height-1]
|
2230 |
|
|
update
|
2231 |
|
|
list [.t bbox 19.1] [.t bbox 20.1]
|
2232 |
|
|
} {{10 120 7 13} {10 133 7 3}}
|
2233 |
|
|
test textDisp-22.4 {TkTextCharBbox, cut-off lines} {fonts} {
|
2234 |
|
|
.t config -wrap char
|
2235 |
|
|
.t yview 10.0
|
2236 |
|
|
wm geom . ${width}x[expr $height+1]
|
2237 |
|
|
update
|
2238 |
|
|
list [.t bbox 19.1] [.t bbox 20.1]
|
2239 |
|
|
} {{10 120 7 13} {10 133 7 5}}
|
2240 |
|
|
test textDisp-22.5 {TkTextCharBbox, cut-off char} {fonts} {
|
2241 |
|
|
.t config -wrap none
|
2242 |
|
|
.t yview 10.0
|
2243 |
|
|
wm geom . [expr $width-95]x$height
|
2244 |
|
|
update
|
2245 |
|
|
.t bbox 15.6
|
2246 |
|
|
} {45 68 7 13}
|
2247 |
|
|
test textDisp-22.6 {TkTextCharBbox, line visible but not char} {fonts} {
|
2248 |
|
|
.t config -wrap char
|
2249 |
|
|
.t yview 10.0
|
2250 |
|
|
.t tag add big 20.2 20.5
|
2251 |
|
|
wm geom . ${width}x[expr $height+3]
|
2252 |
|
|
update
|
2253 |
|
|
list [.t bbox 19.1] [.t bbox 20.1] [.t bbox 20.2]
|
2254 |
|
|
} {{10 120 7 13} {} {17 133 14 7}}
|
2255 |
|
|
wm geom . {}
|
2256 |
|
|
update
|
2257 |
|
|
test textDisp-22.7 {TkTextCharBbox, different character sizes} {fonts} {
|
2258 |
|
|
.t config -wrap char
|
2259 |
|
|
.t yview 10.0
|
2260 |
|
|
.t tag add big 12.2 12.5
|
2261 |
|
|
update
|
2262 |
|
|
list [.t bbox 12.1] [.t bbox 12.2]
|
2263 |
|
|
} {{10 41 7 13} {17 29 14 27}}
|
2264 |
|
|
.t tag remove big 1.0 end
|
2265 |
|
|
test textDisp-22.8 {TkTextCharBbox, horizontal scrolling} {fonts} {
|
2266 |
|
|
.t configure -wrap none
|
2267 |
|
|
.t delete 1.0 end
|
2268 |
|
|
.t insert end "12345\n"
|
2269 |
|
|
.t insert end "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
2270 |
|
|
.t xview scroll 4 units
|
2271 |
|
|
list [.t bbox 1.3] [.t bbox 1.4] [.t bbox 2.3] [.t bbox 2.4] \
|
2272 |
|
|
[.t bbox 2.23] [.t bbox 2.24]
|
2273 |
|
|
} {{} {3 3 7 13} {} {3 16 7 13} {136 16 7 13} {}}
|
2274 |
|
|
test textDisp-22.9 {TkTextCharBbox, handling of spacing} {fonts} {
|
2275 |
|
|
.t configure -wrap char
|
2276 |
|
|
.t delete 1.0 end
|
2277 |
|
|
.t insert 1.0 "abcdefghijkl\nmnopqrstuvwzyz"
|
2278 |
|
|
.t tag configure spacing -spacing1 8 -spacing3 2
|
2279 |
|
|
.t tag add spacing 1.0 end
|
2280 |
|
|
frame .t.f1 -width 10 -height 4 -bg black
|
2281 |
|
|
frame .t.f2 -width 10 -height 4 -bg black
|
2282 |
|
|
frame .t.f3 -width 10 -height 4 -bg black
|
2283 |
|
|
frame .t.f4 -width 10 -height 4 -bg black
|
2284 |
|
|
.t window create 1.3 -window .t.f1 -align top
|
2285 |
|
|
.t window create 1.7 -window .t.f2 -align center
|
2286 |
|
|
.t window create 2.1 -window .t.f3 -align bottom
|
2287 |
|
|
.t window create 2.10 -window .t.f4 -align baseline
|
2288 |
|
|
update
|
2289 |
|
|
list [.t bbox .t.f1] [.t bbox .t.f2] [.t bbox .t.f3] [.t bbox .t.f4] \
|
2290 |
|
|
[.t bbox 1.1] [.t bbox 2.9]
|
2291 |
|
|
} {{24 11 10 4} {55 15 10 4} {10 43 10 4} {76 40 10 4} {10 11 7 13} {69 34 7 13}}
|
2292 |
|
|
.t tag delete spacing
|
2293 |
|
|
|
2294 |
|
|
.t delete 1.0 end
|
2295 |
|
|
.t insert end "Line 1"
|
2296 |
|
|
for {set i 2} {$i <= 200} {incr i} {
|
2297 |
|
|
.t insert end "\nLine $i"
|
2298 |
|
|
}
|
2299 |
|
|
.t configure -wrap word
|
2300 |
|
|
.t delete 50.0 51.0
|
2301 |
|
|
.t insert 50.0 "This is a long line, one that will wrap around twice.\n"
|
2302 |
|
|
update
|
2303 |
|
|
test textDisp-23.1 {TkTextDLineInfo} {fonts} {
|
2304 |
|
|
.t config -wrap word
|
2305 |
|
|
.t yview 48.0
|
2306 |
|
|
list [.t dlineinfo 47.3] [.t dlineinfo 48.0] [.t dlineinfo 50.40] \
|
2307 |
|
|
[.t dlineinfo 56.0]
|
2308 |
|
|
} {{} {3 3 49 13 10} {3 55 126 13 10} {}}
|
2309 |
|
|
test textDisp-23.2 {TkTextDLineInfo} {fonts} {
|
2310 |
|
|
.t config -bd 4 -wrap word
|
2311 |
|
|
update
|
2312 |
|
|
.t yview 48.0
|
2313 |
|
|
.t dlineinfo 50.40
|
2314 |
|
|
} {7 59 126 13 10}
|
2315 |
|
|
.t config -bd 0
|
2316 |
|
|
test textDisp-23.3 {TkTextDLineInfo} {fonts} {
|
2317 |
|
|
.t config -wrap none
|
2318 |
|
|
update
|
2319 |
|
|
.t yview 48.0
|
2320 |
|
|
list [.t dlineinfo 50.40] [.t dlineinfo 57.3]
|
2321 |
|
|
} {{3 29 371 13 10} {3 120 49 13 10}}
|
2322 |
|
|
test textDisp-23.4 {TkTextDLineInfo, cut-off lines} {fonts} {
|
2323 |
|
|
.t config -wrap char
|
2324 |
|
|
.t yview 10.0
|
2325 |
|
|
wm geom . ${width}x[expr $height-1]
|
2326 |
|
|
update
|
2327 |
|
|
list [.t dlineinfo 19.0] [.t dlineinfo 20.0]
|
2328 |
|
|
} {{3 120 49 13 10} {3 133 49 3 10}}
|
2329 |
|
|
test textDisp-23.5 {TkTextDLineInfo, cut-off lines} {fonts} {
|
2330 |
|
|
.t config -wrap char
|
2331 |
|
|
.t yview 10.0
|
2332 |
|
|
wm geom . ${width}x[expr $height+1]
|
2333 |
|
|
update
|
2334 |
|
|
list [.t dlineinfo 19.0] [.t dlineinfo 20.0]
|
2335 |
|
|
} {{3 120 49 13 10} {3 133 49 5 10}}
|
2336 |
|
|
wm geom . {}
|
2337 |
|
|
update
|
2338 |
|
|
test textDisp-23.6 {TkTextDLineInfo, horizontal scrolling} {fonts} {
|
2339 |
|
|
.t config -wrap none
|
2340 |
|
|
.t delete 1.0 end
|
2341 |
|
|
.t insert end "First line\n"
|
2342 |
|
|
.t insert end "Second line is a very long one that doesn't all fit.\n"
|
2343 |
|
|
.t insert end "Third"
|
2344 |
|
|
.t xview scroll 6 units
|
2345 |
|
|
update
|
2346 |
|
|
list [.t dlineinfo 1.0] [.t dlineinfo 2.0] [.t dlineinfo 3.0]
|
2347 |
|
|
} {{-39 3 70 13 10} {-39 16 364 13 10} {-39 29 35 13 10}}
|
2348 |
|
|
.t xview moveto 0
|
2349 |
|
|
test textDisp-23.7 {TkTextDLineInfo, centering} {fonts} {
|
2350 |
|
|
.t config -wrap word
|
2351 |
|
|
.t delete 1.0 end
|
2352 |
|
|
.t insert end "First line\n"
|
2353 |
|
|
.t insert end "Second line is a very long one that doesn't all fit.\n"
|
2354 |
|
|
.t insert end "Third"
|
2355 |
|
|
.t tag configure x -justify center
|
2356 |
|
|
.t tag configure y -justify right
|
2357 |
|
|
.t tag add x 1.0
|
2358 |
|
|
.t tag add y 3.0
|
2359 |
|
|
list [.t dlineinfo 1.0] [.t dlineinfo 2.0] [.t dlineinfo 3.0]
|
2360 |
|
|
} {{38 3 70 13 10} {3 16 119 13 10} {108 55 35 13 10}}
|
2361 |
|
|
.t tag delete x y
|
2362 |
|
|
|
2363 |
|
|
test textDisp-24.1 {TkTextCharLayoutProc} {fonts} {
|
2364 |
|
|
.t configure -wrap char
|
2365 |
|
|
.t delete 1.0 end
|
2366 |
|
|
.t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
|
2367 |
|
|
list [.t bbox 1.19] [.t bbox 1.20]
|
2368 |
|
|
} {{136 3 7 13} {3 16 7 13}}
|
2369 |
|
|
test textDisp-24.2 {TkTextCharLayoutProc} {fonts} {
|
2370 |
|
|
.t configure -wrap char
|
2371 |
|
|
.t delete 1.0 end
|
2372 |
|
|
.t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
|
2373 |
|
|
wm geom . [expr $width+1]x$height
|
2374 |
|
|
update
|
2375 |
|
|
list [.t bbox 1.19] [.t bbox 1.20]
|
2376 |
|
|
} {{136 3 12 13} {3 16 7 13}}
|
2377 |
|
|
test textDisp-24.3 {TkTextCharLayoutProc} {fonts} {
|
2378 |
|
|
.t configure -wrap char
|
2379 |
|
|
.t delete 1.0 end
|
2380 |
|
|
.t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
|
2381 |
|
|
wm geom . [expr $width-1]x$height
|
2382 |
|
|
update
|
2383 |
|
|
list [.t bbox 1.19] [.t bbox 1.20]
|
2384 |
|
|
} {{136 3 10 13} {3 16 7 13}}
|
2385 |
|
|
test textDisp-24.4 {TkTextCharLayoutProc, newline not visible} {fonts} {
|
2386 |
|
|
.t configure -wrap char
|
2387 |
|
|
.t delete 1.0 end
|
2388 |
|
|
.t insert 1.0 01234567890123456789\n012345678901234567890
|
2389 |
|
|
wm geom . {}
|
2390 |
|
|
update
|
2391 |
|
|
list [.t bbox 1.19] [.t bbox 1.20] [.t bbox 2.20]
|
2392 |
|
|
} {{136 3 7 13} {143 3 0 13} {3 29 7 13}}
|
2393 |
|
|
test textDisp-24.5 {TkTextCharLayoutProc, char doesn't fit, newline not visible} {fonts} {
|
2394 |
|
|
.t configure -wrap char
|
2395 |
|
|
.t delete 1.0 end
|
2396 |
|
|
.t insert 1.0 0\n1\n
|
2397 |
|
|
wm geom . 110x$height
|
2398 |
|
|
update
|
2399 |
|
|
list [.t bbox 1.0] [.t bbox 1.1] [.t bbox 2.0]
|
2400 |
|
|
} {{3 3 4 13} {7 3 0 13} {3 16 4 13}}
|
2401 |
|
|
test textDisp-24.6 {TkTextCharLayoutProc, line ends with space} {fonts} {
|
2402 |
|
|
.t configure -wrap char
|
2403 |
|
|
.t delete 1.0 end
|
2404 |
|
|
.t insert 1.0 "a b c d e f g h i j k l m n o p"
|
2405 |
|
|
wm geom . {}
|
2406 |
|
|
update
|
2407 |
|
|
list [.t bbox 1.19] [.t bbox 1.20]
|
2408 |
|
|
} {{136 3 7 13} {3 16 7 13}}
|
2409 |
|
|
test textDisp-24.7 {TkTextCharLayoutProc, line ends with space} {fonts} {
|
2410 |
|
|
.t configure -wrap char
|
2411 |
|
|
.t delete 1.0 end
|
2412 |
|
|
.t insert 1.0 "a b c d e f g h i j k l m n o p"
|
2413 |
|
|
wm geom . [expr $width+1]x$height
|
2414 |
|
|
update
|
2415 |
|
|
list [.t bbox 1.19] [.t bbox 1.20]
|
2416 |
|
|
} {{136 3 12 13} {3 16 7 13}}
|
2417 |
|
|
test textDisp-24.8 {TkTextCharLayoutProc, line ends with space} {fonts} {
|
2418 |
|
|
.t configure -wrap char
|
2419 |
|
|
.t delete 1.0 end
|
2420 |
|
|
.t insert 1.0 "a b c d e f g h i j k l m n o p"
|
2421 |
|
|
wm geom . [expr $width-1]x$height
|
2422 |
|
|
update
|
2423 |
|
|
list [.t bbox 1.19] [.t bbox 1.20]
|
2424 |
|
|
} {{136 3 10 13} {3 16 7 13}}
|
2425 |
|
|
test textDisp-24.9 {TkTextCharLayoutProc, line ends with space} {fonts} {
|
2426 |
|
|
.t configure -wrap char
|
2427 |
|
|
.t delete 1.0 end
|
2428 |
|
|
.t insert 1.0 "a b c d e f g h i j k l m n o p"
|
2429 |
|
|
wm geom . [expr $width-6]x$height
|
2430 |
|
|
update
|
2431 |
|
|
list [.t bbox 1.19] [.t bbox 1.20]
|
2432 |
|
|
} {{136 3 5 13} {3 16 7 13}}
|
2433 |
|
|
test textDisp-24.10 {TkTextCharLayoutProc, line ends with space} {fonts} {
|
2434 |
|
|
.t configure -wrap char
|
2435 |
|
|
.t delete 1.0 end
|
2436 |
|
|
.t insert 1.0 "a b c d e f g h i j k l m n o p"
|
2437 |
|
|
wm geom . [expr $width-7]x$height
|
2438 |
|
|
update
|
2439 |
|
|
list [.t bbox 1.19] [.t bbox 1.20]
|
2440 |
|
|
} {{136 3 4 13} {3 16 7 13}}
|
2441 |
|
|
test textDisp-24.11 {TkTextCharLayoutProc, line ends with space that doesn't quite fit} {fonts} {
|
2442 |
|
|
.t configure -wrap char
|
2443 |
|
|
.t delete 1.0 end
|
2444 |
|
|
.t insert 1.0 "01234567890123456789 \nabcdefg"
|
2445 |
|
|
wm geom . [expr $width-2]x$height
|
2446 |
|
|
update
|
2447 |
|
|
set result {}
|
2448 |
|
|
lappend result [.t bbox 1.21] [.t bbox 2.0]
|
2449 |
|
|
.t mark set insert 1.21
|
2450 |
|
|
lappend result [.t bbox 1.21] [.t bbox 2.0]
|
2451 |
|
|
} {{145 3 0 13} {3 16 7 13} {145 3 0 13} {3 16 7 13}}
|
2452 |
|
|
test textDisp-24.12 {TkTextCharLayoutProc, tab causes wrap} {fonts} {
|
2453 |
|
|
.t configure -wrap char
|
2454 |
|
|
.t delete 1.0 end
|
2455 |
|
|
.t insert 1.0 "abcdefghi"
|
2456 |
|
|
.t mark set insert 1.4
|
2457 |
|
|
.t insert insert \t\t\t
|
2458 |
|
|
list [.t bbox {insert -1c}] [.t bbox insert]
|
2459 |
|
|
} {{115 3 30 13} {3 16 7 13}}
|
2460 |
|
|
test textDisp-24.13 {TkTextCharLayoutProc, -wrap none} {fonts} {
|
2461 |
|
|
.t configure -wrap none
|
2462 |
|
|
.t delete 1.0 end
|
2463 |
|
|
.t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
|
2464 |
|
|
wm geom . {}
|
2465 |
|
|
update
|
2466 |
|
|
list [.t bbox 1.19] [.t bbox 1.20]
|
2467 |
|
|
} {{136 3 7 13} {}}
|
2468 |
|
|
test textDisp-24.14 {TkTextCharLayoutProc, -wrap none} {fonts} {
|
2469 |
|
|
.t configure -wrap none
|
2470 |
|
|
.t delete 1.0 end
|
2471 |
|
|
.t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
|
2472 |
|
|
wm geom . [expr $width+1]x$height
|
2473 |
|
|
update
|
2474 |
|
|
list [.t bbox 1.19] [.t bbox 1.20]
|
2475 |
|
|
} {{136 3 7 13} {143 3 5 13}}
|
2476 |
|
|
test textDisp-24.15 {TkTextCharLayoutProc, -wrap none} {fonts} {
|
2477 |
|
|
.t configure -wrap none
|
2478 |
|
|
.t delete 1.0 end
|
2479 |
|
|
.t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
|
2480 |
|
|
wm geom . [expr $width-1]x$height
|
2481 |
|
|
update
|
2482 |
|
|
list [.t bbox 1.19] [.t bbox 1.20]
|
2483 |
|
|
} {{136 3 7 13} {143 3 3 13}}
|
2484 |
|
|
test textDisp-24.16 {TkTextCharLayoutProc, no chars fit} {fonts} {
|
2485 |
|
|
.t configure -wrap char
|
2486 |
|
|
.t delete 1.0 end
|
2487 |
|
|
.t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
|
2488 |
|
|
wm geom . 103x$height
|
2489 |
|
|
update
|
2490 |
|
|
list [.t bbox 1.0] [.t bbox 1.1] [.t bbox 1.2]
|
2491 |
|
|
} {{3 3 1 13} {3 16 1 13} {3 29 1 13}}
|
2492 |
|
|
test textDisp-24.17 {TkTextCharLayoutProc, -wrap word} {fonts} {
|
2493 |
|
|
.t configure -wrap word
|
2494 |
|
|
.t delete 1.0 end
|
2495 |
|
|
.t insert 1.0 "This is a line that wraps around"
|
2496 |
|
|
wm geom . {}
|
2497 |
|
|
update
|
2498 |
|
|
list [.t bbox 1.19] [.t bbox 1.20]
|
2499 |
|
|
} {{136 3 7 13} {3 16 7 13}}
|
2500 |
|
|
test textDisp-24.18 {TkTextCharLayoutProc, -wrap word} {fonts} {
|
2501 |
|
|
.t configure -wrap word
|
2502 |
|
|
.t delete 1.0 end
|
2503 |
|
|
.t insert 1.0 "xThis is a line that wraps around"
|
2504 |
|
|
wm geom . {}
|
2505 |
|
|
update
|
2506 |
|
|
list [.t bbox 1.14] [.t bbox 1.15] [.t bbox 1.16]
|
2507 |
|
|
} {{101 3 7 13} {108 3 35 13} {3 16 7 13}}
|
2508 |
|
|
test textDisp-24.19 {TkTextCharLayoutProc, -wrap word} {fonts} {
|
2509 |
|
|
.t configure -wrap word
|
2510 |
|
|
.t delete 1.0 end
|
2511 |
|
|
.t insert 1.0 "xxThis is a line that wraps around"
|
2512 |
|
|
wm geom . {}
|
2513 |
|
|
update
|
2514 |
|
|
list [.t bbox 1.14] [.t bbox 1.15] [.t bbox 1.16]
|
2515 |
|
|
} {{101 3 7 13} {108 3 7 13} {115 3 28 13}}
|
2516 |
|
|
test textDisp-24.20 {TkTextCharLayoutProc, vertical offset} {fonts} {
|
2517 |
|
|
.t configure -wrap none
|
2518 |
|
|
.t delete 1.0 end
|
2519 |
|
|
.t insert 1.0 "Line 1\nLine 2\nLine 3"
|
2520 |
|
|
set result {}
|
2521 |
|
|
lappend result [.t bbox 2.1] [.t dlineinfo 2.1]
|
2522 |
|
|
.t tag configure up -offset 6
|
2523 |
|
|
.t tag add up 2.1
|
2524 |
|
|
lappend result [.t bbox 2.1] [.t dlineinfo 2.1]
|
2525 |
|
|
.t tag configure up -offset -2
|
2526 |
|
|
lappend result [.t bbox 2.1] [.t dlineinfo 2.1]
|
2527 |
|
|
.t tag delete up
|
2528 |
|
|
set result
|
2529 |
|
|
} {{10 16 7 13} {3 16 42 13 10} {10 16 7 13} {3 16 42 19 16} {10 18 7 13} {3 16 42 15 10}}
|
2530 |
|
|
.t configure -width 30
|
2531 |
|
|
update
|
2532 |
|
|
test textDisp-24.21 {TkTextCharLayoutProc, word breaks} {fonts} {
|
2533 |
|
|
.t configure -wrap word
|
2534 |
|
|
.t delete 1.0 end
|
2535 |
|
|
.t insert 1.0 "Sample text xxxxxxx yyyyy zzzzzzz qqqqq rrrr ssss tt u vvvvv"
|
2536 |
|
|
frame .t.f -width 30 -height 20 -bg black
|
2537 |
|
|
.t window create 1.36 -window .t.f
|
2538 |
|
|
.t bbox 1.26
|
2539 |
|
|
} {3 19 7 13}
|
2540 |
|
|
test textDisp-24.22 {TkTextCharLayoutProc, word breaks} {fonts} {
|
2541 |
|
|
.t configure -wrap word
|
2542 |
|
|
.t delete 1.0 end
|
2543 |
|
|
frame .t.f -width 30 -height 20 -bg black
|
2544 |
|
|
.t insert 1.0 "Sample text xxxxxxx yyyyyyy"
|
2545 |
|
|
.t window create end -window .t.f
|
2546 |
|
|
.t insert end "zzzzzzz qqqqq rrrr ssss tt u vvvvv"
|
2547 |
|
|
.t bbox 1.28
|
2548 |
|
|
} {33 19 7 13}
|
2549 |
|
|
test textDisp-24.23 {TkTextCharLayoutProc, word breaks} {fonts} {
|
2550 |
|
|
.t configure -wrap word
|
2551 |
|
|
.t delete 1.0 end
|
2552 |
|
|
frame .t.f -width 30 -height 20 -bg black
|
2553 |
|
|
.t insert 1.0 "Sample text xxxxxxx yyyyyyy "
|
2554 |
|
|
.t insert end "zzzzzzz qqqqq rrrr ssss tt"
|
2555 |
|
|
.t window create end -window .t.f
|
2556 |
|
|
.t insert end "u vvvvv"
|
2557 |
|
|
.t bbox .t.f
|
2558 |
|
|
} {3 29 30 20}
|
2559 |
|
|
catch {destroy .t.f}
|
2560 |
|
|
.t configure -width 20
|
2561 |
|
|
update
|
2562 |
|
|
test textDisp-24.24 {TkTextCharLayoutProc, justification and tabs} {fonts} {
|
2563 |
|
|
.t delete 1.0 end
|
2564 |
|
|
.t tag configure x -justify center
|
2565 |
|
|
.t insert 1.0 aa\tbb\tcc\tdd\t
|
2566 |
|
|
.t tag add x 1.0 end
|
2567 |
|
|
list [.t bbox 1.0] [.t bbox 1.10]
|
2568 |
|
|
} {{45 3 7 13} {94 3 7 13}}
|
2569 |
|
|
|
2570 |
|
|
.t configure -width 40 -bd 0 -relief flat -highlightthickness 0 -padx 0 \
|
2571 |
|
|
-tabs 100
|
2572 |
|
|
update
|
2573 |
|
|
test textDisp-25.1 {CharBboxProc procedure, check tab width} {fonts} {
|
2574 |
|
|
.t delete 1.0 end
|
2575 |
|
|
.t insert 1.0 abc\td\tfgh
|
2576 |
|
|
list [.t bbox 1.3] [.t bbox 1.5] [.t bbox 1.6]
|
2577 |
|
|
} {{21 1 79 13} {107 1 93 13} {200 1 7 13}}
|
2578 |
|
|
|
2579 |
|
|
.t configure -width 40 -bd 0 -relief flat -highlightthickness 0 -padx 0 \
|
2580 |
|
|
-tabs {}
|
2581 |
|
|
update
|
2582 |
|
|
test textDisp-26.1 {AdjustForTab procedure, no tabs} {fonts} {
|
2583 |
|
|
.t delete 1.0 end
|
2584 |
|
|
.t insert 1.0 a\tbcdefghij\tc\td
|
2585 |
|
|
list [lindex [.t bbox 1.2] 0] [lindex [.t bbox 1.12] 0] \
|
2586 |
|
|
[lindex [.t bbox 1.14] 0]
|
2587 |
|
|
} {56 168 224}
|
2588 |
|
|
test textDisp-26.2 {AdjustForTab procedure, not enough tabs specified} {
|
2589 |
|
|
.t delete 1.0 end
|
2590 |
|
|
.t insert 1.0 a\tb\tc\td
|
2591 |
|
|
.t tag delete x
|
2592 |
|
|
.t tag configure x -tabs 40
|
2593 |
|
|
.t tag add x 1.0 end
|
2594 |
|
|
list [lindex [.t bbox 1.2] 0] [lindex [.t bbox 1.4] 0] \
|
2595 |
|
|
[lindex [.t bbox 1.6] 0]
|
2596 |
|
|
} {40 80 120}
|
2597 |
|
|
test textDisp-26.3 {AdjustForTab procedure, not enough tabs specified} {
|
2598 |
|
|
.t delete 1.0 end
|
2599 |
|
|
.t insert 1.0 a\tb\tc\td\te
|
2600 |
|
|
.t tag delete x
|
2601 |
|
|
.t tag configure x -tabs {40 70 right}
|
2602 |
|
|
.t tag add x 1.0 end
|
2603 |
|
|
list [lindex [.t bbox 1.2] 0] \
|
2604 |
|
|
[expr [lindex [.t bbox 1.4] 0] + [lindex [.t bbox 1.4] 2]] \
|
2605 |
|
|
[expr [lindex [.t bbox 1.6] 0] + [lindex [.t bbox 1.6] 2]] \
|
2606 |
|
|
[expr [lindex [.t bbox 1.8] 0] + [lindex [.t bbox 1.8] 2]]
|
2607 |
|
|
} {40 70 100 130}
|
2608 |
|
|
test textDisp-26.4 {AdjustForTab procedure, different alignments} {
|
2609 |
|
|
.t delete 1.0 end
|
2610 |
|
|
.t insert 1.0 a\tbc\tde\tfg\thi
|
2611 |
|
|
.t tag delete x
|
2612 |
|
|
.t tag configure x -tabs {40 center 80 left 130 right}
|
2613 |
|
|
.t tag add x 1.0 end
|
2614 |
|
|
.t tag add y 1.2
|
2615 |
|
|
.t tag add y 1.5
|
2616 |
|
|
.t tag add y 1.8
|
2617 |
|
|
list [lindex [.t bbox 1.3] 0] [lindex [.t bbox 1.5] 0] \
|
2618 |
|
|
[lindex [.t bbox 1.10] 0]
|
2619 |
|
|
} {40 80 130}
|
2620 |
|
|
test textDisp-26.5 {AdjustForTab procedure, numeric alignment} {
|
2621 |
|
|
.t delete 1.0 end
|
2622 |
|
|
.t insert 1.0 a\t1.234
|
2623 |
|
|
.t tag delete x
|
2624 |
|
|
.t tag configure x -tabs {120 numeric}
|
2625 |
|
|
.t tag add x 1.0 end
|
2626 |
|
|
.t tag add y 1.2
|
2627 |
|
|
.t tag add y 1.5
|
2628 |
|
|
lindex [.t bbox 1.3] 0
|
2629 |
|
|
} {120}
|
2630 |
|
|
test textDisp-26.6 {AdjustForTab procedure, numeric alignment} {
|
2631 |
|
|
.t delete 1.0 end
|
2632 |
|
|
.t insert 1.0 a\t1,456.234
|
2633 |
|
|
.t tag delete x
|
2634 |
|
|
.t tag configure x -tabs {120 numeric}
|
2635 |
|
|
.t tag add x 1.0 end
|
2636 |
|
|
.t tag add y 1.2
|
2637 |
|
|
lindex [.t bbox 1.7] 0
|
2638 |
|
|
} {120}
|
2639 |
|
|
test textDisp-26.7 {AdjustForTab procedure, numeric alignment} {
|
2640 |
|
|
.t delete 1.0 end
|
2641 |
|
|
.t insert 1.0 a\t1.456.234,7
|
2642 |
|
|
.t tag delete x
|
2643 |
|
|
.t tag configure x -tabs {120 numeric}
|
2644 |
|
|
.t tag add x 1.0 end
|
2645 |
|
|
.t tag add y 1.2
|
2646 |
|
|
lindex [.t bbox 1.11] 0
|
2647 |
|
|
} {120}
|
2648 |
|
|
test textDisp-26.8 {AdjustForTab procedure, numeric alignment} {
|
2649 |
|
|
.t delete 1.0 end
|
2650 |
|
|
.t insert 1.0 a\ttest
|
2651 |
|
|
.t tag delete x
|
2652 |
|
|
.t tag configure x -tabs {120 numeric}
|
2653 |
|
|
.t tag add x 1.0 end
|
2654 |
|
|
.t tag add y 1.2
|
2655 |
|
|
lindex [.t bbox 1.6] 0
|
2656 |
|
|
} {120}
|
2657 |
|
|
test textDisp-26.9 {AdjustForTab procedure, numeric alignment} {
|
2658 |
|
|
.t delete 1.0 end
|
2659 |
|
|
.t insert 1.0 a\t1234
|
2660 |
|
|
.t tag delete x
|
2661 |
|
|
.t tag configure x -tabs {120 numeric}
|
2662 |
|
|
.t tag add x 1.0 end
|
2663 |
|
|
.t tag add y 1.2
|
2664 |
|
|
lindex [.t bbox 1.6] 0
|
2665 |
|
|
} {120}
|
2666 |
|
|
test textDisp-26.10 {AdjustForTab procedure, numeric alignment} {
|
2667 |
|
|
.t delete 1.0 end
|
2668 |
|
|
.t insert 1.0 a\t1.234567
|
2669 |
|
|
.t tag delete x
|
2670 |
|
|
.t tag configure x -tabs {120 numeric}
|
2671 |
|
|
.t tag add x 1.0 end
|
2672 |
|
|
.t tag add y 1.5
|
2673 |
|
|
lindex [.t bbox 1.3] 0
|
2674 |
|
|
} {120}
|
2675 |
|
|
test textDisp-26.11 {AdjustForTab procedure, numeric alignment} {
|
2676 |
|
|
.t delete 1.0 end
|
2677 |
|
|
.t insert 1.0 a\tx=1.234567
|
2678 |
|
|
.t tag delete x
|
2679 |
|
|
.t tag configure x -tabs {120 numeric}
|
2680 |
|
|
.t tag add x 1.0 end
|
2681 |
|
|
.t tag add y 1.7
|
2682 |
|
|
.t tag add y 1.9
|
2683 |
|
|
lindex [.t bbox 1.5] 0
|
2684 |
|
|
} {120}
|
2685 |
|
|
test textDisp-26.12 {AdjustForTab procedure, adjusting chunks} {
|
2686 |
|
|
.t delete 1.0 end
|
2687 |
|
|
.t insert 1.0 a\tx1.234567
|
2688 |
|
|
.t tag delete x
|
2689 |
|
|
.t tag configure x -tabs {120 numeric}
|
2690 |
|
|
.t tag add x 1.0 end
|
2691 |
|
|
.t tag add y 1.7
|
2692 |
|
|
.t tag add y 1.9
|
2693 |
|
|
button .b -text "="
|
2694 |
|
|
.t window create 1.3 -window .b
|
2695 |
|
|
update
|
2696 |
|
|
lindex [.t bbox 1.5] 0
|
2697 |
|
|
} {120}
|
2698 |
|
|
test textDisp-26.13 {AdjustForTab procedure, not enough space} {fonts} {
|
2699 |
|
|
.t delete 1.0 end
|
2700 |
|
|
.t insert 1.0 "abc\txyz\tqrs\txyz\t0"
|
2701 |
|
|
.t tag delete x
|
2702 |
|
|
.t tag configure x -tabs {10 30 center 50 right 120}
|
2703 |
|
|
.t tag add x 1.0 end
|
2704 |
|
|
list [lindex [.t bbox 1.4] 0] [lindex [.t bbox 1.8] 0] \
|
2705 |
|
|
[lindex [.t bbox 1.12] 0] [lindex [.t bbox 1.16] 0]
|
2706 |
|
|
} {28 56 84 120}
|
2707 |
|
|
|
2708 |
|
|
.t configure -width 20 -bd 2 -highlightthickness 2 -relief sunken -tabs {} \
|
2709 |
|
|
-wrap char
|
2710 |
|
|
update
|
2711 |
|
|
test textDisp-27.1 {SizeOfTab procedure, old-style tabs} {fonts} {
|
2712 |
|
|
.t delete 1.0 end
|
2713 |
|
|
.t insert 1.0 a\tbcdefghij\tc\td
|
2714 |
|
|
list [.t bbox 1.2] [.t bbox 1.10] [.t bbox 1.12]
|
2715 |
|
|
} {{60 5 7 13} {116 5 7 13} {4 18 7 13}}
|
2716 |
|
|
test textDisp-27.2 {SizeOfTab procedure, choosing tabX and alignment} {fonts} {
|
2717 |
|
|
.t delete 1.0 end
|
2718 |
|
|
.t insert 1.0 a\tbcd
|
2719 |
|
|
.t tag delete x
|
2720 |
|
|
.t tag configure x -tabs 120
|
2721 |
|
|
.t tag add x 1.0 end
|
2722 |
|
|
list [.t bbox 1.3] [.t bbox 1.4]
|
2723 |
|
|
} {{131 5 13 13} {4 18 7 13}}
|
2724 |
|
|
test textDisp-27.3 {SizeOfTab procedure, choosing tabX and alignment} {fonts} {
|
2725 |
|
|
.t delete 1.0 end
|
2726 |
|
|
.t insert 1.0 a\t\t\tbcd
|
2727 |
|
|
.t tag delete x
|
2728 |
|
|
.t tag configure x -tabs 40
|
2729 |
|
|
.t tag add x 1.0 end
|
2730 |
|
|
list [.t bbox 1.5] [.t bbox 1.6]
|
2731 |
|
|
} {{131 5 13 13} {4 18 7 13}}
|
2732 |
|
|
test textDisp-27.4 {SizeOfTab procedure, choosing tabX and alignment} {fonts} {
|
2733 |
|
|
.t delete 1.0 end
|
2734 |
|
|
.t insert 1.0 a\t\t\tbcd
|
2735 |
|
|
.t tag delete x
|
2736 |
|
|
.t tag configure x -tabs {20 center 70 left}
|
2737 |
|
|
.t tag add x 1.0 end
|
2738 |
|
|
list [.t bbox 1.5] [.t bbox 1.6]
|
2739 |
|
|
} {{131 5 13 13} {4 18 7 13}}
|
2740 |
|
|
test textDisp-27.5 {SizeOfTab procedure, center alignment} {fonts} {
|
2741 |
|
|
.t delete 1.0 end
|
2742 |
|
|
.t insert 1.0 a\txyzzyabc
|
2743 |
|
|
.t tag delete x
|
2744 |
|
|
.t tag configure x -tabs {120 center}
|
2745 |
|
|
.t tag add x 1.0 end
|
2746 |
|
|
list [.t bbox 1.6] [.t bbox 1.7]
|
2747 |
|
|
} {{135 5 9 13} {4 18 7 13}}
|
2748 |
|
|
test textDisp-27.6 {SizeOfTab procedure, center alignment} {fonts} {
|
2749 |
|
|
.t delete 1.0 end
|
2750 |
|
|
.t insert 1.0 a\txyzzyabc
|
2751 |
|
|
.t tag delete x
|
2752 |
|
|
.t tag configure x -tabs {150 center}
|
2753 |
|
|
.t tag add x 1.0 end
|
2754 |
|
|
list [.t bbox 1.6] [.t bbox 1.7]
|
2755 |
|
|
} {{32 18 7 13} {39 18 7 13}}
|
2756 |
|
|
test textDisp-27.7 {SizeOfTab procedure, center alignment, wrap -none (potential numerical problems)} {fonts} {
|
2757 |
|
|
.t delete 1.0 end
|
2758 |
|
|
.t configure -tabs {1c 2c center 3c 4c} -wrap none -width 40
|
2759 |
|
|
.t insert 1.0 a\tb\tc\td\te\n012345678934567890a\tbb\tcc\tdd
|
2760 |
|
|
update
|
2761 |
|
|
.t bbox 2.24
|
2762 |
|
|
} {172 18 7 13}
|
2763 |
|
|
.t configure -wrap char -tabs {} -width 20
|
2764 |
|
|
update
|
2765 |
|
|
test textDisp-27.8 {SizeOfTab procedure, right alignment} {fonts} {
|
2766 |
|
|
.t delete 1.0 end
|
2767 |
|
|
.t insert 1.0 a\t\txyzzyabc
|
2768 |
|
|
.t tag delete x
|
2769 |
|
|
.t tag configure x -tabs {100 left 140 right}
|
2770 |
|
|
.t tag add x 1.0 end
|
2771 |
|
|
list [.t bbox 1.6] [.t bbox 1.7]
|
2772 |
|
|
} {{137 5 7 13} {4 18 7 13}}
|
2773 |
|
|
test textDisp-27.9 {SizeOfTab procedure, left alignment} {fonts} {
|
2774 |
|
|
.t delete 1.0 end
|
2775 |
|
|
.t insert 1.0 a\txyzzyabc
|
2776 |
|
|
.t tag delete x
|
2777 |
|
|
.t tag configure x -tabs {120}
|
2778 |
|
|
.t tag add x 1.0 end
|
2779 |
|
|
list [.t bbox 1.3] [.t bbox 1.4]
|
2780 |
|
|
} {{131 5 13 13} {4 18 7 13}}
|
2781 |
|
|
test textDisp-27.10 {SizeOfTab procedure, numeric alignment} {fonts} {
|
2782 |
|
|
.t delete 1.0 end
|
2783 |
|
|
.t insert 1.0 a\t123.4
|
2784 |
|
|
.t tag delete x
|
2785 |
|
|
.t tag configure x -tabs {120 numeric}
|
2786 |
|
|
.t tag add x 1.0 end
|
2787 |
|
|
list [.t bbox 1.3] [.t bbox 1.4]
|
2788 |
|
|
} {{117 5 27 13} {4 18 7 13}}
|
2789 |
|
|
test textDisp-27.11 {SizeOfTab procedure, making tabs at least as wide as a space} {fonts} {
|
2790 |
|
|
.t delete 1.0 end
|
2791 |
|
|
.t insert 1.0 abc\tdefghijklmnopqrst
|
2792 |
|
|
.t tag delete x
|
2793 |
|
|
.t tag configure x -tabs {120}
|
2794 |
|
|
.t tag add x 1.0 end
|
2795 |
|
|
list [.t bbox 1.5] [.t bbox 1.6]
|
2796 |
|
|
} {{131 5 13 13} {4 18 7 13}}
|
2797 |
|
|
|
2798 |
|
|
proc bizarre_scroll args {
|
2799 |
|
|
.t2.t delete 5.0 end
|
2800 |
|
|
}
|
2801 |
|
|
test textDisp-28.1 {"yview" option with bizarre scroll command} {
|
2802 |
|
|
catch {destroy .t2}
|
2803 |
|
|
toplevel .t2
|
2804 |
|
|
text .t2.t -width 40 -height 4
|
2805 |
|
|
.t2.t insert end "1\n2\n3\n4\n5\n6\n7\n8\n"
|
2806 |
|
|
pack .t2.t
|
2807 |
|
|
wm geometry .t2 +0+0
|
2808 |
|
|
update
|
2809 |
|
|
.t2.t configure -yscrollcommand bizarre_scroll
|
2810 |
|
|
.t2.t yview 100.0
|
2811 |
|
|
set result [.t2.t index @0,0]
|
2812 |
|
|
update
|
2813 |
|
|
lappend result [.t2.t index @0,0]
|
2814 |
|
|
} {6.0 1.0}
|
2815 |
|
|
|
2816 |
|
|
test textDisp-29.1 {miscellaneous: lines wrap but are still too long} {fonts} {
|
2817 |
|
|
catch {destroy .t2}
|
2818 |
|
|
toplevel .t2
|
2819 |
|
|
wm geometry .t2 +0+0
|
2820 |
|
|
text .t2.t -width 20 -height 10 -font $fixedFont \
|
2821 |
|
|
-wrap char -xscrollcommand ".t2.s set"
|
2822 |
|
|
pack .t2.t -side top
|
2823 |
|
|
scrollbar .t2.s -orient horizontal -command ".t2.t xview"
|
2824 |
|
|
pack .t2.s -side bottom -fill x
|
2825 |
|
|
.t2.t insert end 123
|
2826 |
|
|
frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised
|
2827 |
|
|
.t2.t window create 1.1 -window .t2.t.f
|
2828 |
|
|
update
|
2829 |
|
|
list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3]
|
2830 |
|
|
} {{0 0.466667} 300x50+5+18 {12 68 7 13}}
|
2831 |
|
|
test textDisp-29.2 {miscellaneous: lines wrap but are still too long} {fonts} {
|
2832 |
|
|
catch {destroy .t2}
|
2833 |
|
|
toplevel .t2
|
2834 |
|
|
wm geometry .t2 +0+0
|
2835 |
|
|
text .t2.t -width 20 -height 10 -font $fixedFont \
|
2836 |
|
|
-wrap char -xscrollcommand ".t2.s set"
|
2837 |
|
|
pack .t2.t -side top
|
2838 |
|
|
scrollbar .t2.s -orient horizontal -command ".t2.t xview"
|
2839 |
|
|
pack .t2.s -side bottom -fill x
|
2840 |
|
|
.t2.t insert end 123
|
2841 |
|
|
frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised
|
2842 |
|
|
.t2.t window create 1.1 -window .t2.t.f
|
2843 |
|
|
.t2.t xview scroll 1 unit
|
2844 |
|
|
update
|
2845 |
|
|
list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3]
|
2846 |
|
|
} {{0.0233333 0.49} 300x50+-2+18 {5 68 7 13}}
|
2847 |
|
|
test textDisp-29.3 {miscellaneous: lines wrap but are still too long} {fonts} {
|
2848 |
|
|
catch {destroy .t2}
|
2849 |
|
|
toplevel .t2
|
2850 |
|
|
wm geometry .t2 +0+0
|
2851 |
|
|
text .t2.t -width 20 -height 10 -font $fixedFont \
|
2852 |
|
|
-wrap char -xscrollcommand ".t2.s set"
|
2853 |
|
|
pack .t2.t -side top
|
2854 |
|
|
scrollbar .t2.s -orient horizontal -command ".t2.t xview"
|
2855 |
|
|
pack .t2.s -side bottom -fill x
|
2856 |
|
|
.t2.t insert end 123
|
2857 |
|
|
frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised
|
2858 |
|
|
.t2.t window create 1.1 -window .t2.t.f
|
2859 |
|
|
update
|
2860 |
|
|
.t2.t xview scroll 200 units
|
2861 |
|
|
update
|
2862 |
|
|
list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3]
|
2863 |
|
|
} {{0.536667 1} 300x50+-156+18 {}}
|
2864 |
|
|
|
2865 |
|
|
foreach i [winfo children .] {
|
2866 |
|
|
catch {destroy $i}
|
2867 |
|
|
}
|
2868 |
|
|
option clear
|