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

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [itcl/] [iwidgets3.0.0/] [tests/] [shell.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] Shell 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: shell.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 Shell-1.$c {Shell construction} {
34
    iwidgets::Shell .sh
35
 
36
    listbox [.sh childsite].lb -relief sunken
37
    pack [.sh childsite].lb -fill both -expand yes
38
 
39
    .sh center
40
    .sh activate
41
} {}
42
 
43
incr c
44
 
45
#
46
# Option tests which are successful.
47
#
48
test Shell-2.$o {configuration option} {
49
    llength [.sh configure]
50
} {11}
51
 
52
incr o
53
 
54
foreach test {
55
    {-background #d9d9d9 #d9d9d9}
56
    {-width 200 200}
57
    {-height 200 200}
58
    {-cursor gumby gumby}
59
    {-modality global global}
60
    {-modality application application}
61
    {-modality none none}
62
    {-padx 15 15}
63
    {-pady 15 15}
64
    {-width 0 0}
65
    {-height 0 0}
66
    {-title "Shell" "Shell"}} {
67
        set option [lindex $test 0]
68
        test Shell-2.$o "configuration options, $option" {
69
            .sh configure $option [lindex $test 1]
70
            lindex [.sh configure $option] 4
71
        } [lindex $test 2]
72
        update
73
        incr o
74
}
75
 
76
#
77
# Option tests which fail and produce errors.
78
#
79
foreach test {
80
  {-modality bogus {bad modality option "bogus": should be none, application, or global}}} {
81
        set option [lindex $test 0]
82
        test Shell-2.$o "configuration options, $option" {
83
            list [catch {.sh configure $option [lindex $test 1]} msg] $msg
84
        } [list 1 [lindex $test 2]]
85
        incr o
86
}
87
 
88
#
89
# Method tests which are successful.
90
#
91
foreach test {
92
    {{.sh childsite} {.sh.shellchildsite}}
93
    {{.sh activate} {}}
94
    {{.sh center .} {}}
95
    {{.sh center} {}}} {
96
        set method [lindex [lindex $test 0] 1]
97
        test Shell-3.$m "object methods, $method" {
98
            list [catch {eval [lindex $test 0]} msg] $msg
99
        } [list 0 [lindex $test 1]]
100
        update
101
        incr m
102
}
103
 
104
#
105
# Deactivate test
106
#
107
test Shell-3.$m "object methods, deactivate" {
108
    list [catch {.sh deactivate} msg] $msg
109
} [list 0 {}]
110
update
111
incr m
112
 
113
#
114
# Destruction test
115
#
116
test Shell-1.$c {Shell destruction} {
117
    destroy .sh
118
    update
119
} {}
120
incr c
121
 
122
#
123
# Global modality test.
124
#
125
test Shell-4.2 "global modality, activation, and deactivation" {
126
    iwidgets::shell .sh -modality global
127
    .sh center
128
    pack [label [.sh childsite].l -text "Global Modal Shell"]
129
    after 2000 {.sh deactivate Test}
130
    .sh center
131
    list [catch {.sh activate} msg] $msg
132
} [list 0 Test]
133
update
134
 
135
#
136
# Destruction test
137
#
138
test Shell-1.$c {Shell destruction} {
139
    destroy .sh
140
    update
141
} {}
142
incr c
143
 
144
#
145
# None modality test.
146
#
147
test Shell-4.3 "no modality, activation, and deactivation" {
148
    iwidgets::shell .sh -modality none
149
    .sh center
150
    pack [label [.sh childsite].l -text "Non-Modal Shell"]
151
    .sh center
152
    .sh activate
153
    update
154
    after 2000
155
    .sh deactivate
156
} {}
157
update
158
 
159
#
160
# Destruction test
161
#
162
test Shell-1.$c {Shell destruction} {
163
    destroy .sh
164
    update
165
} {}
166
 
167
incr c
168
 
169
#
170
# Application modality test.
171
#
172
test Shell-4.4 "application modality, activation, and deactivation" {
173
    iwidgets::shell .sh -modality application
174
    .sh center
175
    pack [label [.sh childsite].l -text "Application Modal Shell"]
176
    after 2000 {.sh deactivate Test}
177
    .sh center
178
    list [catch {.sh activate} msg] $msg
179
} [list 0 Test]
180
update
181
 
182
#
183
# Destruction test
184
#
185
test Shell-1.$c {Shell destruction} {
186
    destroy .sh
187
    update
188
} {}
189
 
190
incr c
191
 
192
test Shell-1.$c {Shell destruction} {
193
    iwidgets::shell .sh
194
    destroy .sh
195
    update
196
} {}

powered by: WebSVN 2.1.0

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