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/] [optionmenu.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] Optionmenu 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: optionmenu.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 Optionmenu-1.$c {Optionmenu construction} {
33
    iwidgets::Optionmenu .om
34
    pack .om -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 Optionmenu-2.$o {configuration option} {
44
    llength [.om configure]
45
} {26}
46
 
47
incr o
48
 
49
foreach test {
50
    {-activebackground #ececec #ececec}
51
    {-activeborderwidth 2 2}
52
    {-activeforeground Black Black}
53
    {-labeltext Optionmenu Optionmenu}
54
    {-background #d9d9d9 #d9d9d9}
55
    {-borderwidth 2 2}
56
    {-labelpos w w}
57
    {-clicktime 100 100}
58
    {-command {.om configure -background Red} {.om configure -background Red}}
59
    {-cursor gumby gumby}
60
    {-labelpos nw nw}
61
    {-cyclicon false false}
62
    {-cyclicon true true}
63
    {-font -Adobe-Helvetica-Bold-R-Normal--*-120-*-*-*-*-*-* -Adobe-Helvetica-Bold-R-Normal--*-120-*-*-*-*-*-*}
64
    {-labelpos n n}
65
    {-foreground Black Black}
66
    {-labelpos ne ne}
67
    {-labelpos se se}
68
    {-labelfont -Adobe-Helvetica-Bold-R-Normal--*-120-*-*-*-*-*-* -Adobe-Helvetica-Bold-R-Normal--*-120-*-*-*-*-*-*}
69
    {-labelmargin 5 5}
70
    {-labelpos e e}
71
    {-state disabled disabled}
72
    {-labelpos s s}
73
    {-state normal normal}
74
    {-labelpos sw sw}
75
    {-labelpos w w}
76
    {-width 140 140}} {
77
        set option [lindex $test 0]
78
        test Optionmenu-2.$o "configuration options, $option" {
79
            .om configure $option [lindex $test 1]
80
            lindex [.om configure $option] 4
81
        } [lindex $test 2]
82
        update
83
        incr o
84
}
85
 
86
#
87
# Option tests which fail and produce errors.
88
#
89
foreach test {
90
  {-state bogus {bad state option "bogus": should be disabled or normal}}} {
91
        set option [lindex $test 0]
92
        test Optionmenu-2.$o "configuration options, $option" {
93
            list [catch {.om configure $option [lindex $test 1]} msg] $msg
94
        } [list 1 [lindex $test 2]]
95
        incr o
96
}
97
 
98
#
99
# Method tests which are successful.
100
#
101
foreach test {
102
    {{.om index 0} 0}
103
    {{.om insert end Unix VMS Linux OS/2 {Windows NT} DOS} {}}
104
    {{.om index end} 6}
105
    {{.om index select} 0}
106
    {{.om index OS/2} 3}
107
    {{.om delete 0 1} {}}
108
    {{.om delete OS/2} {}}
109
    {{.om disable 0} {}}
110
    {{.om enable 0} {}}
111
    {{.om disable DOS} {}}
112
    {{.om enable DOS} {}}
113
    {{.om select Linux} {}}
114
    {{.om get} Linux}
115
    {{.om get 1} {Windows NT}}
116
    {{.om get 0 end} {Linux {Windows NT} DOS}}
117
    {{.om insert 0 Unix VMS} {}}
118
    {{.om select 3} {}}
119
    {{.om select end} {}}
120
    {{.om sort ascending} {}}
121
    {{.om sort descending} {}}
122
    {{.om sort increasing} {}}
123
    {{.om sort decreasing} {}}} {
124
        set method [lindex [lindex $test 0] 1]
125
        test Optionmenu-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
# Method tests which fail and produce errors
134
#
135
foreach test {
136
    {{.om index bogus} {bad Optionmenu index "bogus"}}
137
    {{.om sort bogus} {bad sort argument "bogus": should be ascending, descending, increasing, or decreasing}}} {
138
        set method [lindex [lindex $test 0] 1]
139
        test Optionmenu-3.$m "object methods, $method" {
140
            list [catch {eval [lindex $test 0]} msg] $msg
141
        } [list 1 [lindex $test 1]]
142
        incr m
143
}
144
 
145
#
146
# Conclusion of constrcution/destruction tests
147
#
148
test Optionmenu-1.$c {Optionmenu destruction} {
149
    destroy .om
150
    update
151
} {}
152
 
153
incr c
154
 
155
test Optionmenu-1.$c {Optionmenu construction} {
156
    iwidgets::optionmenu .om -labeltext "Label" \
157
        -labelpos n
158
    pack .om -padx 10 -pady 10 -fill both -expand yes
159
    update
160
} {}
161
 
162
incr c
163
 
164
test Optionmenu-1.$c {Optionmenu destruction} {
165
    destroy .om
166
    update
167
} {}
168
 
169
incr c
170
 
171
test Optionmenu-1.$c {Optionmenu destruction} {
172
    iwidgets::optionmenu .om
173
    pack .om
174
    destroy .om
175
    update
176
} {}

powered by: WebSVN 2.1.0

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