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

Subversion Repositories or1k

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

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# This file tests  is a Tcl script to test the procedures in the file
2
# tkWinWm.c.  It is organized in the standard fashion for Tcl tests.
3
#
4
# This file contains a collection of tests for one or more of the Tcl
5
# built-in commands.  Sourcing this file into Tcl runs the tests and
6
# generates output for errors.  No output means no errors were found.
7
#
8
# Copyright (c) 1996 by Sun Microsystems, Inc.
9
#
10
# See the file "license.terms" for information on usage and redistribution
11
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12
#
13
# RCS: @(#) $Id: winWm.test,v 1.1.1.1 2002-01-16 10:26:00 markom Exp $
14
 
15
if {$tcl_platform(platform) != "windows"} {
16
    return
17
}
18
 
19
if {[info procs test] != "test"} {
20
    source defs
21
}
22
 
23
foreach i [winfo children .] {
24
    catch {destroy $i}
25
}
26
 
27
# Measure the height of a single menu line
28
 
29
toplevel .t
30
frame .t.f -width 100 -height 50
31
pack .t.f
32
menu .t.m
33
.t.m add command -label "thisisreallylong"
34
.t conf -menu .t.m
35
wm geom .t -0-0
36
update
37
set menuheight [winfo y .t]
38
.t.m add command -label "thisisreallylong"
39
wm geom .t -0-0
40
update
41
set menuheight [expr $menuheight - [winfo y .t]]
42
destroy .t
43
 
44
test winWm-1.1 {TkWmMapWindow} {
45
    toplevel .t
46
    wm override .t 1
47
    wm geometry .t +0+0
48
    update
49
    set result [list [winfo rootx .t] [winfo rooty .t]]
50
    destroy .t
51
    set result
52
} {0 0}
53
test winWm-1.2 {TkWmMapWindow} {
54
    toplevel .t
55
    wm transient .t .
56
    update
57
    wm iconify .
58
    update
59
    wm deiconify .
60
    update
61
    catch {wm iconify .t} msg
62
    destroy .t
63
    set msg
64
} {can't iconify ".t": it is a transient}
65
test winWm-1.3 {TkWmMapWindow} {
66
    toplevel .t
67
    update
68
    toplevel .t2
69
    update
70
    set result [expr [winfo x .t] != [winfo x .t2]]
71
    destroy .t .t2
72
    set result
73
} 1
74
test winWm-1.4 {TkWmMapWindow} {
75
    toplevel .t
76
    wm geometry .t +10+10
77
    update
78
    toplevel .t2
79
    wm geometry .t2 +40+10
80
    update
81
    set result [list [winfo x .t] [winfo x .t2]]
82
    destroy .t .t2
83
    set result
84
} {10 40}
85
test winWm-1.5 {TkWmMapWindow} {
86
    toplevel .t
87
    wm iconify .t
88
    update
89
    set result [wm state .t]
90
    destroy .t
91
    set result
92
} iconic
93
 
94
test winWm-2.1 {TkpWmSetState} {
95
    toplevel .t
96
    wm geometry .t 150x50+10+10
97
    update
98
    set result [wm state .t]
99
    wm iconify .t
100
    update
101
    lappend result [wm state .t]
102
    wm deiconify .t
103
    update
104
    lappend result [wm state .t]
105
    destroy .t
106
    set result
107
} {normal iconic normal}
108
test winWm-2.2 {TkpWmSetState} {
109
    toplevel .t
110
    wm geometry .t 150x50+10+10
111
    update
112
    set result [wm state .t]
113
    wm withdraw .t
114
    update
115
    lappend result [wm state .t]
116
    wm iconify .t
117
    update
118
    lappend result [wm state .t]
119
    wm deiconify .t
120
    update
121
    lappend result [wm state .t]
122
    destroy .t
123
    set result
124
} {normal withdrawn iconic normal}
125
test winWm-2.3 {TkpWmSetState} {
126
    set result {}
127
    toplevel .t
128
    wm geometry .t 150x50+10+10
129
    update
130
    lappend result [list [wm state .t] [wm geometry .t]]
131
    wm iconify .t
132
    update
133
    lappend result [list [wm state .t] [wm geometry .t]]
134
    wm geometry .t 200x50+10+10
135
    update
136
    lappend result [list [wm state .t] [wm geometry .t]]
137
    wm deiconify .t
138
    update
139
    lappend result [list [wm state .t] [wm geometry .t]]
140
    destroy .t
141
    set result
142
} {{normal 150x50+10+10} {iconic 150x50+10+10} {iconic 150x50+10+10} {normal 200x50+10+10}}
143
 
144
 
145
test winWm-3.1 {ConfigureTopLevel: window geometry propagation} {
146
    toplevel .t
147
    wm geometry .t +0+0
148
    button .t.b
149
    pack .t.b
150
    update
151
    set x [winfo x .t.b]
152
    destroy .t
153
    toplevel .t
154
    wm geometry .t +0+0
155
    button .t.b
156
    update
157
    pack .t.b
158
    update
159
    set x [expr $x == [winfo x .t.b]]
160
    destroy .t
161
    set x
162
} 1
163
 
164
test winWm-4.1 {ConfigureTopLevel: menu resizing} {
165
    set result {}
166
    toplevel .t
167
    frame .t.f -width 150 -height 50 -bg red
168
    pack .t.f
169
    wm geometry .t -0-0
170
    update
171
    set y [winfo y .t]
172
    menu .t.m
173
    .t.m add command -label foo
174
    .t conf -menu .t.m
175
    update
176
    set result [expr $y - [winfo y .t]]
177
    destroy .t
178
    set result
179
} [expr $menuheight + 1]
180
 
181
test winWm-5.1 {UpdateGeometryInfo: menu resizing} {
182
    set result {}
183
    toplevel .t
184
    frame .t.f -width 150 -height 50 -bg red
185
    pack .t.f
186
    update
187
    set result [winfo height .t]
188
    menu .t.m
189
    .t.m add command -label foo
190
    .t conf -menu .t.m
191
    update
192
    lappend result [winfo height .t]
193
    .t.m add command -label "thisisreallylong"
194
    .t.m add command -label "thisisreallylong"
195
    update
196
    lappend result [winfo height .t]
197
    destroy .t
198
    set result
199
} {50 50 50}
200
test winWm-5.2 {UpdateGeometryInfo: menu resizing} {
201
    set result {}
202
    toplevel .t
203
    frame .t.f -width 150 -height 50 -bg red
204
    pack .t.f
205
    wm geom .t -0-0
206
    update
207
    set y [winfo rooty .t]
208
    lappend result [winfo height .t]
209
    menu .t.m
210
    .t conf -menu .t.m
211
    .t.m add command -label foo
212
    .t.m add command -label "thisisreallylong"
213
    .t.m add command -label "thisisreallylong"
214
    update
215
    lappend result [winfo height .t]
216
    lappend result [expr $y - [winfo rooty .t]]
217
    destroy .t
218
    set result
219
} {50 50 0}

powered by: WebSVN 2.1.0

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