head	1.5;
access;
symbols
	core-8-5-9:1.5
	core-8-5-8:1.5
	macosx-cocoa-merge:1.5
	macosx-cocoa-premerge:1.5
	macosx-carbon-freeze:1.5
	core-8-5-7:1.5
	core-8-5-6:1.5
	core-8-6-b1:1.5
	core-8-6-a3:1.5
	core-8-5-5:1.5
	core-8-6-a2:1.5
	core-8-5-4:1.5
	core-8-5-3:1.5
	core-8-6-a1:1.5
	core-8-5-branch:1.5.0.2
	core-8-5-2:1.5
	core-8-5-1:1.5
	core-8-5-0:1.5
	core-8-5-b3:1.3
	core-8-5-b2:1.3
	core-8-5-b1:1.2
	core-stablilizer-merge:1.2
	core-stabilizer-branch:1.1.0.2
	core-stabilizer-merge:1.5
	core-8-5-a6:1.1;
locks; strict;
comment	@# @;


1.5
date	2007.12.13.15.28.49;	author dgp;	state Exp;
branches;
next	1.4;

1.4
date	2007.11.25.18.11.13;	author jenglish;	state Exp;
branches;
next	1.3;

1.3
date	2007.10.25.22.52.42;	author jenglish;	state Exp;
branches;
next	1.2;

1.2
date	2007.06.09.21.45.45;	author jenglish;	state Exp;
branches;
next	1.1;

1.1
date	2006.10.31.01.42.27;	author hobbs;	state Exp;
branches
	1.1.2.1;
next	;

1.1.2.1
date	2007.06.12.16.22.43;	author dgp;	state Exp;
branches;
next	1.1.2.2;

1.1.2.2
date	2007.10.27.04.23.17;	author dgp;	state Exp;
branches;
next	1.1.2.3;

1.1.2.3
date	2007.11.25.19.19.22;	author dgp;	state Exp;
branches;
next	;


desc
@@


1.5
log
@merge stable branch onto HEAD
@
text
@#
# $Id: notebook.test,v 1.1.2.3 2007/11/25 19:19:22 dgp Exp $
#

package require Tk 8.5
package require tcltest ; namespace import -force tcltest::*
loadTestedCommands

test notebook-1.0 "Setup" -body {
    ttk::notebook .nb
} -result .nb

#
# Error handling tests:
#
test notebook-1.1 "Cannot add ancestor" -body {
    .nb add .
} -returnCodes error -result "*" -match glob

proc inoperative {args} {}

inoperative test notebook-1.2 "Cannot add siblings" -body {
    # This is legal now
    .nb add [frame .sibling]
} -returnCodes error -result "*" -match glob

test notebook-1.3 "Cannot add toplevel" -body {
    .nb add [toplevel .nb.t]
} -cleanup {
    destroy .t.nb
} -returnCodes 1 -match glob -result "can't add .nb.t*"

test notebook-1.4 "Try to select bad tab" -body {
    .nb select @@6000,6000
} -returnCodes 1 -match glob -result "* not found"

#
# Now add stuff:
#
test notebook-2.0 "Add children" -body {
    pack .nb -expand true -fill both
    .nb add [frame .nb.foo] -text "Foo"
    pack [label .nb.foo.l -text "Foo"]

    .nb add [frame .nb.bar -relief raised -borderwidth 2] -text "Bar"
    pack [label .nb.bar.l -text "Bar"]

    .nb tabs
} -result [list .nb.foo .nb.bar]

test notebook-2.1 "select pane" -body {
    .nb select .nb.foo
    update
    list [winfo viewable .nb.foo] [winfo viewable .nb.bar] [.nb index current]
} -result [list 1 0 0]

test notebook-2.2 "select another pane" -body {
    .nb select 1
    update
    list [winfo viewable .nb.foo] [winfo viewable .nb.bar] [.nb index current]
} -result [list 0 1 1]

test notebook-2.3 "tab - get value" -body {
    .nb tab .nb.foo -text
} -result "Foo"

test notebook-2.4 "tab - set value" -body {
    .nb tab .nb.foo -text "Changed Foo"
    .nb tab .nb.foo -text
} -result "Changed Foo"

