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/] [spinint.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] Spinint 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: spinint.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 Spinint-1.$c {Spinint construction} {
33
    iwidgets::Spinint .spi
34
    pack .spi -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 Spinint-2.$o {configuration option} {
44
    llength [.spi configure]
45
} {46}
46
 
47
incr o
48
 
49
foreach test {
50
    {-background #d9d9d9 #d9d9d9}
51
    {-childsitepos e e}
52
    {-childsitepos s s}
53
    {-childsitepos w w}
54
    {-childsitepos n n}
55
    {-childsitepos e e}
56
    {-borderwidth 4 4}
57
    {-cursor gumby gumby}
58
    {-decrement {.spi insert end Down} {.spi insert end Down}}
59
    {-exportselection 0 0}
60
    {-fixed 10 10}
61
    {-borderwidth 2 2}
62
    {-foreground Black Black}
63
    {-increment {.spi insert end Up} {.spi insert end Up}}
64
    {-insertbackground Black Black}
65
    {-insertborderwidth 2 2}
66
    {-insertofftime 200 200}
67
    {-insertontime 500 500}
68
    {-insertwidth 3 3}
69
    {-labelfont 6x13 6x13}
70
    {-labelmargin 5 5}
71
    {-labeltext Label Label}
72
    {-labelpos w w}
73
    {-labelpos nw nw}
74
    {-labelpos n n}
75
    {-labelpos ne ne}
76
    {-labelpos e e}
77
    {-labelpos se se}
78
    {-labelpos s s}
79
    {-labelpos sw sw}
80
    {-arroworient horizontal horizontal}
81
    {-range {0 100} {0 100}}
82
    {-relief raised raised}
83
    {-selectbackground blue blue}
84
    {-selectbackground #c3c3c3 #c3c3c3}
85
    {-selectborderwidth 2 2}
86
    {-selectforeground Blue Blue}
87
    {-selectforeground Black Black}
88
    {-state disabled disabled}
89
    {-state normal normal}
90
    {-step 2 2}
91
    {-textfont 6x13 6x13}
92
    {-width 30 30}
93
    {-wrap 0 0}} {
94
        set option [lindex $test 0]
95
        test Spinint-2.$o "configuration options, $option" {
96
            .spi configure $option [lindex $test 1]
97
            lindex [.spi configure $option] 4
98
        } [lindex $test 2]
99
        update
100
        incr o
101
}
102
 
103
#
104
# Option tests which fail and produce errors.
105
#
106
foreach test {
107
    {-range {bogus} {wrong # args: should be ".spi configure -range {begin end}"}}
108
    {-range {bogus 0} {bad range option "bogus": begin value must be an integer}}
109
    {-range {0 bogus} {bad range option "bogus": end value must be an integer}}
110
    {-range {100 10} {bad option starting range "100": must be less than ending: "10"}}} {
111
        set option [lindex $test 0]
112
        test Spinint-2.$o "configuration options, $option" {
113
            list [catch {.spi 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
    {{.spi clear} {}}
123
    {{.spi insert end 50} {}}
124
    {{.spi cget -step} 2}
125
    {{.spi up} {}}
126
    {{.spi down} {}}
127
    {{.spi get} 50}} {
128
        set method [lindex [lindex $test 0] 1]
129
        test Spinint-3.$m "object methods, $method" {
130
            list [catch {eval [lindex $test 0]} msg] $msg
131
        } [list 0 [lindex $test 1]]
132
        update
133
        incr m
134
}
135
 
136
#
137
# Conclusion of constrcution/destruction tests
138
#
139
test Spinint-1.$c {Spinint destruction} {
140
    destroy .spi
141
    update
142
} {}
143
 
144
incr c
145
 
146
test Spinint-1.$c {Spinint construction} {
147
    iwidgets::spinint .spi
148
    pack .spi -padx 10 -pady 10 -fill both -expand yes
149
    update
150
} {}
151
 
152
incr c
153
 
154
test Spinint-1.$c {Spinint destruction} {
155
    destroy .spi
156
    update
157
} {}
158
 
159
incr c
160
 
161
test Spinint-1.$c {Spinint destruction} {
162
    iwidgets::spinint .spi
163
    pack .spi
164
    destroy .spi
165
    update
166
} {}

powered by: WebSVN 2.1.0

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