1package require Tk 8.5
2package require tcltest ; namespace import -force tcltest::*
3loadTestedCommands
4
5test image-1.1 "Bad image element" -body {
6    ttk::style element create BadImage image badimage
7} -returnCodes error -result {image "badimage" doesn't exist}
8
9test image-1.2 "Duplicate element" -setup {
10    image create photo test.element -width 10 -height 10
11    ttk::style element create testElement image test.element
12} -body {
13    ttk::style element create testElement image test.element
14} -returnCodes 1 -result "Duplicate element testElement"
15
16test image-2.0 "Deletion of displayed image (label)" -setup {
17     image create photo test.image -width 10 -height 10
18} -body {
19    pack [set w [ttk::label .ttk_image20 -image test.image]]
20    tkwait visibility $w
21    image delete test.image
22    update
23} -cleanup {
24    destroy .ttk_image20
25} -result {}
26
27test image-2.1 "Deletion of displayed image (checkbutton)" -setup {
28     image create photo test.image -width 10 -height 10
29} -body {
30    pack [set w [ttk::checkbutton .ttk_image21 -image test.image]]
31    tkwait visibility $w
32    image delete test.image
33    update
34} -cleanup {
35    destroy .ttk_image21
36} -result {}
37
38test image-2.2 "Deletion of displayed image (radiobutton)" -setup {
39     image create photo test.image -width 10 -height 10
40} -body {
41    pack [set w [ttk::radiobutton .ttk_image22 -image test.image]]
42    tkwait visibility $w
43    image delete test.image
44    update
45} -cleanup {
46    destroy .ttk_image22
47} -result {}
48
49#
50tcltest::cleanupTests
51