test notebook-2.5 "tab - get all options" -body {
    .nb tab .nb.foo
} -result [list \
    -padding 0 -sticky nsew \
    -state normal -text "Changed Foo" -image "" -compound none -underline -1]

test notebook-4.1 "Test .nb index end" -body {
    .nb index end
} -result 2

test notebook-4.2 "'end' is not a selectable index" -body {
    .nb select end
} -returnCodes error -result "*" -match glob

test notebook-4.3 "Select index out of range" -body {
    .nb select 2
} -returnCodes error -result "*" -match glob

test notebook-4.4 "-padding option" -body {
    .nb configure -padding "5 5 5 5"
}

test notebook-4.end "Cleanup test suite 1-4.*" -body { destroy .nb }

test notebook-5.1 "Virtual events" -body {
    toplevel .t
    set ::events [list]
    bind .t <<NotebookTabChanged>> { lappend events changed %W }

    pack [set nb [ttk::notebook .t.nb]] -expand true -fill both; update
    $nb add [frame $nb.f1]
    $nb add [frame $nb.f2]
    $nb add [frame $nb.f3]

    $nb select $nb.f1
    update; set events
} -result [list changed .t.nb]

test notebook-5.2 "Virtual events, continued" -body {
    set events [list]
    $nb select $nb.f3
    update ; set events
} -result [list changed .t.nb]
# OR: [list deselected .t.nb.f1 selected .t.nb.f3 changed .t.nb]

test notebook-5.3 "Disabled tabs" -body {
    set events [list]
    $nb tab $nb.f2 -state disabled
    $nb select $nb.f2
    update
    list $events [$nb index current]
} -result [list [list] 2]

test notebook-5.4 "Reenable tab" -body {
    set events [list]
    $nb tab $nb.f2 -state normal
    $nb select $nb.f2
    update
    list $events [$nb index current]
} -result [list [list changed .t.nb] 1]

test notebook-5.end "Virtual events, cleanup" -body { destroy .t }

test notebook-6.0 "Select hidden tab" -setup {
    set nb [ttk::notebook .nb]
    $nb add [ttk::frame $nb.f1]
    $nb add [ttk::frame $nb.f2]
    $nb select $nb.f2
} -cleanup  {
    destroy $nb
} -body {
    set result [list]
    $nb tab $nb.f1 -state hidden
    lappend result [$nb tab $nb.f1 -state]
    $nb select $nb.f1
    lappend result [$nb tab $nb.f1 -state]
} -result [list hidden normal]

test notebook-6.1 "Hide selected 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] [winfo ismapped $nb.f2]
    $nb hide $nb.f2
    lappend result [$nb index current] [winfo ismapped $nb.f2]
    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 {
    ttk::notebook .n
    pack .n
    label .n.l -text abc
    .n add .n.l
} -body {
    update
    after 100
    .n forget .n.l
    update		;# Yowch!
} -cleanup {
    destroy .n
} -result {}

test notebook-6.3 "Hide first tab when it's the current" -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.f1
} -cleanup  {
    destroy $nb
} -body {
    set result [list]
    lappend result [$nb index current] [winfo ismapped $nb.f1]
    $nb hide $nb.f1
    lappend result [$nb index current] [winfo ismapped $nb.f1]
} -result [list 0 1 1 0]

test notebook-6.4 "Forget first tab when it's the current" -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.f1
} -cleanup  {
    destroy $nb
} -body {
    set result [list]
    lappend result [$nb index current] [winfo ismapped $nb.f1]
    $nb forget $nb.f1
    lappend result [$nb index current] [winfo ismapped $nb.f1]
} -result [list 0 1 0 0]

test notebook-6.5 "Hide last tab when it's the current" -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.f3
} -cleanup  {
    destroy $nb
} -body {
    set result [list]
    lappend result [$nb index current] [winfo ismapped $nb.f3]
    $nb hide $nb.f3
    lappend result [$nb index current] [winfo ismapped $nb.f3]
} -result [list 2 1 1 0]

test notebook-6.6 "Forget a middle tab when it's the current" -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] [winfo ismapped $nb.f2]
    $nb forget $nb.f2
    lappend result [$nb index current] [winfo ismapped $nb.f2]
} -result [list 1 1 1 0]

