blob: b1f66bd2c14c7ffa094073661a272f434c81bb6a (
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
|
#
# $Id: image.test,v 1.1 2006/10/31 01:42:27 hobbs Exp $
#
package require Tk 8.5
package require tcltest ; namespace import -force tcltest::*
loadTestedCommands
# catch background errors:
#
if {[info procs bgerror] == "bgerror"} { rename bgerror {} }
array set BGerror { caught 0 message {} }
proc bgerror {message} {
variable BGerror
set BGerror(caught) 1
set BGerror(message) $message
}
proc caughtbgerror {} {
variable BGerror
if {!$BGerror(caught)} {
error "No bgerror caught"
}
set BGerror(caught) 0
return $BGerror(message)
}
test image-1.1 "Bad image element" -body {
ttk::style element create BadImage image badimage
ttk::style layout BadImage { BadImage }
ttk::label .l -style BadImage
pack .l ; update
destroy .l
caughtbgerror
} -result {image "badimage" doesn't exist}
test image-1.2 "Duplicate element" -setup {
image create photo test.element -width 10 -height 10
ttk::style element create testElement image test.element
} -body {
ttk::style element create testElement image test.element
} -returnCodes 1 -result "Duplicate element testElement"
#
tcltest::cleanupTests
|