Pratt 1.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (283) hide show
  1. data/.exrc +61 -0
  2. data/.gitignore +4 -0
  3. data/History.txt +6 -0
  4. data/Manifest.txt +46 -0
  5. data/Pratt.gemspec +351 -0
  6. data/README.txt +66 -0
  7. data/Rakefile +85 -0
  8. data/TODO +54 -0
  9. data/VERSION +1 -0
  10. data/bin/pratt.rb +13 -0
  11. data/config.rb +34 -0
  12. data/lib/pratt.rb +527 -0
  13. data/lib/pratt/array.rb +11 -0
  14. data/lib/pratt/string.rb +18 -0
  15. data/models/app.rb +40 -0
  16. data/models/customer.rb +24 -0
  17. data/models/payment.rb +22 -0
  18. data/models/pratt.rb +19 -0
  19. data/models/project.rb +82 -0
  20. data/models/whence.rb +70 -0
  21. data/pkgs/tile-0.8.2.tar.gz +0 -0
  22. data/pkgs/tile-0.8.2/ANNOUNCE.txt +95 -0
  23. data/pkgs/tile-0.8.2/ChangeLog +4651 -0
  24. data/pkgs/tile-0.8.2/Makefile +250 -0
  25. data/pkgs/tile-0.8.2/Makefile.in +250 -0
  26. data/pkgs/tile-0.8.2/README.txt +86 -0
  27. data/pkgs/tile-0.8.2/aclocal.m4 +2 -0
  28. data/pkgs/tile-0.8.2/altTheme.o +0 -0
  29. data/pkgs/tile-0.8.2/blink.o +0 -0
  30. data/pkgs/tile-0.8.2/button.o +0 -0
  31. data/pkgs/tile-0.8.2/cache.o +0 -0
  32. data/pkgs/tile-0.8.2/clamTheme.o +0 -0
  33. data/pkgs/tile-0.8.2/classicTheme.o +0 -0
  34. data/pkgs/tile-0.8.2/config.log +1330 -0
  35. data/pkgs/tile-0.8.2/config.status +795 -0
  36. data/pkgs/tile-0.8.2/configure +15248 -0
  37. data/pkgs/tile-0.8.2/configure.in +89 -0
  38. data/pkgs/tile-0.8.2/demos/autocomplete.tcl +59 -0
  39. data/pkgs/tile-0.8.2/demos/demo.tcl +870 -0
  40. data/pkgs/tile-0.8.2/demos/dirbrowser.tcl +167 -0
  41. data/pkgs/tile-0.8.2/demos/dlgtest.tcl +97 -0
  42. data/pkgs/tile-0.8.2/demos/iconlib.tcl +110 -0
  43. data/pkgs/tile-0.8.2/demos/repeater.tcl +117 -0
  44. data/pkgs/tile-0.8.2/demos/toolbutton.tcl +101 -0
  45. data/pkgs/tile-0.8.2/doc/Geometry.3 +230 -0
  46. data/pkgs/tile-0.8.2/doc/INDEX.MAP +153 -0
  47. data/pkgs/tile-0.8.2/doc/Makefile +36 -0
  48. data/pkgs/tile-0.8.2/doc/TILE.XML +45 -0
  49. data/pkgs/tile-0.8.2/doc/Theme.3 +34 -0
  50. data/pkgs/tile-0.8.2/doc/button.n +75 -0
  51. data/pkgs/tile-0.8.2/doc/checkbutton.n +61 -0
  52. data/pkgs/tile-0.8.2/doc/combobox.n +98 -0
  53. data/pkgs/tile-0.8.2/doc/converting.txt +97 -0
  54. data/pkgs/tile-0.8.2/doc/dialog.n +122 -0
  55. data/pkgs/tile-0.8.2/doc/entry.n +438 -0
  56. data/pkgs/tile-0.8.2/doc/frame.n +43 -0
  57. data/pkgs/tile-0.8.2/doc/html/Geometry.html +304 -0
  58. data/pkgs/tile-0.8.2/doc/html/Theme.html +48 -0
  59. data/pkgs/tile-0.8.2/doc/html/button.html +120 -0
  60. data/pkgs/tile-0.8.2/doc/html/category-index.html +18 -0
  61. data/pkgs/tile-0.8.2/doc/html/checkbutton.html +94 -0
  62. data/pkgs/tile-0.8.2/doc/html/combobox.html +164 -0
  63. data/pkgs/tile-0.8.2/doc/html/converting.txt +97 -0
  64. data/pkgs/tile-0.8.2/doc/html/dialog.html +159 -0
  65. data/pkgs/tile-0.8.2/doc/html/entry.html +613 -0
  66. data/pkgs/tile-0.8.2/doc/html/frame.html +76 -0
  67. data/pkgs/tile-0.8.2/doc/html/image.html +100 -0
  68. data/pkgs/tile-0.8.2/doc/html/index.html +25 -0
  69. data/pkgs/tile-0.8.2/doc/html/keyword-index.html +228 -0
  70. data/pkgs/tile-0.8.2/doc/html/label.html +133 -0
  71. data/pkgs/tile-0.8.2/doc/html/labelframe.html +91 -0
  72. data/pkgs/tile-0.8.2/doc/html/manpage.css +212 -0
  73. data/pkgs/tile-0.8.2/doc/html/menubutton.html +63 -0
  74. data/pkgs/tile-0.8.2/doc/html/notebook.html +280 -0
  75. data/pkgs/tile-0.8.2/doc/html/paned.html +149 -0
  76. data/pkgs/tile-0.8.2/doc/html/progressbar.html +138 -0
  77. data/pkgs/tile-0.8.2/doc/html/radiobutton.html +89 -0
  78. data/pkgs/tile-0.8.2/doc/html/scrollbar.html +221 -0
  79. data/pkgs/tile-0.8.2/doc/html/separator.html +48 -0
  80. data/pkgs/tile-0.8.2/doc/html/sizegrip.html +62 -0
  81. data/pkgs/tile-0.8.2/doc/html/style.html +172 -0
  82. data/pkgs/tile-0.8.2/doc/html/tile-intro.html +164 -0
  83. data/pkgs/tile-0.8.2/doc/html/treeview.html +634 -0
  84. data/pkgs/tile-0.8.2/doc/html/widget.html +342 -0
  85. data/pkgs/tile-0.8.2/doc/image.n +81 -0
  86. data/pkgs/tile-0.8.2/doc/internals.txt +409 -0
  87. data/pkgs/tile-0.8.2/doc/label.n +75 -0
  88. data/pkgs/tile-0.8.2/doc/labelframe.n +64 -0
  89. data/pkgs/tile-0.8.2/doc/man.macros +239 -0
  90. data/pkgs/tile-0.8.2/doc/menubutton.n +41 -0
  91. data/pkgs/tile-0.8.2/doc/notebook.n +188 -0
  92. data/pkgs/tile-0.8.2/doc/paned.n +95 -0
  93. data/pkgs/tile-0.8.2/doc/progressbar.n +79 -0
  94. data/pkgs/tile-0.8.2/doc/radiobutton.n +57 -0
  95. data/pkgs/tile-0.8.2/doc/scrollbar.n +160 -0
  96. data/pkgs/tile-0.8.2/doc/separator.n +30 -0
  97. data/pkgs/tile-0.8.2/doc/sizegrip.n +53 -0
  98. data/pkgs/tile-0.8.2/doc/style.n +119 -0
  99. data/pkgs/tile-0.8.2/doc/tile-intro.n +165 -0
  100. data/pkgs/tile-0.8.2/doc/tmml.options +4 -0
  101. data/pkgs/tile-0.8.2/doc/treeview.n +415 -0
  102. data/pkgs/tile-0.8.2/doc/widget.n +227 -0
  103. data/pkgs/tile-0.8.2/doc/xml/Geometry.tmml +379 -0
  104. data/pkgs/tile-0.8.2/doc/xml/INDEX.MAP +153 -0
  105. data/pkgs/tile-0.8.2/doc/xml/Theme.tmml +63 -0
  106. data/pkgs/tile-0.8.2/doc/xml/button.tmml +134 -0
  107. data/pkgs/tile-0.8.2/doc/xml/checkbutton.tmml +119 -0
  108. data/pkgs/tile-0.8.2/doc/xml/combobox.tmml +184 -0
  109. data/pkgs/tile-0.8.2/doc/xml/dialog.tmml +195 -0
  110. data/pkgs/tile-0.8.2/doc/xml/entry.tmml +630 -0
  111. data/pkgs/tile-0.8.2/doc/xml/frame.tmml +98 -0
  112. data/pkgs/tile-0.8.2/doc/xml/image.tmml +101 -0
  113. data/pkgs/tile-0.8.2/doc/xml/label.tmml +154 -0
  114. data/pkgs/tile-0.8.2/doc/xml/labelframe.tmml +116 -0
  115. data/pkgs/tile-0.8.2/doc/xml/menubutton.tmml +80 -0
  116. data/pkgs/tile-0.8.2/doc/xml/notebook.tmml +306 -0
  117. data/pkgs/tile-0.8.2/doc/xml/paned.tmml +154 -0
  118. data/pkgs/tile-0.8.2/doc/xml/progressbar.tmml +151 -0
  119. data/pkgs/tile-0.8.2/doc/xml/radiobutton.tmml +109 -0
  120. data/pkgs/tile-0.8.2/doc/xml/scrollbar.tmml +233 -0
  121. data/pkgs/tile-0.8.2/doc/xml/separator.tmml +59 -0
  122. data/pkgs/tile-0.8.2/doc/xml/sizegrip.tmml +82 -0
  123. data/pkgs/tile-0.8.2/doc/xml/style.tmml +171 -0
  124. data/pkgs/tile-0.8.2/doc/xml/tile-intro.tmml +192 -0
  125. data/pkgs/tile-0.8.2/doc/xml/treeview.tmml +604 -0
  126. data/pkgs/tile-0.8.2/doc/xml/widget.tmml +372 -0
  127. data/pkgs/tile-0.8.2/entry.o +0 -0
  128. data/pkgs/tile-0.8.2/frame.o +0 -0
  129. data/pkgs/tile-0.8.2/generic/Makefile.in +221 -0
  130. data/pkgs/tile-0.8.2/generic/TODO +493 -0
  131. data/pkgs/tile-0.8.2/generic/altTheme.c +1172 -0
  132. data/pkgs/tile-0.8.2/generic/blink.c +168 -0
  133. data/pkgs/tile-0.8.2/generic/button.c +858 -0
  134. data/pkgs/tile-0.8.2/generic/cache.c +354 -0
  135. data/pkgs/tile-0.8.2/generic/clamTheme.c +974 -0
  136. data/pkgs/tile-0.8.2/generic/classicTheme.c +518 -0
  137. data/pkgs/tile-0.8.2/generic/configure +10334 -0
  138. data/pkgs/tile-0.8.2/generic/configure.in +100 -0
  139. data/pkgs/tile-0.8.2/generic/entry.c +1922 -0
  140. data/pkgs/tile-0.8.2/generic/frame.c +648 -0
  141. data/pkgs/tile-0.8.2/generic/gunk.h +44 -0
  142. data/pkgs/tile-0.8.2/generic/image.c +416 -0
  143. data/pkgs/tile-0.8.2/generic/label.c +663 -0
  144. data/pkgs/tile-0.8.2/generic/layout.c +1215 -0
  145. data/pkgs/tile-0.8.2/generic/manager.c +554 -0
  146. data/pkgs/tile-0.8.2/generic/manager.h +91 -0
  147. data/pkgs/tile-0.8.2/generic/notebook.c +1380 -0
  148. data/pkgs/tile-0.8.2/generic/paned.c +958 -0
  149. data/pkgs/tile-0.8.2/generic/pkgIndex.tcl.in +7 -0
  150. data/pkgs/tile-0.8.2/generic/progress.c +549 -0
  151. data/pkgs/tile-0.8.2/generic/scale.c +526 -0
  152. data/pkgs/tile-0.8.2/generic/scroll.c +253 -0
  153. data/pkgs/tile-0.8.2/generic/scrollbar.c +346 -0
  154. data/pkgs/tile-0.8.2/generic/separator.c +132 -0
  155. data/pkgs/tile-0.8.2/generic/square.c +306 -0
  156. data/pkgs/tile-0.8.2/generic/tagset.c +147 -0
  157. data/pkgs/tile-0.8.2/generic/tile.c +296 -0
  158. data/pkgs/tile-0.8.2/generic/tkElements.c +1280 -0
  159. data/pkgs/tile-0.8.2/generic/tkTheme.c +1708 -0
  160. data/pkgs/tile-0.8.2/generic/tkTheme.h +419 -0
  161. data/pkgs/tile-0.8.2/generic/tkThemeInt.h +45 -0
  162. data/pkgs/tile-0.8.2/generic/tkstate.c +268 -0
  163. data/pkgs/tile-0.8.2/generic/trace.c +145 -0
  164. data/pkgs/tile-0.8.2/generic/track.c +174 -0
  165. data/pkgs/tile-0.8.2/generic/treeview.c +3211 -0
  166. data/pkgs/tile-0.8.2/generic/ttk.decls +154 -0
  167. data/pkgs/tile-0.8.2/generic/ttkDecls.h +340 -0
  168. data/pkgs/tile-0.8.2/generic/ttkStubInit.c +61 -0
  169. data/pkgs/tile-0.8.2/generic/ttkStubLib.c +70 -0
  170. data/pkgs/tile-0.8.2/generic/widget.c +785 -0
  171. data/pkgs/tile-0.8.2/generic/widget.h +263 -0
  172. data/pkgs/tile-0.8.2/image.o +0 -0
  173. data/pkgs/tile-0.8.2/label.o +0 -0
  174. data/pkgs/tile-0.8.2/layout.o +0 -0
  175. data/pkgs/tile-0.8.2/library/altTheme.tcl +101 -0
  176. data/pkgs/tile-0.8.2/library/aquaTheme.tcl +62 -0
  177. data/pkgs/tile-0.8.2/library/button.tcl +85 -0
  178. data/pkgs/tile-0.8.2/library/clamTheme.tcl +139 -0
  179. data/pkgs/tile-0.8.2/library/classicTheme.tcl +108 -0
  180. data/pkgs/tile-0.8.2/library/combobox.tcl +439 -0
  181. data/pkgs/tile-0.8.2/library/cursors.tcl +36 -0
  182. data/pkgs/tile-0.8.2/library/defaults.tcl +118 -0
  183. data/pkgs/tile-0.8.2/library/dialog.tcl +274 -0
  184. data/pkgs/tile-0.8.2/library/entry.tcl +580 -0
  185. data/pkgs/tile-0.8.2/library/fonts.tcl +153 -0
  186. data/pkgs/tile-0.8.2/library/icons.tcl +105 -0
  187. data/pkgs/tile-0.8.2/library/keynav.tcl +192 -0
  188. data/pkgs/tile-0.8.2/library/menubutton.tcl +171 -0
  189. data/pkgs/tile-0.8.2/library/notebook.tcl +193 -0
  190. data/pkgs/tile-0.8.2/library/paned.tcl +87 -0
  191. data/pkgs/tile-0.8.2/library/progress.tcl +51 -0
  192. data/pkgs/tile-0.8.2/library/scale.tcl +54 -0
  193. data/pkgs/tile-0.8.2/library/scrollbar.tcl +125 -0
  194. data/pkgs/tile-0.8.2/library/sizegrip.tcl +77 -0
  195. data/pkgs/tile-0.8.2/library/tile.tcl +211 -0
  196. data/pkgs/tile-0.8.2/library/treeview.tcl +382 -0
  197. data/pkgs/tile-0.8.2/library/utils.tcl +254 -0
  198. data/pkgs/tile-0.8.2/library/winTheme.tcl +77 -0
  199. data/pkgs/tile-0.8.2/library/xpTheme.tcl +63 -0
  200. data/pkgs/tile-0.8.2/libtile0.8.2.so +0 -0
  201. data/pkgs/tile-0.8.2/libttkstub.a +0 -0
  202. data/pkgs/tile-0.8.2/license.terms +24 -0
  203. data/pkgs/tile-0.8.2/macosx/aquaTheme.c +1076 -0
  204. data/pkgs/tile-0.8.2/manager.o +0 -0
  205. data/pkgs/tile-0.8.2/notebook.o +0 -0
  206. data/pkgs/tile-0.8.2/paned.o +0 -0
  207. data/pkgs/tile-0.8.2/pkgIndex.tcl +3 -0
  208. data/pkgs/tile-0.8.2/progress.o +0 -0
  209. data/pkgs/tile-0.8.2/scale.o +0 -0
  210. data/pkgs/tile-0.8.2/scroll.o +0 -0
  211. data/pkgs/tile-0.8.2/scrollbar.o +0 -0
  212. data/pkgs/tile-0.8.2/separator.o +0 -0
  213. data/pkgs/tile-0.8.2/tagset.o +0 -0
  214. data/pkgs/tile-0.8.2/tclconfig/install-sh +119 -0
  215. data/pkgs/tile-0.8.2/tclconfig/tcl.m4 +4069 -0
  216. data/pkgs/tile-0.8.2/tclconfig/teax.m4 +109 -0
  217. data/pkgs/tile-0.8.2/tests/all.tcl +18 -0
  218. data/pkgs/tile-0.8.2/tests/bwidget.test +103 -0
  219. data/pkgs/tile-0.8.2/tests/cbtest.tcl +125 -0
  220. data/pkgs/tile-0.8.2/tests/combobox.test +51 -0
  221. data/pkgs/tile-0.8.2/tests/compound.tcl +92 -0
  222. data/pkgs/tile-0.8.2/tests/entry.test +285 -0
  223. data/pkgs/tile-0.8.2/tests/entrytest.tcl +78 -0
  224. data/pkgs/tile-0.8.2/tests/image.test +94 -0
  225. data/pkgs/tile-0.8.2/tests/labelframe.tcl +41 -0
  226. data/pkgs/tile-0.8.2/tests/labelframe.test +137 -0
  227. data/pkgs/tile-0.8.2/tests/layout.test +33 -0
  228. data/pkgs/tile-0.8.2/tests/misc.test +35 -0
  229. data/pkgs/tile-0.8.2/tests/nbtest.tcl +66 -0
  230. data/pkgs/tile-0.8.2/tests/notebook.test +500 -0
  231. data/pkgs/tile-0.8.2/tests/paned.test +298 -0
  232. data/pkgs/tile-0.8.2/tests/progress.test +92 -0
  233. data/pkgs/tile-0.8.2/tests/pwtest.tcl +90 -0
  234. data/pkgs/tile-0.8.2/tests/sbtest.tcl +79 -0
  235. data/pkgs/tile-0.8.2/tests/scrollbar.test +77 -0
  236. data/pkgs/tile-0.8.2/tests/sgtest.tcl +52 -0
  237. data/pkgs/tile-0.8.2/tests/testutils.tcl +20 -0
  238. data/pkgs/tile-0.8.2/tests/tile.test +674 -0
  239. data/pkgs/tile-0.8.2/tests/treetags.test +78 -0
  240. data/pkgs/tile-0.8.2/tests/treeview.test +563 -0
  241. data/pkgs/tile-0.8.2/tests/tvtest.tcl +332 -0
  242. data/pkgs/tile-0.8.2/tests/validate.test +278 -0
  243. data/pkgs/tile-0.8.2/tile.o +0 -0
  244. data/pkgs/tile-0.8.2/tkElements.o +0 -0
  245. data/pkgs/tile-0.8.2/tkTheme.o +0 -0
  246. data/pkgs/tile-0.8.2/tkstate.o +0 -0
  247. data/pkgs/tile-0.8.2/tools/genStubs.tcl +861 -0
  248. data/pkgs/tile-0.8.2/trace.o +0 -0
  249. data/pkgs/tile-0.8.2/track.o +0 -0
  250. data/pkgs/tile-0.8.2/treeview.o +0 -0
  251. data/pkgs/tile-0.8.2/ttkStubInit.o +0 -0
  252. data/pkgs/tile-0.8.2/ttkStubLib.o +0 -0
  253. data/pkgs/tile-0.8.2/widget.o +0 -0
  254. data/pkgs/tile-0.8.2/win/Tile.dsp +261 -0
  255. data/pkgs/tile-0.8.2/win/makefile.vc +527 -0
  256. data/pkgs/tile-0.8.2/win/monitor.c +164 -0
  257. data/pkgs/tile-0.8.2/win/nmakehlp.c +483 -0
  258. data/pkgs/tile-0.8.2/win/rules.vc +512 -0
  259. data/pkgs/tile-0.8.2/win/tile.rc +40 -0
  260. data/pkgs/tile-0.8.2/win/winTheme.c +734 -0
  261. data/pkgs/tile-0.8.2/win/xpTheme.c +1029 -0
  262. data/spec/app_spec.rb +48 -0
  263. data/spec/customer_spec.rb +31 -0
  264. data/spec/fixtures/graph.expectation +18 -0
  265. data/spec/payment_spec.rb +19 -0
  266. data/spec/pratt_spec.rb +148 -0
  267. data/spec/project_spec.rb +163 -0
  268. data/spec/rcov.opts +0 -0
  269. data/spec/spec.opts +1 -0
  270. data/spec/spec_helper.rb +21 -0
  271. data/spec/whence_spec.rb +54 -0
  272. data/tasks/pratt.rb +84 -0
  273. data/templates/model.eruby +12 -0
  274. data/templates/spec.eruby +8 -0
  275. data/views/env.rb +22 -0
  276. data/views/graph.eruby +20 -0
  277. data/views/invoice.eruby +148 -0
  278. data/views/main.rb +92 -0
  279. data/views/pid.eruby +3 -0
  280. data/views/pop.rb +94 -0
  281. data/views/pop2.rb +75 -0
  282. data/views/raw.eruby +11 -0
  283. metadata +390 -0