test notebook-6.7 "Hide a middle tab when it's the current" -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] [winfo ismapped $nb.f2]
    $nb hide $nb.f2
    lappend result [$nb index current] [winfo ismapped $nb.f2]
} -result [list 1 1 2 0]

test notebook-6.8 "Forget a non-current tab < current" -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] [winfo ismapped $nb.f2]
    $nb forget $nb.f1
    lappend result [$nb index current] [winfo ismapped $nb.f2]
} -result [list 1 1 0 1]

test notebook-6.9 "Hide a non-current tab < current" -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] [winfo ismapped $nb.f2]
    $nb hide $nb.f1
    lappend result [$nb index current] [winfo ismapped $nb.f2]
} -result [list 1 1 1 1]

test notebook-6.10 "Forget a non-current tab > current" -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] [winfo ismapped $nb.f2]
    $nb forget $nb.f3
    lappend result [$nb index current] [winfo ismapped $nb.f2]
} -result [list 1 1 1 1]

test notebook-6.11 "Hide a non-current tab > current" -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] [winfo ismapped $nb.f2]
    $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:
#
unset nb
test notebook-7.0 "insert - setup" -body {
    pack [ttk::notebook .nb]
    for {set i 0} {$i < 5} {incr i} {
	.nb add [ttk::frame .nb.f$i] -text "$i"
    }
    .nb select .nb.f1
    list [.nb index current] [.nb tabs]
} -result [list 1 [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4]]

test notebook-7.1 "insert - move backwards" -body {
    .nb insert 1 3
    list [.nb index current] [.nb tabs]
} -result [list 2 [list .nb.f0 .nb.f3 .nb.f1 .nb.f2 .nb.f4]]

test notebook-7.2 "insert - move backwards again" -body {
    .nb insert 1 3
    list [.nb index current] [.nb tabs]
} -result [list 3 [list .nb.f0 .nb.f2 .nb.f3 .nb.f1 .nb.f4]]

test notebook-7.3 "insert - move backwards again" -body {
    .nb insert 1 3
    list [.nb index current] [.nb tabs]
} -result [list 1 [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4]]

test notebook-7.4 "insert - move forwards" -body {
    .nb insert 3 1
    list [.nb index current] [.nb tabs]
} -result [list 3 [list .nb.f0 .nb.f2 .nb.f3 .nb.f1 .nb.f4]]

test notebook-7.5 "insert - move forwards again" -body {
    .nb insert 3 1
    list [.nb index current] [.nb tabs]
} -result [list 2 [list .nb.f0 .nb.f3 .nb.f1 .nb.f2 .nb.f4]]

test notebook-7.6 "insert - move forwards again" -body {
    .nb insert 3 1
    list [.nb index current] [.nb tabs]
} -result [list 1 [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4]]

test notebook-7.7a "insert - current tab undisturbed" -body {
    .nb select 0
    .nb insert 3 1
    .nb index current
} -result 0

test notebook-7.7b "insert - current tab undisturbed" -body {
    .nb select 0
    .nb insert 1 3
    .nb index current
} -result 0

test notebook-7.7c "insert - current tab undisturbed" -body {
    .nb select 4
    .nb insert 3 1
    .nb index current
} -result 4

test notebook-7.7d "insert - current tab undisturbed" -body {
    .nb select 4
    .nb insert 1 3
    .nb index current
} -result 4

test notebook-7.8a "move tabs - current tab undisturbed - exhaustive" -body {
    .nb select .nb.f0
    foreach i {0 1 2 3 4} {
    	.nb insert $i .nb.f$i
    }

    foreach i {0 1 2 3 4} {
	.nb select .nb.f$i
	foreach j {0 1 2 3 4} {
	    foreach k {0 1 2 3 4} {
		.nb insert $j $k
		set current [lindex [.nb tabs] [.nb index current]]
		if {$current != ".nb.f$i"} {
		    error "($i,$j,$k) current = $current"
		}
		.nb insert $k $j
		if {[.nb tabs] ne [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4]} {
		    error "swap $j $k; swap $k $j => [.nb tabs]"
		}
	    }
	}
    }
    .nb tabs
} -result [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4]

