summaryrefslogtreecommitdiffstats
path: root/tests/ttk/notebook.test
diff options
context:
space:
mode:
authorjenglish <jenglish@flightlab.com>2007-11-25 18:11:10 (GMT)
committerjenglish <jenglish@flightlab.com>2007-11-25 18:11:10 (GMT)
commit37a492a973a6293e2324e7a9d66dee21daf1d033 (patch)
tree22175f1ab591c35a78f6f7b5914368ecf10d3186 /tests/ttk/notebook.test
parent81e551c563bf0c2e7ba07e4b6f207bbae50242df (diff)
downloadtk-37a492a973a6293e2324e7a9d66dee21daf1d033.zip
tk-37a492a973a6293e2324e7a9d66dee21daf1d033.tar.gz
tk-37a492a973a6293e2324e7a9d66dee21daf1d033.tar.bz2
Internal Ttk_Manager API updates; Fixed [Bug 1343984];
Added [$nb hide] method; [$nb add] on already-managed windows no longer throws an error, can be used to re-add a hidden tab. Updated docs and test suite.
Diffstat (limited to 'tests/ttk/notebook.test')
-rw-r--r--tests/ttk/notebook.test56
1 files changed, 48 insertions, 8 deletions
diff --git a/tests/ttk/notebook.test b/tests/ttk/notebook.test
index b07ed30..8f97464 100644
--- a/tests/ttk/notebook.test
+++ b/tests/ttk/notebook.test
@@ -1,5 +1,5 @@
#
-# $Id: notebook.test,v 1.3 2007/10/25 22:52:42 jenglish Exp $
+# $Id: notebook.test,v 1.4 2007/11/25 18:11:13 jenglish Exp $
#
package require Tk 8.5
@@ -158,9 +158,10 @@ test notebook-6.1 "Hide selected tab" -setup {
} -body {
set result [list]
lappend result [$nb index current] [winfo ismapped $nb.f2]
- $nb tab $nb.f2 -state hidden
+ $nb hide $nb.f2
lappend result [$nb index current] [winfo ismapped $nb.f2]
-} -result [list 1 1 2 0]
+ update idletasks; lappend result [winfo ismapped $nb.f3]
+} -result [list 1 1 2 0 1]
# See 1370833
test notebook-6.2 "Forget selected tab" -setup {
@@ -188,7 +189,7 @@ test notebook-6.3 "Hide first tab when it's the current" -setup {
} -body {
set result [list]
lappend result [$nb index current] [winfo ismapped $nb.f1]
- $nb tab $nb.f1 -state hidden
+ $nb hide $nb.f1
lappend result [$nb index current] [winfo ismapped $nb.f1]
} -result [list 0 1 1 0]
@@ -218,7 +219,7 @@ test notebook-6.5 "Hide last tab when it's the current" -setup {
} -body {
set result [list]
lappend result [$nb index current] [winfo ismapped $nb.f3]
- $nb tab $nb.f3 -state hidden
+ $nb hide $nb.f3
lappend result [$nb index current] [winfo ismapped $nb.f3]
} -result [list 2 1 1 0]
@@ -248,7 +249,7 @@ test notebook-6.7 "Hide a middle tab when it's the current" -setup {
} -body {
set result [list]
lappend result [$nb index current] [winfo ismapped $nb.f2]
- $nb tab $nb.f2 -state hidden
+ $nb hide $nb.f2
lappend result [$nb index current] [winfo ismapped $nb.f2]
} -result [list 1 1 2 0]
@@ -278,7 +279,7 @@ test notebook-6.9 "Hide a non-current tab < current" -setup {
} -body {
set result [list]
lappend result [$nb index current] [winfo ismapped $nb.f2]
- $nb tab $nb.f1 -state hidden
+ $nb hide $nb.f1
lappend result [$nb index current] [winfo ismapped $nb.f2]
} -result [list 1 1 1 1]
@@ -308,10 +309,27 @@ test notebook-6.11 "Hide a non-current tab > current" -setup {
} -body {
set result [list]
lappend result [$nb index current] [winfo ismapped $nb.f2]
- $nb tab $nb.f3 -state hidden
+ $nb hide $nb.f3
lappend result [$nb index current] [winfo ismapped $nb.f2]
} -result [list 1 1 1 1]
+test notebook-6.12 "Hide and re-add a tab" -setup {
+ pack [set nb [ttk::notebook .nb]]; update
+ $nb add [ttk::frame $nb.f1]
+ $nb add [ttk::frame $nb.f2]
+ $nb add [ttk::frame $nb.f3]
+ $nb select $nb.f2
+} -cleanup {
+ destroy $nb
+} -body {
+ set result [list]
+ lappend result [$nb index current] [$nb tab $nb.f2 -state]
+ $nb hide $nb.f2
+ lappend result [$nb index current] [$nb tab $nb.f2 -state]
+ $nb add $nb.f2
+ lappend result [$nb index current] [$nb tab $nb.f2 -state]
+} -result [list 1 normal 2 hidden 2 normal]
+
#
# Insert:
#
@@ -454,4 +472,26 @@ test notebook-1817596-3 "insert/configure" -body {
} -result [list [list .nb.l2 .nb.l0 .nb.l1] L2 L0 L1] -cleanup { destroy .nb }
+
+# See #1343984
+test notebook-1343984-1 "don't autoselect on destroy - setup" -body {
+ ttk::notebook .nb
+ set ::history [list]
+ bind TestFrame <Map> { lappend history MAP %W }
+ bind TestFrame <Destroy> { lappend history DESTROY %W }
+ .nb add [ttk::frame .nb.frame1 -class TestFrame] -text "Frame 1"
+ .nb add [ttk::frame .nb.frame2 -class TestFrame] -text "Frame 2"
+ .nb add [ttk::frame .nb.frame3 -class TestFrame] -text "Frame 3"
+ pack .nb -fill both -expand 1
+ update
+ set ::history
+} -result [list MAP .nb.frame1]
+
+test notebook-1343984-2 "don't autoselect on destroy" -body {
+ set ::history [list]
+ destroy .nb
+ update
+ set ::history
+} -result [list DESTROY .nb.frame1 DESTROY .nb.frame2 DESTROY .nb.frame3]
+
tcltest::cleanupTests