@@ -0,0 +1,79 @@
1
+ #
2
+ # side-by-side interactive test of Tk vs. Tile scrollbars.
3
+ #
4
+
5
+ lappend auto_path .
6
+
7
+ package require Tk
8
+ package require tile
9
+
10
+ proc sbstub {sb cmd number {units units}} {
11
+ # puts [info level 0]
12
+ sbstub.$cmd $sb $number $units
13
+ }
14
+ proc sbstub.moveto {sb number _} {
15
+ $sb set $number [expr {$number + 0.5}]
16
+ # puts "[$sb get]"
17
+ }
18
+ proc sbstub.scroll {sb number units} {
19
+ if {$units eq "pages"} {
20
+ set delta 0.2
21
+ } else {
22
+ set delta 0.05
23
+ }
24
+ set current [$sb get]
25
+ set new0 [expr {[lindex $current 0] + $delta*$number}]
26
+ set new1 [expr {[lindex $current 1] + $delta*$number}]
27
+ $sb set $new0 $new1 ;
28
+ # puts "$current - $new0 $new1 - [$sb get]"
29
+ }
30
+
31
+ wm geometry . 400x200
32
+
33
+ pack [scrollbar .hsb -orient horizontal -command [list sbstub .hsb]] \
34
+ -side top -expand false -fill x
35
+ pack [tscrollbar .thsb -orient horizontal -command [list sbstub .thsb]] \
36
+ -side top -expand false -fill x
37
+ pack [scrollbar .vsb -orient vertical -command [list sbstub .vsb]] \
38
+ -side left -expand false -fill y
39
+ pack [tscrollbar .tvsb -orient vertical -command [list sbstub .tvsb]] \
40
+ -side left -expand false -fill y
41
+
42
+ pack [set c [frame .client]] -expand true -fill both
43
+
44
+ grid \
45
+ [label $c.li -text "Element:" -anchor w] \
46
+ [entry $c.i -textvariable ::identified] \
47
+ -sticky ew
48
+
49
+ grid \
50
+ [label $c.lf -text "Fraction:" -anchor w] \
51
+ [entry $c.f -textvariable ::fraction] \
52
+ -sticky ew
53
+
54
+ grid \
55
+ [label $c.lr -text "Range:" -anchor w] \
56
+ [entry $c.r -textvariable ::range] \
57
+ -sticky ew
58
+
59
+ grid columnconfigure $c 1 -weight 1
60
+
61
+ bind Test <ButtonPress-1> { sbdebug %W %x %y }
62
+ bind Test <B1-Motion> { sbdebug %W %x %y }
63
+ bind Test <B2-Motion> { sbdebug %W %x %y }
64
+
65
+ proc sbdebug {W x y} {
66
+ set ::identified [$W identify $x $y]
67
+ set ::fraction [$W fraction $x $y]
68
+ set ::range [$W get]
69
+ }
70
+
71
+ foreach w {.vsb .hsb .tvsb .thsb} {
72
+ bindtags $w [linsert [bindtags $w] 0 Test]
73
+ }
74
+
75
+ .vsb set 0 0.5
76
+ .hsb set 0 0.5
77
+ .tvsb set 0 0.5
78
+ .thsb set 0 0.5
79
+
@@ -0,0 +1,77 @@
1
+ #
2
+ # scrollbar.test,v 1.9 2007/11/18 17:09:35 jenglish Exp
3
+ #
4
+
5
+ package require Tk
6
+ package require tcltest ; namespace import -force tcltest::*
7
+ loadTestedCommands
8
+
9
+ lappend auto_path .
10
+ package require tile
11
+
12
+ testConstraint coreScrollbar [expr {[tk windowingsystem] eq "aqua"}]
13
+
14
+ test scrollbar-swapout-1 "Use core scrollbars on OSX..." -constraints {
15
+ coreScrollbar
16
+ } -body {
17
+ ttk::scrollbar .sb -command "yadda"
18
+ list [winfo class .sb] [.sb cget -command]
19
+ } -result [list Scrollbar yadda] -cleanup {
20
+ destroy .sb
21
+ }
22
+
23
+ test scrollbar-swapout-2 "... unless -style is specified ..." -constraints {
24
+ coreScrollbar
25
+ } -body {
26
+ ttk::style layout Vertical.Custom.TScrollbar \
27
+ [ttk::style layout Vertical.TScrollbar] ; # See #1833339
28
+ ttk::scrollbar .sb -command "yadda" -style Custom.TScrollbar
29
+ list [winfo class .sb] [.sb cget -command] [.sb cget -style]
30
+ } -result [list TScrollbar yadda Custom.TScrollbar] -cleanup {
31
+ destroy .sb
32
+ }
33
+
34
+ test scrollbar-swapout-3 "... or -class." -constraints {
35
+ coreScrollbar
36
+ } -body {
37
+ ttk::scrollbar .sb -command "yadda" -class Custom.TScrollbar
38
+ list [winfo class .sb] [.sb cget -command]
39
+ } -result [list Custom.TScrollbar yadda] -cleanup {
40
+ destroy .sb
41
+ }
42
+
43
+
44
+ test scrollbar-1.0 "Setup" -body {
45
+ ttk::scrollbar .tsb
46
+ } -result .tsb
47
+
48
+ test scrollbar-1.1 "Set method" -body {
49
+ .tsb set 0.2 0.4
50
+ .tsb get
51
+ } -result [list 0.2 0.4]
52
+
53
+ test scrollbar-1.2 "Set orientation" -body {
54
+ .tsb configure -orient vertical
55
+ set w [winfo reqwidth .tsb] ; set h [winfo reqheight .tsb]
56
+ expr {$h > $w}
57
+ } -result 1
58
+
59
+ test scrollbar-1.3 "Change orientation" -body {
60
+ .tsb configure -orient horizontal
61
+ set w [winfo reqwidth .tsb] ; set h [winfo reqheight .tsb]
62
+ expr {$h < $w}
63
+ } -result 1
64
+
65
+ #
66
+ # Scale tests:
67
+ #
68
+
69
+ test scale-1.0 "Self-destruction" -body {
70
+ trace variable v w { destroy .s ;# }
71
+ ttk::scale .s -variable v
72
+ pack .s ; update
73
+ .s set 1 ; update
74
+ } -returnCodes 1 -match glob -result "*"
75
+
76
+ tcltest::cleanupTests
77
+
@@ -0,0 +1,52 @@
1
+ #
2
+ # sgtest.tcl,v 1.1 2006/08/05 23:18:30 jenglish Exp
3
+ #
4
+ # Interactive test driver for sizegrip widget.
5
+ #
6
+
7
+ package require Tk
8
+ package require tile
9
+
10
+ source [file join [file dirname [info script]] testutils.tcl]
11
+
12
+ variable setgrid 0
13
+ proc setsetgrid {w} { $w configure -setgrid $::setgrid }
14
+
15
+ variable wmgeometry
16
+ bind . <Configure> { set ::wmgeometry [wm geometry .] }
17
+
18
+ set tb [ttk::frame .toolbar]
19
+ pack \
20
+ [ttk::checkbutton $tb.cb -text "Setgrid?" \
21
+ -command [list setsetgrid .tt] -variable setgrid] \
22
+ [ttk::button $tb.tl -text "+50+50" \
23
+ -command [list wm geometry . +50+50]] \
24
+ [ttk::button $tb.br -text "-50-50" \
25
+ -command [list wm geometry . -50-50]] \
26
+ [ttk::button $tb.cg -text "Reset geometry" \
27
+ -command [list wm geometry . {}]] \
28
+ -side left -anchor w -padx 3 -pady 3
29
+ pack \
30
+ [ttk::label $tb.geometry -width 20 -textvariable wmgeometry] \
31
+ -side right
32
+
33
+ ttk::sizegrip .grip
34
+ ttk::scrollbar .vsb -orient vertical -command [list .tt yview]
35
+ ttk::scrollbar .hsb -orient horizontal -command [list .tt xview]
36
+ text .tt -setgrid $setgrid -wrap none \
37
+ -xscrollcommand [list .hsb set] -yscrollcommand [list .vsb set] \
38
+ -highlightthickness 0
39
+
40
+ .tt insert end [read [set fp [open [info script]]]] ; close $fp
41
+
42
+ grid .toolbar -row 0 -columnspan 2 -sticky nsew
43
+ grid .tt -row 1 -column 0 -sticky nsew
44
+ grid .vsb -row 1 -column 1 -sticky nse
45
+ grid .hsb -row 2 -column 0 -sticky sew
46
+ grid .grip -row 2 -column 1 -sticky senw ;# -sticky se
47
+ grid columnconfigure . 0 -weight 1
48
+ grid rowconfigure . 1 -weight 1
49
+
50
+ bind all <KeyPress-Escape> [list destroy .]
51
+
52
+ #*EOF*
@@ -0,0 +1,20 @@
1
+ #
2
+ # testutils.tcl,v 1.2 2006/11/24 19:42:28 jenglish Exp
3
+ #
4
+ # Miscellaneous utilities for interactive tests.
5
+ #
6
+
7
+
8
+ # Global binding: <Alt-KeyPress-t> cycles the current theme.
9
+ #
10
+ variable currentTheme alt
11
+ proc CycleTheme {} {
12
+ variable currentTheme
13
+ set themes [tile::availableThemes]
14
+ set i [expr {([lsearch $themes $currentTheme] + 1) % [llength $themes]}]
15
+ tile::setTheme [set currentTheme [lindex $themes $i]]
16
+ puts "Theme: $currentTheme"
17
+ }
18
+ bind all <Alt-KeyPress-t> { CycleTheme }
19
+
20
+ lappend auto_path /usr/local/lib
@@ -0,0 +1,674 @@
1
+
2
+ package require Tk
3
+ package require tcltest ; namespace import -force tcltest::*
4
+ loadTestedCommands
5
+
6
+ lappend auto_path .
7
+ package require tile
8
+
9
+ proc skip args {}
10
+ proc ok {} { return }
11
+
12
+ variable widgetClasses {
13
+ button checkbutton radiobutton menubutton label entry
14
+ frame labelframe scrollbar
15
+ notebook progressbar combobox separator
16
+ panedwindow treeview sizegrip
17
+ scale
18
+ }
19
+
20
+ proc bgerror {error} {
21
+ variable bgerror $error
22
+ variable bgerrorInfo $::errorInfo
23
+ variable bgerrorCode $::errorCode
24
+ }
25
+
26
+ # Self-destruct tests.
27
+ # Do these early, so any memory corruption has a longer time to cause a crash.
28
+ #
29
+ proc selfdestruct {w args} {
30
+ destroy $w
31
+ }
32
+ test ttk-6.1 "Self-destructing checkbutton" -body {
33
+ pack [ttk::checkbutton .sd -text "Self-destruction" -variable ::sd]
34
+ trace variable sd w [list selfdestruct .sd]
35
+ update
36
+ .sd invoke
37
+ } -returnCodes 1
38
+ test ttk-6.2 "Checkbutton self-destructed" -body {
39
+ winfo exists .sd
40
+ } -result 0
41
+
42
+ test ttk-6.3 "Test package cleanup" -body {
43
+ interp create foo
44
+ foo eval { if {[catch {package require Tk}]} { load {} Tk } }
45
+ foo eval [package ifneeded tile [package provide tile]]
46
+ foo eval { destroy . }
47
+ interp delete foo
48
+ }
49
+
50
+ test ttk-6.4 "Defeat evil intentions" -body {
51
+ trace variable OUCH r { kill.b }
52
+ proc kill.b {args} { destroy .b }
53
+ pack [ttk::checkbutton .b]
54
+ .b configure -variable OUCH
55
+ # At this point, .b should be gone.
56
+ .b invoke
57
+ list [set OUCH] [winfo exists .b]
58
+ # Mostly we just care that we haven't crashed the interpreter.
59
+ #
60
+ } -returnCodes error -match glob -result "*"
61
+
62
+ test ttk-6.5 "Clean up -textvariable traces" -body {
63
+ foreach class {ttk::button ttk::checkbutton ttk::radiobutton} {
64
+ $class .b1 -textvariable V
65
+ set V "asdf"
66
+ destroy .b1
67
+ set V ""
68
+ }
69
+ }
70
+
71
+ test ttk-6.6 "Bad color spec in styles" -body {
72
+ pack [ttk::button .b1 -text Hi!]
73
+ ttk::style configure TButton -foreground badColor
74
+ event generate .b1 <Expose>
75
+ update
76
+ ttk::style configure TButton -foreground black
77
+ destroy .b1
78
+ set ::bgerror
79
+ } -result {unknown color name "badColor"}
80
+
81
+ test ttk-6.7 "Basic destruction test" -body {
82
+ foreach widget $widgetClasses {
83
+ ttk::$widget .w
84
+ pack .w
85
+ destroy .w
86
+ }
87
+ }
88
+
89
+ test ttk-6.8 "Button command removes itself" -body {
90
+ ttk::button .b -command ".b configure -command {}; set ::A {it worked}"
91
+ .b invoke
92
+ destroy .b
93
+ set ::A
94
+ } -result {it worked}
95
+
96
+ test ttk-6.9 "Bad font spec in styles" -setup {
97
+ ttk::style theme create badfont -settings {
98
+ ttk::style configure . -font {Helvetica 12 Bogus}
99
+ }
100
+ ttk::style theme use badfont
101
+ } -cleanup {
102
+ ttk::style theme use default
103
+ } -body {
104
+ pack [ttk::label .l -text Hi! -font {}]
105
+
106
+ # SEE ALSO: #1583038 - "-font {}" makes test suite pass
107
+ # but does not fix the underlying problem.
108
+
109
+ event generate .l <Expose>
110
+ update
111
+ destroy .l
112
+ set ::bgerror
113
+ } -result {unknown font style "Bogus"}
114
+
115
+ #
116
+ # Basic tests.
117
+ #
118
+
119
+ test ttk-1.1 "Create button" -body {
120
+ pack [ttk::button .t] -expand true -fill both
121
+ update
122
+ }
123
+
124
+ test ttk-1.2 "Check style" -body {
125
+ .t cget -style
126
+ } -result {}
127
+
128
+
129
+ test ttk-1.4 "Restore default style" -body {
130
+ .t cget -style
131
+ } -result ""
132
+
133
+ proc checkstate {w} {
134
+ foreach statespec {
135
+ {!active !disabled}
136
+ {!active disabled}
137
+ {active !disabled}
138
+ {active disabled}
139
+ active
140
+ disabled
141
+ } {
142
+ lappend result [$w instate $statespec]
143
+ }
144
+ set result
145
+ }
146
+
147
+ # NB: this will fail if the top-level window pops up underneath the cursor
148
+ test ttk-2.0 "Check state" -body {
149
+ checkstate .t
150
+ } -result [list 1 0 0 0 0 0]
151
+
152
+ test ttk-2.1 "Change state" -body {
153
+ .t state active
154
+ } -result !active
155
+
156
+ test ttk-2.2 "Check state again" -body {
157
+ checkstate .t
158
+ } -result [list 0 0 1 0 1 0]
159
+
160
+ test ttk-2.3 "Change state again" -body {
161
+ .t state {!active disabled}
162
+ } -result {active !disabled}
163
+
164
+ test ttk-2.4 "Check state again" -body {
165
+ checkstate .t
166
+ } -result [list 0 1 0 0 0 1]
167
+
168
+ test ttk-2.5 "Change state again" -body {
169
+ .t state !disabled
170
+ } -result {disabled}
171
+
172
+ test ttk-2.6 "instate scripts, false" -body {
173
+ set x 0
174
+ .t instate disabled { set x 1 }
175
+ set x
176
+ } -result 0
177
+
178
+ test ttk-2.7 "instate scripts, true" -body {
179
+ set x 0
180
+ .t instate !disabled { set x 1 }
181
+ set x
182
+ } -result 1
183
+
184
+
185
+ # misc. error detection
186
+ test ttk-3.0 "Bad option" -body {
187
+ ttk::button .bad -badoption foo
188
+ } -returnCodes 1 -result {unknown option "-badoption"} -match glob
189
+
190
+ test ttk-3.1 "Make sure widget command not created" -body {
191
+ .bad state disabled
192
+ } -returnCodes 1 -result {invalid command name ".bad"} -match glob
193
+
194
+ test ttk-3.2 "Propagate errors from variable traces" -body {
195
+ set A 0
196
+ trace add variable A write {error "failure" ;# }
197
+ ttk::checkbutton .cb -variable A
198
+ .cb invoke
199
+ } -cleanup {
200
+ unset ::A ; destroy .cb
201
+ } -returnCodes error -result {can't set "A": failure}
202
+
203
+ test ttk-3.3 "Constructor failure with cursor" -constraints KNOWNBUG -body {
204
+ # This raises an X error.
205
+ # See also: test 15.1
206
+ # Also: ttk::sizegrip .g -style BadStyle
207
+
208
+ ttk::button .b -cursor bottom_right_corner -style BadStyle
209
+
210
+ } -returnCodes 1 -result "Layout BadStyle not found"
211
+
212
+ # Test resource allocation
213
+ # (@@@ "-font" is a compatibility option now, so tests 4.1-4.3
214
+ # don't really test anything useful at the moment.)
215
+ #
216
+
217
+ test ttk-4.0 "Setup" -body {
218
+ catch { destroy .t }
219
+ pack [ttk::label .t -text "Button 1"]
220
+ testConstraint fontOption [expr ![catch { set prevFont [.t cget -font] }]]
221
+ ok
222
+ }
223
+
224
+ test ttk-4.1 "Change font" -constraints fontOption -body {
225
+ .t configure -font "Helvetica 18 bold"
226
+ }
227
+ test ttk-4.2 "Check font" -constraints fontOption -body {
228
+ .t cget -font
229
+ } -result "Helvetica 18 bold"
230
+
231
+ test ttk-4.3 "Restore font" -constraints fontOption -body {
232
+ .t configure -font $prevFont
233
+ }
234
+
235
+ test ttk-4.4 "Bad resource specifications" -body {
236
+ ttk::style theme settings alt {
237
+ ttk::style configure TButton -font {Bad font}
238
+ # @@@ it would be best to raise an error at this point,
239
+ # @@@ but that's not really feasible in the current framework.
240
+ }
241
+ pack [ttk::button .tb1 -text "Ouch"]
242
+ ttk::style theme use alt
243
+ update;
244
+ # As long as we haven't crashed, everything's OK
245
+ ttk::style theme settings alt {
246
+ ttk::style configure TButton -font TkDefaultFont
247
+ }
248
+ ttk::style theme use default
249
+ destroy .tb1
250
+ }
251
+
252
+ #
253
+ # checkbutton tests
254
+ #
255
+ test ttk-5.1 "Checkbutton check" -body {
256
+ pack [ttk::checkbutton .cb -text "TCheckbutton" -variable cb]
257
+ }
258
+ test ttk-5.2 "Checkbutton invoke" -body {
259
+ .cb invoke
260
+ list [set ::cb] [.cb instate selected]
261
+ } -result [list 1 1]
262
+ test ttk-5.3 "Checkbutton reinvoke" -body {
263
+ .cb invoke
264
+ list [set ::cb] [.cb instate selected]
265
+ } -result [list 0 0]
266
+
267
+ test ttk-5.4 "Checkbutton variable" -body {
268
+ set result []
269
+ set ::cb 1
270
+ lappend result [.cb instate selected]
271
+ set ::cb 0
272
+ lappend result [.cb instate selected]
273
+ } -result {1 0}
274
+
275
+ test ttk-5.5 "Unset checkbutton variable" -body {
276
+ set result []
277
+ unset ::cb
278
+ lappend result [.cb instate alternate] [info exists ::cb]
279
+ set ::cb 1
280
+ lappend result [.cb instate alternate] [info exists ::cb]
281
+ } -result {1 0 0 1}
282
+
283
+ # See #1257319
284
+ test ttk-5.6 "Checkbutton default variable" -body {
285
+ destroy .cb ; unset -nocomplain {} ; set result [list]
286
+ ttk::checkbutton .cb -onvalue on -offvalue off
287
+ lappend result [.cb cget -variable] [info exists .cb] [.cb state]
288
+ .cb invoke
289
+ lappend result [info exists .cb] [set .cb] [.cb state]
290
+ .cb invoke
291
+ lappend result [info exists .cb] [set .cb] [.cb state]
292
+ } -result [list .cb 0 alternate 1 on selected 1 off {}]
293
+
294
+ #
295
+ # radiobutton tests
296
+ #
297
+ test ttk-7.1 "Radiobutton check" -body {
298
+ pack \
299
+ [ttk::radiobutton .rb1 -text "One" -variable choice -value 1] \
300
+ [ttk::radiobutton .rb2 -text "Two" -variable choice -value 2] \
301
+ [ttk::radiobutton .rb3 -text "Three" -variable choice -value 3] \
302
+ ;
303
+ }
304
+ test ttk-7.2 "Radiobutton invoke" -body {
305
+ .rb1 invoke
306
+ set ::choice
307
+ } -result 1
308
+
309
+ test ttk-7.3 "Radiobutton state" -body {
310
+ .rb1 instate selected
311
+ } -result 1
312
+
313
+ test ttk-7.4 "Other radiobutton invoke" -body {
314
+ .rb2 invoke
315
+ set ::choice
316
+ } -result 2
317
+
318
+ test ttk-7.5 "Other radiobutton state" -body {
319
+ .rb2 instate selected
320
+ } -result 1
321
+
322
+ test ttk-7.6 "First radiobutton state" -body {
323
+ .rb1 instate selected
324
+ } -result 0
325
+
326
+ test ttk-7.7 "Unset radiobutton variable" -body {
327
+ unset ::choice
328
+ list [info exists ::choice] [.rb1 instate alternate] [.rb2 instate alternate]
329
+ } -result {0 1 1}
330
+
331
+ test ttk-7.8 "Reset radiobutton variable" -body {
332
+ set ::choice 2
333
+ list [info exists ::choice] [.rb1 instate alternate] [.rb2 instate alternate]
334
+ } -result {1 0 0}
335
+
336
+ #
337
+ # -compound tests:
338
+ #
339
+ variable iconData \
340
+ {R0lGODlhIAAgAKIAANnZ2YQAAP8AAISEhP///////////////yH5BAEAAAAALAAAAAAgACAA
341
+ AAP/CLoMGLqKoMvtGIqiqxEYCLrcioGiyxwIusyBgaLLLRiBoMsQKLrcjYGgu4Giy+2CAkFX
342
+ A0WX2wXFIOgGii7trkCEohsDCACBoktEKLpKhISiGwAIECiqSKooukiqKKoxgACBooukKiIo
343
+ SKooujGDECi6iqQqsopEV2MQAkV3kXQZRXdjEAJFl5F0FUWXY3ACRZcFSRdFlyVwJlB0WZB0
344
+ UXRZAmcCRZeRdBVFl2NwAkV3kXQZRXdjcAJFV5FURVaR6GoMDgSKLpKqiKAgqaLoxgwOBIoq
345
+ kiqKLpIqimrM4ECg6BIRiq4SIaHoxgyCBoou7a5AhKIbMzgAAIGiy+2CTWJmBhAAAkWX2wXF
346
+ zCDoBooud2PMDIKuRqDocgtGzMwg6O4Eii5z4Kgi6DIMhqLoagQGjiqCLvPgYOgqji6CLrfi
347
+ 6DIj6HI7jq4i6DIkADs=}
348
+
349
+ variable compoundStrings {text image center top bottom left right none}
350
+
351
+ if {0} {
352
+ proc now {} { set ::now [clock clicks -milliseconds] }
353
+ proc tick {} { puts -nonewline stderr "+" ; flush stderr }
354
+ proc tock {} {
355
+ set then $::now; set ::now [clock clicks -milliseconds]
356
+ puts stderr " [expr {$::now - $then}] ms"
357
+ }
358
+ } else {
359
+ proc now {} {} ; proc tick {} {} ; proc tock {} {}
360
+ }
361
+
362
+ now ; tick
363
+ test ttk-8.0 "Setup for 8.X" -body {
364
+ ttk::button .ctb
365
+ image create photo icon -data $::iconData;
366
+ pack .ctb
367
+ }
368
+ tock
369
+
370
+ now
371
+ test ttk-8.1 "Test -compound options" -body {
372
+ # Exhaustively test each combination.
373
+ # Main goal is to make sure no code paths crash.
374
+ foreach image {icon ""} {
375
+ foreach text {"Hi!" ""} {
376
+ foreach compound $::compoundStrings {
377
+ .ctb configure -image $image -text $text -compound $compound
378
+ update; tick
379
+ }
380
+ }
381
+ }
382
+ }
383
+ tock
384
+
385
+ test ttk-8.2 "Test -compound options with regular button" -body {
386
+ button .rtb
387
+ pack .rtb
388
+
389
+ foreach image {"" icon} {
390
+ foreach text {"Hi!" ""} {
391
+ foreach compound [lrange $::compoundStrings 2 end] {
392
+ .rtb configure -image $image -text $text -compound $compound
393
+ update; tick
394
+ }
395
+ }
396
+ }
397
+ }
398
+ tock
399
+
400
+ test ttk-8.3 "Rerun test 8.1" -body {
401
+ foreach image {icon ""} {
402
+ foreach text {"Hi!" ""} {
403
+ foreach compound $::compoundStrings {
404
+ .ctb configure -image $image -text $text -compound $compound
405
+ update; tick
406
+ }
407
+ }
408
+ }
409
+ }
410
+ tock
411
+
412
+ test ttk-8.4 "ImageChanged" -body {
413
+ ttk::button .b -image icon
414
+ icon blank
415
+ } -cleanup { destroy .b }
416
+
417
+ #------------------------------------------------------------------------
418
+
419
+ test ttk-9.1 "Traces on nonexistant namespaces" -body {
420
+ ttk::checkbutton .tcb -variable foo::bar
421
+ } -returnCodes 1 -result "*parent namespace doesn't exist*" -match glob
422
+
423
+ test ttk-9.2 "Traces on nonexistant namespaces II" -body {
424
+ ttk::checkbutton .tcb -variable X
425
+ .tcb configure -variable foo::bar
426
+ } -returnCodes 1 -result "*parent namespace doesn't exist*" -match glob
427
+
428
+ test ttk-9.3 "Restore saved options on configure error" -body {
429
+ .tcb cget -variable
430
+ } -result X
431
+
432
+ test ttk-9.4 "Textvariable tests" -body {
433
+ set tcbLabel "Testing..."
434
+ .tcb configure -textvariable tcbLabel
435
+ .tcb cget -text
436
+ } -result "Testing..."
437
+
438
+ # Changing -text has no effect if there is a linked -textvariable.
439
+ # Compatible with core widget.
440
+ test ttk-9.5 "Change -text" -body {
441
+ .tcb configure -text "Changed -text"
442
+ .tcb cget -text
443
+ } -result "Testing..."
444
+
445
+ # Unset -textvariable clears the text.
446
+ # NOTE: this is different from core widgets, which automagically reinitalize
447
+ # the -textvariable to the last value of -text.
448
+ #
449
+ test ttk-9.6 "Unset -textvariable" -body {
450
+ unset tcbLabel
451
+ list [info exists tcbLabel] [.tcb cget -text]
452
+ } -result [list 0 ""]
453
+
454
+ test ttk-9.7 "Unset textvariable, comparison" -body {
455
+ #
456
+ # NB: the tile label behaves differently from the standard label here;
457
+ # NB: this is on purpose: I believe the standard behaviour is the Wrong Thing
458
+ #
459
+ unset -nocomplain V1 V2
460
+ label .l -text Foo ; ttk::label .tl -text Foo
461
+
462
+ .l configure -textvariable V1 ; .tl configure -textvariable V2
463
+ list [set V1] [info exists V2]
464
+ } -cleanup { destroy .l .tl } -result [list Foo 0]
465
+
466
+ test ttk-9.8 "-textvariable overrides -text" -body {
467
+ ttk::label .tl -textvariable TV
468
+ set TV Foo
469
+ .tl configure -text Bar
470
+ .tl cget -text
471
+ } -cleanup { destroy .tl } -result "Foo"
472
+
473
+ #
474
+ # Frame widget tests:
475
+ #
476
+
477
+ test ttk-10.1 "ttk::frame -class resource" -body {
478
+ ttk::frame .f -class Foo
479
+ } -result .f
480
+
481
+ test ttk-10.2 "Check widget class" -body {
482
+ winfo class .f
483
+ } -result Foo
484
+
485
+ test ttk-10.3 "Check class resource" -body {
486
+ .f cget -class
487
+ } -result Foo
488
+
489
+ test ttk-10.4 "Try to modify class resource" -body {
490
+ .f configure -class Bar
491
+ } -returnCodes 1 -match glob -result "*read-only option*"
492
+
493
+ test ttk-10.5 "Check class resource again" -body {
494
+ .f cget -class
495
+ } -result Foo
496
+
497
+ test ttk-11.1 "-state test, setup" -body {
498
+ ttk::button .b
499
+ .b instate disabled
500
+ } -result 0
501
+
502
+ test ttk-11.2 "-state test, disable" -body {
503
+ .b configure -state disabled
504
+ .b instate disabled
505
+ } -result 1
506
+
507
+ test ttk-11.3 "-state test, reenable" -body {
508
+ .b configure -state normal
509
+ .b instate disabled
510
+ } -result 0
511
+
512
+ test ttk-11.4 "-state test, unrecognized -state value" -body {
513
+ .b configure -state bogus
514
+ .b state
515
+ } -result [list]
516
+
517
+ test ttk-11.5 "-state test, 'active'" -body {
518
+ .b configure -state active
519
+ .b state
520
+ } -result [list active] -cleanup { .b state !active }
521
+
522
+ test ttk-11.6 "-state test, 'readonly'" -body {
523
+ .b configure -state readonly
524
+ .b state
525
+ } -result [list readonly] -cleanup { .b state !readonly }
526
+
527
+ test ttk-11.7 "-state test, cleanup" -body {
528
+ destroy .b
529
+ }
530
+
531
+ test ttk-12.1 "-cursor option" -body {
532
+ ttk::button .b
533
+ .b cget -cursor
534
+ } -result {}
535
+
536
+ test ttk-12.2 "-cursor option" -body {
537
+ .b configure -cursor arrow
538
+ .b cget -cursor
539
+ } -result arrow
540
+
541
+ test ttk-12.3 "-borderwidth frame option" -body {
542
+ destroy .t
543
+ toplevel .t
544
+ raise .t
545
+ pack [set t [ttk::frame .t.f]] -expand true -fill x ;
546
+ pack [ttk::label $t.l -text "ASDF QWERTY"] -expand true -fill both
547
+ foreach theme {default alt} {
548
+ ttk::style theme use $theme
549
+ foreach relief {flat raised sunken ridge groove solid} {
550
+ $t configure -relief $relief
551
+ for {set i 5} {$i >= 0} {incr i -1} {
552
+ $t configure -borderwidth $i
553
+ update
554
+ }
555
+ }
556
+ }
557
+ }
558
+
559
+ test ttk-12.4 "-borderwidth frame option" -body {
560
+ .t.f configure -relief raised
561
+ .t.f configure -borderwidth 1
562
+ ttk::style theme use alt
563
+ update
564
+ }
565
+
566
+
567
+ test ttk-13.1 "Custom styles -- bad -style option" -body {
568
+ ttk::button .tb1 -style badstyle
569
+ } -returnCodes 1 -result "*badstyle not found*" -match glob
570
+
571
+ test ttk-13.4 "Custom styles -- bad -style option" -body {
572
+ ttk::button .tb1
573
+ .tb1 configure -style badstyle
574
+ } -cleanup {
575
+ destroy .tb1
576
+ } -returnCodes 1 -result "*badstyle not found*" -match glob
577
+
578
+ test ttk-13.5 "Custom layouts -- missing element definition" -body {
579
+ ttk::style layout badstyle {
580
+ NoSuchElement
581
+ }
582
+ ttk::button .tb1 -style badstyle
583
+ } -cleanup {
584
+ destroy .tb1
585
+ } -result .tb1
586
+ # @@@ Should: signal an error, possibly a background error.
587
+
588
+ #
589
+ # See #793909
590
+ #
591
+
592
+ test ttk-14.1 "-variable in nonexistant namespace" -body {
593
+ ttk::checkbutton .tw -variable ::nsn::foo
594
+ } -returnCodes 1 -result {can't trace *: parent namespace doesn't exist} \
595
+ -match glob -cleanup { destroy .tw }
596
+
597
+ test ttk-14.2 "-textvariable in nonexistant namespace" -body {
598
+ ttk::label .tw -textvariable ::nsn::foo
599
+ } -returnCodes 1 -result {can't trace *: parent namespace doesn't exist} \
600
+ -match glob -cleanup { destroy .tw }
601
+
602
+ test ttk-14.3 "-textvariable in nonexistant namespace" -body {
603
+ ttk::entry .tw -textvariable ::nsn::foo
604
+ } -returnCodes 1 -result {can't trace *: parent namespace doesn't exist} \
605
+ -match glob -cleanup { destroy .tw }
606
+
607
+ test ttk-15.1 "style element create: insufficient args" -body {
608
+ ttk::style element create
609
+ } -returnCodes 1 -result "wrong # args: should be \"ttk::style element create name type ?options...?\""
610
+ test ttk-15.2 "style element create: insufficient args" -body {
611
+ ttk::style element create plain.background
612
+ } -returnCodes 1 -result "wrong # args: should be \"ttk::style element create name type ?options...?\""
613
+ test ttk-15.3 "style element create: insufficient args" -body {
614
+ ttk::style element create plain.background from
615
+ } -returnCodes 1 -result "wrong # args: should be \"theme ?element?\""
616
+ test ttk-15.4 "style element create: valid" -body {
617
+ ttk::style element create plain.background from default
618
+ } -returnCodes 0 -result ""
619
+
620
+ # GetLayout tests:
621
+ test ttk-getlayout-1 "GetLayout - setup" -body {
622
+ set theme1 alt
623
+ set theme2 clam
624
+ ttk::style theme settings $theme2 {
625
+ ttk::style layout BadLayout { background }
626
+ }
627
+ ttk::setTheme $theme1
628
+ return
629
+ }
630
+
631
+ foreach wc $widgetClasses {
632
+
633
+ if {$wc eq "sizegrip"} { continue } ;# see
634
+
635
+ test ttk-getlayout-2-$wc "GetLayout - bad layout, widget constructor" -body {
636
+ ttk::$wc .g -style BadLayout
637
+ } -returnCodes error -match regexp -result \
638
+ "Layout (Vertical.|Horizontal.)?BadLayout not found"
639
+
640
+ # See #1603506
641
+ test ttk-getlayout-2a-$wc "GetLayout - update after failure" -body { update }
642
+
643
+ test ttk-getlayout-3-$wc "GetLayout - bad layout, widget configure" -body {
644
+ pack [ttk::$wc .g]
645
+ .g configure -style BadLayout
646
+ } -returnCodes error -match regexp -result \
647
+ "Layout (Vertical.|Horizontal.)?BadLayout not found"
648
+
649
+ # See #1603506
650
+ test ttk-getlayout-3a-$wc "GetLayout - update after failure" -body { update }
651
+
652
+ test ttk-getlayout-4-$wc "GetLayout - bad layout, put the rug down" -body {
653
+ ttk::setTheme $theme2
654
+ .g configure -style BadLayout
655
+ .g cget -style
656
+ } -result BadLayout
657
+
658
+ test ttk-getlayout-5-$wc "GetLayout - bad layout, yank the rug out" -body {
659
+ ttk::setTheme $theme1
660
+ pack .g
661
+ update
662
+ .g cget -style
663
+ } -result BadLayout
664
+
665
+ test ttk-getlayout-6-$wc "GetLayout - cleanup" -body {
666
+ destroy .g
667
+ }
668
+
669
+ } ;# foreach wc $widgetClasses ...
670
+
671
+ eval destroy [winfo children .]
672
+ tcltest::cleanupTests
673
+
674
+ #*EOF*