test notebook-7.8b "insert new - current tab undisturbed - exhaustive" -body {
    foreach i {0 1 2 3 4} {
	.nb select .nb.f$i
	foreach j {0 1 2 3 4} {
.nb select .nb.f$i
	    .nb insert $j [frame .nb.newf]
	    set current [lindex [.nb tabs] [.nb index current]]
	    if {$current != ".nb.f$i"} {
		puts stderr "new tab at $j, current = $current, expect .nb.f$i"
	    }
	    destroy .nb.newf
	    if {[.nb tabs] ne [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4]} {
		error "tabs disturbed"
	    }
	}
    }
}

test notebook-7.end "insert - cleanup" -body {
    destroy .nb
}

test notebook-1817596-1 "insert should autoselect first tab" -body {
    pack [ttk::notebook .nb]
    list \
	[.nb insert end [ttk::label .nb.l1 -text One] -text One] \
	[.nb select] \
	;
} -result [list "" .nb.l1] -cleanup { destroy .nb }

test notebook-1817596-2 "error in insert should have no effect" -body {
    pack [ttk::notebook .nb]
    .nb insert end [ttk::label .nb.l1]
    .nb insert end [ttk::label .nb.l2]
    list \
    	[catch { .nb insert .l2 0 -badoption badvalue } err] \
	[.nb tabs] \
} -result [list 1 [list .nb.l1 .nb.l2]] -cleanup { destroy .nb }

test notebook-1817596-3 "insert/configure" -body {
    pack [ttk::notebook .nb]
    .nb insert end [ttk::label .nb.l0] -text "L0"
    .nb insert end [ttk::label .nb.l1] -text "L1"
    .nb insert end [ttk::label .nb.l2] -text "XX"
    .nb insert 0 2 -text "L2"

    list [.nb tabs] [.nb tab 0 -text] [.nb tab 1 -text] [.nb tab 2 -text]

} -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
@


1.4
log
@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.
@
text
@d2 1
a2 1
# $Id: notebook.test,v 1.3 2007/10/25 22:52:42 jenglish Exp $
@


1.3
log
@ttk::notebook: reworked [$nb insert] logic (fixes multiple bugs; see #1817596)
@
text
@d2 1
a2 1
# $Id: notebook.test,v 1.2 2007/06/09 21:45:45 jenglish Exp $
d161 1
a161 1
    $nb tab $nb.f2 -state hidden
d163 2
a164 1
} -result [list 1 1 2 0]
d192 1
a192 1
    $nb tab $nb.f1 -state hidden
d222 1
a222 1
    $nb tab $nb.f3 -state hidden
d252 1
a252 1
    $nb tab $nb.f2 -state hidden
d282 1
a282 1
    $nb tab $nb.f1 -state hidden
d312 1
a312 1
    $nb tab $nb.f3 -state hidden
d316 17
d475 22
@


1.2
log
@Ttk_Manager API overhaul:
    + Ttk_Manager no longer responsible for managing slave records
    + Ttk_Manager structure now opaque
    + Ttk_Slave structure now private
    + Pass Ttk_Manager * to Tk_GeomMgr hooks instead of Ttk_Slave *
ttk::labelframe: Simplified -labelwidget management.
ttk::noteboook 'insert' command didn't correctly maintain current tab.
Changed documentation of ttk::panedwindow 'identify' command to
match implementation.
@
text
@d2 1
a2 1
# $Id: notebook.test,v 1.1 2006/10/31 01:42:27 hobbs Exp $
a314 1

d429 28
@


