OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [itcl/] [iwidgets3.0.0/] [tests/] [scrolledtext.test] - Blame information for rev 1765

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] Scrolledtext 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: scrolledtext.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 Scrolledtext-1.$c {Scrolledtext construction} {
33
    iwidgets::Scrolledtext .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 Scrolledtext-2.$o {configuration option} {
44
    llength [.st configure]
45
} {47}
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 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
    {-vscrollmode none none}
80
    {-vscrollmode static static}
81
    {-vscrollmode dynamic dynamic}
82
    {-hscrollmode none none}
83
    {-hscrollmode static static}
84
    {-hscrollmode dynamic dynamic}
85
    {-sbwidth 20 20}
86
    {-scrollmargin 5 5}
87
    {-selectborderwidth 2 2}
88
    {-state disabled disabled}
89
    {-state normal normal}
90
    {-textbackground GhostWhite GhostWhite}
91
    {-visibleitems 72x40 72x40}
92
    {-height 0 0}
93
    {-width 0 0}
94
    {-wrap char char}
95
    {-wrap none none}} {
96
        set option [lindex $test 0]
97
        test Scrolledtext-2.$o "configuration options, $option" {
98
            .st configure $option [lindex $test 1]
99
            lindex [.st configure $option] 4
100
        } [lindex $test 2]
101
        update
102
        incr o
103
}
104
 
105
#
106
# Option tests which fail and produce errors.
107
#
108
foreach test {
109
  {-visibleitems bogus {bad visibleitems option "bogus": should be widthxheight}}
110
  {-hscrollmode bogus {bad hscrollmode option "bogus": should be static, dynamic, or none}}
111
  {-vscrollmode bogus {bad vscrollmode option "bogus": should be static, dynamic, or none}}} {
112
        set option [lindex $test 0]
113
        test Scrolledtext-2.$o "configuration options, $option" {
114
            list [catch {.st configure $option [lindex $test 1]} msg] $msg
115
        } [list 1 [lindex $test 2]]
116
        incr o
117
}
118
 
119
#
120
# Method tests which are successful.
121
#
122
foreach test {
123
    {{.st import ./scrolledtext.test} {}}
124
    {{.st export /tmp/scrolledtext.test} {}}
125
    {{.st clear} {}}} {
126
        set method [lindex [lindex $test 0] 1]
127
        test Scrolledtext-3.$m "object methods, $method" {
128
            list [catch {eval [lindex $test 0]} msg] $msg
129
        } [list 0 [lindex $test 1]]
130
        update
131
        incr m
132
}
133
 
134
#
135
# Conclusion of constrcution/destruction tests
136
#
137
test Scrolledtext-1.$c {Scrolledtext destruction} {
138
    destroy .st
139
    update
140
} {}
141
 
142
incr c
143
 
144
test Scrolledtext-1.$c {Scrolledtext construction} {
145
    iwidgets::scrolledtext .st -hscrollmode dynamic -labeltext "Label" \
146
            -labelpos n -labelmargin 5
147
    pack .st -padx 10 -pady 10 -fill both -expand yes
148
    update
149
} {}
150
 
151
incr c
152
 
153
test Scrolledtext-1.$c {Scrolledtext destruction} {
154
    destroy .st
155
    update
156
} {}
157
 
158
incr c
159
 
160
test Scrolledtext-1.$c {Scrolledtext destruction} {
161
    iwidgets::scrolledtext .st
162
    pack .st
163
    destroy .st
164
    update
165
} {}

powered by: WebSVN 2.1.0

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