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/] [scrolledhtml.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] Scrolledhtml 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: scrolledhtml.test
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 Scrolledhtml-1.$c {Scrolledhtml construction} {
33
    iwidgets::Scrolledhtml .sh
34
    pack .sh -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 Scrolledhtml-2.$o {configuration option} {
44
    llength [.sh configure]
45
} {57}
46
 
47
incr o
48
 
49
foreach test {
50
    {-background #d9d9d9 #d9d9d9}
51
    {-borderwidth 3 3}
52
    {-cursor gumby gumby}
53
    {-exportselection 0 0}
54
    {-exportselection 1 1}
55
    {-foreground Black Black}
56
    {-height 120 120}
57
    {-width 500 500}
58
    {-insertbackground Black Black}
59
    {-insertborderwidth 1 1}
60
    {-insertofftime 200 200}
61
    {-insertontime 500 500}
62
    {-insertwidth 3 3}
63
    {-labelmargin 5 5}
64
    {-labeltext Label Label}
65
    {-labelpos n n}
66
    {-labelpos ne ne}
67
    {-labelpos e e}
68
    {-labelpos se se}
69
    {-labelpos s s}
70
    {-labelpos sw sw}
71
    {-labelpos w w}
72
    {-labelpos nw nw}
73
    {-relief raised raised}
74
    {-relief sunken sunken}
75
    {-vscrollmode none none}
76
    {-vscrollmode static static}
77
    {-vscrollmode dynamic dynamic}
78
    {-hscrollmode none none}
79
    {-hscrollmode static static}
80
    {-hscrollmode dynamic dynamic}
81
    {-sbwidth 20 20}
82
    {-scrollmargin 5 5}
83
    {-selectborderwidth 2 2}
84
    {-state disabled disabled}
85
    {-state normal normal}
86
    {-textbackground GhostWhite GhostWhite}
87
    {-visibleitems 72x40 72x40}
88
    {-height 0 0}
89
    {-width 0 0}
90
    {-wrap char char}
91
    {-wrap none none}
92
    {-feedback puts puts}
93
    {-feedback {} {}}
94
    {-linkcommand puts puts}
95
    {-linkcommand {} {}}
96
    {-unknownimage {} {}}
97
    {-link blue blue}
98
    {-linkhighlight red red}
99
    {-fontname times times}
100
    {-fixedfont courier courier}
101
    {-fontsize medium medium}
102
    {-update 1 1}} {
103
        set option [lindex $test 0]
104
        test Scrolledhtml-2.$o "configuration options, $option" {
105
            .sh configure $option [lindex $test 1]
106
            lindex [.sh configure $option] 4
107
        } [lindex $test 2]
108
        update
109
        incr o
110
}
111
 
112
#
113
# Option tests which fail and produce errors.
114
#
115
foreach test {
116
  {-visibleitems bogus {bad visibleitems option "bogus": should be widthxheight}}
117
  {-hscrollmode bogus {bad hscrollmode option "bogus": should be static, dynamic, or none}}
118
  {-vscrollmode bogus {bad vscrollmode option "bogus": should be static, dynamic, or none}}
119
  {-fontname bogus {Invalid font name "bogus". Must be one of  helvetica courier times symbol}}
120
  {-fontsize bogus {bad fontsize option "bogus": should be small, medium, large, or huge}}
121
  {-fixedfont bogus {Invalid font name "bogus". Must be one of  helvetica courier times symbol}}} {
122
        set option [lindex $test 0]
123
        test Scrolledhtml-2.$o "configuration options, $option" {
124
            list [catch {.sh configure $option [lindex $test 1]} msg] $msg
125
        } [list 1 [lindex $test 2]]
126
        incr o
127
}
128
 
129
#
130
# Method tests which are successful.
131
#
132
foreach test {
133
    {{.sh import ./scrolledhtml.test} {}}
134
    {{.sh pwd} {.}}
135
    {{.sh export /tmp/scrolledhtml.test} {}}
136
    {{.sh render {
137
        Test
138
  
139
        

This is a test

140
        of the emergency broadcast system.
141
        This is only a test.

142
        If this were a real html document
143
        
it would be displayed

144
        
for more than an instant
145
        
Four score and seven years ago
146
        int main { printf(\"Hello World!\");}
147
        
write only memory
148
        
the obvious antonym to read-only memory
149
        
    reasons this is a short list:
  1. it only has one entry
150
        
    reasons this is a short list:
  • it only has one entry
151
        
152
       No_image_here
153
        
154
        
155
                  }} {}}
156
    {{.sh title} {Test}}
157
    {{.sh clear} {}}} {
158
        set method [lindex [lindex $test 0] 1]
159
        test Scrolledhtml-3.$m "object methods, $method" {
160
            list [catch {eval [lindex $test 0]} msg] $msg
161
        } [list 0 [lindex $test 1]]
162
        update
163
        incr m
164
}
165
 
166
#
167
# Conclusion of construction/destruction tests
168
#
169
test Scrolledhtml-1.$c {Scrolledhtml destruction} {
170
    destroy .sh
171
    update
172
} {}
173
 
174
incr c
175
 
176
test Scrolledhtml-1.$c {Scrolledhtml construction} {
177
    iwidgets::scrolledhtml .sh -hscrollmode dynamic -labeltext "Label" \
178
            -labelpos n -labelmargin 5
179
    pack .sh -padx 10 -pady 10 -fill both -expand yes
180
    update
181
} {}
182
 
183
incr c
184
 
185
test Scrolledhtml-1.$c {Scrolledhtml destruction} {
186
    destroy .sh
187
    update
188
} {}
189
 
190
incr c
191
 
192
test Scrolledhtml-1.$c {Scrolledhtml destruction} {
193
    iwidgets::scrolledhtml .sh
194
    pack .sh
195
    destroy .sh
196
    update
197
} {}

powered by: WebSVN 2.1.0

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