Pratt 1.5.6
Sign up to get free protection for your applications and to get access to all the features.
- 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,41 @@
|
|
1
|
+
#
|
2
|
+
# Interactive test for labelframes.
|
3
|
+
#
|
4
|
+
|
5
|
+
lappend auto_path .
|
6
|
+
package require tile
|
7
|
+
|
8
|
+
puts "Loaded tile: [package ifneeded tile [package provide tile]]"
|
9
|
+
source [file join [file dirname [info script]] testutils.tcl]
|
10
|
+
|
11
|
+
#style map . -background {{} blue}
|
12
|
+
|
13
|
+
variable anchorStrings { nw n ne en e es se s sw ws w wn }
|
14
|
+
variable labelanchor nw
|
15
|
+
|
16
|
+
variable label "-labelanchor"
|
17
|
+
|
18
|
+
set c [ttk::labelframe .actl -text "-labelanchor"]
|
19
|
+
$c configure -text "" -labelwidget [ttk::label .lbl -textvariable label]
|
20
|
+
.lbl configure -relief solid -borderwidth 1
|
21
|
+
|
22
|
+
foreach string $anchorStrings {
|
23
|
+
pack [ttk::radiobutton $c.$string -text $string \
|
24
|
+
-variable labelanchor -value $string -command setAnchor] \
|
25
|
+
-side top -expand false -fill x ;
|
26
|
+
}
|
27
|
+
pack [ttk::entry $c.editlabel -textvariable label] \
|
28
|
+
-side top -expand false -anchor w
|
29
|
+
bind $c.editlabel <KeyPress-Return> "$c configure -text \[%W get\]"
|
30
|
+
|
31
|
+
proc setAnchor {} {
|
32
|
+
variable labelanchor
|
33
|
+
.actl configure -labelanchor $labelanchor
|
34
|
+
}
|
35
|
+
pack $c -side top -expand true -fill both -padx 10 -pady 10
|
36
|
+
setAnchor
|
37
|
+
|
38
|
+
bind . <Key-Escape> [list destroy .]
|
39
|
+
bind . <Alt-KeyPress-l> { .actl configure -labelwidget {} -text $::label }
|
40
|
+
bind . <Alt-KeyPress-w> { .actl configure -labelwidget .lbl }
|
41
|
+
|
@@ -0,0 +1,137 @@
|
|
1
|
+
#
|
2
|
+
# labelframe.test,v 1.6 2005/12/06 20:45:29 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
|
+
test labelframe-1.0 "Setup" -body {
|
13
|
+
pack [ttk::labelframe .lf] -expand true -fill both
|
14
|
+
}
|
15
|
+
|
16
|
+
test labelframe-2.1 "Can't use indirect descendant as labelwidget" -body {
|
17
|
+
ttk::frame .lf.t
|
18
|
+
ttk::checkbutton .lf.t.cb
|
19
|
+
.lf configure -labelwidget .lf.t.cb
|
20
|
+
} -returnCodes 1 -result "can't *" -match glob \
|
21
|
+
-cleanup { destroy .lf.t } ;
|
22
|
+
|
23
|
+
test labelframe-2.2 "Can't use toplevel as labelwidget" -body {
|
24
|
+
toplevel .lf.t
|
25
|
+
.lf configure -labelwidget .lf.t
|
26
|
+
} -returnCodes 1 -result "can't *" -match glob \
|
27
|
+
-cleanup { destroy .lf.t } ;
|
28
|
+
|
29
|
+
test labelframe-2.3 "Can't use non-windows as -labelwidget" -body {
|
30
|
+
.lf configure -labelwidget BogusWindowName
|
31
|
+
} -returnCodes 1 -result {bad window path name "BogusWindowName"}
|
32
|
+
|
33
|
+
test labelframe-2.4 "Can't use nonexistent-windows as -labelwidget" -body {
|
34
|
+
.lf configure -labelwidget .nosuchwindow
|
35
|
+
} -returnCodes 1 -result {bad window path name ".nosuchwindow"}
|
36
|
+
|
37
|
+
|
38
|
+
###
|
39
|
+
# See also series labelframe-4.x
|
40
|
+
#
|
41
|
+
test labelframe-3.1 "Add child slave" -body {
|
42
|
+
checkbutton .lf.cb -text "abcde"
|
43
|
+
.lf configure -labelwidget .lf.cb
|
44
|
+
list [update; winfo viewable .lf.cb] [winfo manager .lf.cb]
|
45
|
+
} -result [list 1 labelframe]
|
46
|
+
|
47
|
+
test labelframe-3.2 "Remove child slave" -body {
|
48
|
+
.lf configure -labelwidget {}
|
49
|
+
list [update; winfo viewable .lf.cb] [winfo manager .lf.cb]
|
50
|
+
} -result [list 0 {}]
|
51
|
+
|
52
|
+
test labelframe-3.3 "Re-add child slave" -body {
|
53
|
+
.lf configure -labelwidget .lf.cb
|
54
|
+
list [update; winfo viewable .lf.cb] [winfo manager .lf.cb]
|
55
|
+
} -result [list 1 labelframe]
|
56
|
+
|
57
|
+
test labelframe-3.4 "Re-manage child slave" -body {
|
58
|
+
pack .lf.cb -side right
|
59
|
+
list [update; winfo viewable .lf.cb] [winfo manager .lf.cb] [.lf cget -labelwidget]
|
60
|
+
} -result [list 1 pack {}]
|
61
|
+
|
62
|
+
test labelframe-3.5 "Re-add child slave" -body {
|
63
|
+
.lf configure -labelwidget .lf.cb
|
64
|
+
list [update; winfo viewable .lf.cb] [winfo manager .lf.cb]
|
65
|
+
} -result [list 1 labelframe]
|
66
|
+
|
67
|
+
test labelframe-3.6 "Destroy child slave" -body {
|
68
|
+
destroy .lf.cb
|
69
|
+
.lf cget -labelwidget
|
70
|
+
} -result {}
|
71
|
+
|
72
|
+
###
|
73
|
+
# Re-run series labelframe-3.x with nonchild slaves.
|
74
|
+
#
|
75
|
+
# @@@ ODDITY, 14 Nov 2005:
|
76
|
+
# @@@ labelframe-4.1 fails if .cb is a [checkbutton],
|
77
|
+
# @@@ but seems to succeed if it's some other widget class.
|
78
|
+
# @@@ I suspect a race condition; unable to track it down ATM.
|
79
|
+
#
|
80
|
+
# @@@ FOLLOWUP: This *may* have been caused by a bug in ManagerIdleProc
|
81
|
+
# @@@ (see manager.c r1.11). There's still probably a race condition in here.
|
82
|
+
#
|
83
|
+
test labelframe-4.1 "Add nonchild slave" -body {
|
84
|
+
checkbutton .cb -text "abcde"
|
85
|
+
.lf configure -labelwidget .cb
|
86
|
+
update
|
87
|
+
list [winfo ismapped .cb] [winfo viewable .cb] [winfo manager .cb]
|
88
|
+
|
89
|
+
} -result [list 1 1 labelframe]
|
90
|
+
|
91
|
+
test labelframe-4.2 "Remove nonchild slave" -body {
|
92
|
+
.lf configure -labelwidget {}
|
93
|
+
update;
|
94
|
+
list [winfo ismapped .cb] [winfo viewable .cb] [winfo manager .cb]
|
95
|
+
} -result [list 0 0 {}]
|
96
|
+
|
97
|
+
test labelframe-4.3 "Re-add nonchild slave" -body {
|
98
|
+
.lf configure -labelwidget .cb
|
99
|
+
list [update; winfo viewable .cb] [winfo manager .cb]
|
100
|
+
} -result [list 1 labelframe]
|
101
|
+
|
102
|
+
test labelframe-4.4 "Re-manage nonchild slave" -body {
|
103
|
+
pack .cb -side right
|
104
|
+
list [update; winfo viewable .cb] \
|
105
|
+
[winfo manager .cb] \
|
106
|
+
[.lf cget -labelwidget]
|
107
|
+
} -result [list 1 pack {}]
|
108
|
+
|
109
|
+
test labelframe-4.5 "Re-add nonchild slave" -body {
|
110
|
+
.lf configure -labelwidget .cb
|
111
|
+
list [update; winfo viewable .cb] \
|
112
|
+
[winfo manager .cb] \
|
113
|
+
[.lf cget -labelwidget]
|
114
|
+
} -result [list 1 labelframe .cb]
|
115
|
+
|
116
|
+
test labelframe-4.6 "Destroy nonchild slave" -body {
|
117
|
+
destroy .cb
|
118
|
+
.lf cget -labelwidget
|
119
|
+
} -result {}
|
120
|
+
|
121
|
+
test labelframe-5.0 "Cleanup" -body {
|
122
|
+
destroy .lf
|
123
|
+
}
|
124
|
+
|
125
|
+
# 1342876 -- labelframe should raise sibling -labelwidget above self.
|
126
|
+
#
|
127
|
+
test labelframe-6.1 "Stacking order" -body {
|
128
|
+
toplevel .t
|
129
|
+
pack [ttk::checkbutton .t.x1]
|
130
|
+
pack [ttk::labelframe .t.lf -labelwidget [ttk::label .t.lb]]
|
131
|
+
pack [ttk::checkbutton .t.x2]
|
132
|
+
winfo children .t
|
133
|
+
} -cleanup {
|
134
|
+
destroy .t
|
135
|
+
} -result [list .t.x1 .t.lf .t.lb .t.x2]
|
136
|
+
|
137
|
+
tcltest::cleanupTests
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#
|
2
|
+
# layout.test,v 1.7 2006/11/06 02:30:49 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
|
+
test layout-1.1 "Size computations for mixed-orientation layouts" -body {
|
13
|
+
ttk::style theme use default
|
14
|
+
|
15
|
+
set block [image create photo -width 10 -height 10]
|
16
|
+
ttk::style element create block image $block
|
17
|
+
ttk::style layout Blocks {
|
18
|
+
border -children { block } -side left
|
19
|
+
border -children { block } -side top
|
20
|
+
border -children { block } -side bottom
|
21
|
+
}
|
22
|
+
ttk::style configure Blocks -borderwidth 1 -relief raised
|
23
|
+
ttk::button .b -style Blocks
|
24
|
+
|
25
|
+
pack .b -expand true -fill both
|
26
|
+
|
27
|
+
list [winfo reqwidth .b] [winfo reqheight .b]
|
28
|
+
|
29
|
+
} -cleanup { destroy .b } -result [list 24 24]
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
tcltest::cleanupTests
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#
|
2
|
+
# misc.test,v 1.1 2006/09/13 14:05:07 jenglish Exp
|
3
|
+
#
|
4
|
+
package require Tk
|
5
|
+
package require tcltest ; namespace import -force tcltest::*
|
6
|
+
loadTestedCommands
|
7
|
+
|
8
|
+
lappend auto_path .
|
9
|
+
package require tile
|
10
|
+
|
11
|
+
test misc-1.0 "#1551500 -parent option in ttk::dialog doesn't work" -body {
|
12
|
+
ttk::dialog .dialog -parent . -type ok \
|
13
|
+
-message "Something to say" -title "Let's see"
|
14
|
+
wm transient .dialog
|
15
|
+
} -result . -cleanup { destroy .dialog }
|
16
|
+
|
17
|
+
test misc-1.1 "ttk::dialog w/no -parent option" -body {
|
18
|
+
toplevel .t
|
19
|
+
ttk::dialog .t.dialog -type ok
|
20
|
+
wm transient .t.dialog
|
21
|
+
} -result .t -cleanup { destroy .t }
|
22
|
+
|
23
|
+
test misc-1.2 "Explicitly specify -parent" -body {
|
24
|
+
toplevel .t
|
25
|
+
ttk::dialog .t.dialog -type ok -parent .
|
26
|
+
wm transient .t.dialog
|
27
|
+
} -result . -cleanup { destroy .t }
|
28
|
+
|
29
|
+
test misc-1.3 "Nontransient dialog" -body {
|
30
|
+
toplevel .t
|
31
|
+
ttk::dialog .t.dialog -type ok -parent ""
|
32
|
+
wm transient .t.dialog
|
33
|
+
} -result "" -cleanup { destroy .t }
|
34
|
+
|
35
|
+
tcltest::cleanupTests
|
@@ -0,0 +1,66 @@
|
|
1
|
+
#
|
2
|
+
# Test case for #1368921 "ttk::notebook::enableTraversal"
|
3
|
+
#
|
4
|
+
# Test toplevel and mnemonic activation in the presence of
|
5
|
+
# multiple notebooks, nested notebooks, and traversal-enabled
|
6
|
+
# notebooks that have been destroyed.
|
7
|
+
#
|
8
|
+
|
9
|
+
package require tile
|
10
|
+
|
11
|
+
bind TNotebook <Control-KeyPress-F4> { destroy [%W select] }
|
12
|
+
bind TNotebook <Shift-KeyPress-F4> { destroy %W }
|
13
|
+
# Argh. Shift-KeyPress-Fn bindings don't work under XFree
|
14
|
+
bind TNotebook <Control-KeyPress-F3> { destroy %W }
|
15
|
+
|
16
|
+
set pw [ttk::panedwindow .pw -orient vertical]
|
17
|
+
|
18
|
+
foreach nb {.pw.nb1 .pw.nb2} {
|
19
|
+
$pw add [ttk::notebook $nb] -weight 1
|
20
|
+
ttk::notebook::enableTraversal $nb
|
21
|
+
foreach {k} {foo bar qux} {
|
22
|
+
set label [string totitle $k]
|
23
|
+
$nb add [ttk::button $nb.$k -text $label \
|
24
|
+
-command [list destroy $nb.$k]] \
|
25
|
+
-text $label -underline 0
|
26
|
+
}
|
27
|
+
$nb add [ttk::notebook $nb.nested] -text Nested -underline 0
|
28
|
+
ttk::notebook::enableTraversal $nb.nested
|
29
|
+
foreach {k} {asdf zxcv uiop} {
|
30
|
+
set label [string totitle $k]
|
31
|
+
$nb.nested add [ttk::button $nb.nested.$k -text $label \
|
32
|
+
-command [list destroy $nb.nested.$k]] \
|
33
|
+
-text $label -underline 0
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
# Command frame:
|
38
|
+
#
|
39
|
+
option add *TButton.default normal
|
40
|
+
set cmd [ttk::frame .cmd]
|
41
|
+
grid x \
|
42
|
+
[ttk::button $cmd.ok -text OK -command [list destroy .]] \
|
43
|
+
[ttk::button $cmd.cancel -text Cancel -command [list destroy .]] \
|
44
|
+
-padx 6 -pady 6 ;
|
45
|
+
grid columnconfigure $cmd 0 -weight 1
|
46
|
+
keynav::defaultButton $cmd.ok
|
47
|
+
bind . <KeyPress-Escape> [list event generate $cmd.cancel <<Invoke>>]
|
48
|
+
|
49
|
+
# Status bar
|
50
|
+
#
|
51
|
+
set status [ttk::frame .status -class Statusbar]
|
52
|
+
foreach v {focus key element} {
|
53
|
+
pack [ttk::label $status.$v -textvariable ::Status($v) -anchor w \
|
54
|
+
-width 20 -relief sunken -borderwidth 1] \
|
55
|
+
-side left -expand false -fill none
|
56
|
+
}
|
57
|
+
bind all <FocusIn> {+set ::Status(focus) "Focus: %W" }
|
58
|
+
bind all <KeyPress> {+set ::Status(key) "Key: %K" }
|
59
|
+
bind TNotebook <Motion> {
|
60
|
+
set ::Status(element) "[%W identify %x %y] [%W index @%x,%y]"
|
61
|
+
}
|
62
|
+
|
63
|
+
pack $status -side bottom -expand false -fill x
|
64
|
+
pack $cmd -side bottom -expand false -fill x
|
65
|
+
pack $pw -side top -expand true -fill both
|
66
|
+
|
@@ -0,0 +1,500 @@
|
|
1
|
+
#
|
2
|
+
# notebook.test,v 1.26 2007/11/25 18:09:51 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
|
+
test notebook-1.0 "Setup" -body {
|
13
|
+
ttk::notebook .nb
|
14
|
+
} -result .nb
|
15
|
+
|
16
|
+
#
|
17
|
+
# Error handling tests:
|
18
|
+
#
|
19
|
+
test notebook-1.1 "Cannot add ancestor" -body {
|
20
|
+
.nb add .
|
21
|
+
} -returnCodes error -result "*" -match glob
|
22
|
+
|
23
|
+
proc inoperative {args} {}
|
24
|
+
|
25
|
+
inoperative test notebook-1.2 "Cannot add siblings" -body {
|
26
|
+
# This is legal now
|
27
|
+
.nb add [frame .sibling]
|
28
|
+
} -returnCodes error -result "*" -match glob
|
29
|
+
|
30
|
+
test notebook-1.3 "Cannot add toplevel" -body {
|
31
|
+
.nb add [toplevel .nb.t]
|
32
|
+
} -cleanup {
|
33
|
+
destroy .t.nb
|
34
|
+
} -returnCodes 1 -match glob -result "can't add .nb.t*"
|
35
|
+
|
36
|
+
test notebook-1.4 "Try to select bad tab" -body {
|
37
|
+
.nb select @6000,6000
|
38
|
+
} -returnCodes 1 -match glob -result "* not found"
|
39
|
+
|
40
|
+
#
|
41
|
+
# Now add stuff:
|
42
|
+
#
|
43
|
+
test notebook-2.0 "Add children" -body {
|
44
|
+
pack .nb -expand true -fill both
|
45
|
+
.nb add [frame .nb.foo] -text "Foo"
|
46
|
+
pack [label .nb.foo.l -text "Foo"]
|
47
|
+
|
48
|
+
.nb add [frame .nb.bar -relief raised -borderwidth 2] -text "Bar"
|
49
|
+
pack [label .nb.bar.l -text "Bar"]
|
50
|
+
|
51
|
+
.nb tabs
|
52
|
+
} -result [list .nb.foo .nb.bar]
|
53
|
+
|
54
|
+
test notebook-2.1 "select pane" -body {
|
55
|
+
.nb select .nb.foo
|
56
|
+
update
|
57
|
+
list [winfo viewable .nb.foo] [winfo viewable .nb.bar] [.nb index current]
|
58
|
+
} -result [list 1 0 0]
|
59
|
+
|
60
|
+
test notebook-2.2 "select another pane" -body {
|
61
|
+
.nb select 1
|
62
|
+
update
|
63
|
+
list [winfo viewable .nb.foo] [winfo viewable .nb.bar] [.nb index current]
|
64
|
+
} -result [list 0 1 1]
|
65
|
+
|
66
|
+
test notebook-2.3 "tab - get value" -body {
|
67
|
+
.nb tab .nb.foo -text
|
68
|
+
} -result "Foo"
|
69
|
+
|
70
|
+
test notebook-2.4 "tab - set value" -body {
|
71
|
+
.nb tab .nb.foo -text "Changed Foo"
|
72
|
+
.nb tab .nb.foo -text
|
73
|
+
} -result "Changed Foo"
|
74
|
+
|
75
|
+
test notebook-2.5 "tab - get all options" -body {
|
76
|
+
.nb tab .nb.foo
|
77
|
+
} -result [list \
|
78
|
+
-padding 0 -sticky nsew \
|
79
|
+
-state normal -text "Changed Foo" -image "" -compound none -underline -1]
|
80
|
+
|
81
|
+
test notebook-4.1 "Test .nb index end" -body {
|
82
|
+
.nb index end
|
83
|
+
} -result 2
|
84
|
+
|
85
|
+
test notebook-4.2 "'end' is not a selectable index" -body {
|
86
|
+
.nb select end
|
87
|
+
} -returnCodes error -result "*" -match glob
|
88
|
+
|
89
|
+
test notebook-4.3 "Select index out of range" -body {
|
90
|
+
.nb select 2
|
91
|
+
} -returnCodes error -result "*" -match glob
|
92
|
+
|
93
|
+
test notebook-4.4 "-padding option" -body {
|
94
|
+
.nb configure -padding "5 5 5 5"
|
95
|
+
}
|
96
|
+
|
97
|
+
test notebook-4.end "Cleanup test suite 1-4.*" -body { destroy .nb }
|
98
|
+
|
99
|
+
test notebook-5.1 "Virtual events" -body {
|
100
|
+
toplevel .t
|
101
|
+
set ::events [list]
|
102
|
+
bind .t <<NotebookTabChanged>> { lappend events changed %W }
|
103
|
+
|
104
|
+
pack [set nb [ttk::notebook .t.nb]] -expand true -fill both; update
|
105
|
+
$nb add [frame $nb.f1]
|
106
|
+
$nb add [frame $nb.f2]
|
107
|
+
$nb add [frame $nb.f3]
|
108
|
+
|
109
|
+
$nb select $nb.f1
|
110
|
+
update; set events
|
111
|
+
} -result [list changed .t.nb]
|
112
|
+
|
113
|
+
test notebook-5.2 "Virtual events, continued" -body {
|
114
|
+
set events [list]
|
115
|
+
$nb select $nb.f3
|
116
|
+
update ; set events
|
117
|
+
} -result [list changed .t.nb]
|
118
|
+
# OR: [list deselected .t.nb.f1 selected .t.nb.f3 changed .t.nb]
|
119
|
+
|
120
|
+
test notebook-5.3 "Disabled tabs" -body {
|
121
|
+
set events [list]
|
122
|
+
$nb tab $nb.f2 -state disabled
|
123
|
+
$nb select $nb.f2
|
124
|
+
update
|
125
|
+
list $events [$nb index current]
|
126
|
+
} -result [list [list] 2]
|
127
|
+
|
128
|
+
test notebook-5.4 "Reenable tab" -body {
|
129
|
+
set events [list]
|
130
|
+
$nb tab $nb.f2 -state normal
|
131
|
+
$nb select $nb.f2
|
132
|
+
update
|
133
|
+
list $events [$nb index current]
|
134
|
+
} -result [list [list changed .t.nb] 1]
|
135
|
+
|
136
|
+
test notebook-5.end "Virtual events, cleanup" -body { destroy .t }
|
137
|
+
|
138
|
+
test notebook-6.0 "Select hidden tab" -setup {
|
139
|
+
set nb [ttk::notebook .nb]
|
140
|
+
$nb add [ttk::frame $nb.f1]
|
141
|
+
$nb add [ttk::frame $nb.f2]
|
142
|
+
$nb select $nb.f2
|
143
|
+
} -cleanup {
|
144
|
+
destroy $nb
|
145
|
+
} -body {
|
146
|
+
set result [list]
|
147
|
+
$nb tab $nb.f1 -state hidden
|
148
|
+
lappend result [$nb tab $nb.f1 -state]
|
149
|
+
$nb select $nb.f1
|
150
|
+
lappend result [$nb tab $nb.f1 -state]
|
151
|
+
} -result [list hidden normal]
|
152
|
+
|
153
|
+
test notebook-6.1 "Hide selected tab" -setup {
|
154
|
+
pack [set nb [ttk::notebook .nb]] ; update
|
155
|
+
$nb add [ttk::frame $nb.f1]
|
156
|
+
$nb add [ttk::frame $nb.f2]
|
157
|
+
$nb add [ttk::frame $nb.f3]
|
158
|
+
$nb select $nb.f2
|
159
|
+
} -cleanup {
|
160
|
+
destroy $nb
|
161
|
+
} -body {
|
162
|
+
set result [list]
|
163
|
+
lappend result [$nb index current] [winfo ismapped $nb.f2]
|
164
|
+
$nb hide $nb.f2
|
165
|
+
lappend result [$nb index current] [winfo ismapped $nb.f2]
|
166
|
+
update idletasks; lappend result [winfo ismapped $nb.f3]
|
167
|
+
} -result [list 1 1 2 0 1]
|
168
|
+
|
169
|
+
# See 1370833
|
170
|
+
test notebook-6.2 "Forget selected tab" -setup {
|
171
|
+
ttk::notebook .n
|
172
|
+
pack .n
|
173
|
+
label .n.l -text abc
|
174
|
+
.n add .n.l
|
175
|
+
} -body {
|
176
|
+
update
|
177
|
+
after 100
|
178
|
+
.n forget .n.l
|
179
|
+
update ;# Yowch!
|
180
|
+
} -cleanup {
|
181
|
+
destroy .n
|
182
|
+
} -result {}
|
183
|
+
|
184
|
+
test notebook-6.3 "Hide first tab when it's the current" -setup {
|
185
|
+
pack [set nb [ttk::notebook .nb]] ; update
|
186
|
+
$nb add [ttk::frame $nb.f1]
|
187
|
+
$nb add [ttk::frame $nb.f2]
|
188
|
+
$nb add [ttk::frame $nb.f3]
|
189
|
+
$nb select $nb.f1
|
190
|
+
} -cleanup {
|
191
|
+
destroy $nb
|
192
|
+
} -body {
|
193
|
+
set result [list]
|
194
|
+
lappend result [$nb index current] [winfo ismapped $nb.f1]
|
195
|
+
$nb hide $nb.f1
|
196
|
+
lappend result [$nb index current] [winfo ismapped $nb.f1]
|
197
|
+
} -result [list 0 1 1 0]
|
198
|
+
|
199
|
+
test notebook-6.4 "Forget first tab when it's the current" -setup {
|
200
|
+
pack [set nb [ttk::notebook .nb]] ; update
|
201
|
+
$nb add [ttk::frame $nb.f1]
|
202
|
+
$nb add [ttk::frame $nb.f2]
|
203
|
+
$nb add [ttk::frame $nb.f3]
|
204
|
+
$nb select $nb.f1
|
205
|
+
} -cleanup {
|
206
|
+
destroy $nb
|
207
|
+
} -body {
|
208
|
+
set result [list]
|
209
|
+
lappend result [$nb index current] [winfo ismapped $nb.f1]
|
210
|
+
$nb forget $nb.f1
|
211
|
+
lappend result [$nb index current] [winfo ismapped $nb.f1]
|
212
|
+
} -result [list 0 1 0 0]
|
213
|
+
|
214
|
+
test notebook-6.5 "Hide last tab when it's the current" -setup {
|
215
|
+
pack [set nb [ttk::notebook .nb]] ; update
|
216
|
+
$nb add [ttk::frame $nb.f1]
|
217
|
+
$nb add [ttk::frame $nb.f2]
|
218
|
+
$nb add [ttk::frame $nb.f3]
|
219
|
+
$nb select $nb.f3
|
220
|
+
} -cleanup {
|
221
|
+
destroy $nb
|
222
|
+
} -body {
|
223
|
+
set result [list]
|
224
|
+
lappend result [$nb index current] [winfo ismapped $nb.f3]
|
225
|
+
$nb hide $nb.f3
|
226
|
+
lappend result [$nb index current] [winfo ismapped $nb.f3]
|
227
|
+
} -result [list 2 1 1 0]
|
228
|
+
|
229
|
+
test notebook-6.6 "Forget a middle tab when it's the current" -setup {
|
230
|
+
pack [set nb [ttk::notebook .nb]] ; update
|
231
|
+
$nb add [ttk::frame $nb.f1]
|
232
|
+
$nb add [ttk::frame $nb.f2]
|
233
|
+
$nb add [ttk::frame $nb.f3]
|
234
|
+
$nb select $nb.f2
|
235
|
+
} -cleanup {
|
236
|
+
destroy $nb
|
237
|
+
} -body {
|
238
|
+
set result [list]
|
239
|
+
lappend result [$nb index current] [winfo ismapped $nb.f2]
|
240
|
+
$nb forget $nb.f2
|
241
|
+
lappend result [$nb index current] [winfo ismapped $nb.f2]
|
242
|
+
} -result [list 1 1 1 0]
|
243
|
+
|
244
|
+
test notebook-6.7 "Hide a middle tab when it's the current" -setup {
|
245
|
+
pack [set nb [ttk::notebook .nb]]; update
|
246
|
+
$nb add [ttk::frame $nb.f1]
|
247
|
+
$nb add [ttk::frame $nb.f2]
|
248
|
+
$nb add [ttk::frame $nb.f3]
|
249
|
+
$nb select $nb.f2
|
250
|
+
} -cleanup {
|
251
|
+
destroy $nb
|
252
|
+
} -body {
|
253
|
+
set result [list]
|
254
|
+
lappend result [$nb index current] [winfo ismapped $nb.f2]
|
255
|
+
$nb hide $nb.f2
|
256
|
+
lappend result [$nb index current] [winfo ismapped $nb.f2]
|
257
|
+
} -result [list 1 1 2 0]
|
258
|
+
|
259
|
+
test notebook-6.8 "Forget a non-current tab < current" -setup {
|
260
|
+
pack [set nb [ttk::notebook .nb]] ; update
|
261
|
+
$nb add [ttk::frame $nb.f1]
|
262
|
+
$nb add [ttk::frame $nb.f2]
|
263
|
+
$nb add [ttk::frame $nb.f3]
|
264
|
+
$nb select $nb.f2
|
265
|
+
} -cleanup {
|
266
|
+
destroy $nb
|
267
|
+
} -body {
|
268
|
+
set result [list]
|
269
|
+
lappend result [$nb index current] [winfo ismapped $nb.f2]
|
270
|
+
$nb forget $nb.f1
|
271
|
+
lappend result [$nb index current] [winfo ismapped $nb.f2]
|
272
|
+
} -result [list 1 1 0 1]
|
273
|
+
|
274
|
+
test notebook-6.9 "Hide a non-current tab < current" -setup {
|
275
|
+
pack [set nb [ttk::notebook .nb]] ; update
|
276
|
+
$nb add [ttk::frame $nb.f1]
|
277
|
+
$nb add [ttk::frame $nb.f2]
|
278
|
+
$nb add [ttk::frame $nb.f3]
|
279
|
+
$nb select $nb.f2
|
280
|
+
} -cleanup {
|
281
|
+
destroy $nb
|
282
|
+
} -body {
|
283
|
+
set result [list]
|
284
|
+
lappend result [$nb index current] [winfo ismapped $nb.f2]
|
285
|
+
$nb hide $nb.f1
|
286
|
+
lappend result [$nb index current] [winfo ismapped $nb.f2]
|
287
|
+
} -result [list 1 1 1 1]
|
288
|
+
|
289
|
+
test notebook-6.10 "Forget a non-current tab > current" -setup {
|
290
|
+
pack [set nb [ttk::notebook .nb]] ; update
|
291
|
+
$nb add [ttk::frame $nb.f1]
|
292
|
+
$nb add [ttk::frame $nb.f2]
|
293
|
+
$nb add [ttk::frame $nb.f3]
|
294
|
+
$nb select $nb.f2
|
295
|
+
} -cleanup {
|
296
|
+
destroy $nb
|
297
|
+
} -body {
|
298
|
+
set result [list]
|
299
|
+
lappend result [$nb index current] [winfo ismapped $nb.f2]
|
300
|
+
$nb forget $nb.f3
|
301
|
+
lappend result [$nb index current] [winfo ismapped $nb.f2]
|
302
|
+
} -result [list 1 1 1 1]
|
303
|
+
|
304
|
+
test notebook-6.11 "Hide a non-current tab > current" -setup {
|
305
|
+
pack [set nb [ttk::notebook .nb]]; update
|
306
|
+
$nb add [ttk::frame $nb.f1]
|
307
|
+
$nb add [ttk::frame $nb.f2]
|
308
|
+
$nb add [ttk::frame $nb.f3]
|
309
|
+
$nb select $nb.f2
|
310
|
+
} -cleanup {
|
311
|
+
destroy $nb
|
312
|
+
} -body {
|
313
|
+
set result [list]
|
314
|
+
lappend result [$nb index current] [winfo ismapped $nb.f2]
|
315
|
+
$nb hide $nb.f3
|
316
|
+
lappend result [$nb index current] [winfo ismapped $nb.f2]
|
317
|
+
} -result [list 1 1 1 1]
|
318
|
+
|
319
|
+
test notebook-6.12 "Hide and re-add a tab" -setup {
|
320
|
+
pack [set nb [ttk::notebook .nb]]; update
|
321
|
+
$nb add [ttk::frame $nb.f1]
|
322
|
+
$nb add [ttk::frame $nb.f2]
|
323
|
+
$nb add [ttk::frame $nb.f3]
|
324
|
+
$nb select $nb.f2
|
325
|
+
} -cleanup {
|
326
|
+
destroy $nb
|
327
|
+
} -body {
|
328
|
+
set result [list]
|
329
|
+
lappend result [$nb index current] [$nb tab $nb.f2 -state]
|
330
|
+
$nb hide $nb.f2
|
331
|
+
lappend result [$nb index current] [$nb tab $nb.f2 -state]
|
332
|
+
$nb add $nb.f2
|
333
|
+
lappend result [$nb index current] [$nb tab $nb.f2 -state]
|
334
|
+
} -result [list 1 normal 2 hidden 2 normal]
|
335
|
+
|
336
|
+
#
|
337
|
+
# Insert:
|
338
|
+
#
|
339
|
+
unset nb
|
340
|
+
test notebook-7.0 "insert - setup" -body {
|
341
|
+
pack [ttk::notebook .nb]
|
342
|
+
for {set i 0} {$i < 5} {incr i} {
|
343
|
+
.nb add [ttk::frame .nb.f$i] -text "$i"
|
344
|
+
}
|
345
|
+
.nb select .nb.f1
|
346
|
+
list [.nb index current] [.nb tabs]
|
347
|
+
} -result [list 1 [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4]]
|
348
|
+
|
349
|
+
test notebook-7.1 "insert - move backwards" -body {
|
350
|
+
.nb insert 1 3
|
351
|
+
list [.nb index current] [.nb tabs]
|
352
|
+
} -result [list 2 [list .nb.f0 .nb.f3 .nb.f1 .nb.f2 .nb.f4]]
|
353
|
+
|
354
|
+
test notebook-7.2 "insert - move backwards again" -body {
|
355
|
+
.nb insert 1 3
|
356
|
+
list [.nb index current] [.nb tabs]
|
357
|
+
} -result [list 3 [list .nb.f0 .nb.f2 .nb.f3 .nb.f1 .nb.f4]]
|
358
|
+
|
359
|
+
test notebook-7.3 "insert - move backwards again" -body {
|
360
|
+
.nb insert 1 3
|
361
|
+
list [.nb index current] [.nb tabs]
|
362
|
+
} -result [list 1 [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4]]
|
363
|
+
|
364
|
+
test notebook-7.4 "insert - move forwards" -body {
|
365
|
+
.nb insert 3 1
|
366
|
+
list [.nb index current] [.nb tabs]
|
367
|
+
} -result [list 3 [list .nb.f0 .nb.f2 .nb.f3 .nb.f1 .nb.f4]]
|
368
|
+
|
369
|
+
test notebook-7.5 "insert - move forwards again" -body {
|
370
|
+
.nb insert 3 1
|
371
|
+
list [.nb index current] [.nb tabs]
|
372
|
+
} -result [list 2 [list .nb.f0 .nb.f3 .nb.f1 .nb.f2 .nb.f4]]
|
373
|
+
|
374
|
+
test notebook-7.6 "insert - move forwards again" -body {
|
375
|
+
.nb insert 3 1
|
376
|
+
list [.nb index current] [.nb tabs]
|
377
|
+
} -result [list 1 [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4]]
|
378
|
+
|
379
|
+
test notebook-7.7a "insert - current tab undisturbed" -body {
|
380
|
+
.nb select 0
|
381
|
+
.nb insert 3 1
|
382
|
+
.nb index current
|
383
|
+
} -result 0
|
384
|
+
|
385
|
+
test notebook-7.7b "insert - current tab undisturbed" -body {
|
386
|
+
.nb select 0
|
387
|
+
.nb insert 1 3
|
388
|
+
.nb index current
|
389
|
+
} -result 0
|
390
|
+
|
391
|
+
test notebook-7.7c "insert - current tab undisturbed" -body {
|
392
|
+
.nb select 4
|
393
|
+
.nb insert 3 1
|
394
|
+
.nb index current
|
395
|
+
} -result 4
|
396
|
+
|
397
|
+
test notebook-7.7d "insert - current tab undisturbed" -body {
|
398
|
+
.nb select 4
|
399
|
+
.nb insert 1 3
|
400
|
+
.nb index current
|
401
|
+
} -result 4
|
402
|
+
|
403
|
+
test notebook-7.8a "move tabs - current tab undisturbed - exhaustive" -body {
|
404
|
+
.nb select .nb.f0
|
405
|
+
foreach i {0 1 2 3 4} {
|
406
|
+
.nb insert $i .nb.f$i
|
407
|
+
}
|
408
|
+
|
409
|
+
foreach i {0 1 2 3 4} {
|
410
|
+
.nb select .nb.f$i
|
411
|
+
foreach j {0 1 2 3 4} {
|
412
|
+
foreach k {0 1 2 3 4} {
|
413
|
+
.nb insert $j $k
|
414
|
+
set current [lindex [.nb tabs] [.nb index current]]
|
415
|
+
if {$current != ".nb.f$i"} {
|
416
|
+
error "($i,$j,$k) current = $current"
|
417
|
+
}
|
418
|
+
.nb insert $k $j
|
419
|
+
if {[.nb tabs] ne [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4]} {
|
420
|
+
error "swap $j $k; swap $k $j => [.nb tabs]"
|
421
|
+
}
|
422
|
+
}
|
423
|
+
}
|
424
|
+
}
|
425
|
+
.nb tabs
|
426
|
+
} -result [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4]
|
427
|
+
|
428
|
+
test notebook-7.8b "insert new - current tab undisturbed - exhaustive" -body {
|
429
|
+
foreach i {0 1 2 3 4} {
|
430
|
+
.nb select .nb.f$i
|
431
|
+
foreach j {0 1 2 3 4} {
|
432
|
+
.nb select .nb.f$i
|
433
|
+
.nb insert $j [frame .nb.newf]
|
434
|
+
set current [lindex [.nb tabs] [.nb index current]]
|
435
|
+
if {$current != ".nb.f$i"} {
|
436
|
+
puts stderr "new tab at $j, current = $current, expect .nb.f$i"
|
437
|
+
}
|
438
|
+
destroy .nb.newf
|
439
|
+
if {[.nb tabs] ne [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4]} {
|
440
|
+
error "tabs disturbed"
|
441
|
+
}
|
442
|
+
}
|
443
|
+
}
|
444
|
+
}
|
445
|
+
|
446
|
+
test notebook-7.end "insert - cleanup" -body {
|
447
|
+
destroy .nb
|
448
|
+
}
|
449
|
+
|
450
|
+
test notebook-1817596-1 "insert should autoselect first tab" -body {
|
451
|
+
pack [ttk::notebook .nb]
|
452
|
+
list \
|
453
|
+
[.nb insert end [ttk::label .nb.l1 -text One] -text One] \
|
454
|
+
[.nb select] \
|
455
|
+
;
|
456
|
+
} -result [list "" .nb.l1] -cleanup { destroy .nb }
|
457
|
+
|
458
|
+
test notebook-1817596-2 "error in insert should have no effect" -body {
|
459
|
+
pack [ttk::notebook .nb]
|
460
|
+
.nb insert end [ttk::label .nb.l1]
|
461
|
+
.nb insert end [ttk::label .nb.l2]
|
462
|
+
list \
|
463
|
+
[catch { .nb insert .l2 0 -badoption badvalue } err] \
|
464
|
+
[.nb tabs] \
|
465
|
+
} -result [list 1 [list .nb.l1 .nb.l2]] -cleanup { destroy .nb }
|
466
|
+
|
467
|
+
test notebook-1817596-3 "insert/configure" -body {
|
468
|
+
pack [ttk::notebook .nb]
|
469
|
+
.nb insert end [ttk::label .nb.l0] -text "L0"
|
470
|
+
.nb insert end [ttk::label .nb.l1] -text "L1"
|
471
|
+
.nb insert end [ttk::label .nb.l2] -text "XX"
|
472
|
+
.nb insert 0 2 -text "L2"
|
473
|
+
|
474
|
+
list [.nb tabs] [.nb tab 0 -text] [.nb tab 1 -text] [.nb tab 2 -text]
|
475
|
+
|
476
|
+
} -result [list [list .nb.l2 .nb.l0 .nb.l1] L2 L0 L1] -cleanup { destroy .nb }
|
477
|
+
|
478
|
+
|
479
|
+
# See #1343984
|
480
|
+
test notebook-1343984-1 "don't autoselect on destroy - setup" -body {
|
481
|
+
ttk::notebook .nb
|
482
|
+
set ::history [list]
|
483
|
+
bind TestFrame <Map> { lappend history MAP %W }
|
484
|
+
bind TestFrame <Destroy> { lappend history DESTROY %W }
|
485
|
+
.nb add [ttk::frame .nb.frame1 -class TestFrame] -text "Frame 1"
|
486
|
+
.nb add [ttk::frame .nb.frame2 -class TestFrame] -text "Frame 2"
|
487
|
+
.nb add [ttk::frame .nb.frame3 -class TestFrame] -text "Frame 3"
|
488
|
+
pack .nb -fill both -expand 1
|
489
|
+
update
|
490
|
+
set ::history
|
491
|
+
} -result [list MAP .nb.frame1]
|
492
|
+
|
493
|
+
test notebook-1343984-2 "don't autoselect on destroy" -body {
|
494
|
+
set ::history [list]
|
495
|
+
destroy .nb
|
496
|
+
update
|
497
|
+
set ::history
|
498
|
+
} -result [list DESTROY .nb.frame1 DESTROY .nb.frame2 DESTROY .nb.frame3]
|
499
|
+
|
500
|
+
tcltest::cleanupTests
|