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

Subversion Repositories or1k_old

[/] [or1k_old/] [tags/] [start/] [insight/] [itcl/] [iwidgets3.0.0/] [tests/] [selectiondialog.test] - Blame information for rev 1782

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] Selectiondialog 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: selectiondialog.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 Selectiondialog-1.$c {Selectiondialog construction} {
34
    iwidgets::Selectiondialog .sd
35
    .sd insert items end Hello {Out There} World
36
    .sd activate
37
} {}
38
 
39
incr c
40
 
41
#
42
# Option tests which are successful.
43
#
44
test Selectiondialog-2.$o {configuration option} {
45
    llength [.sd configure]
46
} {44}
47
 
48
incr o
49
 
50
foreach test {
51
    {-width 340 340}
52
    {-width 360 360}
53
    {-activerelief raised raised}
54
    {-borderwidth 2 2}
55
    {-background #d9d9d9 #d9d9d9}
56
    {-buttonboxpos n n}
57
    {-buttonboxpadx 10 10}
58
    {-buttonboxpos e e}
59
    {-buttonboxpos w w}
60
    {-buttonboxpady 10 10}
61
    {-buttonboxpos s s}
62
    {-cursor gumby gumby}
63
    {-foreground Black Black}
64
    {-highlightcolor Black Black}
65
    {-highlightthickness 2 2}
66
    {-modality global global}
67
    {-modality application application}
68
    {-modality none none}
69
    {-padx 15 15}
70
    {-pady 15 15}
71
    {-textbackground GhostWhite GhostWhite}
72
    {-separator off off}
73
    {-thickness 4 4}
74
    {-separator on on}
75
    {-title Selectiondialog Selectiondialog}
76
    {-childsitepos n n}
77
    {-childsitepos s s}
78
    {-childsitepos e e}
79
    {-childsitepos w w}
80
    {-childsitepos center center}
81
    {-cursor gumby gumby}
82
    {-exportselection 0 0}
83
    {-insertbackground Blue Blue}
84
    {-insertbackground Black Black}
85
    {-insertborderwidth 1 1}
86
    {-insertofftime 200 200}
87
    {-insertontime  500 500}
88
    {-insertwidth 3 3}
89
    {-itemslabel "Items Label" "Items Label"}
90
    {-itemson no no}
91
    {-labelfont 6x13 6x13}
92
    {-itemson yes yes}
93
    {-selectbackground #c3c3c3 #c3c3c3}
94
    {-selectborderwidth 2 2}
95
    {-selectforeground Black Black}
96
    {-selectionlabel "Selection Label" "Selection Label"}
97
    {-selectionon no no}
98
    {-selectionon yes yes}
99
    {-width 0 0}
100
    {-height 0 0}
101
    {-textfont 6x13 6x13}} {
102
        set option [lindex $test 0]
103
        test Selectiondialog-2.$o "configuration options, $option" {
104
            .sd configure $option [lindex $test 1]
105
            lindex [.sd configure $option] 4
106
        } [lindex $test 2]
107
        update
108
        incr o
109
}
110
 
111
#
112
# Method tests which are successful.
113
#
114
foreach test {
115
    {{.sd childsite} {.sd.shellchildsite.dschildsite.selectionbox.sbchildsite}}
116
    {{.sd clear items} {}}
117
    {{.sd component selectionbox component items get 0 end} {}}
118
    {{.sd insert items 0 One Two Three Four Five Six} {}}
119
    {{.sd component selectionbox component items get 0 end} {One Two Three Four Five Six}}
120
    {{.sd size} 6}
121
    {{.sd clear selection} {}}
122
    {{.sd insert selection 0 One} {}}
123
    {{.sd get} One}
124
    {{.sd index end} 6}
125
    {{.sd index Six} 5}
126
    {{.sd selection set 1} {}}
127
    {{.sd selectitem} {}}
128
    {{.sd curselection} 1}
129
    {{.sd get} Two}
130
    {{.sd delete Three} {}}
131
    {{.sd clear items} {}}
132
    {{.sd hide Help} {}}
133
    {{.sd hide Cancel} {}}
134
    {{.sd default Apply} {}}
135
    {{.sd show Cancel} {}}
136
    {{.sd deactivate} {}}} {
137
        set method [lindex [lindex $test 0] 1]
138
        test Selectiondialog-3.$m "object methods, $method" {
139
            list [catch {eval [lindex $test 0]} msg] $msg
140
        } [list 0 [lindex $test 1]]
141
        update
142
        incr m
143
}
144
 
145
#
146
# Method tests which fail and produce errors
147
#
148
foreach test {
149
    {{.sd clear bogus} {bad clear argument "bogus": should be selection or items}}
150
    {{.sd insert bogus bogus} {bad insert argument "bogus": should be selection or items}}} {
151
        set method [lindex [lindex $test 0] 1]
152
        test Selectiondialog-3.$m "object methods, $method" {
153
            list [catch {eval [lindex $test 0]} msg] $msg
154
        } [list 1 [lindex $test 1]]
155
        incr m
156
}
157
 
158
#
159
# Conclusion of constrcution/destruction tests
160
#
161
test Selectiondialog-1.$c {Selectiondialog destruction} {
162
    destroy .sd
163
    update
164
} {}
165
 
166
incr c
167
 
168
test Selectiondialog-1.$c {Selectiondialog construction} {
169
    iwidgets::selectiondialog .sd
170
    update
171
} {}
172
 
173
incr c
174
 
175
test Selectiondialog-1.$c {Selectiondialog destruction} {
176
    destroy .sd
177
    update
178
} {}
179
 
180
incr c
181
 
182
test Selectiondialog-1.$c {Selectiondialog destruction} {
183
    iwidgets::selectiondialog .sd
184
    destroy .sd
185
    update
186
} {}

powered by: WebSVN 2.1.0

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