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/] [spintime.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] Spintime 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: spintime.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 Spintime-1.$c {Spintime construction} {
33
    iwidgets::Spintime .st
34
    pack .st -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 Spintime-2.$o {configuration option} {
44
    llength [.st configure]
45
} {25}
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
    {-hourlabel Hour: Hour:}
55
    {-houron false false}
56
    {-houron true true}
57
    {-hourwidth 4 4}
58
    {-labelmargin 4 4}
59
    {-labelpos n n}
60
    {-labelpos s s}
61
    {-labelpos e e}
62
    {-labelpos w w}
63
    {-militaryon no no}
64
    {-militaryon yes yes}
65
    {-minutelabel Minute: Minute:}
66
    {-minuteon false false}
67
    {-minuteon true true}
68
    {-minutewidth 4 4}
69
    {-orient horizontal horizontal}
70
    {-orient vertical vertical}
71
    {-secondlabel Second: Second:}
72
    {-secondon false false}
73
    {-secondon true true}
74
    {-secondwidth 4 4}
75
    {-textbackground GhostWhite GhostWhite}
76
    {-timemargin 3 3}} {
77
        set option [lindex $test 0]
78
        test Spintime-2.$o "configuration options, $option" {
79
            .st configure $option [lindex $test 1]
80
            lindex [.st configure $option] 4
81
        } [lindex $test 2]
82
        update
83
        incr o
84
}
85
 
86
#
87
# Method tests which are successful.
88
#
89
foreach test {
90
    {{.st show "21:21:21"} {}}
91
    {{.st get -string} "21:21:21"}} {
92
        set method [lindex [lindex $test 0] 1]
93
        test Spintime-3.$m "object methods, $method" {
94
            list [catch {eval [lindex $test 0]} msg] $msg
95
        } [list 0 [lindex $test 1]]
96
        update
97
        incr m
98
}
99
 
100
foreach test {
101
    {{.st show bogus} {bad time: "bogus", must be a valid time string, clock clicks value or the keyword now}}
102
    {{.st get bogus} {bad format option "bogus": should be -string or -clicks}}} {
103
        set method [lindex [lindex $test 0] 1]
104
        test ScrolledListBox-3.$m "object methods, $method" {
105
            list [catch {eval [lindex $test 0]} msg] $msg
106
        } [list 1 [lindex $test 1]]
107
        incr m
108
}
109
 
110
#
111
# Conclusion of constrcution/destruction tests
112
#
113
test Spintime-1.$c {Spintime destruction} {
114
    destroy .st
115
    update
116
} {}
117
 
118
incr c
119
 
120
test Spintime-1.$c {Spintime construction} {
121
    iwidgets::spintime .st
122
    pack .st -padx 10 -pady 10 -fill both -expand yes
123
    update
124
} {}
125
 
126
incr c
127
 
128
test Spintime-1.$c {Spintime destruction} {
129
    destroy .st
130
    update
131
} {}
132
 
133
incr c
134
 
135
test Spintime-1.$c {Spintime destruction} {
136
    iwidgets::spintime .st
137
    pack .st
138
    destroy .st
139
    update
140
} {}

powered by: WebSVN 2.1.0

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