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/] [spindate.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] Spindate 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: spindate.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 Spindate-1.$c {Spindate construction} {
33
    iwidgets::Spindate .sd
34
    pack .sd -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 Spindate-2.$o {configuration option} {
44
    llength [.sd configure]
45
} {26}
46
 
47
incr o
48
 
49
foreach test {
50
    {-arroworient horizontal horizontal}
51
    {-arroworient vertical vertical}
52
    {-background #d9d9d9 #d9d9d9}
53
    {-cursor gumby gumby}
54
    {-datemargin 3 3}
55
    {-daylabel Day: Day:}
56
    {-dayon false false}
57
    {-dayon true true}
58
    {-daywidth 4 4}
59
    {-labelmargin 4 4}
60
    {-labelpos n n}
61
    {-labelpos s s}
62
    {-labelpos e e}
63
    {-labelpos w w}
64
    {-monthformat integer integer}
65
    {-monthformat brief brief}
66
    {-monthformat full full}
67
    {-monthlabel Month: Month:}
68
    {-monthon false false}
69
    {-monthon true true}
70
    {-monthwidth 4 4}
71
    {-orient horizontal horizontal}
72
    {-orient vertical vertical}
73
    {-textbackground GhostWhite GhostWhite}
74
    {-yeardigits 2 2}
75
    {-yeardigits 4 4}
76
    {-yearlabel Year: Year:}
77
    {-yearon false false}
78
    {-yearon true true}
79
    {-yearwidth 4 4}} {
80
        set option [lindex $test 0]
81
        test Spindate-2.$o "configuration options, $option" {
82
            .sd configure $option [lindex $test 1]
83
            lindex [.sd configure $option] 4
84
        } [lindex $test 2]
85
        update
86
        incr o
87
}
88
 
89
#
90
# Option tests which fail and produce errors.
91
#
92
foreach test {
93
  {-yeardigits bogus {bad yeardigits option "bogus", should be 2 or 4}}
94
  {-monthformat bogus {bad monthformat option "bogus", should be "integer", "brief" or "full"}}} {
95
        set option [lindex $test 0]
96
        test Spindate-2.$o "configuration options, $option" {
97
            list [catch {.sd configure $option [lindex $test 1]} msg] $msg
98
        } [list 1 [lindex $test 2]]
99
        incr o
100
}
101
 
102
#
103
# Method tests which are successful.
104
#
105
foreach test {
106
    {{.sd show 3/3/1960} {}}
107
    {{.sd get -string} "03 March 1960"}} {
108
        set method [lindex [lindex $test 0] 1]
109
        test Spindate-3.$m "object methods, $method" {
110
            list [catch {eval [lindex $test 0]} msg] $msg
111
        } [list 0 [lindex $test 1]]
112
        update
113
        incr m
114
}
115
 
116
foreach test {
117
    {{.sd show bogus} {bad date: "bogus", must be a valid date string, clock clicks value or the keyword now}}
118
    {{.sd get bogus} {bad format option "bogus": should be -string or -clicks}}} {
119
        set method [lindex [lindex $test 0] 1]
120
        test ScrolledListBox-3.$m "object methods, $method" {
121
            list [catch {eval [lindex $test 0]} msg] $msg
122
        } [list 1 [lindex $test 1]]
123
        incr m
124
}
125
 
126
#
127
# Conclusion of constrcution/destruction tests
128
#
129
test Spindate-1.$c {Spindate destruction} {
130
    destroy .sd
131
    update
132
} {}
133
 
134
incr c
135
 
136
test Spindate-1.$c {Spindate construction} {
137
    iwidgets::spindate .sd -monthformat brief
138
    pack .sd -padx 10 -pady 10 -fill both -expand yes
139
    update
140
} {}
141
 
142
incr c
143
 
144
test Spindate-1.$c {Spindate destruction} {
145
    destroy .sd
146
    update
147
} {}
148
 
149
incr c
150
 
151
test Spindate-1.$c {Spindate destruction} {
152
    iwidgets::spindate .sd
153
    pack .sd
154
    destroy .sd
155
    update
156
} {}

powered by: WebSVN 2.1.0

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