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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tk/] [tests/] [winButton.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 Windows specific behavior of
2
# labels, buttons, checkbuttons, and radiobuttons in Tk (i.e., all the
3
# widgets defined in tkWinButton.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: winButton.test,v 1.1.1.1 2002-01-16 10:26:00 markom Exp $
13
 
14
if {$tcl_platform(platform)!="windows"} {
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
proc bogusTrace args {
36
    error "trace aborted"
37
}
38
catch {unset value}
39
catch {unset value2}
40
 
41
eval image delete [image names]
42
image create test image1
43
label .l -text Label
44
button .b -text Button
45
checkbutton .c -text Checkbutton
46
radiobutton .r -text Radiobutton
47
pack .l .b .c .r
48
update
49
 
50
test winbutton-1.1 {TkpComputeButtonGeometry procedure} {
51
    eval destroy [winfo children .]
52
    image create test image1
53
    image1 changed 0 0 0 0 60 40
54
    label .b1 -image image1 -bd 4 -padx 0 -pady 2
55
    button .b2 -image image1 -bd 4 -padx 0 -pady 2
56
    checkbutton .b3 -image image1 -bd 4 -padx 1 -pady 1
57
    radiobutton .b4 -image image1 -bd 4 -padx 2 -pady 0
58
    pack .b1 .b2 .b3 .b4
59
    update
60
    list [winfo reqwidth .b1] [winfo reqheight .b1] \
61
            [winfo reqwidth .b2] [winfo reqheight .b2] \
62
            [winfo reqwidth .b3] [winfo reqheight .b3] \
63
            [winfo reqwidth .b4] [winfo reqheight .b4]
64
} {68 48 71 51 96 50 96 50}
65
test winbutton-1.2 {TkpComputeButtonGeometry procedure} {
66
    eval destroy [winfo children .]
67
    label .b1 -bitmap question -bd 3 -padx 0 -pady 2
68
    button .b2 -bitmap question -bd 3 -padx 0 -pady 2
69
    checkbutton .b3 -bitmap question -bd 3 -padx 1 -pady 1
70
    radiobutton .b4 -bitmap question -bd 3 -padx 2 -pady 0
71
    pack .b1 .b2 .b3 .b4
72
    update
73
    list [winfo reqwidth .b1] [winfo reqheight .b1] \
74
            [winfo reqwidth .b2] [winfo reqheight .b2] \
75
            [winfo reqwidth .b3] [winfo reqheight .b3] \
76
            [winfo reqwidth .b4] [winfo reqheight .b4]
77
} {23 33 26 36 51 35 51 35}
78
test winbutton-1.3 {TkpComputeButtonGeometry procedure} {
79
    eval destroy [winfo children .]
80
    label .b1 -bitmap question -bd 3 -highlightthickness 4
81
    button .b2 -bitmap question -bd 3 -highlightthickness 0
82
    checkbutton .b3 -bitmap question -bd 3 -highlightthickness 1 \
83
            -indicatoron 0
84
    radiobutton .b4 -bitmap question -bd 3 -indicatoron false
85
    pack .b1 .b2 .b3 .b4
86
    update
87
    list [winfo reqwidth .b1] [winfo reqheight .b1] \
88
            [winfo reqwidth .b2] [winfo reqheight .b2] \
89
            [winfo reqwidth .b3] [winfo reqheight .b3] \
90
            [winfo reqwidth .b4] [winfo reqheight .b4]
91
} {31 41 24 34 26 36 26 36}
92
test winbutton-1.4 {TkpComputeButtonGeometry procedure} {nonPortable} {
93
    eval destroy [winfo children .]
94
    label .b1 -text Xagqpim -bd 2 -padx 0 -pady 2 -font {{MS Sans Serif} 8}
95
    button .b2 -text Xagqpim -bd 2 -padx 0 -pady 2 -font {{MS Sans Serif} 8}
96
    checkbutton .b3 -text Xagqpim -bd 2 -padx 1 -pady 1 -font {{MS Sans Serif} 8}
97
    radiobutton .b4 -text Xagqpim -bd 2 -padx 2 -pady 0 -font {{MS Sans Serif} 8}
98
    pack .b1 .b2 .b3 .b4
99
    update
100
    list [winfo reqwidth .b1] [winfo reqheight .b1] \
101
            [winfo reqwidth .b2] [winfo reqheight .b2] \
102
            [winfo reqwidth .b3] [winfo reqheight .b3] \
103
            [winfo reqwidth .b4] [winfo reqheight .b4]
104
} {58 24 67 33 88 30 90 28}
105
test winbutton-1.5 {TkpComputeButtonGeometry procedure} {nonPortable} {
106
    eval destroy [winfo children .]
107
    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
108
    pack .l1
109
    update
110
    list [winfo reqwidth .l1] [winfo reqheight .l1]
111
} {178 84}
112
test winbutton-1.6 {TkpComputeButtonGeometry procedure} {nonPortable} {
113
    eval destroy [winfo children .]
114
    label .l1 -text "This is a long string without wrapping.\n\nIt also has a blank line (above)." -padx 0 -pady 0
115
    pack .l1
116
    update
117
    list [winfo reqwidth .l1] [winfo reqheight .l1]
118
} {222 52}
119
test winbutton-1.7 {TkpComputeButtonGeometry procedure} {nonPortable} {
120
    eval destroy [winfo children .]
121
    label .b1 -text Xagqpim -bd 2 -padx 0 -pady 2 -width 10
122
    button .b2 -text Xagqpim -bd 2 -padx 0 -pady 2 -height 5
123
    checkbutton .b3 -text Xagqpim -bd 2 -padx 1 -pady 1 -width 20 -height 2
124
    radiobutton .b4 -text Xagqpim -bd 2 -padx 2 -pady 0 -width 4
125
    pack .b1 .b2 .b3 .b4
126
    update
127
    list [winfo reqwidth .b1] [winfo reqheight .b1] \
128
            [winfo reqwidth .b2] [winfo reqheight .b2] \
129
            [winfo reqwidth .b3] [winfo reqheight .b3] \
130
            [winfo reqwidth .b4] [winfo reqheight .b4]
131
} {74 24 67 97 174 46 64 28}
132
test winbutton-1.8 {TkpComputeButtonGeometry procedure} {nonPortable} {
133
    eval destroy [winfo children .]
134
    label .b1 -text Xagqpim -bd 2 -padx 0 -pady 2 \
135
        -highlightthickness 4
136
    button .b2 -text Xagqpim -bd 2 -padx 0 -pady 2 \
137
        -highlightthickness 0
138
    checkbutton .b3 -text Xagqpim -bd 2 -padx 1 -pady 1  \
139
        -highlightthickness 1 -indicatoron no
140
    radiobutton .b4 -text Xagqpim -bd 2 -padx 2 -pady 0 -indicatoron 0
141
    pack .b1 .b2 .b3 .b4
142
    update
143
    list [winfo reqwidth .b1] [winfo reqheight .b1] \
144
            [winfo reqwidth .b2] [winfo reqheight .b2] \
145
            [winfo reqwidth .b3] [winfo reqheight .b3] \
146
            [winfo reqwidth .b4] [winfo reqheight .b4]
147
} {66 32 65 31 69 31 71 29}
148
test winbutton-1.9 {TkpComputeButtonGeometry procedure} {
149
    eval destroy [winfo children .]
150
    button .b2 -bitmap question -default normal
151
    list [winfo reqwidth .b2] [winfo reqheight .b2]
152
} {24 34}
153
 
154
eval destroy [winfo children .]

powered by: WebSVN 2.1.0

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