1.1
log
@	* doc/ttk_Geometry.3, doc/ttk_Theme.3, doc/ttk_button.n:
	* doc/ttk_checkbutton.n, doc/ttk_combobox.n, doc/ttk_dialog.n:
	* doc/ttk_entry.n, doc/ttk_frame.n, doc/ttk_image.n:
	* doc/ttk_intro.n, doc/ttk_label.n, doc/ttk_labelframe.n:
	* doc/ttk_menubutton.n, doc/ttk_notebook.n, doc/ttk_panedwindow.n:
	* doc/ttk_progressbar.n, doc/ttk_radiobutton.n, doc/ttk_scrollbar.n:
	* doc/ttk_separator.n, doc/ttk_sizegrip.n, doc/ttk_style.n:
	* doc/ttk_treeview.n, doc/ttk_widget.n,:
	* generic/ttk/ttk.decls, generic/ttk/ttkBlink.c:
	* generic/ttk/ttkButton.c, generic/ttk/ttkCache.c:
	* generic/ttk/ttkClamTheme.c, generic/ttk/ttkClassicTheme.c:
	* generic/ttk/ttkDecls.h, generic/ttk/ttkDefaultTheme.c:
	* generic/ttk/ttkElements.c, generic/ttk/ttkEntry.c:
	* generic/ttk/ttkFrame.c, generic/ttk/ttkImage.c:
	* generic/ttk/ttkInit.c, generic/ttk/ttkLabel.c:
	* generic/ttk/ttkLayout.c, generic/ttk/ttkManager.c:
	* generic/ttk/ttkManager.h, generic/ttk/ttkNotebook.c:
	* generic/ttk/ttkPanedwindow.c, generic/ttk/ttkProgress.c:
	* generic/ttk/ttkScale.c, generic/ttk/ttkScroll.c:
	* generic/ttk/ttkScrollbar.c, generic/ttk/ttkSeparator.c:
	* generic/ttk/ttkSquare.c, generic/ttk/ttkState.c:
	* generic/ttk/ttkStubInit.c, generic/ttk/ttkStubLib.c:
	* generic/ttk/ttkTagSet.c, generic/ttk/ttkTheme.c:
	* generic/ttk/ttkTheme.h, generic/ttk/ttkThemeInt.h:
	* generic/ttk/ttkTrace.c, generic/ttk/ttkTrack.c:
	* generic/ttk/ttkTreeview.c, generic/ttk/ttkWidget.c:
	* generic/ttk/ttkWidget.h:
	* library/demos/ttk_demo.tcl, library/demos/ttk_iconlib.tcl:
	* library/demos/ttk_repeater.tcl:
	* library/ttk/altTheme.tcl, library/ttk/aquaTheme.tcl:
	* library/ttk/button.tcl, library/ttk/clamTheme.tcl:
	* library/ttk/classicTheme.tcl, library/ttk/combobox.tcl:
	* library/ttk/cursors.tcl, library/ttk/defaults.tcl:
	* library/ttk/dialog.tcl, library/ttk/entry.tcl:
	* library/ttk/fonts.tcl, library/ttk/icons.tcl:
	* library/ttk/keynav.tcl, library/ttk/menubutton.tcl:
	* library/ttk/notebook.tcl, library/ttk/panedwindow.tcl:
	* library/ttk/progress.tcl, library/ttk/scale.tcl:
	* library/ttk/scrollbar.tcl, library/ttk/sizegrip.tcl:
	* library/ttk/treeview.tcl, library/ttk/ttk.tcl:
	* library/ttk/utils.tcl, library/ttk/winTheme.tcl:
	* library/ttk/xpTheme.tcl:
	* macosx/ttkMacOSXTheme.c:
	* tests/ttk/all.tcl, tests/ttk/bwidget.test, tests/ttk/combobox.test:
	* tests/ttk/entry.test, tests/ttk/image.test:
	* tests/ttk/labelframe.test, tests/ttk/layout.test:
	* tests/ttk/misc.test, tests/ttk/notebook.test:
	* tests/ttk/panedwindow.test, tests/ttk/progressbar.test:
	* tests/ttk/scrollbar.test, tests/ttk/treetags.test:
	* tests/ttk/treeview.test, tests/ttk/ttk.test, tests/ttk/validate.test:
	* win/ttkWinMonitor.c, win/ttkWinTheme.c, win/ttkWinXPTheme.c:
	First import of Ttk themed Tk widgets as branched from tile 0.7.8

	* generic/tkInt.h, generic/tkWindow.c: add Ttk_Init call, copy
	tk classic widgets to ::tk namespace.
	* library/tk.tcl: add source of ttk/ttk.tcl, define $::ttk::library.
	* unix/Makefile.in, win/Makefile.in: add Ttk build bits
	* win/configure, win/configure.in: check for uxtheme.h (XP theme).
