home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / tcl / tk3.3b1 / tests / text.test < prev    next >
Encoding:
Text File  |  1993-07-10  |  36.6 KB  |  1,127 lines

  1. # This file is a Tcl script to test out Tk's text widget.  The test
  2. # file "btree.test" contains additional tests focussed on the B-tree
  3. # facilities in particular.  This file is organized in the standard
  4. # fashion for Tcl tests.
  5. #
  6. # Copyright (c) 1992-1993 The Regents of the University of California.
  7. # All rights reserved.
  8. #
  9. # Permission is hereby granted, without written agreement and without
  10. # license or royalty fees, to use, copy, modify, and distribute this
  11. # software and its documentation for any purpose, provided that the
  12. # above copyright notice and the following two paragraphs appear in
  13. # all copies of this software.
  14. #
  15. # IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
  16. # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
  17. # OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  18. # CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  19. #
  20. # THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  21. # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  22. # AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  23. # ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  24. # PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  25. #
  26. # $Header: /user6/ouster/wish/tests/RCS/text.test,v 1.11 93/07/10 15:03:25 ouster Exp $ (Berkeley)
  27.  
  28. if {[string compare test [info procs test]] == 1} then \
  29.   {source defs}
  30.  
  31. catch {destroy .t}
  32. text .t -font -adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1 \
  33.     -width 80 -height 24
  34. pack append . .t {top expand fill}
  35. .t debug on
  36. wm geometry . {}
  37.  
  38. # The statements below reset the main window;  it's needed if the window
  39. # manager is mwm to make mwm forget about a previous minimum size setting.
  40.  
  41. wm withdraw .
  42. wm minsize . 1 1
  43. wm positionfrom . user
  44. wm deiconify .
  45.  
  46. proc setup {} {
  47.     .t delete 1.0 end
  48.     foreach i [.t tag names] {
  49.     if {$i != "sel"} {
  50.         .t tag delete $i
  51.     }
  52.     }
  53.     .t insert 1.0 "Text for first line\nSecond line\n\nLast line of info"
  54.     .t tag add x 1.1
  55.     .t tag add x 1.5 1.13
  56.     .t tag add x 2.2 2.6
  57.     .t tag add y 1.5
  58. }
  59.  
  60. setup
  61. foreach i [.t mark names] {
  62.     if {($i != "insert") && ($i != "current")} {
  63.     .t mark unset $i
  64.     }
  65. }
  66. test text-1.1 {"compare" option} {
  67.     list [.t compare 1.1 < 1.2] [.t compare 1.1 < 1.1] [.t compare 1.1 < 1.0]
  68. } {1 0 0}
  69. test text-1.2 {"compare" option} {
  70.     list [.t compare 1.1 <= 1.2] [.t compare 1.1 <= 1.1] [.t compare 1.1 <= 1.0]
  71. } {1 1 0}
  72. test text-1.3 {"compare" option} {
  73.     list [.t compare 1.1 == 1.2] [.t compare 1.1 == 1.1] [.t compare 1.1 == 1.0]
  74. } {0 1 0}
  75. test text-1.4 {"compare" option} {
  76.     list [.t compare 1.1 >= 1.2] [.t compare 1.1 >= 1.1] [.t compare 1.1 >= 1.0]
  77. } {0 1 1}
  78. test text-1.5 {"compare" option} {
  79.     list [.t compare 1.1 > 1.2] [.t compare 1.1 > 1.1] [.t compare 1.1 > 1.0]
  80. } {0 0 1}
  81. test text-1.6 {"compare" option} {
  82.     list [.t compare 1.1 != 1.2] [.t compare 1.1 != 1.1] [.t compare 1.1 != 1.0]
  83. } {1 0 1}
  84. test text-1.7 {"compare" option} {
  85.     list [.t compare 1.3 < 2.3] [.t compare 1.3 == 2.3] [.t compare 1.1 > 2.3]
  86. } {1 0 0}
  87. test text-1.8 {"compare" option} {
  88.     list [.t compare 2.1 < 2.3] [.t compare 2.1 == 2.3] [.t compare 2.1 > 2.3]
  89. } {1 0 0}
  90. test text-1.9 {"compare" option} {
  91.     list [.t compare 2.3 < 2.3] [.t compare 2.3 == 2.3] [.t compare 2.3 > 2.3]
  92. } {0 1 0}
  93. test text-1.10 {"compare" option} {
  94.     list [.t compare 2.5 < 2.3] [.t compare 2.5 == 2.3] [.t compare 2.5 > 2.3]
  95. } {0 0 1}
  96. test text-1.11 {"compare" option} {
  97.     list [.t compare 3.0 < 2.3] [.t compare 3.0 == 2.3] [.t compare 3.0 > 2.3]
  98. } {0 0 1}
  99. test text-1.12 {"compare" option} {
  100.     list [catch {.t compare} msg] $msg
  101. } {1 {wrong # args: should be ".t compare index1 op index2"}}
  102. test text-1.13 {"compare" option} {
  103.     list [catch {.t compare 1 2} msg] $msg
  104. } {1 {wrong # args: should be ".t compare index1 op index2"}}
  105. test text-1.14 {"compare" option} {
  106.     list [catch {.t compare 1 2 3 4} msg] $msg
  107. } {1 {wrong # args: should be ".t compare index1 op index2"}}
  108. test text-1.15 {"compare" option} {
  109.     list [catch {.t compare foo < 1.2} msg] $msg
  110. } {1 {bad text index "foo"}}
  111. test text-1.16 {"compare" option} {
  112.     list [catch {.t compare 1.2 < foo} msg] $msg
  113. } {1 {bad text index "foo"}}
  114. test text-1.17 {"compare" option} {
  115.     list [catch {.t compare 1.0 a 1.2} msg] $msg
  116. } {1 {bad comparison operator "a": must be <, <=, ==, >=, >, or !=}}
  117. test text-1.18 {"compare" option} {
  118.     list [catch {.t compare 1.0 <a 1.2} msg] $msg
  119. } {1 {bad comparison operator "<a": must be <, <=, ==, >=, >, or !=}}
  120. test text-1.19 {"compare" option} {
  121.     list [catch {.t compare 1.0 <=x 1.2} msg] $msg
  122. } {1 {bad comparison operator "<=x": must be <, <=, ==, >=, >, or !=}}
  123. test text-1.20 {"compare" option} {
  124.     list [catch {.t compare 1.0 >=x 1.2} msg] $msg
  125. } {1 {bad comparison operator ">=x": must be <, <=, ==, >=, >, or !=}}
  126. test text-1.21 {"compare" option} {
  127.     list [catch {.t compare 1.0 >a 1.2} msg] $msg
  128. } {1 {bad comparison operator ">a": must be <, <=, ==, >=, >, or !=}}
  129. test text-1.22 {"compare" option} {
  130.     list [catch {.t compare 1.0 !x 1.2} msg] $msg
  131. } {1 {bad comparison operator "!x": must be <, <=, ==, >=, >, or !=}}
  132. test text-1.23 {"compare" option} {
  133.     list [catch {.t compare 1.0 === 1.2} msg] $msg
  134. } {1 {bad comparison operator "===": must be <, <=, ==, >=, >, or !=}}
  135.  
  136. setup
  137. .t mark set m1 1.2
  138. .t mark set m2 2.4
  139. update
  140. test text-2.1 {"index" option, "@" notation} {
  141.     .t index @1,1
  142. } {1.0}
  143. test text-2.2 {"index" option, "@" notation} {
  144.     .t index @133,8
  145. } {1.18}
  146. test text-2.3 {"index" option, "@" notation} {
  147.     .t index @136,8
  148. } {1.19}
  149. test text-2.4 {"index" option, "@" notation} {
  150.     .t index @5,19
  151. } {2.0}
  152. test text-2.5 {"index" option, "@" notation} {
  153.     .t index @69,46
  154. } {4.9}
  155. test text-2.6 {"index" option, "@" notation} {
  156.     .t index @10,100
  157. } {4.17}
  158. test text-2.7 {"index" option, "@" notation} {
  159.     list [catch {.t index "@"} msg] $msg
  160. } {1 {bad text index "@"}}
  161. test text-2.8 {"index" option, "@" notation} {
  162.     list [catch {.t index "@a"} msg] $msg
  163. } {1 {bad text index "@a"}}
  164. test text-2.9 {"index" option, "@" notation} {
  165.     list [catch {.t index "@1x"} msg] $msg
  166. } {1 {bad text index "@1x"}}
  167. test text-2.10 {"index" option, "@" notation} {
  168.     list [catch {.t index "@1."} msg] $msg
  169. } {1 {bad text index "@1."}}
  170. test text-2.11 {"index" option, "@" notation} {
  171.     list [catch {.t index "@1.a"} msg] $msg
  172. } {1 {bad text index "@1.a"}}
  173.  
  174. test text-3.1 {"index" option, line.char notation} {
  175.     .t index 1.1
  176. } {1.1}
  177. test text-3.2 {"index" option, line.char notation} {
  178.     .t index 2.end
  179. } {2.11}
  180. test text-3.3 {"index" option, line.char notation} {
  181.     .t index 3.end
  182. } {3.0}
  183. test text-3.4 {"index" option, line.char notation} {
  184.     .t index -1.-2
  185. } {-1.-2}
  186. test text-3.5 {"index" option, line.char notation} {
  187.     list [catch {.t index -a} msg] $msg
  188. } {1 {bad text index "-a"}}
  189. test text-3.6 {"index" option, line.char notation} {
  190.     list [catch {.t index 1.} msg] $msg
  191. } {1 {bad text index "1."}}
  192. test text-3.7 {"index" option, line.char notation} {
  193.     list [catch {.t index 1.e} msg] $msg
  194. } {1 {bad text index "1.e"}}
  195. test text-3.8 {"index" option, line.char notation} {
  196.     list [catch {.t index 1.enda} msg] $msg
  197. } {1 {bad text index "1.enda"}}
  198. test text-3.9 {"index" option, line.char notation} {
  199.     list [catch {.t index 400.end} msg] $msg
  200. } {1 {bad text index "400.end": no such line in text}}
  201. test text-3.10 {"index" option, line.char notation} {
  202.     list [catch {.t index 1.x} msg] $msg
  203. } {1 {bad text index "1.x"}}
  204.  
  205. test text-4.1 {"index" option, miscellaneous bases} {
  206.     .t index end
  207. } {4.17}
  208. test text-4.2 {"index" option, miscellaneous bases} {
  209.     .t index m1
  210. } {1.2}
  211. test text-4.3 {"index" option, miscellaneous bases} {
  212.     .t index m2
  213. } {2.4}
  214. test text-4.4 {"index" option, miscellaneous bases} {
  215.     .t index x.first
  216. } {1.1}
  217. test text-4.5 {"index" option, miscellaneous bases} {
  218.     .t index x.last
  219. } {2.6}
  220. test text-4.6 {"index" option, miscellaneous bases} {
  221.     .t index y.first
  222. } {1.5}
  223. test text-4.7 {"index" option, miscellaneous bases} {
  224.     .t index y.last
  225. } {1.6}
  226. test text-4.8 {"index" option, miscellaneous bases} {
  227.     list [catch {.t index x.f} msg] $msg
  228. } {1 {bad text index "x.f"}}
  229. test text-4.9 {"index" option, miscellaneous bases} {
  230.     list [catch {.t index x.firstl} msg] $msg
  231. } {1 {bad text index "x.firstl"}}
  232. test text-4.10 {"index" option, miscellaneous bases} {
  233.     list [catch {.t index x.las} msg] $msg
  234. } {1 {bad text index "x.las"}}
  235. test text-4.11 {"index" option, miscellaneous bases} {
  236.     list [catch {.t index x.last1} msg] $msg
  237. } {1 {bad text index "x.last1"}}
  238. test text-4.12 {"index" option, miscellaneous bases} {
  239.     .t tag remove sel 0.0 end
  240.     list [catch {.t index sel.first} msg] $msg
  241. } {1 {text doesn't contain any characters tagged with "sel"}}
  242.  
  243. test text-5.1 {"index" option with +/- modifiers} {
  244.     .t index 1.1+1c
  245. } 1.2
  246. test text-5.2 {"index" option with +/- modifiers} {
  247.     .t index @0,0+1c
  248. } 1.1
  249. test text-5.3 {"index" option with +/- modifiers} {
  250.     .t index 1.end+1c
  251. } 2.0
  252. test text-5.4 {"index" option with +/- modifiers} {
  253.     .t index m1+1c
  254. } 1.3
  255. test text-5.5 {"index" option with +/- modifiers} {
  256.     .t index "m1      +1c"
  257. } 1.3
  258. test text-5.6 {"index" option with +/- modifiers} {
  259.     .t index "m1-1c"
  260. } 1.1
  261. test text-5.7 {"index" option with +/- modifiers} {
  262.     list [catch {.t index "m1 x"} msg] $msg
  263. } {1 {bad text index "m1 x"}}
  264. test text-5.8 {"index" option with +/- modifiers} {
  265.     .t index "m1 +       1          c"
  266. } 1.3
  267. test text-5.9 {"index" option with +/- modifiers} {
  268.     list [catch {.t index "m1+x"} msg] $msg
  269. } {1 {bad text index "m1+x"}}
  270. test text-5.10 {"index" option with +/- modifiers} {
  271.     list [catch {.t index "m1+22gorps"} msg] $msg
  272. } {1 {bad text index "m1+22gorps"}}
  273. test text-5.11 {"index" option with +/- modifiers} {
  274.     .t index "1.2+1c"
  275. } 1.3
  276. test text-5.12 {"index" option with +/- modifiers} {
  277.     .t index "1.2+3c"
  278. } 1.5
  279. test text-5.13 {"index" option with +/- modifiers} {
  280.     .t index "1.2+17c"
  281. } 1.19
  282. test text-5.14 {"index" option with +/- modifiers} {
  283.     .t index "1.2+18c"
  284. } 2.0
  285. test text-5.15 {"index" option with +/- modifiers} {
  286.     .t index "1.2+20c"
  287. } 2.2
  288. test text-5.16 {"index" option with +/- modifiers} {
  289.     .t index "1.2+100c"
  290. } 4.17
  291. test text-5.17 {"index" option with +/- modifiers} {
  292.     .t index "2.4-1c"
  293. } 2.3
  294. test text-5.18 {"index" option with +/- modifiers} {
  295.     .t index "2.4-4c"
  296. } 2.0
  297. test text-5.19 {"index" option with +/- modifiers} {
  298.     .t index "2.4-5c"
  299. } 1.19
  300. test text-5.20 {"index" option with +/- modifiers} {
  301.     .t index "2.4-10c"
  302. } 1.14
  303. test text-5.21 {"index" option with +/- modifiers} {
  304.     .t index "2.4-100c"
  305. } 1.0
  306. test text-5.22 {"index" option with +/- modifiers} {
  307.     .t index "2.4 - 100 chars"
  308. } 1.0
  309. test text-5.23 {"index" option with +/- modifiers} {
  310.     list [catch {.t index "2.4 - 100 charsx"} msg] $msg
  311. } {1 {bad text index "2.4 - 100 charsx"}}
  312. test text-5.24 {"index" option with +/- modifiers} {
  313.     .t index "1.3+1l"
  314. } 2.3
  315. test text-5.25 {"index" option with +/- modifiers} {
  316.     .t index "1.3+2l"
  317. } 3.0
  318. test text-5.26 {"index" option with +/- modifiers} {
  319.     .t index "1.3+3li"
  320. } 4.3
  321. test text-5.27 {"index" option with +/- modifiers} {
  322.     .t index "1.3+4lines"
  323. } 4.3
  324. test text-5.28 {"index" option with +/- modifiers} {
  325.     .t index "3.2 - 1 lines"
  326. } 2.2
  327. test text-5.29 {"index" option with +/- modifiers} {
  328.     .t index "3.2 - 2 lines"
  329. } 1.2
  330. test text-5.30 {"index" option with +/- modifiers} {
  331.     .t index "3.2 - 3 lines"
  332. } 1.2
  333. test text-5.31 {"index" option with +/- modifiers} {
  334.     .t index "3.-2 - 1 lines"
  335. } 2.0
  336. test text-5.32 {"index" option with +/- modifiers} {
  337.     list [catch {.t index "3.-2 - 1 linesx"} msg] $msg
  338. } {1 {bad text index "3.-2 - 1 linesx"}}
  339.  
  340. setup
  341. .t insert end "\n#\$foo.bar! first_l60t _ "
  342. test text-6.1 {"index" option with start/end modifiers} {
  343.     .t index "2.3 lines"
  344. } 2.0
  345. test text-6.2 {"index" option with start/end modifiers} {
  346.     .t index "2.0 linestart"
  347. } 2.0
  348. test text-6.3 {"index" option with start/end modifiers} {
  349.     .t index "2.-4 linestart"
  350. } 2.0
  351. test text-6.4 {"index" option with start/end modifiers} {
  352.     .t index "2.30 linestart"
  353. } 3.0
  354. test text-6.5 {"index" option with start/end modifiers} {
  355.     .t index "10.0 linestart"
  356. } 5.0
  357. test text-6.6 {"index" option with start/end modifiers} {
  358.     .t index "10.0 lineend"
  359. } 5.24
  360. test text-6.7 {"index" option with start/end modifiers} {
  361.     .t index "3.5 linee"
  362. } 4.17
  363. test text-6.8 {"index" option with start/end modifiers} {
  364.     .t index "2.4 lineend"
  365. } 2.11
  366. test text-6.9 {"index" option with start/end modifiers} {
  367.     .t index "0.0 lineend"
  368. } 1.19
  369. test text-6.10 {"index" option with start/end modifiers} {
  370.     list [catch {.t index "2.2 line"} msg] $msg
  371. } {1 {bad text index "2.2 line"}}
  372. test text-6.11 {"index" option with start/end modifiers} {
  373.     .t index "1.0 wordstart"
  374. } 1.0
  375. test text-6.12 {"index" option with start/end modifiers} {
  376.     .t index "1.1 wordstart"
  377. } 1.0
  378. test text-6.13 {"index" option with start/end modifiers} {
  379.     .t index "1.3 wordstart"
  380. } 1.0
  381. test text-6.14 {"index" option with start/end modifiers} {
  382.     .t index "1.4 words"
  383. } 1.4
  384. test text-6.15 {"index" option with start/end modifiers} {
  385.     .t index "1.5 wordstart"
  386. } 1.5
  387. test text-6.16 {"index" option with start/end modifiers} {
  388.     .t index "1.19 wordstart"
  389. } 1.19
  390. test text-6.17 {"index" option with start/end modifiers} {
  391.     .t index "5.3 wordstart"
  392. } 5.2
  393. test text-6.18 {"index" option with start/end modifiers} {
  394.     .t index "5.20 wordstart"
  395. } 5.11
  396. test text-6.19 {"index" option with start/end modifiers} {
  397.     .t index "5.0 wordend"
  398. } 5.1
  399. test text-6.20 {"index" option with start/end modifiers} {
  400.     .t index "5.1 wordend"
  401. } 5.2
  402. test text-6.21 {"index" option with start/end modifiers} {
  403.     .t index "5.2 wordend"
  404. } 5.5
  405. test text-6.22 {"index" option with start/end modifiers} {
  406.     .t index "5.4 wordend"
  407. } 5.5
  408. test text-6.23 {"index" option with start/end modifiers} {
  409.     .t index "5.5 wordend"
  410. } 5.6
  411. test text-6.24 {"index" option with start/end modifiers} {
  412.     .t index "5.11 wordend"
  413. } 5.21
  414. test text-6.25 {"index" option with start/end modifiers} {
  415.     .t index "5.100 wordend"
  416. } 5.24
  417. test text-6.26 {"index" option with start/end modifiers} {
  418.     list [catch {.t index "2.2 word"} msg] $msg
  419. } {1 {bad text index "2.2 word"}}
  420. test text-6.27 {"index" option with start/end modifiers} {
  421.     .t index "1.2 wordend+1line wordend"
  422. } 2.6
  423. test text-6.28 {"index" option with start/end modifiers} {
  424.     .t index "2.1 wordend-1 line wordend"
  425. } 1.8
  426. test text-6.29 {"index" option with start/end modifiers} {
  427.     .t index "2.3 wordend + 1 char wordend"
  428. } 2.11
  429.  
  430. setup
  431. test text-7.1 {RoundIndex procedure} {
  432.     .t index -1.4+0c
  433. } 1.0
  434. test text-7.2 {RoundIndex procedure} {
  435.     .t index 100.2+0c
  436. } 4.17
  437. test text-7.3 {RoundIndex procedure} {
  438.     .t index 2.-3+0c
  439. } 2.0
  440. test text-7.4 {RoundIndex procedure} {
  441.     .t index 2.100+0c
  442. } 3.0
  443. test text-7.5 {RoundIndex procedure} {
  444.     .t index 4.100+0c
  445. } 4.17
  446.  
  447. test text-8.1 {"tag" option} {
  448.     list [catch {.t tag} msg] $msg
  449. } {1 {wrong # args: should be ".t tag option ?arg arg ...?"}}
  450. test text-8.2 {"tag" option} {
  451.     list [catch {.t tag gorp} msg] $msg
  452. } {1 {bad tag option "gorp":  must be add, bind, configure, delete, lower, names, nextrange, raise, ranges, or remove}}
  453. test text-8.3 {"tag" option} {
  454.     list [catch {.t tag n} msg] $msg
  455. } {1 {bad tag option "n":  must be add, bind, configure, delete, lower, names, nextrange, raise, ranges, or remove}}
  456. test text-8.4 {"tag" option} {
  457.     list [catch {.t tag r} msg] $msg
  458. } {1 {bad tag option "r":  must be add, bind, configure, delete, lower, names, nextrange, raise, ranges, or remove}}
  459. test text-8.5 {"tag" option} {
  460.     list [catch {.t tag ra} msg] $msg
  461. } {1 {bad tag option "ra":  must be add, bind, configure, delete, lower, names, nextrange, raise, ranges, or remove}}
  462.  
  463. setup
  464. test text-9.1 {"tag add" option} {
  465.     .t tag add x1 2.0
  466.     .t tag ranges x1
  467. } {2.0 2.1}
  468. test text-9.2 {"tag add" option} {
  469.     .t tag a x2 2.0 2.3
  470.     .t tag ranges x2
  471. } {2.0 2.3}
  472. test text-9.3 {"tag add" option} {
  473.     .t tag remove sel 0.0 end
  474.     .t tag add sel 2.0 2.3
  475.     selection get
  476. } {Sec}
  477. test text-9.4 {"tag add" option} {
  478.     list [catch {.t tag add} msg] $msg
  479. } {1 {wrong # args: should be ".t tag add tagName index1 ?index2?"}}
  480. test text-9.5 {"tag add" option} {
  481.     list [catch {.t tag add a b c d} msg] $msg
  482. } {1 {wrong # args: should be ".t tag add tagName index1 ?index2?"}}
  483. test text-9.6 {"tag add" option} {
  484.     list [catch {.t tag add a #xgorp} msg] $msg
  485. } {1 {bad text index "#xgorp"}}
  486. test text-9.7 {"tag add" option} {
  487.     list [catch {.t tag add a 1.0 #xgorp} msg] $msg
  488. } {1 {bad text index "#xgorp"}}
  489.  
  490. setup
  491. test text-10.1 {"tag configure" option} {
  492.     .t tag configure test -foreground white
  493.     lindex [.t tag c test -foreground] 4
  494. } {white}
  495. test text-10.2 {"tag configure" option} {
  496.     llength [.t tag configure test]
  497. } {8}
  498. test text-10.3 {"tag configure" option} {
  499.     list [catch {.t tag configure test -gorp} msg] $msg
  500. } {1 {unknown option "-gorp"}}
  501. test text-10.4 {"tag configure" option} {
  502.     list [catch {.t tag configure test -gorp blue} msg] $msg
  503. } {1 {unknown option "-gorp"}}
  504. test text-10.5 {"tag configure" option} {
  505.     list [catch {.t tag configure} msg] $msg
  506. } {1 {wrong # args: should be ".t tag configure tagName ?option? ?value? ?option value ...?"}}
  507. test text-10.6 {"tag configure" option} {
  508.     .t tag configure sel -foreground white
  509.     lindex [.t configure -selectforeground] 4
  510. } {white}
  511. test text-10.7 {"tag configure" option} {
  512.     .t tag configure sel -foreground black
  513.     lindex [.t configure -selectforeground] 4
  514. } {black}
  515. test text-10.8 {"tag configure" option} {
  516.     .t tag configure sel -borderwidth 8
  517.     lindex [.t configure -selectborderwidth] 4
  518. } {8}
  519. test text-10.6 {"tag configure" option} {
  520.     .t tag configure sel -background white
  521.     lindex [.t configure -selectbackground] 4
  522. } {white}
  523. test text-10.7 {"tag configure" option} {
  524.     .t tag configure sel -background black
  525.     lindex [.t configure -selectbackground] 4
  526. } {black}
  527.  
  528. setup
  529. test text-11.1 {"tag delete" option} {
  530.     .t tag add t1 2.0 2.3
  531.     .t tag delete t1
  532.     .t tag names
  533. } {sel x y}
  534. test text-11.2 {"tag delete" option} {
  535.     .t tag d x y
  536.     .t tag names
  537. } {sel}
  538. test text-11.3 {"tag delete" option} {
  539.     list [catch {.t tag delete sel} msg] $msg
  540. } {1 {can't delete selection tag}}
  541. test text-11.4 {"tag delete" option} {
  542.     list [catch {.t tag delete} msg] $msg
  543. } {1 {wrong # args: should be ".t tag delete tagName tagName ..."}}
  544. test text-11.5 {"tag delete" option} {
  545.     list [catch {.t tag delete #gorp} msg] $msg
  546. } {0 {}}
  547.  
  548. setup
  549. .t tag add a 2.0
  550. .t tag add b 2.1
  551. .t tag lower b
  552. test text-12.1 {"tag lower" option} {
  553.     .t tag names
  554. } {b sel x y a}
  555. .t tag l b a
  556. test text-12.2 {"tag lower" option} {
  557.     .t tag names
  558. } {sel x y b a}
  559. .t tag lower b b
  560. test text-12.3 {"tag lower" option} {
  561.     .t tag names
  562. } {sel x y b a}
  563. .t tag lower b y
  564. test text-12.4 {"tag lower" option} {
  565.     .t tag names
  566. } {sel x b y a}
  567. test text-12.5 {"tag lower" option} {
  568.     list [catch {.t tag lower} msg] $msg
  569. } {1 {wrong # args: should be ".t tag lower tagName ?belowThis?"}}
  570. test text-12.6 {"tag lower" option} {
  571.     list [catch {.t tag lower a b c} msg] $msg
  572. } {1 {wrong # args: should be ".t tag lower tagName ?belowThis?"}}
  573. test text-12.7 {"tag lower" option} {
  574.     list [catch {.t tag lower #gorp} msg] $msg
  575. } {1 {tag "#gorp" isn't defined in text widget}}
  576. test text-12.8 {"tag lower" option} {
  577.     list [catch {.t tag lower a #gorp} msg] $msg
  578. } {1 {tag "#gorp" isn't defined in text widget}}
  579.  
  580. setup
  581. .t tag add a 2.0 2.3
  582. .t tag add b 2.2
  583. .t tag lower b
  584. test text-13.1 {"tag names" option} {
  585.     .t tag na
  586. } {b sel x y a}
  587. test text-13.2 {"tag names" option} {
  588.     .t tag names 2.2
  589. } {b x a}
  590. test text-13.3 {"tag names" option} {
  591.     list [catch {.t tag names a b} msg] $msg
  592. } {1 {wrong # args: should be ".t tag names ?index?"}}
  593. test text-13.4 {"tag names" option} {
  594.     list [catch {.t tag names @gorp} msg] $msg
  595. } {1 {bad text index "@gorp"}}
  596. test text-13.5 {"tag names" option} {
  597.     list [catch {.t tag names 100000.0} msg] $msg
  598. } {0 {}}
  599. test text-13.6 {"tag names" option} {
  600.     list [catch {.t tag names 2.7} msg] $msg
  601. } {0 {}}
  602.  
  603. setup
  604. test text-14.1 {"tag nextrange" option} {
  605.     .t tag ne x 1.0
  606. } {1.1 1.2}
  607. test text-14.2 {"tag nextrange" option} {
  608.     .t tag nextrange x 1.1
  609. } {1.1 1.2}
  610. test text-14.3 {"tag nextrange" option} {
  611.     .t tag nextrange x 1.2
  612. } {1.5 1.13}
  613. test text-14.4 {"tag nextrange" option} {
  614.     .t tag nextrange x 1.6
  615. } {2.2 2.6}
  616. test text-14.5 {"tag nextrange" option} {
  617.     .t tag nextrange x 1.3 1.14
  618. } {1.5 1.13}
  619. test text-14.6 {"tag nextrange" option} {
  620.     .t tag nextrange x 1.3 1.13
  621. } {1.5 1.13}
  622. test text-14.7 {"tag nextrange" option} {
  623.     .t tag nextrange x 1.3 1.10
  624. } {1.5 1.13}
  625. test text-14.8 {"tag nextrange" option} {
  626.     .t tag nextrange x 1.3 1.6
  627. } {1.5 1.13}
  628. test text-14.9 {"tag nextrange" option} {
  629.     .t tag nextrange x 1.3 1.5
  630. } {}
  631. test text-14.10 {"tag nextrange" option} {
  632.     list [catch {.t tag nextrange} msg] $msg
  633. } {1 {wrong # args: should be ".t tag nextrange tagName index1 ?index2?"}}
  634. test text-14.11 {"tag nextrange" option} {
  635.     list [catch {.t tag nextrange a} msg] $msg
  636. } {1 {wrong # args: should be ".t tag nextrange tagName index1 ?index2?"}}
  637. test text-14.12 {"tag nextrange" option} {
  638.     list [catch {.t tag nextrange a b c d} msg] $msg
  639. } {1 {wrong # args: should be ".t tag nextrange tagName index1 ?index2?"}}
  640. test text-14.13 {"tag nextrange" option} {
  641.     list [catch {.t tag nextrange #gorp 1.0} msg] $msg
  642. } {0 {}}
  643. test text-14.14 {"tag nextrange" option} {
  644.     list [catch {.t tag nextrange x @bogus} msg] $msg
  645. } {1 {bad text index "@bogus"}}
  646. test text-14.15 {"tag nextrange" option} {
  647.     list [catch {.t tag nextrange x 1.0 @bogus} msg] $msg
  648. } {1 {bad text index "@bogus"}}
  649.  
  650. setup
  651. .t tag add a 2.0
  652. .t tag add b 2.1
  653. .t tag rai x
  654. test text-15.1 {"tag raise" option} {
  655.     .t tag names
  656. } {sel y a b x}
  657. .t tag raise x y
  658. test text-15.2 {"tag raise" option} {
  659.     .t tag names
  660. } {sel y x a b}
  661. .t tag raise x x
  662. test text-15.3 {"tag raise" option} {
  663.     .t tag names
  664. } {sel y x a b}
  665. .t tag raise x a
  666. test text-15.4 {"tag raise" option} {
  667.     .t tag names
  668. } {sel y a x b}
  669. test text-15.5 {"tag raise" option} {
  670.     list [catch {.t tag raise} msg] $msg
  671. } {1 {wrong # args: should be ".t tag raise tagName ?aboveThis?"}}
  672. test text-15.6 {"tag raise" option} {
  673.     list [catch {.t tag raise a b c} msg] $msg
  674. } {1 {wrong # args: should be ".t tag raise tagName ?aboveThis?"}}
  675. test text-15.7 {"tag raise" option} {
  676.     list [catch {.t tag raise #gorp} msg] $msg
  677. } {1 {tag "#gorp" isn't defined in text widget}}
  678. test text-15.8 {"tag raise" option} {
  679.     list [catch {.t tag raise a #gorp} msg] $msg
  680. } {1 {tag "#gorp" isn't defined in text widget}}
  681.  
  682. setup
  683. .t tag configure a -foreground black
  684. test text-16.1 {"tag ranges" option} {
  685.     .t tag ran x
  686. } {1.1 1.2 1.5 1.13 2.2 2.6}
  687. test text-16.2 {"tag ranges" option} {
  688.     .t tag ranges y
  689. } {1.5 1.6}
  690. test text-16.3 {"tag ranges" option} {
  691.     .t tag ranges a
  692. } {}
  693. test text-16.4 {"tag ranges" option} {
  694.     .t tag ranges #gorp
  695. } {}
  696. test text-16.5 {"tag ranges" option} {
  697.     list [catch {.t tag ranges} msg] $msg
  698. } {1 {wrong # args: should be ".t tag ranges tagName"}}
  699. test text-16.6 {"tag ranges" option} {
  700.     list [catch {.t tag ranges a b} msg] $msg
  701. } {1 {wrong # args: should be ".t tag ranges tagName"}}
  702.  
  703. setup
  704. test text-17.1 {"tag remove" option} {
  705.     .t tag re x 2.3 2.7
  706.     .t tag ranges x
  707. } {1.1 1.2 1.5 1.13 2.2 2.3}
  708. test text-17.2 {"tag remove" option} {
  709.     list [catch {.t tag remove} msg] $msg
  710. } {1 {wrong # args: should be ".t tag remove tagName index1 ?index2?"}}
  711.  
  712. setup
  713. test text-18.1 {"tag bind" option} {
  714.     .t tag delete x
  715.     .t tag bind x <Enter> "going in"
  716.     .t tag bind x <Leave> "going out"
  717.     list [lsort [.t tag bind x]] [.t tag bind x <Enter>] [.t tag bind x <Leave>]
  718. } {{<Enter> <Leave>} {going in} {going out}}
  719. test text-18.2 {"tag bind" option} {
  720.     .t tag delete x
  721.     .t tag bind x <Enter> "command #1"
  722.     .t tag bind x <Enter> "+command #2"
  723.     .t tag bind x <Enter>
  724. } {command #1; command #2}
  725. test text-18.3 {"tag bind" option} {
  726.     .t tag delete x
  727.     .t tag bind x <Enter> "command #1"
  728.     .t tag bind x <Enter> {}
  729.     list [catch {.t tag bind x <Enter>} msg] $msg
  730. } {1 {no binding exists for "<Enter>"}}
  731. test text-18.4 {"tag bind" option} {
  732.     list [catch {.t tag bind} msg] $msg
  733. } {1 {wrong # args: should be ".t tag bind tagName ?sequence? ?command?"}}
  734. test text-18.5 {"tag bind" option} {
  735.     list [catch {.t tag bind a b c d} msg] $msg
  736. } {1 {wrong # args: should be ".t tag bind tagName ?sequence? ?command?"}}
  737. test text-18.6 {"tag bind" option} {
  738.     list [catch {.t tag bind x <badEvent> abcd} msg] $msg
  739. } {1 {bad event type or keysym "badEvent"}}
  740. test text-18.7 {"tag bind" option} {
  741.     .t tag delete x
  742.     list [catch {.t tag bind x <Configure> abcd} msg] $msg [.t tag bind x]
  743. } {1 {requested illegal events; only key, button, motion, and enter/leave events may be used} {}}
  744.  
  745. setup
  746. test text-19.1 {"debug" option} {
  747.     .t debug on
  748.     .t debug
  749. } on
  750. test text-19.2 {"debug" option} {
  751.     .t debug off
  752.     .t debug
  753. } off
  754. test text-19.3 {"debug" option} {
  755.     list [catch {.t debug a b} msg] $msg
  756. } {1 {wrong # args: should be ".t debug ?on|off?"}}
  757. test text-19.4 {"debug" option} {
  758.     list [catch {.t debug gorp} msg] $msg
  759. } {1 {expected boolean value but got "gorp"}}
  760.  
  761. test text-20.1 {"delete" option} {
  762.     setup
  763.     .t delete 1.2
  764.     .t get 1.0 1.end
  765. } {Tet for first line}
  766. test text-20.2 {"delete" option} {
  767.     setup
  768.     .t delete 1.2 1.6
  769.     .t get 1.0 1.end
  770. } {Teor first line}
  771. test text-20.3 {"delete" option} {
  772.     list [catch {.t delete} msg] $msg
  773. } {1 {wrong # args: should be ".t delete index1 ?index2?"}}
  774. test text-20.4 {"delete" option} {
  775.     list [catch {.t delete a b c} msg] $msg
  776. } {1 {wrong # args: should be ".t delete index1 ?index2?"}}
  777. test text-20.5 {"delete" option} {
  778.     list [catch {.t delete @badIndex} msg] $msg
  779. } {1 {bad text index "@badIndex"}}
  780. test text-20.6 {"delete" option} {
  781.     list [catch {.t delete 1.2 @badIndex} msg] $msg
  782. } {1 {bad text index "@badIndex"}}
  783. test text-20.7 {"delete" option} {
  784.     setup
  785.     .t config -state disabled
  786.     list [catch {.t delete 1.2} msg] $msg
  787.     .t get 1.0 1.end
  788. } {Text for first line}
  789. .t config -state normal
  790.  
  791. setup
  792. test text-21.1 {"get" option} {
  793.     .t get 1.3 1.5
  794. } {t }
  795. test text-21.2 {"get" option} {
  796.     .t get 1.8 2.4
  797. } " first line\nSeco"
  798. test text-21.3 {"get" option} {
  799.     .t get 1.5 4.4
  800. } "for first line\nSecond line\n\nLast"
  801. test text-21.4 {"get" option} {
  802.     .t get 2.0
  803. } S
  804. test text-21.5 {"get" option} {
  805.     .t get 1.0 2.0
  806. } "Text for first line\n"
  807. test text-21.6 {"get" option} {
  808.     list [catch {.t get} msg] $msg
  809. } {1 {wrong # args: should be ".t get index1 ?index2?"}}
  810. test text-21.7 {"get" option} {
  811.     list [catch {.t get a b c} msg] $msg
  812. } {1 {wrong # args: should be ".t get index1 ?index2?"}}
  813. test text-21.8 {"get" option} {
  814.     list [catch {.t get badMark} msg] $msg
  815. } {1 {bad text index "badMark"}}
  816. test text-21.8 {"get" option} {
  817.     list [catch {.t get 1.0 badMarkToo} msg] $msg
  818. } {1 {bad text index "badMarkToo"}}
  819.  
  820. test text-22.1 {errors in "index" option} {
  821.     list [catch {.t index} msg] $msg
  822. } {1 {wrong # args: should be ".t index index"}}
  823. test text-22.2 {errors in "index" option} {
  824.     list [catch {.t index a b} msg] $msg
  825. } {1 {wrong # args: should be ".t index index"}}
  826. test text-22.3 {errors in "index" option} {
  827.     list [catch {.t index badMarkToo} msg] $msg
  828. } {1 {bad text index "badMarkToo"}}
  829.  
  830. test text-23.1 {"insert" option} {
  831.     setup
  832.     .t insert 1.3 XYZ
  833.     .t get 1.0 1.end
  834. } {TexXYZt for first line}
  835. test text-23.2 {"insert" option} {
  836.     setup
  837.     .t insert 1.3 {}
  838.     .t get 1.0 1.end
  839. } {Text for first line}
  840. test text-23.3 {"insert" option} {
  841.     setup
  842.     .t configure -state disabled
  843.     .t insert 1.3 "Lots of text"
  844.     .t configure -state normal
  845.     .t get 1.0 1.end
  846. } {Text for first line}
  847. test text-23.4 {"insert" option} {
  848.     list [catch {.t insert a} msg] $msg
  849. } {1 {wrong # args: should be ".t insert index chars ?chars ...?"}}
  850. test text-23.5 {"insert" option} {
  851.     list [catch {.t insert a b c} msg] $msg
  852. } {1 {wrong # args: should be ".t insert index chars ?chars ...?"}}
  853. test text-23.6 {"insert" option} {
  854.     list [catch {.t insert @bogus foo} msg] $msg
  855. } {1 {bad text index "@bogus"}}
  856.  
  857. setup
  858. .t mark set mark1 1.3
  859. .t mark set mark2 1.6
  860. test text-24.1 {"mark" options} {
  861.     list [catch {.t mark} msg] $msg
  862. } {1 {wrong # args: should be ".t mark option ?arg arg ...?"}}
  863. test text-24.2 {"mark" options} {
  864.     list [catch {.t mark badOption} msg] $msg
  865. } {1 {bad mark option "badOption":  must be names, set, or unset}}
  866. test text-24.3 {"mark" options} {
  867.     lsort [.t mark names]
  868. } {current insert m1 m2 mark1 mark2}
  869. test text-24.4 {"mark" options} {
  870.     list [catch {.t mark names a} msg] $msg
  871. } {1 {wrong # args: should be ".t mark names"}}
  872. test text-24.5 {"mark" options} {
  873.     .t index mark1
  874. } 1.3
  875. test text-24.6 {"mark" options} {
  876.     list [catch {.t mark set} msg] $msg
  877. } {1 {wrong # args: should be ".t mark set markName index"}}
  878. test text-24.7 {"mark" options} {
  879.     list [catch {.t mark set a b c} msg] $msg
  880. } {1 {wrong # args: should be ".t mark set markName index"}}
  881. test text-24.8 {"mark" options} {
  882.     list [catch {.t mark set a @bogus} msg] $msg
  883. } {1 {bad text index "@bogus"}}
  884. .t mark unset mark1 mark2
  885. test text-24.9 {"mark" options} {
  886.     list [catch {.t index mark1} msg] $msg
  887. } {1 {bad text index "mark1"}}
  888. test text-24.10 {"mark" options} {
  889.     list [catch {.t index mark2} msg] $msg
  890. } {1 {bad text index "mark2"}}
  891. test text-24.11 {"mark" options} {
  892.     list [catch {.t mark unset bogus bogus m1} msg] $msg
  893. } {0 {}}
  894. test text-24.12 {"mark" options} {
  895.     list [catch {.t mark unset insert} msg] $msg
  896. } {1 {can't delete "insert" mark}}
  897. test text-24.13 {"mark" options} {
  898.     list [catch {.t mark unset current} msg] $msg
  899. } {1 {can't delete "current" mark}}
  900.  
  901. .t delete 1.0 end
  902. .t insert insert "Line 1"
  903. for {set i 2} {$i <= 200} {incr i} {
  904.     .t insert insert "\nLine $i"
  905. }
  906. update
  907. test text-25.1 {"yview" option} {
  908.     .t y 2
  909.     .t index @0,0
  910. } {3.0}
  911. test text-25.2 {"yview" option} {
  912.     .t yview 50
  913.     .t index @0,0
  914. } {51.0}
  915. test text-25.3 {"yview" option} {
  916.     .t yview 1.0
  917.     .t index @0,0
  918. } {1.0}
  919. test text-25.4 {"yview" option} {
  920.     .t yview 1000000
  921.     .t index @0,0
  922. } {200.0}
  923. test text-25.5 {"yview" option} {
  924.     .t yview 1.0
  925.     .t yview -pickplace 25.0
  926.     .t index @0,0
  927. } {2.0}
  928. test text-25.6 {"yview" option} {
  929.     .t yview 0.0
  930.     .t yview -pickplace 29.0
  931.     .t index @0,0
  932. } {6.0}
  933. test text-25.7 {"yview" option} {
  934.     .t yview 0.0
  935.     .t yview -pickplace 30.0
  936.     .t index @0,0
  937. } {19.0}
  938. test text-25.8 {"yview" option} {
  939.     .t yview 40.0
  940.     .t yview -pickplace 39.0
  941.     .t index @0,0
  942. } {39.0}
  943. test text-25.9 {"yview" option} {
  944.     .t yview 40.0
  945.     .t yview -pickplace 35.0
  946.     .t index @0,0
  947. } {35.0}
  948. test text-25.10 {"yview" option} {
  949.     .t yview 40.0
  950.     .t yview -pickplace 34.0
  951.     .t index @0,0
  952. } {23.0}
  953. test text-25.11 {"yview" option} {
  954.     .t yview -100
  955.     .t index @0,0
  956. } {1.0}
  957. test text-25.12 {"yview" option} {
  958.     list [catch {.t yview} msg] $msg
  959. } {1 {wrong # args: should be ".t yview ?-pickplace? lineNum|index"}}
  960. test text-25.13 {"yview" option} {
  961.     list [catch {.t yview 1.0 1.0} msg] $msg
  962. } {1 {wrong # args: should be ".t yview ?-pickplace? lineNum|index"}}
  963. test text-25.14 {"yview" option} {
  964.     list [catch {.t yview -pickplace 1.0 1.0} msg] $msg
  965. } {1 {wrong # args: should be ".t yview ?-pickplace? lineNum|index"}}
  966. test text-25.15 {"yview" option} {
  967.     list [catch {.t yview -poop 1.0} msg] $msg
  968. } {1 {wrong # args: should be ".t yview ?-pickplace? lineNum|index"}}
  969. test text-25.16 {"yview" option} {
  970.     list [catch {.t yview @bogus} msg] $msg
  971. } {1 {bad text index "@bogus"}}
  972.  
  973. test text-26.1 {ambiguous options, other errors} {
  974.     list [catch {.t badOption} msg] $msg
  975. } {1 {bad option "badOption":  must be compare, configure, debug, delete, get, index, insert, mark, scan, tag, or yview}}
  976. test text-26.2 {ambiguous options, other errors} {
  977.     list [catch {.t co} msg] $msg
  978. } {1 {bad option "co":  must be compare, configure, debug, delete, get, index, insert, mark, scan, tag, or yview}}
  979. test text-26.3 {ambiguous options, other errors} {
  980.     list [catch {.t de} msg] $msg
  981. } {1 {bad option "de":  must be compare, configure, debug, delete, get, index, insert, mark, scan, tag, or yview}}
  982. test text-26.4 {ambiguous options, other errors} {
  983.     list [catch {.t in} msg] $msg
  984. } {1 {bad option "in":  must be compare, configure, debug, delete, get, index, insert, mark, scan, tag, or yview}}
  985. test text-26.4 {ambiguous options, other errors} {
  986.     list [catch {.t} msg] $msg
  987. } {1 {wrong # args: should be ".t option ?arg arg ...?"}}
  988.  
  989. setup
  990. .t tag remove sel 1.0 end
  991. .t tag add sel 1.0 1.10
  992. test text-27.1 {selection exporting} {
  993.     list [catch {selection get} msg] $msg
  994. } {0 {Text for f}}
  995. .t configure -exportselection off
  996. test text-27.2 {selection exporting} {
  997.     list [catch {selection get} msg] $msg
  998. } {1 {selection doesn't exist or form "STRING" not defined}}
  999. .t tag add sel 2.0 2.end
  1000. test text-27.3 {selection exporting} {
  1001.     list [catch {selection get} msg] $msg
  1002. } {1 {selection doesn't exist or form "STRING" not defined}}
  1003. .t configure -exportselection on
  1004. test text-27.4 {selection exporting} {
  1005.     list [catch {selection get} msg] $msg
  1006. } {0 {Text for fSecond line}}
  1007. .t configure -exportselection off
  1008. .t tag remove sel 1.0 end
  1009. .t configure -exportselection on
  1010. test text-27.5 {selection exporting} {
  1011.     list [catch {selection get} msg] $msg
  1012. } {1 {selection doesn't exist or form "STRING" not defined}}
  1013. .t tag add sel 1.0 1.10
  1014. .t tag remove sel 1.0 1.10
  1015. test text-27.6 {selection exporting} {
  1016.     list [catch {selection get} msg] $msg
  1017. } {1 {selection doesn't exist or form "STRING" not defined}}
  1018. .t tag add sel 1.0 1.4
  1019. .t tag add sel 1.9 1.14
  1020. .t tag add sel 1.15 1.19
  1021. .t tag add sel 2.3 2.6
  1022. .t tag add sel 4.0 4.9
  1023. test text-27.7 {selection exporting} {
  1024.     list [catch {selection get} msg] $msg
  1025. } {0 {TextfirstlineondLast line}}
  1026. .t tag remove sel 1.0 end
  1027. .t tag add sel 1.15 2.6
  1028. .t tag add sel 2.7 4.4
  1029. test text-27.8 {selection exporting} {
  1030.     list [catch {selection get} msg] $msg
  1031. } {0 {line
  1032. Secondline
  1033.  
  1034. Last}}
  1035. entry .e
  1036. .e insert end "Some text"
  1037. .e select from 0
  1038. .e select to 4
  1039. test text-27.9 {losing the selection} {
  1040.     .t tag ranges sel
  1041. } {}
  1042. destroy .e
  1043.  
  1044. test text-28.1 {copying from configs to sel tag} {
  1045.     .t configure -selectbackground white
  1046.     lindex [.t tag configure sel -background] 4
  1047. } {white}
  1048. test text-28.2 {copying from configs to sel tag} {
  1049.     .t configure -selectbackground black
  1050.     lindex [.t tag configure sel -background] 4
  1051. } {black}
  1052. test text-28.3 {copying from configs to sel tag} {
  1053.     .t configure -selectforeground black
  1054.     lindex [.t tag configure sel -foreground] 4
  1055. } {black}
  1056. test text-28.4 {copying from configs to sel tag} {
  1057.     .t configure -selectforeground white
  1058.     lindex [.t tag configure sel -foreground] 4
  1059. } {white}
  1060. test text-28.5 {copying from configs to sel tag} {
  1061.     .t configure -selectborderwidth 3
  1062.     lindex [.t tag configure sel -borderwidth] 4
  1063. } {3}
  1064.  
  1065. .t delete 1.0 end
  1066. .t config -width 20 -height 10
  1067. .t insert 1.0 "abcd efgh ijklmno pqrst uvwxyz 1234 56 7890\nLine 2\nLine 3"
  1068. update
  1069. after 200
  1070. wm geometry . [expr [winfo width .]+3]x[winfo height .]
  1071. update
  1072. after 200
  1073. .t config -wrap none
  1074. test text-29.1 {-wrap option} {
  1075.     list [.t index @500,8] [.t index @1,20] [.t index @500,20] \
  1076.         [.t index @1,35] [.t index @500,35] [.t index @1,48]
  1077. } {1.20 2.0 2.6 3.0 3.6 3.6}
  1078. .t config -wrap char
  1079. test text-29.2 {-wrap option} {
  1080.     list [.t index @500,8] [.t index @1,20] [.t index @500,20] \
  1081.         [.t index @1,35] [.t index @500,35] [.t index @1,48]
  1082. } {1.19 1.20 1.39 1.40 1.43 2.0}
  1083. .t config -wrap word
  1084. test text-29.3 {-wrap option} {
  1085.     list [.t index @500,8] [.t index @1,20] [.t index @500,20] \
  1086.         [.t index @1,35] [.t index @500,35] [.t index @1,48]
  1087. } {1.17 1.18 1.38 1.39 1.43 2.0}
  1088. .t tag add sel 1.16
  1089. .t tag add sel 1.18
  1090. .t tag add sel 1.38
  1091. .t tag add sel 1.39
  1092. .t config -wrap none
  1093. test text-29.4 {-wrap option} {
  1094.     list [.t index @500,8] [.t index @1,20] [.t index @500,20] \
  1095.         [.t index @1,35] [.t index @500,35] [.t index @1,48]
  1096. } {1.20 2.0 2.6 3.0 3.6 3.6}
  1097. .t config -wrap char
  1098. test text-29.5 {-wrap option} {
  1099.     list [.t index @500,8] [.t index @1,20] [.t index @500,20] \
  1100.         [.t index @1,35] [.t index @500,35] [.t index @1,48]
  1101. } {1.19 1.20 1.39 1.40 1.43 2.0}
  1102. .t config -wrap word
  1103. test text-29.6 {-wrap option} {
  1104.     list [.t index @500,8] [.t index @1,20] [.t index @500,20] \
  1105.         [.t index @1,35] [.t index @500,35] [.t index @1,48]
  1106. } {1.17 1.18 1.38 1.39 1.43 2.0}
  1107. .t tag remove sel 1.0 end
  1108. .t tag add sel 1.17
  1109. .t tag add sel 1.37
  1110. .t config -wrap none
  1111. test text-29.7 {-wrap option} {
  1112.     list [.t index @500,8] [.t index @1,20] [.t index @500,20] \
  1113.         [.t index @1,35] [.t index @500,35] [.t index @1,48]
  1114. } {1.20 2.0 2.6 3.0 3.6 3.6}
  1115. .t config -wrap char
  1116. test text-29.8 {-wrap option} {
  1117.     list [.t index @500,8] [.t index @1,20] [.t index @500,20] \
  1118.         [.t index @1,35] [.t index @500,35] [.t index @1,48]
  1119. } {1.19 1.20 1.39 1.40 1.43 2.0}
  1120. .t config -wrap word
  1121. test text-29.9 {-wrap option} {
  1122.     list [.t index @500,8] [.t index @1,20] [.t index @500,20] \
  1123.         [.t index @1,35] [.t index @500,35] [.t index @1,48]
  1124. } {1.17 1.18 1.38 1.39 1.43 2.0}
  1125.  
  1126. #destroy .t
  1127.