arcadia 0.12.2 → 0.13.0

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 (57) hide show
  1. data/README +25 -14
  2. data/conf/LC/en-UK.LANG +3 -1
  3. data/conf/arcadia.conf +10 -0
  4. data/conf/arcadia.res.rb +29 -1
  5. data/ext/ae-editor/ae-editor.rb +239 -48
  6. data/ext/ae-file-history/ae-file-history.conf +11 -1
  7. data/ext/ae-file-history/ae-file-history.rb +120 -2
  8. data/ext/ae-ruby-debug/ae-ruby-debug.rb +6 -5
  9. data/ext/ae-subprocess-inspector/ae-subprocess-inspector.rb +7 -3
  10. data/ext/ae-term/ae-term.rb +1 -1
  11. data/lib/a-commons.rb +72 -56
  12. data/lib/a-contracts.rb +23 -1
  13. data/lib/a-core.rb +136 -41
  14. data/lib/a-tkcommons.rb +127 -36
  15. data/tcl/fsdialog/fsdialog.tcl +2 -2
  16. data/tcl/ptwidgets-1.1.0/COPYRIGHT +10 -0
  17. data/tcl/ptwidgets-1.1.0/ChangeLog +194 -0
  18. data/tcl/ptwidgets-1.1.0/README +50 -0
  19. data/tcl/ptwidgets-1.1.0/common/stacktrace.tcl +29 -0
  20. data/tcl/ptwidgets-1.1.0/common/tokenframe.tcl +200 -0
  21. data/tcl/ptwidgets-1.1.0/doc/img/toggleswitch_off.png +0 -0
  22. data/tcl/ptwidgets-1.1.0/doc/img/toggleswitch_on.png +0 -0
  23. data/tcl/ptwidgets-1.1.0/doc/img/tokenentry.png +0 -0
  24. data/tcl/ptwidgets-1.1.0/doc/img/tokensearch_popup_example.png +0 -0
  25. data/tcl/ptwidgets-1.1.0/doc/img/tokensearch_popup_example2.png +0 -0
  26. data/tcl/ptwidgets-1.1.0/doc/img/wmarkentry.png +0 -0
  27. data/tcl/ptwidgets-1.1.0/doc/toggleswitch.html +402 -0
  28. data/tcl/ptwidgets-1.1.0/doc/tokenentry.html +1366 -0
  29. data/tcl/ptwidgets-1.1.0/doc/tokensearch.html +1549 -0
  30. data/tcl/ptwidgets-1.1.0/doc/wmarkentry.html +634 -0
  31. data/tcl/ptwidgets-1.1.0/library/toggleswitch.tcl +432 -0
  32. data/tcl/ptwidgets-1.1.0/library/tokenentry.tcl +2208 -0
  33. data/tcl/ptwidgets-1.1.0/library/tokensearch.tcl +2488 -0
  34. data/tcl/ptwidgets-1.1.0/library/wmarkentry.tcl +630 -0
  35. data/tcl/ptwidgets-1.1.0/pkgIndex.tcl +10 -0
  36. data/tcl/ptwidgets-1.1.0/test/Makefile +3 -0
  37. data/tcl/ptwidgets-1.1.0/test/run.tcl +3 -0
  38. data/tcl/ptwidgets-1.1.0/test/test.tcl +89 -0
  39. data/tcl/ptwidgets-1.1.0/test/toggleswitch.test +562 -0
  40. data/tcl/ptwidgets-1.1.0/test/tokenentry.test +1023 -0
  41. data/tcl/ptwidgets-1.1.0/test/tokensearch.test +1023 -0
  42. data/tcl/ptwidgets-1.1.0/test/wmarkentry.test +1325 -0
  43. data/tcl/themes/altTheme.tcl +101 -0
  44. data/tcl/themes/aquaTheme.tcl +59 -0
  45. data/tcl/themes/clamTheme.tcl +140 -0
  46. data/tcl/themes/classicTheme.tcl +108 -0
  47. data/tcl/themes/pkgIndex.tcl +3 -0
  48. data/tcl/themes/ttk.tcl +176 -0
  49. data/tcl/themes/vistaTheme.tcl +224 -0
  50. data/tcl/themes/winTheme.tcl +80 -0
  51. data/tcl/themes/xpTheme.tcl +65 -0
  52. data/tcl/tkfbox/folder.gif +0 -0
  53. data/tcl/tkfbox/textfile.gif +0 -0
  54. data/tcl/tkfbox/tkfbox.tcl +1 -0
  55. data/tcl/tkfbox/tkfbox.tcl~ +1 -0
  56. data/tcl/tkfbox/updir.xbm +1 -0
  57. metadata +43 -2
