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

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [itcl/] [iwidgets3.0.0/] [tests/] [dialogshell.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 [incr Widgets] Dialogshell class.
2
# It is organized in the standard fashion for Tcl tests with the following
3
# notation for test case labels:
4
#
5
#   1.x - Construction/Destruction tests
6
#   2.x - Configuration option tests
7
#   3.x - Method tests
8
#   4.x - Other tests
9
#
10
# Copyright (c) 1995 DSC Technologies Corporation
11
#
12
# See the file "license.terms" for information on usage and redistribution
13
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14
#
15
# @(#) $Id: dialogshell.test,v 1.1.1.1 2002-01-16 10:24:51 markom Exp $
16
 
17
package require Iwidgets 3.0
18
 
19
if {[string compare test [info procs test]] == 1} {
20
    source defs
21
}
22
 
23
wm geometry . {}
24
raise .
25
 
26
set c 1
27
set o 1
28
set m 1
29
 
30
#
31
# Initial construction test
32
#
33
test Dialogshell-1.$c {Dialogshell construction} {
34
    iwidgets::Dialogshell .ds
35
    .ds add OK -text "OK"
36
    .ds add Cancel -text "Cancel"
37
    .ds default OK
38
 
39
    listbox [.ds childsite].lb -relief sunken
40
    pack [.ds childsite].lb -fill both -expand yes
41
 
42
    .ds activate
43
} {}
44
 
45
incr c
46
 
47
#
48
# Option tests which are successful.
49
#
50
test Dialogshell-2.$o {configuration option} {
51
    llength [.ds configure]
52
} {17}
53
 
54
incr o
55
 
56
foreach test {
57
    {-background #d9d9d9 #d9d9d9}
58
    {-width 300 300}
59
    {-height 300 300}
60
    {-buttonboxpadx 10 10}
61
    {-buttonboxpady 10 10}
62
    {-buttonboxpos n n}
63
    {-buttonboxpos e e}
64
    {-buttonboxpos w w}
65
    {-buttonboxpos s s}
66
    {-cursor gumby gumby}
67
    {-modality global global}
68
    {-modality application application}
69
    {-modality none none}
70
    {-separator off off}
71
    {-padx 15 15}
72
    {-pady 15 15}
73
    {-thickness 5 5}
74
    {-width 0 0}
75
    {-height 0 0}
76
    {-separator on on}
77
    {-title "Dialog Shell" "Dialog Shell"}} {
78
        set option [lindex $test 0]
79
        test Dialogshell-2.$o "configuration options, $option" {
80
            .ds configure $option [lindex $test 1]
81
            lindex [.ds configure $option] 4
82
        } [lindex $test 2]
83
        update
84
        incr o
85
}
86
 
87
#
88
# Option tests which fail and produce errors.
89
#
90
foreach test {
91
  {-buttonboxpos bogus {bad buttonboxpos option "bogus": should be n, s, e, or w}}
92
  {-modality bogus {bad modality option "bogus": should be none, application, or global}}} {
93
        set option [lindex $test 0]
94
        test Dialogshell-2.$o "configuration options, $option" {
95
            list [catch {.ds configure $option [lindex $test 1]} msg] $msg
96
        } [list 1 [lindex $test 2]]
97
        incr o
98
}
99
 
100
#
101
# Method tests which are successful.
102
#
103
foreach test {
104
    {{.ds childsite} {.ds.shellchildsite.dschildsite}}
105
    {{.ds add Help -text Help} {}}
106
    {{.ds insert 1 Apply -text Apply} {}}
107
    {{.ds center .} {}}
108
    {{.ds delete Help} {}}
109
    {{.ds hide Apply} {}}
110
    {{.ds default Cancel} {}}
111
    {{.ds center} {}}
112
    {{.ds show Apply} {}}
113
    {{.ds invoke OK} {}}
114
    {{.ds buttonconfigure OK -text Ok} {}}} {
115
        set method [lindex [lindex $test 0] 1]
116
        test Dialogshell-3.$m "object methods, $method" {
117
            list [catch {eval [lindex $test 0]} msg] $msg
118
        } [list 0 [lindex $test 1]]
119
        update
120
        incr m
121
}
122
 
123
#
124
# Method tests which fail and produce errors
125
#
126
test Dialogshell-3.$m "object methods, activate already active" {
127
    list [catch {.ds activate} msg] $msg
128
} [list 0 {}]
129
update
130
incr m
131
 
132
test Dialogshell-3.$m "object methods, deactivate" {
133
    list [catch {.ds deactivate} msg] $msg
134
} [list 0 {}]
135
update
136
incr m
137
 
138
#
139
# Destruction test
140
#
141
test Dialogshell-1.$c {Dialogshell destruction} {
142
    destroy .ds
143
    update
144
} {}
145
incr c
146
 
147
#
148
# Global modality test.
149
#
150
test Dialogshell-4.2 "global modality, activation, and deactivation" {
151
    iwidgets::dialogshell .ds -modality global
152
    .ds add OK -text "OK"
153
    .ds add Cancel -text "Cancel"
154
    .ds default OK
155
    pack [label [.ds childsite].l -text "Global Modal Dialogshell"]
156
    after 2000 {.ds deactivate Test}
157
    list [catch {.ds activate} msg] $msg
158
} [list 0 Test]
159
update
160
 
161
#
162
# Destruction test
163
#
164
test Dialogshell-1.$c {Dialogshell destruction} {
165
    destroy .ds
166
    update
167
} {}
168
incr c
169
 
170
#
171
# None modality test.
172
#
173
test Dialogshell-4.3 "no modality, activation, and deactivation" {
174
    iwidgets::dialogshell .ds -modality none
175
    .ds add OK -text "OK"
176
    .ds add Cancel -text "Cancel"
177
    .ds default OK
178
    pack [label [.ds childsite].l -text "Non-Modal Dialogshell"]
179
    .ds activate
180
    update
181
    after 2000
182
    .ds deactivate
183
} {}
184
update
185
 
186
#
187
# Destruction test
188
#
189
test Dialogshell-1.$c {Dialogshell destruction} {
190
    destroy .ds
191
    update
192
} {}
193
 
194
incr c
195
 
196
#
197
# Application modality test.
198
#
199
test Dialogshell-4.4 "application modality, activation, and deactivation" {
200
    iwidgets::dialogshell .ds -modality application
201
    .ds add OK -text "OK"
202
    .ds add Cancel -text "Cancel"
203
    .ds default OK
204
    pack [label [.ds childsite].l -text "Application Modal Dialogshell"]
205
    after 2000 {.ds deactivate Test}
206
    list [catch {.ds activate} msg] $msg
207
} [list 0 Test]
208
update
209
 
210
#
211
# Destruction test
212
#
213
test Dialogshell-1.$c {Dialogshell destruction} {
214
    destroy .ds
215
    update
216
} {}
217
 
218
incr c
219
 
220
test Dialogshell-1.$c {Dialogshell destruction} {
221
    iwidgets::dialogshell .ds
222
    destroy .ds
223
    update
224
} {}

powered by: WebSVN 2.1.0

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