summaryrefslogtreecommitdiffstats
path: root/tests/ttk/notebook.test
diff options
context:
space:
mode:
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 de286f9..93b555e 100644
--- a/tests/ttk/notebook.test
+++ b/tests/ttk/notebook.test
@@ -1,5 +1,5 @@
#
-# $Id: notebook.test,v 1.1.2.2 2007/10/27 04:23:17 dgp Exp $
+# $Id: notebook.test,v 1.1.2.3 2007/11/25 19:19:22 dgp 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