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/] [watch.test] - Blame information for rev 579

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] Watch 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: watch.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
catch {destroy .w}
30
 
31
#
32
# Initial construction test
33
#
34
test Watch-1.$c {Watch construction} {
35
    iwidgets::Watch .w
36
    pack .w -padx 10 -pady 10 -fill both -expand yes
37
    update
38
} {}
39
 
40
incr c
41
 
42
#
43
# Option tests which are successful.
44
#
45
test Watch-2.$o {configuration option} {
46
    llength [.w configure]
47
} {34}
48
 
49
incr o
50
 
51
foreach test {
52
    {-background #d9d9d9 #d9d9d9}
53
    {-cursor gumby gumby}
54
    {-hourcolor yellow yellow}
55
    {-minutecolor blue blue}
56
    {-secondcolor green green}
57
    {-tickcolor red red}
58
    {-clockcolor orange orange}
59
    {-clockstipple error error}
60
    {-state disabled disabled}
61
    {-state normal normal}
62
    {-showampm no no}
63
    {-showampm yes yes}
64
    {-hourradius .3 .3}
65
    {-minuteradius .5 .5}
66
    {-secondradius .7 .7}} {
67
        set option [lindex $test 0]
68
        test Watch-2.$o "configuration options, $option" {
69
            .w configure $option [lindex $test 1]
70
            lindex [.w configure $option] 4
71
        } [lindex $test 2]
72
        update
73
        incr o
74
        .w show
75
        after 500
76
}
77
 
78
#
79
# Option tests which fail and produce errors.
80
#
81
foreach test {
82
  {-state bogus {bad state option "bogus": should be normal or disabled}}
83
  {-showampm bogus {bad showampm option "bogus": should be boolean}}} {
84
        set option [lindex $test 0]
85
        test Watch-2.$o "configuration options, $option" {
86
            list [catch {.w configure $option [lindex $test 1]} msg] $msg
87
        } [list 1 [lindex $test 2]]
88
        incr o
89
}
90
 
91
#
92
# Method tests which are successful.
93
#
94
foreach test {
95
    {{.w show "11:11:11"} {}}
96
    {{.w get} "11:11:11 AM"}
97
    {{.w show "now"} {}}} {
98
        set method [lindex [lindex $test 0] 1]
99
        test Watch-3.$m "object methods, $method" {
100
            list [catch {eval [lindex $test 0]} msg] $msg
101
        } [list 0 [lindex $test 1]]
102
        update
103
        incr m
104
        after 500
105
}
106
 
107
foreach test {
108
    {{.w show bogus} {bad time: "bogus", must be a valid time string, clock clicks value or the keyword now}}
109
    {{.w get bogus} {bad format option "bogus": should be -string or -clicks}}} {
110
        set method [lindex [lindex $test 0] 1]
111
        test ScrolledListBox-3.$m "object methods, $method" {
112
            list [catch {eval [lindex $test 0]} msg] $msg
113
        } [list 1 [lindex $test 1]]
114
        incr m
115
        .w show
116
        after 500
117
}
118
 
119
#
120
# Conclusion of constrcution/destruction tests
121
#
122
test Watch-1.$c {Watch destruction} {
123
    destroy .w
124
    update
125
} {}
126
 
127
incr c
128
 
129
test Watch-1.$c {Watch construction} {
130
    iwidgets::watch .w
131
    pack .w -padx 10 -pady 10 -fill both -expand yes
132
    update
133
} {}
134
 
135
incr c
136
 
137
test Watch-1.$c {Watch destruction} {
138
    destroy .w
139
    update
140
} {}
141
 
142
incr c
143
 
144
test Watch-1.$c {Watch destruction} {
145
    iwidgets::watch .w
146
    pack .w
147
    destroy .w
148
    update
149
} {}

powered by: WebSVN 2.1.0

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