summaryrefslogtreecommitdiffstats
path: root/tests/ttk/layout.test
blob: e0baa20ffdf6d940f3a42eac547939a623e43856 (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
#
# Tests for the "ttk::style layout" command
#

#
# 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 layout-1.1 "Size computations for mixed-orientation layouts" -body {
    ttk::style theme use default

    set block [image create photo -width 10 -height 10]
    ttk::style element create block image $block
    ttk::style layout Blocks {
	border -children { block } -side left
	border -children { block } -side top
	border -children { block } -side bottom
    }
    ttk::style configure Blocks -borderwidth 1 -relief raised
    ttk::button .b -style Blocks

    pack .b -expand true -fill both

    list [winfo reqwidth .b] [winfo reqheight .b]

} -cleanup { destroy .b } -result [list 24 24]

test layout-2 "Empty -children not allowed" -body {
    ttk::style layout Test.Tentry {Entry.field -children {}}
} -returnCodes error -result {Invalid -children value}

#
# TESTFILE CLEANUP
#

tcltest::cleanupTests