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

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [itcl/] [iwidgets3.0.0/] [tests/] [fileselectiondialog.test] - Blame information for rev 578

Go to most recent revision | 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] Fileselectiondialog
2
# class.  It is organized in the standard fashion for Tcl tests with the
3
# following 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: fileselectiondialog.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 Fileselectiondialog-1.$c {Fileselectiondialog construction} {
34
    iwidgets::Fileselectiondialog .fsd
35
    .fsd activate
36
} {}
37
 
38
incr c
39
 
40
#
41
# Option tests which are successful.
42
#
43
test Fileselectiondialog-2.$o {configuration option} {
44
    llength [.fsd configure]
45
} {51}
46
 
47
incr o
48
 
49
foreach test {
50
    {-activebackground #ececec #ececec}
51
    {-borderwidth 2 2}
52
    {-childsitepos n n}
53
    {-childsitepos s s}
54
    {-childsitepos e e}
55
    {-childsitepos w w}
56
    {-childsitepos top top}
57
    {-childsitepos bottom bottom}
58
    {-childsitepos center center}
59
    {-cursor gumby gumby}
60
    {-directory {..} {..}}
61
    {-textbackground GhostWhite GhostWhite}
62
    {-foreground Black Black}
63
    {-insertbackground Black Black}
64
    {-insertborderwidth 1 1}
65
    {-insertofftime 200 200}
66
    {-insertontime  500 500}
67
    {-insertwidth 3 3}
68
    {-dirslabel "Dirs Label" "Dirs Label"}
69
    {-dirson no no}
70
    {-dirson yes yes}
71
    {-fileslabel "Files Label" "Files Label"}
72
    {-fileson no no}
73
    {-directory ../tests ../tests}
74
    {-mask *.* *.*}
75
    {-nomatchstring {No Files} {No Files}}
76
    {-fileson yes yes}
77
    {-filetype any any}
78
    {-filetype directory directory}
79
    {-filetype regular regular}
80
    {-filterlabel "Filter Label" "Filter Label"}
81
    {-filteron no no}
82
    {-filteron yes yes}
83
    {-selectbackground #c3c3c3 #c3c3c3}
84
    {-selectionlabel "Selection Label" "Selection Label"}
85
    {-selectionon no no}
86
    {-selectionon yes yes}
87
    {-textfont -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*}
88
    {-background #d9d9d9 #d9d9d9}
89
    {-buttonboxpos n n}
90
    {-buttonboxpos e e}
91
    {-buttonboxpos w w}
92
    {-buttonboxpos s s}
93
    {-cursor gumby gumby}
94
    {-modality global global}
95
    {-modality application application}
96
    {-modality none none}
97
    {-padx 15 15}
98
    {-pady 15 15}
99
    {-separator off off}
100
    {-thickness 4 4}
101
    {-separator on on}
102
    {-title Fileselectiondialog Fileselectiondialog}} {
103
        set option [lindex $test 0]
104
        test Fileselectiondialog-2.$o "configuration options, $option" {
105
            .fsd configure $option [lindex $test 1]
106
            lindex [.fsd configure $option] 4
107
        } [lindex $test 2]
108
        update
109
        incr o
110
}
111
 
112
#
113
# Option tests which fail and produce errors.
114
#
115
foreach test {
116
  {-directory bogus {bad directory option "bogus": directory does not exist}}
117
  {-filetype bogus {bad filetype option "bogus": should be regular, directory, or any}}} {
118
        set option [lindex $test 0]
119
        test FileSelectionBox-2.$o "configuration options, $option" {
120
            list [catch {.fsd configure $option [lindex $test 1]} msg] $msg
121
        } [list 1 [lindex $test 2]]
122
        incr o
123
}
124
 
125
#
126
# Method tests which are successful.
127
#
128
foreach test {
129
    {{.fsd childsite} {.fsd.shellchildsite.dschildsite.fsb.fsbchildsite}}
130
    {{.fsd hide Help} {}}
131
    {{.fsd hide Cancel} {}}
132
    {{.fsd default Apply} {}}
133
    {{.fsd show Cancel} {}}
134
    {{.fsd deactivate} {}}} {
135
        set method [lindex [lindex $test 0] 1]
136
        test Fileselectiondialog-3.$m "object methods, $method" {
137
            list [catch {eval [lindex $test 0]} msg] $msg
138
        } [list 0 [lindex $test 1]]
139
        update
140
        incr m
141
}
142
 
143
#
144
# Conclusion of constrcution/destruction tests
145
#
146
test Fileselectiondialog-1.$c {Fileselectiondialog destruction} {
147
    destroy .fsd
148
    update
149
} {}
150
 
151
incr c
152
 
153
test Fileselectiondialog-1.$c {Fileselectiondialog construction} {
154
    iwidgets::fileselectiondialog .fsd
155
    update
156
} {}
157
 
158
incr c
159
 
160
test Fileselectiondialog-1.$c {Fileselectiondialog destruction} {
161
    destroy .fsd
162
    update
163
} {}
164
 
165
incr c
166
 
167
test Fileselectiondialog-1.$c {Fileselectiondialog destruction} {
168
    iwidgets::fileselectiondialog .fsd
169
    destroy .fsd
170
    update
171
} {}
172
 
173
#
174
# Childsite tests
175
#
176
incr o
177
 
178
test Fileselectiondialog-1.$o {Fileselectiondialog -childsitepos} {
179
    iwidgets::fileselectiondialog .fsd
180
    .fsd activate
181
    update
182
    label [.fsd childsite].lb -background red -text CS
183
    pack [.fsd childsite].lb -fill both -expand yes
184
    update
185
 
186
    .fsd configure -childsitepos n
187
    update
188
    .fsd configure -childsitepos s
189
    update
190
    .fsd configure -childsitepos e
191
    update
192
    .fsd configure -childsitepos w
193
    update
194
    .fsd configure -childsitepos top
195
    update
196
    .fsd configure -childsitepos bottom
197
    update
198
    .fsd configure -childsitepos center
199
    update
200
    .fsd deactivate
201
    update
202
    destroy .fsd
203
} {}

powered by: WebSVN 2.1.0

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