#
# Tile package: combobox widget tests
#

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

lappend auto_path .
package require tile

test combobox-1.0 "Combobox tests -- setup" -body {
    ttk::combobox .cb
} -result .cb

test combobox-1.1 "Bad -values list" -body {
    .cb configure -values "bad \{list"
} -result "unmatched open brace in list" -returnCodes 1

test combobox-1.end "Combobox tests -- cleanup" -body {
    destroy .cb
}

test combobox-2.0 "current command" -body {
    ttk::combobox .cb -values [list a b c d e a]
    .cb current
} -result -1

test combobox-2.1 "current -- set index" -body {
    .cb current 5
    .cb get
} -result a

test combobox-2.2 "current -- change -values" -body {
    .cb configure -values [list c b a d e]
    .cb current
} -result 2

test combobox-2.3 "current -- change value" -body {
    .cb set "b"
    .cb current
} -result 1

test combobox-2.4 "current -- value not in list" -body { 
    .cb set "z"
    .cb current
} -result -1

test combobox-end "Cleanup" -body { destroy .cb }

tcltest::cleanupTests