@
text
@d2 1
a2 1
# $Id: notebook.test,v 1.22 2006/08/20 01:17:08 jenglish Exp $
d383 43
@


1.1.2.1
log
@merge updates from HEAD
@
text
@d2 1
a2 1
# $Id: notebook.test,v 1.1 2006/10/31 01:42:27 hobbs Exp $
a382 43
test notebook-7.8a "move tabs - current tab undisturbed - exhaustive" -body {
    .nb select .nb.f0
    foreach i {0 1 2 3 4} {
    	.nb insert $i .nb.f$i
    }

    foreach i {0 1 2 3 4} {
	.nb select .nb.f$i
	foreach j {0 1 2 3 4} {
	    foreach k {0 1 2 3 4} {
		.nb insert $j $k
		set current [lindex [.nb tabs] [.nb index current]]
		if {$current != ".nb.f$i"} {
		    error "($i,$j,$k) current = $current"
		}
		.nb insert $k $j
		if {[.nb tabs] ne [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4]} {
		    error "swap $j $k; swap $k $j => [.nb tabs]"
		}
	    }
	}
    }
    .nb tabs
} -result [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4]

test notebook-7.8b "insert new - current tab undisturbed - exhaustive" -body {
    foreach i {0 1 2 3 4} {
	.nb select .nb.f$i
	foreach j {0 1 2 3 4} {
.nb select .nb.f$i
	    .nb insert $j [frame .nb.newf]
	    set current [lindex [.nb tabs] [.nb index current]]
	    if {$current != ".nb.f$i"} {
		puts stderr "new tab at $j, current = $current, expect .nb.f$i"
	    }
	    destroy .nb.newf
	    if {[.nb tabs] ne [list .nb.f0 .nb.f1 .nb.f2 .nb.f3 .nb.f4]} {
		error "tabs disturbed"
	    }
	}
    }
}

@


1.1.2.2
log
@merge updates from HEAD
@
text
@d2 1
a2 1
# $Id: notebook.test,v 1.1.2.1 2007/06/12 16:22:43 dgp Exp $
d315 1
a429 28
test notebook-1817596-1 "insert should autoselect first tab" -body {
    pack [ttk::notebook .nb]
    list \
	[.nb insert end [ttk::label .nb.l1 -text One] -text One] \
	[.nb select] \
	;
} -result [list "" .nb.l1] -cleanup { destroy .nb }

test notebook-1817596-2 "error in insert should have no effect" -body {
    pack [ttk::notebook .nb]
    .nb insert end [ttk::label .nb.l1]
    .nb insert end [ttk::label .nb.l2]
    list \
    	[catch { .nb insert .l2 0 -badoption badvalue } err] \
	[.nb tabs] \
} -result [list 1 [list .nb.l1 .nb.l2]] -cleanup { destroy .nb }

test notebook-1817596-3 "insert/configure" -body {
    pack [ttk::notebook .nb]
    .nb insert end [ttk::label .nb.l0] -text "L0"
    .nb insert end [ttk::label .nb.l1] -text "L1"
    .nb insert end [ttk::label .nb.l2] -text "XX"
    .nb insert 0 2 -text "L2"

    list [.nb tabs] [.nb tab 0 -text] [.nb tab 1 -text] [.nb tab 2 -text]

} -result [list [list .nb.l2 .nb.l0 .nb.l1] L2 L0 L1] -cleanup { destroy .nb }

@


1.1.2.3
log
@merge updates from HEAD
@
text
@d2 1
a2 1
# $Id: notebook.test,v 1.1.2.2 2007/10/27 04:23:17 dgp Exp $
d161 1
a161 1
    $nb hide $nb.f2
d163 1
a163 2
    update idletasks; lappend result [winfo ismapped $nb.f3]
} -result [list 1 1 2 0 1]
d191 1
a191 1
    $nb hide $nb.f1
d221 1
a221 1
    $nb hide $nb.f3
d251 1
a251 1
    $nb hide $nb.f2
d281 1
a281 1
    $nb hide $nb.f1
d311 1
a311 1
    $nb hide $nb.f3
a314 17
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]

a456 22

# 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]

@


