blob: 32db3cfbd500e22a7d49298881fceb76e7ba3e10 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
#
# ttk::scale widget tests
#
#
# TESTFILE INITIALIZATION
#
package require tcltest 2.2; # needed in mode -singleproc 0
# Load the main script main.tcl, which takes care of:
# - setup for the application and the root window
# - importing commands from the tcltest namespace
# - loading of the testutils mechanism along with its utility procs
# - loading of Tk specific test constraints (additionally to constraints
# provided by the package tcltest)
source [file join [file dirname [tcltest::configure -testdir]] main.tcl]
# Ensure a pristine initial window state
resetWindows
#
# TESTS
#
test scale-1.0 "Self-destruction" -body {
trace add variable v write { destroy .s ;# }
ttk::scale .s -variable v
pack .s ; update
.s set 1 ; update
} -returnCodes error -match glob -result "*"
test scale-2.1 "-state option" -setup {
ttk::scale .s
set res ""
} -body {
# defaults
lappend res [.s instate disabled] [.s cget -state]
# set -state: instate returns accordingly
.s configure -state disabled
lappend res [.s instate disabled] [.s cget -state]
# back to normal
.s configure -state normal
lappend res [.s instate disabled] [.s cget -state]
# use state command: -state does NOT reflect it
.s state disabled
lappend res [.s instate disabled] [.s cget -state]
# further use state command
.s state readonly
lappend res [.s state] [.s cget -state]
} -cleanup {
destroy .s
unset -nocomplain res
} -result {0 normal 1 disabled 0 normal 1 normal {disabled readonly} normal}
test scale-3.1 "style command" -body {
ttk::scale .wh ; # default is -orient horizontal
ttk::scale .wv -orient vertical
list [.wh cget -style] [.wh style] [winfo class .wh] \
[.wv cget -style] [.wv style] [winfo class .wv]
} -cleanup {
destroy .wh .wv
} -result {{} Horizontal.TScale TScale {} Vertical.TScale TScale}
test scale-3.2 "style command" -body {
ttk::style configure customStyle.Vertical.TScale
ttk::scale .w -orient vertical -style customStyle.Vertical.TScale
list [.w cget -style] [.w style] [winfo class .w]
} -cleanup {
destroy .w
} -result {customStyle.Vertical.TScale Vertical.customStyle.Vertical.TScale TScale}
#
# TESTFILE CLEANUP
#
tcltest::cleanupTests
|