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.
- data/.exrc +61 -0
- data/.gitignore +4 -0
- data/History.txt +6 -0
- data/Manifest.txt +46 -0
- data/Pratt.gemspec +351 -0
- data/README.txt +66 -0
- data/Rakefile +85 -0
- data/TODO +54 -0
- data/VERSION +1 -0
- data/bin/pratt.rb +13 -0
- data/config.rb +34 -0
- data/lib/pratt.rb +527 -0
- data/lib/pratt/array.rb +11 -0
- data/lib/pratt/string.rb +18 -0
- data/models/app.rb +40 -0
- data/models/customer.rb +24 -0
- data/models/payment.rb +22 -0
- data/models/pratt.rb +19 -0
- data/models/project.rb +82 -0
- data/models/whence.rb +70 -0
- data/pkgs/tile-0.8.2.tar.gz +0 -0
- data/pkgs/tile-0.8.2/ANNOUNCE.txt +95 -0
- data/pkgs/tile-0.8.2/ChangeLog +4651 -0
- data/pkgs/tile-0.8.2/Makefile +250 -0
- data/pkgs/tile-0.8.2/Makefile.in +250 -0
- data/pkgs/tile-0.8.2/README.txt +86 -0
- data/pkgs/tile-0.8.2/aclocal.m4 +2 -0
- data/pkgs/tile-0.8.2/altTheme.o +0 -0
- data/pkgs/tile-0.8.2/blink.o +0 -0
- data/pkgs/tile-0.8.2/button.o +0 -0
- data/pkgs/tile-0.8.2/cache.o +0 -0
- data/pkgs/tile-0.8.2/clamTheme.o +0 -0
- data/pkgs/tile-0.8.2/classicTheme.o +0 -0
- data/pkgs/tile-0.8.2/config.log +1330 -0
- data/pkgs/tile-0.8.2/config.status +795 -0
- data/pkgs/tile-0.8.2/configure +15248 -0
- data/pkgs/tile-0.8.2/configure.in +89 -0
- data/pkgs/tile-0.8.2/demos/autocomplete.tcl +59 -0
- data/pkgs/tile-0.8.2/demos/demo.tcl +870 -0
- data/pkgs/tile-0.8.2/demos/dirbrowser.tcl +167 -0
- data/pkgs/tile-0.8.2/demos/dlgtest.tcl +97 -0
- data/pkgs/tile-0.8.2/demos/iconlib.tcl +110 -0
- data/pkgs/tile-0.8.2/demos/repeater.tcl +117 -0
- data/pkgs/tile-0.8.2/demos/toolbutton.tcl +101 -0
- data/pkgs/tile-0.8.2/doc/Geometry.3 +230 -0
- data/pkgs/tile-0.8.2/doc/INDEX.MAP +153 -0
- data/pkgs/tile-0.8.2/doc/Makefile +36 -0
- data/pkgs/tile-0.8.2/doc/TILE.XML +45 -0
- data/pkgs/tile-0.8.2/doc/Theme.3 +34 -0
- data/pkgs/tile-0.8.2/doc/button.n +75 -0
- data/pkgs/tile-0.8.2/doc/checkbutton.n +61 -0
- data/pkgs/tile-0.8.2/doc/combobox.n +98 -0
- data/pkgs/tile-0.8.2/doc/converting.txt +97 -0
- data/pkgs/tile-0.8.2/doc/dialog.n +122 -0
- data/pkgs/tile-0.8.2/doc/entry.n +438 -0
- data/pkgs/tile-0.8.2/doc/frame.n +43 -0
- data/pkgs/tile-0.8.2/doc/html/Geometry.html +304 -0
- data/pkgs/tile-0.8.2/doc/html/Theme.html +48 -0
- data/pkgs/tile-0.8.2/doc/html/button.html +120 -0
- data/pkgs/tile-0.8.2/doc/html/category-index.html +18 -0
- data/pkgs/tile-0.8.2/doc/html/checkbutton.html +94 -0
- data/pkgs/tile-0.8.2/doc/html/combobox.html +164 -0
- data/pkgs/tile-0.8.2/doc/html/converting.txt +97 -0
- data/pkgs/tile-0.8.2/doc/html/dialog.html +159 -0
- data/pkgs/tile-0.8.2/doc/html/entry.html +613 -0
- data/pkgs/tile-0.8.2/doc/html/frame.html +76 -0
- data/pkgs/tile-0.8.2/doc/html/image.html +100 -0
- data/pkgs/tile-0.8.2/doc/html/index.html +25 -0
- data/pkgs/tile-0.8.2/doc/html/keyword-index.html +228 -0
- data/pkgs/tile-0.8.2/doc/html/label.html +133 -0
- data/pkgs/tile-0.8.2/doc/html/labelframe.html +91 -0
- data/pkgs/tile-0.8.2/doc/html/manpage.css +212 -0
- data/pkgs/tile-0.8.2/doc/html/menubutton.html +63 -0
- data/pkgs/tile-0.8.2/doc/html/notebook.html +280 -0
- data/pkgs/tile-0.8.2/doc/html/paned.html +149 -0
- data/pkgs/tile-0.8.2/doc/html/progressbar.html +138 -0
- data/pkgs/tile-0.8.2/doc/html/radiobutton.html +89 -0
- data/pkgs/tile-0.8.2/doc/html/scrollbar.html +221 -0
- data/pkgs/tile-0.8.2/doc/html/separator.html +48 -0
- data/pkgs/tile-0.8.2/doc/html/sizegrip.html +62 -0
- data/pkgs/tile-0.8.2/doc/html/style.html +172 -0
- data/pkgs/tile-0.8.2/doc/html/tile-intro.html +164 -0
- data/pkgs/tile-0.8.2/doc/html/treeview.html +634 -0
- data/pkgs/tile-0.8.2/doc/html/widget.html +342 -0
- data/pkgs/tile-0.8.2/doc/image.n +81 -0
- data/pkgs/tile-0.8.2/doc/internals.txt +409 -0
- data/pkgs/tile-0.8.2/doc/label.n +75 -0
- data/pkgs/tile-0.8.2/doc/labelframe.n +64 -0
- data/pkgs/tile-0.8.2/doc/man.macros +239 -0
- data/pkgs/tile-0.8.2/doc/menubutton.n +41 -0
- data/pkgs/tile-0.8.2/doc/notebook.n +188 -0
- data/pkgs/tile-0.8.2/doc/paned.n +95 -0
- data/pkgs/tile-0.8.2/doc/progressbar.n +79 -0
- data/pkgs/tile-0.8.2/doc/radiobutton.n +57 -0
- data/pkgs/tile-0.8.2/doc/scrollbar.n +160 -0
- data/pkgs/tile-0.8.2/doc/separator.n +30 -0
- data/pkgs/tile-0.8.2/doc/sizegrip.n +53 -0
- data/pkgs/tile-0.8.2/doc/style.n +119 -0
- data/pkgs/tile-0.8.2/doc/tile-intro.n +165 -0
- data/pkgs/tile-0.8.2/doc/tmml.options +4 -0
- data/pkgs/tile-0.8.2/doc/treeview.n +415 -0
- data/pkgs/tile-0.8.2/doc/widget.n +227 -0
- data/pkgs/tile-0.8.2/doc/xml/Geometry.tmml +379 -0
- data/pkgs/tile-0.8.2/doc/xml/INDEX.MAP +153 -0
- data/pkgs/tile-0.8.2/doc/xml/Theme.tmml +63 -0
- data/pkgs/tile-0.8.2/doc/xml/button.tmml +134 -0
- data/pkgs/tile-0.8.2/doc/xml/checkbutton.tmml +119 -0
- data/pkgs/tile-0.8.2/doc/xml/combobox.tmml +184 -0
- data/pkgs/tile-0.8.2/doc/xml/dialog.tmml +195 -0
- data/pkgs/tile-0.8.2/doc/xml/entry.tmml +630 -0
- data/pkgs/tile-0.8.2/doc/xml/frame.tmml +98 -0
- data/pkgs/tile-0.8.2/doc/xml/image.tmml +101 -0
- data/pkgs/tile-0.8.2/doc/xml/label.tmml +154 -0
- data/pkgs/tile-0.8.2/doc/xml/labelframe.tmml +116 -0
- data/pkgs/tile-0.8.2/doc/xml/menubutton.tmml +80 -0
- data/pkgs/tile-0.8.2/doc/xml/notebook.tmml +306 -0
- data/pkgs/tile-0.8.2/doc/xml/paned.tmml +154 -0
- data/pkgs/tile-0.8.2/doc/xml/progressbar.tmml +151 -0
- data/pkgs/tile-0.8.2/doc/xml/radiobutton.tmml +109 -0
- data/pkgs/tile-0.8.2/doc/xml/scrollbar.tmml +233 -0
- data/pkgs/tile-0.8.2/doc/xml/separator.tmml +59 -0
- data/pkgs/tile-0.8.2/doc/xml/sizegrip.tmml +82 -0
- data/pkgs/tile-0.8.2/doc/xml/style.tmml +171 -0
- data/pkgs/tile-0.8.2/doc/xml/tile-intro.tmml +192 -0
- data/pkgs/tile-0.8.2/doc/xml/treeview.tmml +604 -0
- data/pkgs/tile-0.8.2/doc/xml/widget.tmml +372 -0
- data/pkgs/tile-0.8.2/entry.o +0 -0
- data/pkgs/tile-0.8.2/frame.o +0 -0
- data/pkgs/tile-0.8.2/generic/Makefile.in +221 -0
- data/pkgs/tile-0.8.2/generic/TODO +493 -0
- data/pkgs/tile-0.8.2/generic/altTheme.c +1172 -0
- data/pkgs/tile-0.8.2/generic/blink.c +168 -0
- data/pkgs/tile-0.8.2/generic/button.c +858 -0
- data/pkgs/tile-0.8.2/generic/cache.c +354 -0
- data/pkgs/tile-0.8.2/generic/clamTheme.c +974 -0
- data/pkgs/tile-0.8.2/generic/classicTheme.c +518 -0
- data/pkgs/tile-0.8.2/generic/configure +10334 -0
- data/pkgs/tile-0.8.2/generic/configure.in +100 -0
- data/pkgs/tile-0.8.2/generic/entry.c +1922 -0
- data/pkgs/tile-0.8.2/generic/frame.c +648 -0
- data/pkgs/tile-0.8.2/generic/gunk.h +44 -0
- data/pkgs/tile-0.8.2/generic/image.c +416 -0
- data/pkgs/tile-0.8.2/generic/label.c +663 -0
- data/pkgs/tile-0.8.2/generic/layout.c +1215 -0
- data/pkgs/tile-0.8.2/generic/manager.c +554 -0
- data/pkgs/tile-0.8.2/generic/manager.h +91 -0
- data/pkgs/tile-0.8.2/generic/notebook.c +1380 -0
- data/pkgs/tile-0.8.2/generic/paned.c +958 -0
- data/pkgs/tile-0.8.2/generic/pkgIndex.tcl.in +7 -0
- data/pkgs/tile-0.8.2/generic/progress.c +549 -0
- data/pkgs/tile-0.8.2/generic/scale.c +526 -0
- data/pkgs/tile-0.8.2/generic/scroll.c +253 -0
- data/pkgs/tile-0.8.2/generic/scrollbar.c +346 -0
- data/pkgs/tile-0.8.2/generic/separator.c +132 -0
- data/pkgs/tile-0.8.2/generic/square.c +306 -0
- data/pkgs/tile-0.8.2/generic/tagset.c +147 -0
- data/pkgs/tile-0.8.2/generic/tile.c +296 -0
- data/pkgs/tile-0.8.2/generic/tkElements.c +1280 -0
- data/pkgs/tile-0.8.2/generic/tkTheme.c +1708 -0
- data/pkgs/tile-0.8.2/generic/tkTheme.h +419 -0
- data/pkgs/tile-0.8.2/generic/tkThemeInt.h +45 -0
- data/pkgs/tile-0.8.2/generic/tkstate.c +268 -0
- data/pkgs/tile-0.8.2/generic/trace.c +145 -0
- data/pkgs/tile-0.8.2/generic/track.c +174 -0
- data/pkgs/tile-0.8.2/generic/treeview.c +3211 -0
- data/pkgs/tile-0.8.2/generic/ttk.decls +154 -0
- data/pkgs/tile-0.8.2/generic/ttkDecls.h +340 -0
- data/pkgs/tile-0.8.2/generic/ttkStubInit.c +61 -0
- data/pkgs/tile-0.8.2/generic/ttkStubLib.c +70 -0
- data/pkgs/tile-0.8.2/generic/widget.c +785 -0
- data/pkgs/tile-0.8.2/generic/widget.h +263 -0
- data/pkgs/tile-0.8.2/image.o +0 -0
- data/pkgs/tile-0.8.2/label.o +0 -0
- data/pkgs/tile-0.8.2/layout.o +0 -0
- data/pkgs/tile-0.8.2/library/altTheme.tcl +101 -0
- data/pkgs/tile-0.8.2/library/aquaTheme.tcl +62 -0
- data/pkgs/tile-0.8.2/library/button.tcl +85 -0
- data/pkgs/tile-0.8.2/library/clamTheme.tcl +139 -0
- data/pkgs/tile-0.8.2/library/classicTheme.tcl +108 -0
- data/pkgs/tile-0.8.2/library/combobox.tcl +439 -0
- data/pkgs/tile-0.8.2/library/cursors.tcl +36 -0
- data/pkgs/tile-0.8.2/library/defaults.tcl +118 -0
- data/pkgs/tile-0.8.2/library/dialog.tcl +274 -0
- data/pkgs/tile-0.8.2/library/entry.tcl +580 -0
- data/pkgs/tile-0.8.2/library/fonts.tcl +153 -0
- data/pkgs/tile-0.8.2/library/icons.tcl +105 -0
- data/pkgs/tile-0.8.2/library/keynav.tcl +192 -0
- data/pkgs/tile-0.8.2/library/menubutton.tcl +171 -0
- data/pkgs/tile-0.8.2/library/notebook.tcl +193 -0
- data/pkgs/tile-0.8.2/library/paned.tcl +87 -0
- data/pkgs/tile-0.8.2/library/progress.tcl +51 -0
- data/pkgs/tile-0.8.2/library/scale.tcl +54 -0
- data/pkgs/tile-0.8.2/library/scrollbar.tcl +125 -0
- data/pkgs/tile-0.8.2/library/sizegrip.tcl +77 -0
- data/pkgs/tile-0.8.2/library/tile.tcl +211 -0
- data/pkgs/tile-0.8.2/library/treeview.tcl +382 -0
- data/pkgs/tile-0.8.2/library/utils.tcl +254 -0
- data/pkgs/tile-0.8.2/library/winTheme.tcl +77 -0
- data/pkgs/tile-0.8.2/library/xpTheme.tcl +63 -0
- data/pkgs/tile-0.8.2/libtile0.8.2.so +0 -0
- data/pkgs/tile-0.8.2/libttkstub.a +0 -0
- data/pkgs/tile-0.8.2/license.terms +24 -0
- data/pkgs/tile-0.8.2/macosx/aquaTheme.c +1076 -0
- data/pkgs/tile-0.8.2/manager.o +0 -0
- data/pkgs/tile-0.8.2/notebook.o +0 -0
- data/pkgs/tile-0.8.2/paned.o +0 -0
- data/pkgs/tile-0.8.2/pkgIndex.tcl +3 -0
- data/pkgs/tile-0.8.2/progress.o +0 -0
- data/pkgs/tile-0.8.2/scale.o +0 -0
- data/pkgs/tile-0.8.2/scroll.o +0 -0
- data/pkgs/tile-0.8.2/scrollbar.o +0 -0
- data/pkgs/tile-0.8.2/separator.o +0 -0
- data/pkgs/tile-0.8.2/tagset.o +0 -0
- data/pkgs/tile-0.8.2/tclconfig/install-sh +119 -0
- data/pkgs/tile-0.8.2/tclconfig/tcl.m4 +4069 -0
- data/pkgs/tile-0.8.2/tclconfig/teax.m4 +109 -0
- data/pkgs/tile-0.8.2/tests/all.tcl +18 -0
- data/pkgs/tile-0.8.2/tests/bwidget.test +103 -0
- data/pkgs/tile-0.8.2/tests/cbtest.tcl +125 -0
- data/pkgs/tile-0.8.2/tests/combobox.test +51 -0
- data/pkgs/tile-0.8.2/tests/compound.tcl +92 -0
- data/pkgs/tile-0.8.2/tests/entry.test +285 -0
- data/pkgs/tile-0.8.2/tests/entrytest.tcl +78 -0
- data/pkgs/tile-0.8.2/tests/image.test +94 -0
- data/pkgs/tile-0.8.2/tests/labelframe.tcl +41 -0
- data/pkgs/tile-0.8.2/tests/labelframe.test +137 -0
- data/pkgs/tile-0.8.2/tests/layout.test +33 -0
- data/pkgs/tile-0.8.2/tests/misc.test +35 -0
- data/pkgs/tile-0.8.2/tests/nbtest.tcl +66 -0
- data/pkgs/tile-0.8.2/tests/notebook.test +500 -0
- data/pkgs/tile-0.8.2/tests/paned.test +298 -0
- data/pkgs/tile-0.8.2/tests/progress.test +92 -0
- data/pkgs/tile-0.8.2/tests/pwtest.tcl +90 -0
- data/pkgs/tile-0.8.2/tests/sbtest.tcl +79 -0
- data/pkgs/tile-0.8.2/tests/scrollbar.test +77 -0
- data/pkgs/tile-0.8.2/tests/sgtest.tcl +52 -0
- data/pkgs/tile-0.8.2/tests/testutils.tcl +20 -0
- data/pkgs/tile-0.8.2/tests/tile.test +674 -0
- data/pkgs/tile-0.8.2/tests/treetags.test +78 -0
- data/pkgs/tile-0.8.2/tests/treeview.test +563 -0
- data/pkgs/tile-0.8.2/tests/tvtest.tcl +332 -0
- data/pkgs/tile-0.8.2/tests/validate.test +278 -0
- data/pkgs/tile-0.8.2/tile.o +0 -0
- data/pkgs/tile-0.8.2/tkElements.o +0 -0
- data/pkgs/tile-0.8.2/tkTheme.o +0 -0
- data/pkgs/tile-0.8.2/tkstate.o +0 -0
- data/pkgs/tile-0.8.2/tools/genStubs.tcl +861 -0
- data/pkgs/tile-0.8.2/trace.o +0 -0
- data/pkgs/tile-0.8.2/track.o +0 -0
- data/pkgs/tile-0.8.2/treeview.o +0 -0
- data/pkgs/tile-0.8.2/ttkStubInit.o +0 -0
- data/pkgs/tile-0.8.2/ttkStubLib.o +0 -0
- data/pkgs/tile-0.8.2/widget.o +0 -0
- data/pkgs/tile-0.8.2/win/Tile.dsp +261 -0
- data/pkgs/tile-0.8.2/win/makefile.vc +527 -0
- data/pkgs/tile-0.8.2/win/monitor.c +164 -0
- data/pkgs/tile-0.8.2/win/nmakehlp.c +483 -0
- data/pkgs/tile-0.8.2/win/rules.vc +512 -0
- data/pkgs/tile-0.8.2/win/tile.rc +40 -0
- data/pkgs/tile-0.8.2/win/winTheme.c +734 -0
- data/pkgs/tile-0.8.2/win/xpTheme.c +1029 -0
- data/spec/app_spec.rb +48 -0
- data/spec/customer_spec.rb +31 -0
- data/spec/fixtures/graph.expectation +18 -0
- data/spec/payment_spec.rb +19 -0
- data/spec/pratt_spec.rb +148 -0
- data/spec/project_spec.rb +163 -0
- data/spec/rcov.opts +0 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/whence_spec.rb +54 -0
- data/tasks/pratt.rb +84 -0
- data/templates/model.eruby +12 -0
- data/templates/spec.eruby +8 -0
- data/views/env.rb +22 -0
- data/views/graph.eruby +20 -0
- data/views/invoice.eruby +148 -0
- data/views/main.rb +92 -0
- data/views/pid.eruby +3 -0
- data/views/pop.rb +94 -0
- data/views/pop2.rb +75 -0
- data/views/raw.eruby +11 -0
- metadata +390 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
#
|
|
2
|
+
# ttk::entry widget tests
|
|
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
|
+
variable scrollInfo
|
|
13
|
+
proc scroll args {
|
|
14
|
+
global scrollInfo
|
|
15
|
+
set scrollInfo $args
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
# Some of the tests raise background errors;
|
|
19
|
+
# override default bgerror to catch them.
|
|
20
|
+
#
|
|
21
|
+
variable bgerror ""
|
|
22
|
+
proc bgerror {error} {
|
|
23
|
+
variable bgerror $error
|
|
24
|
+
variable bgerrorInfo $::errorInfo
|
|
25
|
+
variable bgerrorCode $::errorCode
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
#
|
|
29
|
+
test entry-1.1 "Create entry widget" -body {
|
|
30
|
+
ttk::entry .e
|
|
31
|
+
} -result .e
|
|
32
|
+
|
|
33
|
+
test entry-1.2 "Insert" -body {
|
|
34
|
+
.e insert end abcde
|
|
35
|
+
.e get
|
|
36
|
+
} -result abcde
|
|
37
|
+
|
|
38
|
+
test entry-1.3 "Selection" -body {
|
|
39
|
+
.e selection range 1 3
|
|
40
|
+
selection get
|
|
41
|
+
} -result bc
|
|
42
|
+
|
|
43
|
+
test entry-1.4 "Delete" -body {
|
|
44
|
+
.e delete 1 3
|
|
45
|
+
.e get
|
|
46
|
+
} -result ade
|
|
47
|
+
|
|
48
|
+
test entry-1.5 "Deletion - insert cursor" -body {
|
|
49
|
+
.e insert end abcde
|
|
50
|
+
.e icursor 0
|
|
51
|
+
.e delete 0 end
|
|
52
|
+
.e index insert
|
|
53
|
+
} -result 0
|
|
54
|
+
|
|
55
|
+
test entry-1.6 "Deletion - insert cursor at end" -body {
|
|
56
|
+
.e insert end abcde
|
|
57
|
+
.e icursor end
|
|
58
|
+
.e delete 0 end
|
|
59
|
+
.e index insert
|
|
60
|
+
} -result 0
|
|
61
|
+
|
|
62
|
+
test entry-1.7 "Deletion - insert cursor in the middle " -body {
|
|
63
|
+
.e insert end abcde
|
|
64
|
+
.e icursor 3
|
|
65
|
+
.e delete 0 end
|
|
66
|
+
.e index insert
|
|
67
|
+
} -result 0
|
|
68
|
+
|
|
69
|
+
test entry-1.done "Cleanup" -body { destroy .e }
|
|
70
|
+
|
|
71
|
+
# Scrollbar tests.
|
|
72
|
+
|
|
73
|
+
test entry-2.1 "Create entry before scrollbar" -body {
|
|
74
|
+
pack [ttk::entry .te -xscrollcommand [list .tsb set]] \
|
|
75
|
+
-expand true -fill both
|
|
76
|
+
pack [ttk::scrollbar .tsb -orient horizontal -command [list .te xview]] \
|
|
77
|
+
-expand false -fill x
|
|
78
|
+
} -cleanup {destroy .te .tsb}
|
|
79
|
+
|
|
80
|
+
test entry-2.2 "Initial scroll position" -body {
|
|
81
|
+
ttk::entry .e -font fixed -width 5 -xscrollcommand scroll
|
|
82
|
+
.e insert end "0123456789"
|
|
83
|
+
pack .e; update
|
|
84
|
+
set scrollInfo
|
|
85
|
+
} -result {0 0.5} -cleanup { destroy .e }
|
|
86
|
+
# NOTE: result can vary depending on font.
|
|
87
|
+
|
|
88
|
+
# Bounding box / scrolling tests.
|
|
89
|
+
test entry-3.0 "Series 3 setup" -body {
|
|
90
|
+
ttk::style theme use default
|
|
91
|
+
variable fixed fixed
|
|
92
|
+
variable cw [font measure $fixed a]
|
|
93
|
+
variable ch [font metrics $fixed -linespace]
|
|
94
|
+
variable bd 2 ;# border + padding
|
|
95
|
+
variable ux [font measure $fixed \u4e4e]
|
|
96
|
+
|
|
97
|
+
pack [ttk::entry .e -font $fixed -width 20]
|
|
98
|
+
update
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
test entry-3.1 "bbox widget command" -body {
|
|
102
|
+
.e delete 0 end
|
|
103
|
+
.e bbox 0
|
|
104
|
+
} -result [list $bd $bd 0 $ch]
|
|
105
|
+
|
|
106
|
+
test entry-3.2 "xview" -body {
|
|
107
|
+
.e delete 0 end;
|
|
108
|
+
.e insert end [string repeat "0" 40]
|
|
109
|
+
update idletasks
|
|
110
|
+
set result [.e xview]
|
|
111
|
+
} -result {0 0.5}
|
|
112
|
+
|
|
113
|
+
test entry-3.last "Series 3 cleanup" -body {
|
|
114
|
+
destroy .e
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
# Selection tests:
|
|
118
|
+
|
|
119
|
+
test entry-4.0 "Selection test - setup" -body {
|
|
120
|
+
ttk::entry .e
|
|
121
|
+
.e insert end asdfasdf
|
|
122
|
+
.e selection range 0 end
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
test entry-4.1 "Selection test" -body {
|
|
126
|
+
selection get
|
|
127
|
+
} -result asdfasdf
|
|
128
|
+
|
|
129
|
+
test entry-4.2 "Disable -exportselection" -body {
|
|
130
|
+
.e configure -exportselection false
|
|
131
|
+
selection get
|
|
132
|
+
} -returnCodes error -result "PRIMARY selection doesn't exist*" -match glob
|
|
133
|
+
|
|
134
|
+
test entry-4.3 "Reenable -exportselection" -body {
|
|
135
|
+
.e configure -exportselection true
|
|
136
|
+
selection get
|
|
137
|
+
} -result asdfasdf
|
|
138
|
+
|
|
139
|
+
test entry-4.4 "Force selection loss" -body {
|
|
140
|
+
selection own .
|
|
141
|
+
.e index sel.first
|
|
142
|
+
} -returnCodes error -result "selection isn't in widget .e"
|
|
143
|
+
|
|
144
|
+
test entry-4.5 "Allow selection changes if readonly" -body {
|
|
145
|
+
.e delete 0 end
|
|
146
|
+
.e insert end 0123456789
|
|
147
|
+
.e selection range 0 end
|
|
148
|
+
.e configure -state readonly
|
|
149
|
+
.e selection range 2 4
|
|
150
|
+
.e configure -state normal
|
|
151
|
+
list [.e index sel.first] [.e index sel.last]
|
|
152
|
+
} -result {2 4}
|
|
153
|
+
|
|
154
|
+
test entry-4.6 "Disallow selection changes if disabled" -body {
|
|
155
|
+
.e delete 0 end
|
|
156
|
+
.e insert end 0123456789
|
|
157
|
+
.e selection range 0 end
|
|
158
|
+
.e configure -state disabled
|
|
159
|
+
.e selection range 2 4
|
|
160
|
+
.e configure -state normal
|
|
161
|
+
list [.e index sel.first] [.e index sel.last]
|
|
162
|
+
} -result {0 10}
|
|
163
|
+
|
|
164
|
+
test entry-4.7 {sel.first and sel.last gravity} -body {
|
|
165
|
+
set result [list]
|
|
166
|
+
.e delete 0 end
|
|
167
|
+
.e insert 0 0123456789
|
|
168
|
+
.e select range 2 6
|
|
169
|
+
.e insert 2 XXX
|
|
170
|
+
lappend result [.e index sel.first] [.e index sel.last]
|
|
171
|
+
.e insert 6 YYY
|
|
172
|
+
lappend result [.e index sel.first] [.e index sel.last] [.e get]
|
|
173
|
+
} -result {5 9 5 12 01XXX2YYY3456789}
|
|
174
|
+
|
|
175
|
+
# Self-destruct tests.
|
|
176
|
+
|
|
177
|
+
test entry-5.1 {widget deletion while active} -body {
|
|
178
|
+
destroy .e
|
|
179
|
+
pack [ttk::entry .e]
|
|
180
|
+
update
|
|
181
|
+
.e config -xscrollcommand { destroy .e }
|
|
182
|
+
update idletasks
|
|
183
|
+
winfo exists .e
|
|
184
|
+
} -result 0
|
|
185
|
+
|
|
186
|
+
# TODO: test killing .e in -validatecommand, -invalidcommand, variable trace;
|
|
187
|
+
|
|
188
|
+
# -textvariable tests.
|
|
189
|
+
|
|
190
|
+
test entry-6.1 {Update linked variable in write trace} -body {
|
|
191
|
+
proc override args {
|
|
192
|
+
global x
|
|
193
|
+
set x "Overridden!"
|
|
194
|
+
}
|
|
195
|
+
catch {destroy .e}
|
|
196
|
+
set x ""
|
|
197
|
+
trace variable x w override
|
|
198
|
+
ttk::entry .e -textvariable x
|
|
199
|
+
.e insert 0 "Some text"
|
|
200
|
+
set result [list $x [.e get]]
|
|
201
|
+
set result
|
|
202
|
+
} -result {Overridden! Overridden!} -cleanup {
|
|
203
|
+
unset x
|
|
204
|
+
rename override {}
|
|
205
|
+
destroy .e
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
test entry-6.2 {-textvariable tests} -body {
|
|
209
|
+
set result [list]
|
|
210
|
+
ttk::entry .e -textvariable x
|
|
211
|
+
set x "text"
|
|
212
|
+
lappend result [.e get]
|
|
213
|
+
unset x
|
|
214
|
+
lappend result [.e get]
|
|
215
|
+
.e insert end "newtext"
|
|
216
|
+
lappend result [.e get] [set x]
|
|
217
|
+
} -result [list "text" "" "newtext" "newtext"] -cleanup {
|
|
218
|
+
destroy .e
|
|
219
|
+
unset -nocomplain x
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
test entry-7.1 {Bad style options} -body {
|
|
223
|
+
ttk::style theme create entry-7.1 -settings {
|
|
224
|
+
ttk::style configure TEntry -foreground BadColor
|
|
225
|
+
ttk::style map TEntry -foreground {readonly AnotherBadColor}
|
|
226
|
+
ttk::style map TEntry -font {readonly ABadFont}
|
|
227
|
+
ttk::style map TEntry \
|
|
228
|
+
-selectbackground {{} BadColor} \
|
|
229
|
+
-selectforeground {{} BadColor} \
|
|
230
|
+
-insertcolor {{} BadColor}
|
|
231
|
+
}
|
|
232
|
+
pack [ttk::entry .e -text "Don't crash"]
|
|
233
|
+
ttk::style theme use entry-7.1
|
|
234
|
+
update
|
|
235
|
+
.e selection range 0 end
|
|
236
|
+
update
|
|
237
|
+
.e state readonly;
|
|
238
|
+
update
|
|
239
|
+
} -cleanup { destroy .e ; ttk::style theme use default }
|
|
240
|
+
|
|
241
|
+
test entry-8.1 "Unset linked variable" -body {
|
|
242
|
+
variable foo "bar"
|
|
243
|
+
pack [ttk::entry .e -textvariable foo]
|
|
244
|
+
unset foo
|
|
245
|
+
.e insert end "baz"
|
|
246
|
+
list [.e cget -textvariable] [.e get] [set foo]
|
|
247
|
+
} -result [list foo "baz" "baz"] -cleanup { destroy .e }
|
|
248
|
+
|
|
249
|
+
test entry-8.2 "Unset linked variable by deleting namespace" -body {
|
|
250
|
+
namespace eval ::test { variable foo "bar" }
|
|
251
|
+
pack [ttk::entry .e -textvariable ::test::foo]
|
|
252
|
+
namespace delete ::test
|
|
253
|
+
.e insert end "baz" ;# <== error here
|
|
254
|
+
list [.e cget -textvariable] [.e get] [set foo]
|
|
255
|
+
} -returnCodes error -result "*parent namespace doesn't exist*" -match glob
|
|
256
|
+
# '-result [list ::test::foo "baz" "baz"]' would also be sensible,
|
|
257
|
+
# but Tcl namespaces don't work that way.
|
|
258
|
+
|
|
259
|
+
test entry-8.2a "Followup to test 8.2" -body {
|
|
260
|
+
.e cget -textvariable
|
|
261
|
+
} -result ::test::foo -cleanup { destroy .e }
|
|
262
|
+
# For 8.2a, -result {} would also be sensible.
|
|
263
|
+
|
|
264
|
+
test entry-9.1 "Index range invariants" -setup {
|
|
265
|
+
# See bug#1721532 for discussion
|
|
266
|
+
proc entry-9.1-trace {n1 n2 op} {
|
|
267
|
+
set ::V NO!
|
|
268
|
+
}
|
|
269
|
+
variable V
|
|
270
|
+
trace add variable V write entry-9.1-trace
|
|
271
|
+
ttk::entry .e -textvariable V
|
|
272
|
+
} -body {
|
|
273
|
+
set result [list]
|
|
274
|
+
.e insert insert a ; lappend result [.e index insert] [.e index end]
|
|
275
|
+
.e insert insert b ; lappend result [.e index insert] [.e index end]
|
|
276
|
+
.e insert insert c ; lappend result [.e index insert] [.e index end]
|
|
277
|
+
.e insert insert d ; lappend result [.e index insert] [.e index end]
|
|
278
|
+
.e insert insert e ; lappend result [.e index insert] [.e index end]
|
|
279
|
+
set result
|
|
280
|
+
} -result [list 1 3 2 3 3 3 3 3 3 3] -cleanup {
|
|
281
|
+
unset V
|
|
282
|
+
destroy .e
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
tcltest::cleanupTests
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Side-by-side comparison of Tile vs. standard entry widgets.
|
|
3
|
+
#
|
|
4
|
+
|
|
5
|
+
lappend auto_path . ;
|
|
6
|
+
package require tile
|
|
7
|
+
|
|
8
|
+
source [file join [file dirname [info script]] testutils.tcl]
|
|
9
|
+
|
|
10
|
+
style theme use alt
|
|
11
|
+
|
|
12
|
+
. configure -padx 10 -pady 10
|
|
13
|
+
|
|
14
|
+
grid [ttk::scrollbar .tsb -orient horizontal -command [list .te xview]] \
|
|
15
|
+
-pady 2 -sticky news
|
|
16
|
+
grid [ttk::entry .te -textvariable ::A -xscrollcommand [list .tsb set]] \
|
|
17
|
+
-pady 2 -sticky news
|
|
18
|
+
grid [entry .e -textvariable ::A -xscrollcommand [list .sb set]] \
|
|
19
|
+
-pady 2 -sticky news
|
|
20
|
+
grid [ttk::scrollbar .sb -orient horizontal -command [list .e xview]] \
|
|
21
|
+
-pady 2 -sticky news
|
|
22
|
+
|
|
23
|
+
grid rowconfigure . 1 -weight 1
|
|
24
|
+
grid rowconfigure . 2 -weight 1
|
|
25
|
+
grid columnconfigure . 0 -weight 1
|
|
26
|
+
|
|
27
|
+
.te insert end "abcde fghij klmn opqr stuv wxyz"
|
|
28
|
+
|
|
29
|
+
#
|
|
30
|
+
# Test various options.
|
|
31
|
+
#
|
|
32
|
+
proc configboth {args} {
|
|
33
|
+
eval .e configure $args
|
|
34
|
+
eval .te configure $args
|
|
35
|
+
}
|
|
36
|
+
bind all <Alt-Key-d> { configboth -state disabled } ;# "&disable"
|
|
37
|
+
bind all <Alt-Key-e> { configboth -state normal } ;# "&enable"
|
|
38
|
+
bind all <Alt-Key-w> { configboth -state readonly } ;# "&write-protect"
|
|
39
|
+
|
|
40
|
+
bind all <Alt-Key-l> { configboth -justify left }
|
|
41
|
+
bind all <Alt-Key-r> { configboth -justify right }
|
|
42
|
+
bind all <Alt-Key-c> { configboth -justify center }
|
|
43
|
+
|
|
44
|
+
bind all <Alt-Key-q> { destroy . }
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
#
|
|
48
|
+
# Validation test.
|
|
49
|
+
#
|
|
50
|
+
# "If you can't see the fnords, they can't eat you."
|
|
51
|
+
#
|
|
52
|
+
proc nofnords {w p} {
|
|
53
|
+
if {[set i [string first fnord $p]] >= 0} {
|
|
54
|
+
return 0
|
|
55
|
+
}
|
|
56
|
+
if {[set i [string first FNORD $p]] >= 0} {
|
|
57
|
+
$w delete 0 end;
|
|
58
|
+
$w insert end [string replace $p $i [expr {$i+4}]]
|
|
59
|
+
$w icursor $i
|
|
60
|
+
}
|
|
61
|
+
return 1
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
configboth -validatecommand {nofnords %W %P} -validate all
|
|
65
|
+
|
|
66
|
+
# Use gaudy colors to highlight selection:
|
|
67
|
+
#
|
|
68
|
+
|
|
69
|
+
proc gaudyColors {} {
|
|
70
|
+
.te configure \
|
|
71
|
+
-insertcolor red -selectbackground blue -selectforeground green
|
|
72
|
+
.e configure \
|
|
73
|
+
-insertbackground red -selectbackground blue -selectforeground green \
|
|
74
|
+
-background white
|
|
75
|
+
}
|
|
76
|
+
bind all <Alt-KeyPress-g> { gaudyColors }
|
|
77
|
+
|
|
78
|
+
#*EOF*
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
#
|
|
2
|
+
# image.test,v 1.9 2007/11/25 17:06:02 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
|
+
# catch background errors:
|
|
13
|
+
#
|
|
14
|
+
if {[info procs bgerror] == "bgerror"} { rename bgerror {} }
|
|
15
|
+
array set BGerror { caught 0 message {} }
|
|
16
|
+
proc bgerror {message} {
|
|
17
|
+
variable BGerror
|
|
18
|
+
set BGerror(caught) 1
|
|
19
|
+
set BGerror(message) $message
|
|
20
|
+
}
|
|
21
|
+
proc caughtbgerror {} {
|
|
22
|
+
variable BGerror
|
|
23
|
+
if {!$BGerror(caught)} {
|
|
24
|
+
error "No bgerror caught"
|
|
25
|
+
}
|
|
26
|
+
set BGerror(caught) 0
|
|
27
|
+
return $BGerror(message)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
test image-1.1 "Bad image element" -body {
|
|
31
|
+
ttk::style element create BadImage image badimage
|
|
32
|
+
#- ttk::style layout BadImage { BadImage }
|
|
33
|
+
#- ttk::label .l -style BadImage
|
|
34
|
+
#- pack .l ; update
|
|
35
|
+
#- destroy .l
|
|
36
|
+
#- caughtbgerror
|
|
37
|
+
} -returnCodes error -result {image "badimage" doesn't exist}
|
|
38
|
+
|
|
39
|
+
test image-1.2 "Duplicate element" -setup {
|
|
40
|
+
image create photo test.element -width 10 -height 10
|
|
41
|
+
ttk::style element create testElement image test.element
|
|
42
|
+
} -body {
|
|
43
|
+
ttk::style element create testElement image test.element
|
|
44
|
+
} -returnCodes 1 -result "Duplicate element testElement"
|
|
45
|
+
|
|
46
|
+
test image-1.3 "Bad image element later in list" -body {
|
|
47
|
+
ttk::style element create BadImage image {test.element {} badimage}
|
|
48
|
+
} -returnCodes error -result {image "badimage" doesn't exist}
|
|
49
|
+
|
|
50
|
+
test image-1.4 "Bad image option" -body {
|
|
51
|
+
ttk::button .b -image [list test.element {} badimage]
|
|
52
|
+
} -returnCodes error -result {image "badimage" doesn't exist}
|
|
53
|
+
|
|
54
|
+
test image-2.0 "Deletion of displayed image (label)" -constraints {
|
|
55
|
+
KNOWNBUG
|
|
56
|
+
} -setup {
|
|
57
|
+
image create photo test.image -width 10 -height 10
|
|
58
|
+
} -body {
|
|
59
|
+
pack [set w [ttk::label .ttk_image20 -image test.image]]
|
|
60
|
+
tkwait visibility $w
|
|
61
|
+
image delete test.image
|
|
62
|
+
update
|
|
63
|
+
} -cleanup {
|
|
64
|
+
destroy .ttk_image20
|
|
65
|
+
} -result {}
|
|
66
|
+
|
|
67
|
+
test image-2.1 "Deletion of displayed image (checkbutton)" -constraints {
|
|
68
|
+
KNOWNBUG
|
|
69
|
+
} -setup {
|
|
70
|
+
image create photo test.image -width 10 -height 10
|
|
71
|
+
} -body {
|
|
72
|
+
pack [set w [ttk::checkbutton .ttk_image21 -image test.image]]
|
|
73
|
+
tkwait visibility $w
|
|
74
|
+
image delete test.image
|
|
75
|
+
update
|
|
76
|
+
} -cleanup {
|
|
77
|
+
destroy .ttk_image21
|
|
78
|
+
} -result {}
|
|
79
|
+
|
|
80
|
+
test image-2.2 "Deletion of displayed image (radiobutton)" -constraints {
|
|
81
|
+
KNOWNBUG
|
|
82
|
+
} -setup {
|
|
83
|
+
image create photo test.image -width 10 -height 10
|
|
84
|
+
} -body {
|
|
85
|
+
pack [set w [ttk::radiobutton .ttk_image22 -image test.image]]
|
|
86
|
+
tkwait visibility $w
|
|
87
|
+
image delete test.image
|
|
88
|
+
update
|
|
89
|
+
} -cleanup {
|
|
90
|
+
destroy .ttk_image22
|
|
91
|
+
} -result {}
|
|
92
|
+
|
|
93
|
+
#
|
|
94
|
+
tcltest::cleanupTests
|