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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [itcl/] [iwidgets3.0.0/] [tests/] [spinner.test] - Blame information for rev 1770

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] Spinner 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: spinner.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
wm geometry . {}
22
raise .
23
 
24
set c 1
25
set o 1
26
set m 1
27
 
28
#
29
# Initial construction test
30
#
31
test Spinner-1.$c {Spinner construction} {
32
    iwidgets::Spinner .sp
33
    pack .sp -padx 10 -pady 10 -fill both -expand yes
34
    update
35
} {}
36
 
37
incr c
38
 
39
#
40
# Option tests which are successful.
41
#
42
test Spinner-2.$o {configuration option} {
43
    llength [.sp configure]
44
} {43}
45
 
46
incr o
47
 
48
foreach test {
49
    {-background #d9d9d9 #d9d9d9}
50
    {-foreground blue blue}
51
    {-borderwidth 4 4}
52
    {-childsitepos e e}
53
    {-childsitepos s s}
54
    {-childsitepos w w}
55
    {-childsitepos n n}
56
    {-childsitepos e e}
57
    {-borderwidth 2 2}
58
    {-cursor gumby gumby}
59
    {-decrement {.sp insert end Down} {.sp insert end Down}}
60
    {-exportselection 0 0}
61
    {-fixed 15 15}
62
    {-foreground Black Black}
63
    {-increment {.sp insert end Up} {.sp insert end Up}}
64
    {-insertbackground Blue Blue}
65
    {-insertbackground Black Black}
66
    {-insertborderwidth 2 2}
67
    {-insertofftime 200 200}
68
    {-insertontime 500 500}
69
    {-insertwidth 3 3}
70
    {-labelfont 6x13 6x13}
71
    {-labelmargin 5 5}
72
    {-labeltext Label Label}
73
    {-labelpos w w}
74
    {-labelpos nw nw}
75
    {-labelpos n n}
76
    {-labelpos ne ne}
77
    {-labelpos e e}
78
    {-labelpos se se}
79
    {-labelpos s s}
80
    {-labelpos sw sw}
81
    {-arroworient horizontal horizontal}
82
    {-relief raised raised}
83
    {-selectbackground #c3c3c3 #c3c3c3}
84
    {-selectborderwidth 2 2}
85
    {-selectforeground Black Black}
86
    {-state disabled disabled}
87
    {-state normal normal}
88
    {-textfont 6x13 6x13}
89
    {-validate numeric {::iwidgets::Entryfield::numeric %c}}
90
    {-repeatdelay 400 400}
91
    {-repeatdelay -100 0}
92
    {-repeatinterval 200 200}
93
    {-repeatinterval -100 0}
94
    {-width 30 30}} {
95
        set option [lindex $test 0]
96
        test Spinner-2.$o "configuration options, $option" {
97
            .sp configure $option [lindex $test 1]
98
            lindex [.sp configure $option] 4
99
        } [lindex $test 2]
100
        update
101
        incr o
102
}
103
 
104
#
105
# Method tests which are successful.
106
#
107
foreach test {
108
    {{.sp up} {}}
109
    {{.sp down} {}}} {
110
        set method [lindex [lindex $test 0] 1]
111
        test Spinner-3.$m "object methods, $method" {
112
            list [catch {eval [lindex $test 0]} msg] $msg
113
        } [list 0 [lindex $test 1]]
114
        update
115
        incr m
116
}
117
 
118
#
119
# Conclusion of constrcution/destruction tests
120
#
121
test Spinner-1.$c {Spinner destruction} {
122
    destroy .sp
123
    update
124
} {}
125
 
126
incr c
127
 
128
test Spinner-1.$c {Spinner construction} {
129
    iwidgets::spinner .sp
130
    pack .sp -padx 10 -pady 10 -fill both -expand yes
131
    update
132
} {}
133
 
134
incr c
135
 
136
test Spinner-1.$c {Spinner destruction} {
137
    destroy .sp
138
    update
139
} {}
140
 
141
incr c
142
 
143
test Spinner-1.$c {Spinner destruction} {
144
    iwidgets::spinner .sp
145
    pack .sp
146
    destroy .sp
147
    update
148
} {}

powered by: WebSVN 2.1.0

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