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/] [scrolledcanvas.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] ScrolledListBox 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: scrolledcanvas.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 Scrolledcanvas-1.$c {Scrolledcanvas construction} {
33
    iwidgets::Scrolledcanvas .sc
34
    pack .sc -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 Scrolledcanvas-2.$o {configuration option} {
44
    llength [.sc configure]
45
} {44}
46
 
47
incr o
48
 
49
foreach test {
50
    {-automargin 15 15}
51
    {-autoresize 0 0}
52
    {-autoresize 1 1}
53
    {-background #d9d9d9 #d9d9d9}
54
    {-borderwidth 2 2}
55
    {-closeenough 1.0 1.0}
56
    {-confine 1 1}
57
    {-cursor gumby gumby}
58
    {-height 200 200}
59
    {-hscrollmode none none}
60
    {-hscrollmode static static}
61
    {-hscrollmode dynamic dynamic}
62
    {-labelfont 6x13 6x13}
63
    {-labeltext scrolledcanvas scrolledcanvas}
64
    {-labelmargin 3 3}
65
    {-labelpos nw nw}
66
    {-labelpos ne ne}
67
    {-labelpos en en}
68
    {-labelpos e e}
69
    {-labelpos es es}
70
    {-labelpos se se}
71
    {-labelpos s s}
72
    {-labelpos sw sw}
73
    {-labelpos wn wn}
74
    {-labelpos w w}
75
    {-labelpos ws ws}
76
    {-labelpos n n}
77
    {-relief raised raised}
78
    {-relief sunken sunken}
79
    {-sbwidth 15 15}
80
    {-xscrollincrement 10 10}
81
    {-yscrollincrement 10 10}
82
    {-scrollmargin 3 3}
83
    {-scrollregion {0 0 0 0} {0 0 0 0}}
84
    {-textbackground GhostWhite GhostWhite}
85
    {-vscrollmode static static}
86
    {-vscrollmode none none}
87
    {-vscrollmode dynamic dynamic}
88
    {-width 200 200}} {
89
        set option [lindex $test 0]
90
        test Scrolledcanvas-2.$o "configuration options, $option" {
91
            .sc configure $option [lindex $test 1]
92
            lindex [.sc configure $option] 4
93
        } [lindex $test 2]
94
        update
95
        incr o
96
}
97
 
98
#
99
# Option tests which fail and produce errors.
100
#
101
foreach test {
102
  {-vscrollmode bogus {bad vscrollmode option "bogus": should be static, dynamic, or none}}
103
  {-hscrollmode bogus {bad hscrollmode option "bogus": should be static, dynamic, or none}}} {
104
        set option [lindex $test 0]
105
        test Scrolledcanvas-2.$o "configuration options, $option" {
106
            list [catch {.sc configure $option [lindex $test 1]} msg] $msg
107
        } [list 1 [lindex $test 2]]
108
        incr o
109
}
110
 
111
#
112
# Method tests which are successful.
113
#
114
foreach test {
115
    {{.sc create rectangle 100 100 400 400 -fill red} {1}}
116
    {{.sc create rectangle 300 300 600 600 -fill green} {2}}
117
    {{.sc create rectangle 200 200 500 500 -fill blue} {3}}
118
    {{.sc bbox 1} {99 99 401 401}}
119
    {{.sc coords 2} {300.0 300.0 600.0 600.0}}
120
    {{.sc delete 3} {}}
121
    {{.sc move 1 10 10} {}}
122
    {{.sc scale 1 100 100 0.8 0.8} {}}
123
    {{.sc xview moveto 0} {}}
124
    {{.sc yview moveto 0} {}}
125
    {{.sc childsite} {.sc.lwchildsite.clipper.canvas}}
126
    {{.sc justify left} {}}
127
    {{.sc justify right} {}}
128
    {{.sc justify top} {}}
129
    {{.sc justify bottom} {}}} {
130
        set method [lindex [lindex $test 0] 1]
131
        test Scrolledcanvas-3.$m "object methods, $method" {
132
            list [catch {eval [lindex $test 0]} msg] $msg
133
        } [list 0 [lindex $test 1]]
134
        update
135
        incr m
136
}
137
 
138
#
139
# Conclusion of constrcution/destruction tests
140
#
141
test Scrolledcanvas-1.$c {Scrolledcanvas destruction} {
142
    destroy .sc
143
    update
144
} {}
145
 
146
incr c
147
 
148
test Scrolledcanvas-1.$c {Scrolledcanvas construction} {
149
    iwidgets::Scrolledcanvas .sc -autoresize no -labelpos nw \
150
        -vscrollmode static -hscrollmode dynamic -labeltext "Scrolledcanvas"
151
    pack .sc -padx 10 -pady 10 -fill both -expand yes
152
    update
153
} {}
154
 
155
incr c
156
 
157
test Scrolledcanvas-1.$c {Scrolledcanvas destruction} {
158
    destroy .sc
159
    update
160
} {}
161
 
162
incr c
163
 
164
test Scrolledcanvas-1.$c {Scrolledcanvas destruction} {
165
    iwidgets::scrolledcanvas .sc
166
    pack .sc
167
    destroy .sc
168
    update
169
} {}

powered by: WebSVN 2.1.0

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