@@ -0,0 +1,10 @@
1
+
2
+ # Load the packages
3
+ package ifneeded tokenentry 1.0 \
4
+ "namespace eval tokenentry { proc DIR {} {return [list $dir]} }; source [file join $dir library tokenentry.tcl]"
5
+ package ifneeded tokensearch 1.0 \
6
+ "namespace eval tokensearch { proc DIR {} {return [list $dir]} }; source [file join $dir library tokensearch.tcl]"
7
+ package ifneeded wmarkentry 1.0 \
8
+ "namespace eval wmarkentry { proc DIR {} {return [list $dir]} }; source [file join $dir library wmarkentry.tcl]"
9
+ package ifneeded toggleswitch 1.0 \
10
+ "namespace eval toggleswitch { proc DIR {} {return [list $dir]} }; source [file join $dir library toggleswitch.tcl]"
@@ -0,0 +1,3 @@
1
+ all:
2
+ /usr/bin/wish8.5 run.tcl | tee results
3
+ vi results
@@ -0,0 +1,3 @@
1
+ package require tcltest 2.2
2
+
3
+ tcltest::runAllTests
@@ -0,0 +1,89 @@
1
+ lappend auto_path [file normalize ..]
2
+
3
+ package require tokenentry
4
+ package require tokensearch
5
+ package require wmarkentry
6
+
7
+ set te2tokens [list]
8
+ set ts1history [list]
9
+
10
+ proc create {} {
11
+
12
+ set ::foobar ""
13
+
14
+ # Create a token entry
15
+ frame .f
16
+ tokenentry::tokenentry .f.te1 -tokenshape [list tag square] -relief sunken -watermark "Enter text" -xscrollcommand {.f.hb1 set}
17
+ ttk::scrollbar .f.hb1 -orient horizontal -command {.f.te1 xview}
18
+ tokenentry::tokenentry .f.te2 -tokenvar te2tokens -tokenshape eased -bg pink
19
+ tokensearch::tokensearch .f.ts1 -categories [list {Categories {pill tag square}} {{Other Stuff} {eased ticket}}] -bg pink -historyvar ts1history
20
+ ttk::scrollbar .f.hb2 -orient horizontal -command {.f.ts1 xview}
21
+ tokensearch::tokensearch .f.ts2 -categories {{Properties {Name Kind Label Tag {Something Else}}}} \
22
+ -categoryopts {{checkbutton {Ignore Case} 1} {radiobutton {{Use regexp} {Use exact}} {Use regexp}}} \
23
+ -watermark "Search tokens"
24
+ wmarkentry::wmarkentry .f.wme -background white -relief ridge -watermark "Enter text here" -textvariable ::foobar
25
+ ttk::button .f.b -text "Tokens" -command {
26
+ puts "te1: [.f.te1 tokenget]"
27
+ puts "te2: [.f.te2 tokenget], te2tokens: $te2tokens"
28
+ puts "ts1: [.f.ts1 tokenget]"
29
+ puts "ts2: [.f.ts2 tokenget]"
30
+ .f.te2 configure -state normal
31
+ .f.te1 configure -watermark "Enter new text" -watermarkforeground "light blue"
32
+ }
33
+ ttk::button .f.b2 -text "Restart" -command {
34
+ destroy .f
35
+ create
36
+ }
37
+
38
+ bind .f.te1 <<TokenEntryModified>> {puts "te1 modified: [.f.te1 tokenget]"}
39
+ bind .f.te2 <<TokenEntryModified>> {puts "te2 modified: [.f.te2 tokenget]"}
40
+ bind .f.ts1 <<TokenSearchModified>> {
41
+ puts "ts1 modified: [.f.ts1 tokenget]"
42
+ set i 0
43
+ foreach value [.f.ts1 tokenget] {
44
+ .f.ts1 tokenconfigure $i -shape [lindex $value 0]
45
+ incr i
46
+ }
47
+ }
48
+
49
+ grid .f.te1 -row 0 -column 0 -sticky news -padx 2 -pady 2
50
+ grid .f.b -row 0 -column 1 -sticky news -padx 2 -pady 2
51
+ grid .f.te2 -row 1 -column 0 -sticky news -padx 2 -pady 2
52
+ grid .f.b2 -row 1 -column 1 -sticky news -padx 2 -pady 2
53
+ grid .f.hb2 -row 2 -column 0 -sticky ew -padx 2 -pady 2
54
+ grid .f.ts1 -row 3 -column 0 -sticky news -padx 2 -pady 2
55
+ grid .f.hb1 -row 4 -column 0 -sticky ew -padx 2 -pady 2
56
+ grid .f.ts2 -row 5 -column 0 -sticky news -padx 2 -pady 2
57
+ grid .f.wme -row 6 -column 0 -sticky news -padx 2 -pady 2
58
+
59
+ pack .f
60
+
61
+ set ::values {{Trevor phase1geo@gmail.com} {Bubba bubba@hotmail.com} {{Joe Bob} jbob@yahoo.com}}
62
+
63
+ .f.te1 configure -height 1 -width 20 -font [font create -size 6] -tokenbg "light green" -tokenbordercolor "dark green" -tokenselectbg "green" \
64
+ -listvar values -dropdownformatstring "%s (%s)" -matchcase 1 -matchdisplayindex 1 -matchmode glob -wrap 0
65
+
66
+ .f.te2 tokeninsert end [list foobar barfoo dude]
67
+ # .f.te2 tokenconfigure 1 -bg yellow -fg "dark green" -bordercolor red -selectbg "dark green" -selectfg yellow -selectbordercolor pink
68
+ .f.te2 tokeninsert 3 good
69
+ .f.te2 configure -state disabled
70
+ .f.ts1 tokeninsert end [list lorry something]
71
+
72
+ puts "te1 configure: [.f.te1 configure]"
73
+ puts "te1 configure -listvar: [.f.te1 configure -listvar]"
74
+
75
+ .f.wme insert end "Some kind of string"
76
+ .f.wme selection from 1
77
+ .f.wme selection to 6
78
+ .f.wme delete 0 end
79
+ # puts "first: [.f.wme index sel.first], last: [.f.wme index sel.last]"
80
+ # .f.wme delete 0 end
81
+ # .f.wme selection clear
82
+
83
+ focus .f.te2
84
+
85
+ }
86
+
87
+ ttk::style theme use clam
88
+
89
+ create
@@ -0,0 +1,562 @@
1
+ lappend auto_path ".."
2
+
3
+ package require toggleswitch
4
+ package require tcltest 2.2
5
+
6
+ proc setup {args} {
7
+ eval "toggleswitch::toggleswitch .tsw $args"
8
+ pack .tsw
9
+ }
10
+
11
+ proc cleanup {} {
12
+ destroy .tsw
13
+ }
14
+
15
+ proc callback_command {} {
16
+ if {$::foobar} {
17
+ set ::barfoo ON
18
+ } else {
19
+ set ::barfoo OFF
20
+ }
21
+ }
22
+
23
+ # Test Contraints
24
+ tcltest::testConstraint aqua [expr {[tk windowingsystem] eq "aqua"}]
25
+ tcltest::testConstraint x11 [expr {[tk windowingsystem] eq "x11"}]
26
+
27
+ # Tests
28
+ #---------------------------------
29
+
30
+ tcltest::test tsw-configure-badoption {configure called with a bad option} \
31
+ -setup setup \
32
+ -body {
33
+ .tsw configure -foobar
34
+ } -cleanup cleanup \
35
+ -returnCodes error -result "ToggleSwitch configuration option -foobar does not exist"
36
+
37
+ tcltest::test tsw-configure-badoptionwithvalue {configure called with a bad option with a value} \
38
+ -setup setup \
39
+ -body {
40
+ .tsw configure -foobar bubba
41
+ } -cleanup cleanup \
42
+ -returnCodes error -result "Illegal option given to the toggleswitch configure command (-foobar)"
43
+
44
+ tcltest::test tsw-cget {cget without an option} \
45
+ -setup setup \
46
+ -body {
47
+ .tsw cget
48
+ } -cleanup cleanup \
49
+ -returnCodes error -result "Incorrect number of parameters given to the toggleswitch cget command"
50
+
51
+ #---------------------------------
52
+ tcltest::test tsw-offbackground {setup -offbackground returns correct result} \
53
+ -setup {
54
+ setup -offbackground red
55
+ } -body {
56
+ .tsw cget -offbackground
57
+ } -cleanup cleanup \
58
+ -result red
59
+
60
+ tcltest::test tsw-configure-offbackground {configure -offbackground returns correct result} \
61
+ -setup {
62
+ setup -offbackground red
63
+ } -body {
64
+ .tsw configure -offbackground
65
+ } -cleanup cleanup \
66
+ -result {-offbackground offBackground Background white red}
67
+
68
+ tcltest::test tsw-cget-offbackground {cget -offbackground returns the correct result} \
69
+ -setup setup \
70
+ -body {
71
+ .tsw cget -offbackground
72
+ } -cleanup cleanup \
73
+ -result white
74
+
75
+ tcltest::test tsw-configure-cget-offbackground {configure/cget -offbackground returns the correct result} \
76
+ -setup setup \
77
+ -body {
78
+ .tsw configure -offbackground red
79
+ .tsw cget -offbackground
80
+ } -cleanup cleanup \
81
+ -result red
82
+
83
+ #---------------------------------
84
+ tcltest::test tsw-configure-borderwidth {configure -borderwidth returns correct result} \
85
+ -setup {
86
+ setup -borderwidth 5
87
+ } -body {
88
+ .tsw configure -borderwidth
89
+ } -cleanup cleanup \
90
+ -match glob \
91
+ -result {-borderwidth borderWidth BorderWidth * 5}
92
+
93
+ tcltest::test tsw-cget-borderwidth {cget -borderwidth returns the correct result} \
94
+ -setup {
95
+ setup -borderwidth 5
96
+ } -body {
97
+ .tsw cget -borderwidth
98
+ } -cleanup cleanup \
99
+ -result 5
100
+
101
+ tcltest::test tsw-configure-cget-borderwidth {configure/cget -borderwidth returns the correct result} \
102
+ -setup setup \
103
+ -body {
104
+ .tsw configure -borderwidth 2
105
+ .tsw cget -borderwidth
106
+ } -cleanup cleanup \
107
+ -result 2
108
+
109
+ #---------------------------------
110
+ tcltest::test tsw-configure-command {configure -command returns correct result} \
111
+ -setup {
112
+ setup -command bubba
113
+ } -body {
114
+ .tsw configure -command
115
+ } -cleanup cleanup \
116
+ -result {-command command Command {} bubba}
117
+
118
+ tcltest::test tsw-cget-command {cget -command returns correct result} \
119
+ -setup setup \
120
+ -body {
121
+ .tsw cget -command
122
+ } -cleanup cleanup \
123
+ -result {}
124
+
125
+ tcltest::test tsw-configure-cget-command {configure/cget -command returns correct result} \
126
+ -setup setup \
127
+ -body {
128
+ .tsw configure -command bubba
129
+ .tsw cget -command
130
+ } -cleanup cleanup \
131
+ -result bubba
132
+
133
+ #---------------------------------
134
+ tcltest::test tsw-configure-cursor {configure -cursor returns correct result} \
135
+ -setup {
136
+ setup -cursor xterm
137
+ } -body {
138
+ .tsw configure -cursor
139
+ } -cleanup cleanup \
140
+ -result {-cursor cursor Cursor {} xterm}
141
+
142
+ tcltest::test tsw-cget-cursor {cget -cursor returns correct result} \
143
+ -setup setup \
144
+ -body {
145
+ .tsw cget -cursor
146
+ } -cleanup cleanup \
147
+ -result {}
148
+
149
+ tcltest::test tsw-configure-cget-cursor {configure/cget -cursor returns correct result} \
150
+ -setup setup \
151
+ -body {
152
+ .tsw configure -cursor watch
153
+ .tsw cget -cursor
154
+ } -cleanup cleanup \
155
+ -result watch
156
+
157
+ #---------------------------------
158
+ tcltest::test tsw-configure-font {configure -font returns correct result} \
159
+ -setup {
160
+ setup -font TkTextFont
161
+ } -body {
162
+ .tsw configure -font
163
+ } -cleanup cleanup \
164
+ -result {-font font Font {} TkTextFont}
165
+
166
+ tcltest::test tsw-cget-font {cget -font returns correct result} \
167
+ -setup {
168
+ setup -font TkTextFont
169
+ } -body {
170
+ .tsw cget -font
171
+ } -cleanup cleanup \
172
+ -result TkTextFont
173
+
174
+ tcltest::test tsw-configure-cget-font {configure/cget -font returns correct result} \
175
+ -setup setup \
176
+ -body {
177
+ .tsw configure -font TkFixedFont
178
+ .tsw cget -font
179
+ } -cleanup cleanup \
180
+ -result TkFixedFont
181
+
182
+ #---------------------------------
183
+ tcltest::test tsw-configure-offbackground {configure -offbackground returns correct result} \
184
+ -setup {
185
+ setup -offbackground yellow
186
+ } -body {
187
+ .tsw configure -offbackground
188
+ } -cleanup cleanup \
189
+ -match regexp \
190
+ -result {-offbackground offBackground Background \S+ yellow}
191
+
192
+ tcltest::test tsw-cget-offbackground {cget -offbackground returns correct result} \
193
+ -setup {
194
+ setup -offbackground yellow
195
+ } -body {
196
+ .tsw cget -offbackground
197
+ } -cleanup cleanup \
198
+ -result yellow
199
+
200
+ tcltest::test tsw-configure-cget-offbackground {configure/cget -offbackground returns correct result} \
201
+ -setup setup \
202
+ -body {
203
+ .tsw configure -offbackground red
204
+ .tsw cget -offbackground
205
+ } -cleanup cleanup \
206
+ -result red
207
+
208
+ #---------------------------------
209
+ tcltest::test tsw-configure-offforeground {configure -offforeground returns correct result} \
210
+ -setup {
211
+ setup -offforeground yellow
212
+ } -body {
213
+ .tsw configure -offforeground
214
+ } -cleanup cleanup \
215
+ -match regexp \
216
+ -result {-offforeground offForeground Foreground \S+ yellow}
217
+
218
+ tcltest::test tsw-cget-offforeground {cget -offforeground returns correct result} \
219
+ -setup {
220
+ setup -offforeground yellow
221
+ } -body {
222
+ .tsw cget -offforeground
223
+ } -cleanup cleanup \
224
+ -result yellow
225
+
226
+ tcltest::test tsw-configure-cget-offforeground {configure/cget -offforeground returns correct result} \
227
+ -setup setup \
228
+ -body {
229
+ .tsw configure -offforeground red
230
+ .tsw cget -offforeground
231
+ } -cleanup cleanup \
232
+ -result red
233
+
234
+ #---------------------------------
235
+ tcltest::test tsw-configure-offvalue {configure -offvalue returns correct result} \
236
+ -setup {
237
+ setup -offvalue off
238
+ } -body {
239
+ .tsw configure -offvalue
240
+ } -cleanup cleanup \
241
+ -result {-offvalue offValue Value 0 off}
242
+
243
+ tcltest::test tsw-cget-offvalue {cget -offvalue returns correct result} \
244
+ -setup {
245
+ setup -offvalue off
246
+ } -body {
247
+ .tsw cget -offvalue
248
+ } -cleanup cleanup \
249
+ -result off
250
+
251
+ tcltest::test tsw-configure-cget-offvalue {configure/cget -offvalue returns correct result} \
252
+ -setup setup \
253
+ -body {
254
+ .tsw configure -offvalue off
255
+ .tsw cget -offvalue
256
+ } -cleanup cleanup \
257
+ -result off
258
+
259
+ #---------------------------------
260
+ tcltest::test tsw-configure-onbackground {configure -onbackground returns correct result} \
261
+ -setup {
262
+ setup -onbackground yellow
263
+ } -body {
264
+ .tsw configure -onbackground
265
+ } -cleanup cleanup \
266
+ -match regexp \
267
+ -result {-onbackground onBackground Background \S+ yellow}
268
+
269
+ tcltest::test tsw-cget-onbackground {cget -onbackground returns correct result} \
270
+ -setup {
271
+ setup -onbackground yellow
272
+ } -body {
273
+ .tsw cget -onbackground
274
+ } -cleanup cleanup \
275
+ -result yellow
276
+
277
+ tcltest::test tsw-configure-cget-onbackground {configure/cget -onbackground returns correct result} \
278
+ -setup setup \
279
+ -body {
280
+ .tsw configure -onbackground red
281
+ .tsw cget -onbackground
282
+ } -cleanup cleanup \
283
+ -result red
284
+
285
+ #---------------------------------
286
+ tcltest::test tsw-configure-onforeground {configure -onforeground returns correct result} \
287
+ -setup {
288
+ setup -onforeground yellow
289
+ } -body {
290
+ .tsw configure -onforeground
291
+ } -cleanup cleanup \
292
+ -match regexp \
293
+ -result {-onforeground onForeground Foreground \S+ yellow}
294
+
295
+ tcltest::test tsw-cget-onforeground {cget -onforeground returns correct result} \
296
+ -setup {
297
+ setup -onforeground yellow
298
+ } -body {
299
+ .tsw cget -onforeground
300
+ } -cleanup cleanup \
301
+ -result yellow
302
+
303
+ tcltest::test tsw-configure-cget-onforeground {configure/cget -onforeground returns correct result} \
304
+ -setup setup \
305
+ -body {
306
+ .tsw configure -onforeground red
307
+ .tsw cget -onforeground
308
+ } -cleanup cleanup \
309
+ -result red
310
+
311
+ #---------------------------------
312
+ tcltest::test tsw-configure-onvalue {configure -onvalue returns correct result} \
313
+ -setup {
314
+ setup -onvalue on
315
+ } -body {
316
+ .tsw configure -onvalue
317
+ } -cleanup cleanup \
318
+ -result {-onvalue onValue Value 1 on}
319
+
320
+ tcltest::test tsw-cget-onvalue {cget -onvalue returns correct result} \
321
+ -setup {
322
+ setup -onvalue on
323
+ } -body {
324
+ .tsw cget -onvalue
325
+ } -cleanup cleanup \
326
+ -result on
327
+
328
+ tcltest::test tsw-configure-cget-onvalue {configure/cget -onvalue returns correct result} \
329
+ -setup setup \
330
+ -body {
331
+ .tsw configure -onvalue on
332
+ .tsw cget -onvalue
333
+ } -cleanup cleanup \
334
+ -result on
335
+
336
+ #---------------------------------
337
+ tcltest::test tsw-configure-relief {configure -relief returns correct result} \
338
+ -setup {
339
+ setup -relief flat
340
+ } -body {
341
+ .tsw configure -relief
342
+ } -cleanup cleanup \
343
+ -match regexp \
344
+ -result {-relief relief Relief \S+ flat}
345
+
346
+ tcltest::test tsw-cget-relief {cget -relief returns correct result} \
347
+ -setup {
348
+ setup -relief flat
349
+ } -body {
350
+ .tsw cget -relief
351
+ } -cleanup cleanup \
352
+ -result flat
353
+
354
+ tcltest::test tsw-configure-cget-relief {configure/cget -relief returns correct result} \
355
+ -setup setup \
356
+ -body {
357
+ .tsw configure -relief ridge
358
+ .tsw cget -relief
359
+ } -cleanup cleanup \
360
+ -result ridge
361
+
362
+ #---------------------------------
363
+ tcltest::test tsw-configure-state {configure -state returns correct result} \
364
+ -setup {
365
+ setup -state disabled
366
+ } -body {
367
+ .tsw configure -state
368
+ } -cleanup cleanup \
369
+ -result {-state state State normal disabled}
370
+
371
+ tcltest::test tsw-cget-state {cget -state returns correct result} \
372
+ -setup setup \
373
+ -body {
374
+ .tsw cget -state
375
+ } -cleanup cleanup \
376
+ -result normal
377
+
378
+ tcltest::test tsw-configure-cget-state {configure/cget -state returns correct result} \
379
+ -setup setup \
380
+ -body {
381
+ .tsw configure -state disabled
382
+ .tsw cget -state
383
+ } -cleanup cleanup \
384
+ -result disabled
385
+
386
+ #---------------------------------
387
+ tcltest::test tsw-configure-takefocus {configure -takefocus returns correct result} \
388
+ -setup setup \
389
+ -body {
390
+ .tsw configure -takefocus
391
+ } -cleanup cleanup \
392
+ -result {-takefocus takeFocus TakeFocus 1 1}
393
+
394
+ tcltest::test tsw-cget-takefocus {cget -takefocus returns correct result} \
395
+ -setup setup \
396
+ -body {
397
+ .tsw cget -takefocus
398
+ } -cleanup cleanup \
399
+ -result 1
400
+
401
+ tcltest::test tsw-configure-cget-takefocus {configure/cget -takefocsu returns correct result} \
402
+ -setup setup \
403
+ -body {
404
+ .tsw configure -takefocus 0
405
+ .tsw cget -takefocus
406
+ } -cleanup cleanup \
407
+ -result 0
408
+
409
+ #---------------------------------
410
+ tcltest::test tsw-configure-variable {configure -variable returns correct result} \
411
+ -setup setup \
412
+ -body {
413
+ .tsw configure -variable
414
+ } -cleanup cleanup \
415
+ -result {-variable variable Variable {} {}}
416
+
417
+ tcltest::test tsw-cget-variable {cget -variable returns correct result} \
418
+ -setup setup \
419
+ -body {
420
+ .tsw cget -variable
421
+ } -cleanup cleanup \
422
+ -result ""
423
+
424
+ tcltest::test tsw-configure-cget-variable {configure/cget -variable returns correct result} \
425
+ -setup setup \
426
+ -body {
427
+ set ::foobar "buddy"
428
+ .tsw configure -variable ::foobar
429
+ .tsw cget -variable
430
+ } -cleanup {
431
+ cleanup
432
+ unset ::foobar
433
+ } -result ::foobar
434
+
435
+ #---------------------------------
436
+ tcltest::test tsw-switchoff-badargs {call switchoff command with bad arguments} \
437
+ -setup setup \
438
+ -body {
439
+ .tsw switchoff something
440
+ } -cleanup cleanup \
441
+ -returnCodes error \
442
+ -result "Incorrect number of parameters given to the toggleswitch::switchoff command"
443
+
444
+ tcltest::test tsw-switchoff {verify that switchoff changes the -variable option to the offvalue} \
445
+ -setup setup \
446
+ -body {
447
+ set ::foobar 1
448
+ .tsw configure -variable ::foobar
449
+ .tsw switchoff
450
+ return $::foobar
451
+ } -cleanup {
452
+ cleanup
453
+ unset ::foobar
454
+ } -result 0
455
+
456
+ tcltest::test tsw-switchoff-command {verify that switchoff changes the -variable option to the offvalue} \
457
+ -setup setup \
458
+ -body {
459
+ set ::foobar 1
460
+ .tsw configure -variable ::foobar -command callback_command
461
+ .tsw switchoff
462
+ return [list $::foobar $::barfoo]
463
+ } -cleanup {
464
+ cleanup
465
+ unset ::foobar
466
+ unset ::barfoo
467
+ } -result {0 OFF}
468
+
469
+ #---------------------------------
470
+ tcltest::test tsw-switchon-badargs {call switchon command with bad arguments} \
471
+ -setup setup \
472
+ -body {
473
+ .tsw switchon something
474
+ } -cleanup cleanup \
475
+ -returnCodes error \
476
+ -result "Incorrect number of parameters given to the toggleswitch::switchon command"
477
+
478
+ tcltest::test tsw-switchon {verify that switchon changes the -variable option to the offvalue} \
479
+ -setup setup \
480
+ -body {
481
+ set ::foobar 0
482
+ .tsw configure -variable ::foobar
483
+ .tsw switchon
484
+ return $::foobar
485
+ } -cleanup {
486
+ cleanup
487
+ unset ::foobar
488
+ } -result 1
489
+
490
+ tcltest::test tsw-switchon-command {verify that switchon changes the -variable option to the onvalue} \
491
+ -setup setup \
492
+ -body {
493
+ set ::foobar 0
494
+ .tsw configure -variable ::foobar -command callback_command
495
+ .tsw switchon
496
+ return [list $::foobar $::barfoo]
497
+ } -cleanup {
498
+ cleanup
499
+ unset ::foobar
500
+ unset ::barfoo
501
+ } -result {1 ON}
502
+
503
+ #---------------------------------
504
+ tcltest::test tsw-invoke-badargs {call invoke command with bad arguments} \
505
+ -setup setup \
506
+ -body {
507
+ .tsw invoke something
508
+ } -cleanup cleanup \
509
+ -returnCodes error \
510
+ -result "Incorrect number of parameters given to the toggleswitch::invoke command"
511
+
512
+ tcltest::test tsw-invoke {verify that invoke changes the -variable option to the onvalue} \
513
+ -setup setup \
514
+ -body {
515
+ set ::foobar 0
516
+ .tsw configure -variable ::foobar -command callback_command
517
+ .tsw invoke
518
+ return [list $::foobar $::barfoo]
519
+ } -cleanup {
520
+ cleanup
521
+ unset ::foobar
522
+ unset ::barfoo
523
+ } -result {0 OFF}
524
+
525
+ #---------------------------------
526
+ tcltest::test tsw-toggle-badargs {call toggle command with bad arguments} \
527
+ -setup setup \
528
+ -body {
529
+ .tsw toggle something
530
+ } -cleanup cleanup \
531
+ -returnCodes error \
532
+ -result "Incorrect number of parameters given to the toggleswitch::toggle command"
533
+
534
+ tcltest::test tsw-toggle-01 {toggle the value of the switch from off to on via the toggle command} \
535
+ -setup setup \
536
+ -body {
537
+ set ::foobar 0
538
+ .tsw configure -variable ::foobar -command callback_command
539
+ .tsw toggle
540
+ return [list $::foobar $::barfoo]
541
+ } -cleanup {
542
+ cleanup
543
+ unset ::foobar
544
+ unset ::barfoo
545
+ } -result {1 ON}
546
+
547
+ tcltest::test tsw-toggle-10 {toggle the value of the switch from on to off via the toggle command} \
548
+ -setup setup \
549
+ -body {
550
+ set ::foobar 1
551
+ .tsw configure -variable ::foobar -command callback_command
552
+ .tsw toggle
553
+ return [list $::foobar $::barfoo]
554
+ } -cleanup {
555
+ cleanup
556
+ unset ::foobar
557
+ unset ::barfoo
558
+ } -result {0 OFF}
559
+
560
+ # Cleanup the tests
561
+ tcltest::cleanupTests
562
+