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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [itcl/] [iwidgets3.0.0/] [tests/] [fileselectionbox.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] Fileselectionbox 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
#
9
# Copyright (c) 1995 DSC Technologies Corporation
10
#
11
# See the file "license.terms" for information on usage and redistribution
12
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13
#
14
# @(#) $Id: fileselectionbox.test,v 1.1.1.1 2002-01-16 10:24:51 markom Exp $
15
 
16
package require Iwidgets 3.0
17
 
18
if {[string compare test [info procs test]] == 1} {
19
    source defs
20
}
21
 
22
wm geometry . {}
23
raise .
24
 
25
set c 1
26
set o 1
27
set m 1
28
 
29
#
30
# Initial construction test
31
#
32
test Fileselectionbox-1.$c {Fileselectionbox construction} {
33
    iwidgets::Fileselectionbox .fsb
34
    pack .fsb -padx 10 -pady 10 -fill both -expand yes
35
    update
36
} {}
37
 
38
incr c
39
 
40
#
41
# Option tests which are successful.
42
#
43
test Fileselectionbox-2.$o {configuration option} {
44
    llength [.fsb configure]
45
} {45}
46
 
47
incr o
48
 
49
foreach test {
50
    {-activebackground #ececec #ececec}
51
    {-activerelief raised raised}
52
    {-background #d9d9d9 #d9d9d9}
53
    {-borderwidth 2 2}
54
    {-textbackground GhostWhite GhostWhite}
55
    {-childsitepos n n}
56
    {-childsitepos s s}
57
    {-childsitepos e e}
58
    {-childsitepos w w}
59
    {-childsitepos top top}
60
    {-childsitepos bottom bottom}
61
    {-childsitepos center center}
62
    {-cursor gumby gumby}
63
    {-directory {..} {..}}
64
    {-foreground Black Black}
65
    {-highlightcolor black black}
66
    {-highlightthickness 2 2}
67
    {-insertbackground Black Black}
68
    {-insertborderwidth 1 1}
69
    {-insertofftime 300 300}
70
    {-insertontime  600 600}
71
    {-insertwidth 3 3}
72
    {-dirslabel "Dirs Label" "Dirs Label"}
73
    {-dirson no no}
74
    {-dirson yes yes}
75
    {-fileslabel "Files Label" "Files Label"}
76
    {-fileson no no}
77
    {-fileson yes yes}
78
    {-filetype any any}
79
    {-filetype directory directory}
80
    {-filetype regular regular}
81
    {-filterlabel "Filter Label" "Filter Label"}
82
    {-filteron no no}
83
    {-filteron yes yes}
84
    {-directory ../tests ../tests}
85
    {-mask *.* *.*}
86
    {-nomatchstring {No Files} {No Files}}
87
    {-labelfont -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*}
88
    {-selectbackground #e6ceb1 #e6ceb1}
89
    {-selectborderwidth 1 1}
90
    {-selectionlabel "Selection Label" "Selection Label"}
91
    {-selectionon no no}
92
    {-selectionon yes yes}
93
    {-textfont -*-courier-medium-r-normal--*-120-* -*-courier-medium-r-normal--*-120-*}
94
    {-troughcolor #c3c3c3 #c3c3c3}
95
    {-width 400 400}
96
    {-height 375 375}} {
97
        set option [lindex $test 0]
98
        test Fileselectionbox-2.$o "configuration options, $option" {
99
            .fsb configure $option [lindex $test 1]
100
            lindex [.fsb configure $option] 4
101
        } [lindex $test 2]
102
        update
103
        incr o
104
}
105
#
106
# Option tests which fail and produce errors.
107
#
108
foreach test {
109
  {-directory bogus {bad directory option "bogus": directory does not exist}}
110
  {-filetype bogus {bad filetype option "bogus": should be regular, directory, or any}}} {
111
        set option [lindex $test 0]
112
        test Fileselectionbox-2.$o "configuration options, $option" {
113
            list [catch {.fsb configure $option [lindex $test 1]} msg] $msg
114
        } [list 1 [lindex $test 2]]
115
        incr o
116
}
117
 
118
#
119
# Method tests which are successful.
120
#
121
foreach test {
122
    {{.fsb childsite} {.fsb.fsbchildsite}}
123
    {{.fsb get} {}}} {
124
        set method [lindex [lindex $test 0] 1]
125
        test Fileselectionbox-3.$m "object methods, $method" {
126
            list [catch {eval [lindex $test 0]} msg] $msg
127
        } [list 0 [lindex $test 1]]
128
        update
129
        incr m
130
}
131
 
132
#
133
# Conclusion of constrcution/destruction tests
134
#
135
test Fileselectionbox-1.$c {Fileselectionbox destruction} {
136
    destroy .fsb
137
    update
138
} {}
139
 
140
 
141
incr c
142
 
143
test Fileselectionbox-1.$c {Fileselectionbox construction} {
144
    iwidgets::fileselectionbox .fsb
145
    pack .fsb -padx 10 -pady 10 -fill both -expand yes
146
    update
147
} {}
148
 
149
 
150
incr c
151
 
152
test Fileselectionbox-1.$c {Fileselectionbox destruction} {
153
    destroy .fsb
154
    update
155
} {}
156
 
157
incr c
158
 
159
 
160
test Fileselectionbox-1.$c {Fileselectionbox destruction} {
161
    iwidgets::fileselectionbox .fsb
162
    pack .fsb
163
    destroy .fsb
164
    update
165
} {}
166
 
167
#
168
# Childsite tests
169
#
170
incr o
171
 
172
test Fileselectionbox-1.$o {Fileselectionbox -childsitepos} {
173
    iwidgets::fileselectionbox .fsb
174
    pack .fsb
175
    update
176
    label [.fsb childsite].lb -background red -text CS
177
    pack [.fsb childsite].lb -fill both -expand yes
178
    update
179
 
180
    .fsb configure -childsitepos n
181
    update
182
    .fsb configure -childsitepos s
183
    update
184
    .fsb configure -childsitepos e
185
    update
186
    .fsb configure -childsitepos w
187
    update
188
    .fsb configure -childsitepos top
189
    update
190
    .fsb configure -childsitepos bottom
191
    update
192
    .fsb configure -childsitepos center
193
    update
194
    destroy .fsb
195
} {}

powered by: WebSVN 2.1.0

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