1# 2# $Id$ 3# 4 5package require Tk 8.5 6package require tcltest ; namespace import -force tcltest::* 7loadTestedCommands 8 9testConstraint coreScrollbar [expr {[tk windowingsystem] eq "aqua"}] 10 11test scrollbar-swapout-1 "Use core scrollbars on OSX..." -constraints { 12 coreScrollbar 13} -body { 14 ttk::scrollbar .sb -command "yadda" 15 list [winfo class .sb] [.sb cget -command] 16} -result [list Scrollbar yadda] -cleanup { 17 destroy .sb 18} 19 20test scrollbar-swapout-2 "... unless -style is specified ..." -constraints { 21 coreScrollbar 22} -body { 23 ttk::style layout Vertical.Custom.TScrollbar \ 24 [ttk::style layout Vertical.TScrollbar] ; # See #1833339 25 ttk::scrollbar .sb -command "yadda" -style Custom.TScrollbar 26 list [winfo class .sb] [.sb cget -command] [.sb cget -style] 27} -result [list TScrollbar yadda Custom.TScrollbar] -cleanup { 28 destroy .sb 29} 30 31test scrollbar-swapout-3 "... or -class." -constraints { 32 coreScrollbar 33} -body { 34 ttk::scrollbar .sb -command "yadda" -class Custom.TScrollbar 35 list [winfo class .sb] [.sb cget -command] 36} -result [list Custom.TScrollbar yadda] -cleanup { 37 destroy .sb 38} 39 40test scrollbar-1.0 "Setup" -body { 41 ttk::scrollbar .tsb 42} -result .tsb 43 44test scrollbar-1.1 "Set method" -body { 45 .tsb set 0.2 0.4 46 .tsb get 47} -result [list 0.2 0.4] 48 49test scrollbar-1.2 "Set orientation" -body { 50 .tsb configure -orient vertical 51 set w [winfo reqwidth .tsb] ; set h [winfo reqheight .tsb] 52 expr {$h > $w} 53} -result 1 54 55test scrollbar-1.3 "Change orientation" -body { 56 .tsb configure -orient horizontal 57 set w [winfo reqwidth .tsb] ; set h [winfo reqheight .tsb] 58 expr {$h < $w} 59} -result 1 60 61# 62# Scale tests: 63# 64 65test scale-1.0 "Self-destruction" -body { 66 trace variable v w { destroy .s ;# } 67 ttk::scale .s -variable v 68 pack .s ; update 69 .s set 1 ; update 70} -returnCodes 1 -match glob -result "*" 71 72tcltest::cleanupTests 73 74