blob: 9bad7ce81322d99bf6cd2ace60a2e56965c8400d (
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
|
#
# Tests exercising Microsoft Visual Styles elements, defined through
# the command "ttk::style element create XXX vsapi"
#
#
# 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
#
# LOCAL TEST CONSTRAINTS
#
testConstraint vista \
[expr {"vista" in [ttk::style theme names]}]
#
# TESTS
#
test vsapi-1.1 "WINDOW WP_SMALLCLOSEBUTTON" -constraints vista -body {
ttk::style element create smallclose vsapi \
WINDOW 19 {disabled 4 pressed 3 active 2 {} 1}
ttk::style layout CloseButton {CloseButton.smallclose -sticky news}
ttk::button .b -style CloseButton
pack .b -expand true -fill both
list [winfo reqwidth .b] [winfo reqheight .b]
} -cleanup { destroy .b } -result [list 13 13]
test vsapi-1.2 "EXPLORERBAR EBP_HEADERPIN" -constraints vista -body {
ttk::style element create pin vsapi \
EXPLORERBAR 3 {
{pressed !selected} 3
{active !selected} 2
{pressed selected} 6
{active selected} 5
{selected} 4
{} 1
}
ttk::style layout Explorer.Pin {Explorer.Pin.pin -sticky news}
ttk::checkbutton .pin -style Explorer.Pin
pack .pin -expand true -fill both
list [winfo reqwidth .pin] [winfo reqheight .pin]
} -cleanup { destroy .pin } -result [list 16 16]
test vsapi-1.3 "EXPLORERBAR EBP_HEADERCLOSE" -constraints vista -body {
ttk::style element create headerclose vsapi \
EXPLORERBAR 2 {pressed 3 active 2 {} 1}
ttk::style layout Explorer.CloseButton {
Explorer.CloseButton.headerclose -sticky news
}
ttk::button .b -style Explorer.CloseButton
pack .b -expand true -fill both
list [winfo reqwidth .b] [winfo reqheight .b]
} -cleanup { destroy .b } -result [list 16 16]
#
# TESTFILE CLEANUP
#
tcltest::cleanupTests
|