OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [tk/] [tests/] [unixButton.test] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# This file is a Tcl script to test the Unix specific behavior of
2
# labels, buttons, checkbuttons, and radiobuttons in Tk (i.e., all the
3
# widgets defined in tkUnixButton.c).  It is organized in the standard
4
# fashion for Tcl tests.
5
#
6
# Copyright (c) 1994 The Regents of the University of California.
7
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
8
#
9
# See the file "license.terms" for information on usage and redistribution
10
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11
#
12
# RCS: @(#) $Id: unixButton.test,v 1.1.1.1 2002-01-16 10:26:00 markom Exp $
13
 
14
if {$tcl_platform(platform)!="unix"} {
15
    return
16
}
17
 
18
if {[lsearch [image types] test] < 0} {
19
    puts "This application hasn't been compiled with the \"test\""
20
    puts "image, so I can't run this test.  Are you sure you're using"
21
    puts "tktest instead of wish?"
22
    return
23
}
24
 
25
if {[info procs test] != "test"} {
26
    source defs
27
}
28
 
29
foreach i [winfo children .] {
30
    destroy $i
31
}
32
wm geometry . {}
33
raise .
34
 
35
# Create entries in the option database to be sure that geometry options
36
# like border width have predictable values.
37
 
38
option add *Label.borderWidth 2
39
option add *Label.highlightThickness 0
40
option add *Label.font {Helvetica -12 bold}
41
option add *Button.borderWidth 2
42
option add *Button.highlightThickness 2
43
option add *Button.font {Helvetica -12 bold}
44
option add *Checkbutton.borderWidth 2
45
option add *Checkbutton.highlightThickness 2
46
option add *Checkbutton.font {Helvetica -12 bold}
47
option add *Radiobutton.borderWidth 2
48
option add *Radiobutton.highlightThickness 2
49
option add *Radiobutton.font {Helvetica -12 bold}
50
 
51
 
52
proc bogusTrace args {
53
    error "trace aborted"
54
}
55
catch {unset value}
56
catch {unset value2}
57
 
58
eval image delete [image names]
59
image create test image1
60
label .l -text Label
61
button .b -text Button
62
checkbutton .c -text Checkbutton
63
radiobutton .r -text Radiobutton
64
pack .l .b .c .r
65
update
66
 
