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

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [tk/] [tests/] [macEmbed.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 out the procedures in the file
2
# tkMacEmbed.c.  It is organized in the standard fashion for Tcl
3
# tests.
4
#
5
# Copyright (c) 1997 Sun Microsystems, Inc.
6
#
7
# See the file "license.terms" for information on usage and redistribution
8
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
9
#
10
# RCS: @(#) $Id: macEmbed.test,v 1.1.1.1 2002-01-16 10:25:59 markom Exp $
11
 
12
if {$tcl_platform(platform) != "macintosh"} {
13
    return
14
}
15
 
16
if {[info procs test] != "test"} {
17
    source defs
18
}
19
 
20
eval destroy [winfo children .]
21
wm geometry . {}
22
raise .
23
 
24
 
25
test macEmbed-1.1 {TkpUseWindow procedure, bad window identifier} {
26
    catch {destroy .t}
27
    list [catch {toplevel .t -use xyz} msg] $msg
28
} {1 {expected integer but got "xyz"}}
29
test macEmbed-1.2 {TkpUseWindow procedure, bad window identifier} {
30
    catch {destroy .t}
31
    list [catch {toplevel .t -use 47} msg] $msg
32
} {1 {The window ID 47 does not correspond to a valid Tk Window.}}
33
 
34
if {[string compare testembed [info commands testembed]] != 0} {
35
    puts "This application hasn't been compiled with the testembed command,"
36
    puts "therefore I am skipping all of these tests."
37
    return
38
}
39
 
40
test macEmbed-1.3 {TkpUseWindow procedure, creating Container records} {
41
    eval destroy [winfo child .]
42
    frame .f1 -container 1 -width 200 -height 50
43
    frame .f2 -container 1 -width 200 -height 50
44
    pack .f1 .f2
45
    set w [winfo id .f1]
46
        toplevel .t -use $w
47
        list [testembed] [expr [lindex [lindex [testembed all] 1] 0] - $w]
48
} {{{XXX .f2 {} {}} {XXX .f1 XXX .t}} 0}
49
test macEmbed-1.4 {TkpUseWindow procedure, creating Container records} {
50
    eval destroy [winfo child .]
51
    frame .f1 -container 1 -width 200 -height 50
52
    frame .f2 -container 1 -width 200 -height 50
53
    pack .f1 .f2
54
    set w1 [winfo id .f1]
55
    set w2 [winfo id .f2]
56
        toplevel .t1 -use $w1
57
        toplevel .t2 -use $w2
58
        testembed
59
} {{XXX .f2 XXX .t2} {XXX .f1 XXX .t1}}
60
 
61
# Can't think of any way to test the procedures TkpMakeWindow,
62
# TkpMakeContainer, or EmbedErrorProc.
63
 
64
test macEmbed-2.1 {EmbeddedEventProc procedure} {
65
    foreach w [winfo child .] {
66
        catch {destroy $w}
67
    }
68
    frame .f1 -container 1 -width 200 -height 50
69
    pack .f1
70
    set w1 [winfo id .f1]
71
        toplevel .t1 -use $w1
72
        testembed
73
    destroy .t1
74
    update
75
        testembed
76
} {}
77
test macEmbed-2.2 {EmbeddedEventProc procedure} {
78
    foreach w [winfo child .] {
79
        catch {destroy $w}
80
    }
81
    frame .f1 -container 1 -width 200 -height 50
82
    pack .f1
83
    toplevel .t1 -use [winfo id .f1]
84
    update
85
    destroy .f1
86
    testembed
87
} {}
88
test macEmbed-2.3 {EmbeddedEventProc procedure} {
89
    foreach w [winfo child .] {
90
        catch {destroy $w}
91
    }
92
    frame .f1 -container 1 -width 200 -height 50
93
    pack .f1
94
    toplevel .t1 -use [winfo id .f1]
95
    update
96
    destroy .t1
97
    update
98
    list [testembed] [winfo children .]
99
} {{} {}}
100
 
101
test macEmbed-3.1 {EmbeddedEventProc procedure, detect creation} {
102
    foreach w [winfo child .] {
103
        catch {destroy $w}
104
    }
105
    frame .f1 -container 1 -width 200 -height 50
106
    pack .f1
107
    set w1 [winfo id .f1]
108
    set x [testembed]
109
        toplevel .t1 -use $w1
110
        wm withdraw .t1
111
    list $x [testembed]
112
} {{{XXX .f1 {} {}}} {{XXX .f1 XXX .t1}}}
113
test macEmbed-3.2 {EmbeddedEventProc procedure, disallow position changes} {
114
    foreach w [winfo child .] {
115
        catch {destroy $w}
116
    }
117
    frame .f1 -container 1 -width 200 -height 50
118
    pack .f1
119
    set w1 [winfo id .f1]
120
        toplevel .t1 -use $w1 -bd 2 -relief raised
121
        update
122
        wm geometry .t1 +30+40
123
    update
124
        wm geometry .t1
125
} {200x200+0+0}
126
test macEmbed-3.3 {EmbeddedEventProc procedure, disallow position changes} {
127
    foreach w [winfo child .] {
128
        catch {destroy $w}
129
    }
130
    frame .f1 -container 1 -width 200 -height 50
131
    pack .f1
132
    set w1 [winfo id .f1]
133
        toplevel .t1 -use $w1
134
        update
135
        wm geometry .t1 300x100+30+40
136
    update
137
        wm geometry .t1
138
} {300x100+0+0}
139
test macEmbed-3.4 {EmbeddedEventProc procedure, geometry requests} {
140
    foreach w [winfo child .] {
141
        catch {destroy $w}
142
    }
143
    toplevel .t1 -container 1 -width 200 -height 50
144
    set w1 [winfo id .t1]
145
        toplevel .t2 -use $w1
146
    update
147
        .t1 configure -width 300 -height 80
148
    update
149
    list [winfo width .t1] [winfo height .t1] [wm geometry .t2]
150
} {300 80 300x80+0+0}
151
test macEmbed-3.5 {EmbeddedEventProc procedure, map requests} {
152
    foreach w [winfo child .] {
153
        catch {destroy $w}
154
    }
155
    frame .f1 -container 1 -width 200 -height 50
156
    pack .f1
157
    set w1 [winfo id .f1]
158
        toplevel .t1 -use $w1
159
        set x unmapped
160
        bind .t1  {set x mapped}
161
    update
162
        after 100
163
        update
164
        set x
165
} {mapped}
166
test macEmbed-3.6 {EmbeddedEventProc procedure, destroy events} {
167
    foreach w [winfo child .] {
168
        catch {destroy $w}
169
    }
170
    frame .f1 -container 1 -width 200 -height 50
171
    pack .f1
172
    set w1 [winfo id .f1]
173
    bind .f1  {set x dead}
174
    set x alive
175
        toplevel .t1 -use $w1
176
    update
177
        destroy .t1
178
    update
179
    list $x [winfo exists .f1]
180
} {dead 0}
181
 
182
test macEmbed-4.1 {EmbedStructureProc procedure, configure events} {
183
    foreach w [winfo child .] {
184
        catch {destroy $w}
185
    }
186
    frame .f1 -container 1 -width 200 -height 50
187
    pack .f1
188
    set w1 [winfo id .f1]
189
        toplevel .t1 -use $w1
190
    update
191
        .t1 configure -width 180 -height 100
192
    update
193
        winfo geometry .t1
194
} {180x100+0+0}
195
test macEmbed-4.2 {EmbedStructureProc procedure, destroy events} {
196
    foreach w [winfo child .] {
197
        catch {destroy $w}
198
    }
199
    frame .f1 -container 1 -width 200 -height 50
200
    pack .f1
201
    set w1 [winfo id .f1]
202
        toplevel .t1 -use $w1
203
    update
204
    set x [testembed]
205
    destroy .f1
206
    list $x [testembed]
207
} {{{XXX .f1 XXX .t1}} {}}
208
 
209
# Can't think up any tests for TkpGetOtherWindow procedure.
210
 
211
test unixEmbed-5.1 {TkpClaimFocus procedure} {tempNotMac} {
212
    catch {interp delete child}
213
    foreach w [winfo child .] {
214
        catch {destroy $w}
215
    }
216
    frame .f1 -container 1 -width 200 -height 50
217
    frame .f2 -width 200 -height 50
218
    pack .f1 .f2
219
    interp create child
220
    child eval "set argv {-use [winfo id .f1]}"
221
    load {} tk child
222
    child eval {
223
        . configure -bd 2 -highlightthickness 2 -relief sunken
224
    }
225
    focus -force .f2
226
    update
227
    list [child eval {
228
        focus .
229
        set x [list [focus]]
230
        update
231
        lappend x [focus]
232
    }] [focus]
233
} {{{} .} .f1}
234
catch {interp delete child}
235
 
236
test macEmbed-6.1 {EmbedWindowDeleted procedure, check parentPtr} {
237
    foreach w [winfo child .] {
238
        catch {destroy $w}
239
    }
240
    frame .f1 -container 1 -width 200 -height 50
241
    frame .f2 -container 1 -width 200 -height 50
242
    frame .f3 -container 1 -width 200 -height 50
243
    frame .f4 -container 1 -width 200 -height 50
244
    pack .f1 .f2 .f3 .f4
245
    set x {}
246
    lappend x [testembed]
247
    foreach w {.f3 .f4 .f1 .f2} {
248
        destroy $w
249
        lappend x [testembed]
250
    }
251
    set x
252
} {{{XXX .f4 {} {}} {XXX .f3 {} {}} {XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f4 {} {}} {XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f2 {} {}}} {}}
253
test macEmbed-6.2 {EmbedWindowDeleted procedure, check embeddedPtr} {
254
    foreach w [winfo child .] {
255
        catch {destroy $w}
256
    }
257
    frame .f1 -container 1 -width 200 -height 50
258
    pack .f1
259
    set w1 [winfo id .f1]
260
        toplevel .t1 -use $w1 -highlightthickness 2 -bd 2 -relief sunken
261
        set x {}
262
        lappend x [testembed]
263
        destroy .t1
264
        update
265
        lappend x [testembed]
266
} {{{XXX .f1 XXX .t1}} {}}
267
 
268
test macEmbed-7.1 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} {
269
    foreach w [winfo child .] {
270
        catch {destroy $w}
271
    }
272
    frame .f1 -container 1 -width 200 -height 50
273
    pack .f1
274
    toplevel .t1 -use [winfo id .f1] -width 150 -height 80
275
    update
276
    wm geometry .t1 +40+50
277
    update
278
    wm geometry .t1
279
} {150x80+0+0}
280
test macEmbed-7.2 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} {
281
    foreach w [winfo child .] {
282
        catch {destroy $w}
283
    }
284
    frame .f1 -container 1 -width 200 -height 50
285
    pack .f1
286
    toplevel .t1 -use [winfo id .f1] -width 150 -height 80
287
    update
288
    wm geometry .t1 70x300+10+20
289
    update
290
    wm geometry .t1
291
} {70x300+0+0}
292
 
293
 
294
 
295
foreach w [winfo child .] {
296
    catch {destroy $w}
297
}

powered by: WebSVN 2.1.0

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