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

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] Scrolledframe 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: scrolledframe.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 Scrolledframe-1.$c {Scrolledframe construction} {
33
    iwidgets::Scrolledframe .sf
34
    pack .sf -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 Scrolledframe-2.$o {configuration option} {
44
    llength [.sf configure]
45
} {27}
46
 
47
incr o
48
 
49
foreach test {
50
    {-borderwidth 3 3}
51
    {-height 180 180}
52
    {-labeltext "Scrolled Frame" "Scrolled Frame"}
53
    {-labelpos nw nw}
54
    {-labelpos ne ne}
55
    {-labelpos en en}
56
    {-labelpos e e}
57
    {-labelpos es es}
58
    {-labelpos se se}
59
    {-labelpos s s}
60
    {-labelpos sw sw}
61
    {-labelpos wn wn}
62
    {-labelpos w w}
63
    {-labelpos ws ws}
64
    {-labelpos n n}
65
    {-hscrollmode static static}
66
    {-hscrollmode none none}
67
    {-hscrollmode dynamic dynamic}
68
    {-relief raised raised}
69
    {-sbwidth 20 20}
70
    {-relief sunken sunken}
71
    {-scrollmargin 10 10}
72
    {-vscrollmode static static}
73
    {-vscrollmode none none}
74
    {-vscrollmode dynamic dynamic}
75
    {-width 150 150}} {
76
        set option [lindex $test 0]
77
        test Scrolledframe-2.$o "configuration options, $option" {
78
            .sf configure $option [lindex $test 1]
79
            lindex [.sf configure $option] 4
80
        } [lindex $test 2]
81
        update
82
        incr o
83
}
84
 
85
#
86
# Option tests which fail and produce errors.
87
#
88
foreach test {
89
  {-vscrollmode bogus {bad vscrollmode option "bogus": should be static, dynamic, or none}}
90
  {-hscrollmode bogus {bad hscrollmode option "bogus": should be static, dynamic, or none}}} {
91
        set option [lindex $test 0]
92
        test Scrolledframe-2.$o "configuration options, $option" {
93
            list [catch {.sf configure $option [lindex $test 1]} msg] $msg
94
        } [list 1 [lindex $test 2]]
95
        incr o
96
}
97
 
98
#
99
# Method tests which are successful.
100
#
101
foreach test {
102
    {{.sf childsite} {.sf.lwchildsite.clipper.canvas.sfchildsite}}
103
    {{.sf xview moveto .5} {}}
104
    {{.sf yview moveto .5} {}}
105
    {{.sf justify left} {}}
106
    {{.sf justify right} {}}
107
    {{.sf justify top} {}}
108
    {{.sf justify bottom} {}}} {
109
        set method [lindex [lindex $test 0] 1]
110
        test Scrolledframe-3.$m "object methods, $method" {
111
            list [catch {eval [lindex $test 0]} msg] $msg
112
        } [list 0 [lindex $test 1]]
113
        update
114
        incr m
115
}
116
 
117
#
118
# Creation of children tests.
119
#
120
test Scrolledframe-1.$c {Scrolledframe children} {
121
    pack [button [.sf childsite].b1 -text Hello] -pady 10
122
    update
123
} {}
124
 
125
incr c
126
 
127
test Scrolledframe-1.$c {Scrolledframe children} {
128
    pack [button [.sf childsite].b2 -text World] -pady 10
129
    update
130
} {}
131
 
132
incr c
133
 
134
test Scrolledframe-1.$c {Scrolledframe children} {
135
    pack [button [.sf childsite].b3 -text "This is a test"] -pady 10
136
    update
137
} {}
138
 
139
incr c
140
 
141
test Scrolledframe-1.$c {Scrolledframe children} {
142
    pack [button [.sf childsite].b4 -text "This is a really big button"] -pady 10
143
    update
144
} {}
145
 
146
incr c
147
 
148
test Scrolledframe-1.$c {Scrolledframe children} {
149
    pack [button [.sf childsite].b5 -text "This is another really big button"] -pady 10
150
    update
151
} {}
152
 
153
incr c
154
 
155
test Scrolledframe-1.$c {Scrolledframe children} {
156
    pack [button [.sf childsite].b6 -text "This is the last really big button"] -pady 10
157
    update
158
} {}
159
 
160
incr c
161
 
162
#
163
# Conclusion of constrcution/destruction tests
164
#
165
test Scrolledframe-1.$c {Scrolledframe destruction} {
166
    foreach child [winfo children [.sf childsite]] {
167
        destroy $child
168
    }
169
 
170
    destroy .sf
171
    update
172
} {}
173
 
174
incr c
175
 
176
test Scrolledframe-1.$c {Scrolledframe construction} {
177
    iwidgets::scrolledframe .sf -width 150 -height 180 \
178
        -labelpos nw -labeltext Scrolledframe \
179
        -vscrollmode static -hscrollmode dynamic
180
    pack .sf -padx 10 -pady 10 -fill both -expand yes
181
    update
182
} {}
183
 
184
incr c
185
 
186
test Scrolledframe-1.$c {Scrolledframe destruction} {
187
    destroy .sf
188
    update
189
} {}
190
 
191
incr c
192
 
193
test Scrolledframe-1.$c {Scrolledframe destruction} {
194
    iwidgets::scrolledframe .sf
195
    pack .sf
196
    destroy .sf
197
    update
198
} {}

powered by: WebSVN 2.1.0

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