67
test unixbutton-1.1 {TkpComputeButtonGeometry procedure} {
68
    eval destroy [winfo children .]
69
    image create test image1
70
    image1 changed 0 0 0 0 60 40
71
    label .b1 -image image1 -bd 4 -padx 0 -pady 2
72
    button .b2 -image image1 -bd 4 -padx 0 -pady 2
73
    checkbutton .b3 -image image1 -bd 4 -padx 1 -pady 1
74
    radiobutton .b4 -image image1 -bd 4 -padx 2 -pady 0
75
    pack .b1 .b2 .b3 .b4
76
    update
77
    list [winfo reqwidth .b1] [winfo reqheight .b1] \
78
            [winfo reqwidth .b2] [winfo reqheight .b2] \
79
            [winfo reqwidth .b3] [winfo reqheight .b3] \
80
            [winfo reqwidth .b4] [winfo reqheight .b4]
81
} {68 48 74 54 112 52 112 52}
82
test unixbutton-1.2 {TkpComputeButtonGeometry procedure} {
83
    eval destroy [winfo children .]
84
    label .b1 -bitmap question -bd 3 -padx 0 -pady 2
85
    button .b2 -bitmap question -bd 3 -padx 0 -pady 2
86
    checkbutton .b3 -bitmap question -bd 3 -padx 1 -pady 1
87
    radiobutton .b4 -bitmap question -bd 3 -padx 2 -pady 0
88
    pack .b1 .b2 .b3 .b4
89
    update
90
    list [winfo reqwidth .b1] [winfo reqheight .b1] \
91
            [winfo reqwidth .b2] [winfo reqheight .b2] \
92
            [winfo reqwidth .b3] [winfo reqheight .b3] \
93
            [winfo reqwidth .b4] [winfo reqheight .b4]
94
} {23 33 29 39 54 37 54 37}
95
test unixbutton-1.3 {TkpComputeButtonGeometry procedure} {
96
    eval destroy [winfo children .]
97
    label .b1 -bitmap question -bd 3 -highlightthickness 4
98
    button .b2 -bitmap question -bd 3 -highlightthickness 0
99
    checkbutton .b3 -bitmap question -bd 3 -highlightthickness 1 \
100
            -indicatoron 0
101
    radiobutton .b4 -bitmap question -bd 3 -highlightthickness 1 \
102
        -indicatoron false
103
    pack .b1 .b2 .b3 .b4
104
    update
105
    list [winfo reqwidth .b1] [winfo reqheight .b1] \
106
            [winfo reqwidth .b2] [winfo reqheight .b2] \
107
            [winfo reqwidth .b3] [winfo reqheight .b3] \
108
            [winfo reqwidth .b4] [winfo reqheight .b4]
109
} {31 41 25 35 25 35 25 35}
110
test unixbutton-1.4 {TkpComputeButtonGeometry procedure} {nonPortable fonts} {
111
    eval destroy [winfo children .]
112
    label .b1 -text Xagqpim -padx 0 -pady 2 -font {Helvetica -18 bold}
113
    button .b2 -text Xagqpim -padx 0 -pady 2 -font {Helvetica -18 bold}
114
    checkbutton .b3 -text Xagqpim -padx 1 -pady 1 -font {Helvetica -18 bold}
115
    radiobutton .b4 -text Xagqpim -padx 2 -pady 0 -font {Helvetica -18 bold}
116
    pack .b1 .b2 .b3 .b4
117
    update
118
    list [winfo reqwidth .b1] [winfo reqheight .b1] \
119
            [winfo reqwidth .b2] [winfo reqheight .b2] \
120
            [winfo reqwidth .b3] [winfo reqheight .b3] \
121
            [winfo reqwidth .b4] [winfo reqheight .b4]
122
} {82 29 88 35 114 31 121 29}
123
test unixbutton-1.5 {TkpComputeButtonGeometry procedure} {nonPortable fonts} {
124
    eval destroy [winfo children .]
125
    label .l1 -text "This is a long string that will wrap around on several lines.\n\nIt also has a blank line (above)." -wraplength 1.5i -padx 0 -pady 0
126
    pack .l1
127
    update
128
    list [winfo reqwidth .l1] [winfo reqheight .l1]
129
} {136 88}
130
test unixbutton-1.6 {TkpComputeButtonGeometry procedure} {nonPortable fonts} {
131
    eval destroy [winfo children .]
132
    label .l1 -text "This is a long string without wrapping.\n\nIt also has a blank line (above)." -padx 0 -pady 0
133
    pack .l1
134
    update
135
    list [winfo reqwidth .l1] [winfo reqheight .l1]
136
} {231 46}
137
test unixbutton-1.7 {TkpComputeButtonGeometry procedure} {nonPortable fonts} {
138
    eval destroy [winfo children .]
139
    label .b1 -text Xagqpim -bd 2 -padx 0 -pady 2 -width 10
140
    button .b2 -text Xagqpim -bd 2 -padx 0 -pady 2 -height 5
141
    checkbutton .b3 -text Xagqpim -bd 2 -padx 1 -pady 1 -width 20 -height 2
142
    radiobutton .b4 -text Xagqpim -bd 2 -padx 2 -pady 0 -width 4
143
    pack .b1 .b2 .b3 .b4
144
    update
145
    list [winfo reqwidth .b1] [winfo reqheight .b1] \
146
            [winfo reqwidth .b2] [winfo reqheight .b2] \
147
            [winfo reqwidth .b3] [winfo reqheight .b3] \
148
            [winfo reqwidth .b4] [winfo reqheight .b4]
149
} {74 22 60 84 168 38 61 22}
150
test unixbutton-1.8 {TkpComputeButtonGeometry procedure} {nonPortable fonts} {
151
    eval destroy [winfo children .]
152
    label .b1 -text Xagqpim -bd 2 -padx 0 -pady 2 \
153
        -highlightthickness 4
154
    button .b2 -text Xagqpim -bd 2 -padx 0 -pady 2 \
155
        -highlightthickness 0
156
    checkbutton .b3 -text Xagqpim -bd 2 -padx 1 -pady 1  \
157
        -highlightthickness 1 -indicatoron no
158
    radiobutton .b4 -text Xagqpim -bd 2 -padx 2 -pady 0 -indicatoron 0
159
    pack .b1 .b2 .b3 .b4
160
    update
161
    list [winfo reqwidth .b1] [winfo reqheight .b1] \
162
            [winfo reqwidth .b2] [winfo reqheight .b2] \
163
            [winfo reqwidth .b3] [winfo reqheight .b3] \
164
            [winfo reqwidth .b4] [winfo reqheight .b4]
165
} {62 30 56 24 58 22 62 22}
166
test unixbutton-1.9 {TkpComputeButtonGeometry procedure} {
167
    eval destroy [winfo children .]
168
    button .b2 -bitmap question -default active
169
    list [winfo reqwidth .b2] [winfo reqheight .b2]
170
} {37 47}
171
test unixbutton-1.10 {TkpComputeButtonGeometry procedure} {
172
    eval destroy [winfo children .]
173
    button .b2 -bitmap question -default normal
174
    list [winfo reqwidth .b2] [winfo reqheight .b2]
175
} {37 47}
176
test unixbutton-1.11 {TkpComputeButtonGeometry procedure} {
177
    eval destroy [winfo children .]
178
    button .b2 -bitmap question -default disabled
179
    list [winfo reqwidth .b2] [winfo reqheight .b2]
180
} {27 37}
181
 
182
eval destroy [winfo children .]

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.