[go: up one dir, main page]

File: image.test

package info (click to toggle)
tile 0.8.2-2.1
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 3,152 kB
  • ctags: 3,093
  • sloc: ansic: 18,144; tcl: 4,607; makefile: 398; sh: 71
file content (94 lines) | stat: -rw-r--r-- 2,619 bytes parent folder | download
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#
# image.test,v 1.9 2007/11/25 17:06:02 jenglish Exp
#

package require Tk
package require tcltest ; namespace import -force tcltest::*
loadTestedCommands

lappend auto_path .
package require tile

# 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
} -returnCodes error -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"

test image-1.3 "Bad image element later in list" -body {
    ttk::style element create BadImage image {test.element {} badimage}
} -returnCodes error -result {image "badimage" doesn't exist}

test image-1.4 "Bad image option" -body {
    ttk::button .b -image [list test.element {} badimage]
} -returnCodes error -result {image "badimage" doesn't exist}

test image-2.0 "Deletion of displayed image (label)" -constraints {
    KNOWNBUG
} -setup {
    image create photo test.image -width 10 -height 10
} -body {
    pack [set w [ttk::label .ttk_image20 -image test.image]]
    tkwait visibility $w
    image delete test.image
    update
} -cleanup {
    destroy .ttk_image20
} -result {}
    
test image-2.1 "Deletion of displayed image (checkbutton)" -constraints {
    KNOWNBUG 
} -setup {
    image create photo test.image -width 10 -height 10
} -body {
    pack [set w [ttk::checkbutton .ttk_image21 -image test.image]]
    tkwait visibility $w
    image delete test.image
    update
} -cleanup {
    destroy .ttk_image21
} -result {}

test image-2.2 "Deletion of displayed image (radiobutton)" -constraints {
    KNOWNBUG
} -setup {
    image create photo test.image -width 10 -height 10
} -body {
    pack [set w [ttk::radiobutton .ttk_image22 -image test.image]]
    tkwait visibility $w
    image delete test.image
    update
} -cleanup {
    destroy .ttk_image22
} -result {}

#
tcltest::cleanupTests