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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [itcl/] [iwidgets3.0.0/] [tests/] [regexpfield.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] Regexpfield 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: regexpfield.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 Regexpfield-1.$c {Regexpfield construction} {
33
    iwidgets::Regexpfield .ef -labeltext "Entry Field"
34
    .ef insert end test
35
    pack .ef -padx 10 -pady 10 -fill both -expand yes
36
    update
37
} {}
38
 
39
incr c
40
 
41
#
42
# Option tests which are successful.
43
#
44
test Regexpfield-2.$o {configuration option} {
45
    llength [.ef configure]
46
} {39}
47
 
48
incr o
49
 
50
foreach test {
51
    {-background #d9d9d9 #d9d9d9}
52
    {-borderwidth 4 4}
53
    {-borderwidth 2 2}
54
    {-childsitepos e e}
55
    {-childsitepos s s}
56
    {-childsitepos w w}
57
    {-childsitepos n n}
58
    {-command {.ef configure -background red} {.ef configure -background red}}
59
    {-cursor gumby gumby}
60
    {-exportselection 0 0}
61
    {-fixed 10 10}
62
    {-fixed 0 0}
63
    {-foreground Green Green}
64
    {-foreground Black Black}
65
    {-highlightcolor Red Red}
66
    {-highlightthickness 2 2}
67
    {-insertbackground Yellow Yellow}
68
    {-insertbackground Black Black}
69
    {-insertborderwidth 1 1}
70
    {-insertborderwidth 0 0}
71
    {-insertofftime 400 400}
72
    {-insertontime 700 700}
73
    {-insertwidth 3 3}
74
    {-invalid {.ef configure -background Green} {.ef configure -background Green}}
75
    {-justify right right}
76
    {-justify center center}
77
    {-justify left left}
78
    {-labelmargin 5 5}
79
    {-labelpos w w}
80
    {-labelpos nw nw}
81
    {-labelpos n n}
82
    {-labelpos ne ne}
83
    {-labelpos e e}
84
    {-labelpos se se}
85
    {-labelpos s s}
86
    {-labelpos sw sw}
87
    {-labeltext Label Label}
88
    {-relief raised raised}
89
    {-relief sunken sunken}
90
    {-state disabled disabled}
91
    {-state normal normal}
92
    {-textbackground GhostWhite GhostWhite}
93
    {-regexp {.*} {.*}}
94
    {-nocase 0 0}
95
    {-width 30 30}} {
96
        set option [lindex $test 0]
97
        test Regexpfield-2.$o "configuration options, $option" {
98
            .ef configure $option [lindex $test 1]
99
            lindex [.ef 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
  {-fixed bogus {bad fixed option "bogus", should be positive integer}}
110
  {-childsitepos bogus {bad childsite option "bogus": should be n, e, s, or w}}} {
111
        set option [lindex $test 0]
112
        test Regexpfield-2.$o "configuration options, $option" {
113
            list [catch {.ef configure $option [lindex $test 1]} msg] $msg
114
        } [list 1 [lindex $test 2]]
115
        incr o
116
}
117
 
118
#
119
# Method tests which are successful.
120
#
121
foreach test {
122
    {{.ef childsite} {.ef.lwchildsite.efchildsite}}
123
    {{.ef clear} {}}
124
    {{.ef insert end "Test String"} {}}
125
    {{.ef get} {Test String}}
126
    {{.ef delete 0 end} {}}
127
    {{.ef insert end "Another Test"} {}}
128
    {{.ef icursor end} {}}
129
    {{.ef index end} 12}
130
    {{.ef selection from 0} {}}
131
    {{.ef selection to end} {}}
132
    {{.ef xview 3} {}}
133
    {{.ef clear} {}}} {
134
        set method [lindex [lindex $test 0] 1]
135
        test Regexpfield-3.$m "object methods, $method" {
136
            list [catch {eval [lindex $test 0]} msg] $msg
137
        } [list 0 [lindex $test 1]]
138
        update
139
        incr m
140
}
141
 
142
#
143
# Conclusion of constrcution/destruction tests
144
#
145
test Regexpfield-1.$c {Regexpfield destruction} {
146
    destroy .ef
147
    update
148
} {}
149
 
150
incr c
151
 
152
test Regexpfield-1.$c {Regexpfield construction} {
153
    iwidgets::regexpfield .ef -width 12
154
    pack .ef -padx 10 -pady 10
155
    update
156
} {}
157
 
158
incr c
159
 
160
test Regexpfield-1.$c {Regexpfield destruction} {
161
    destroy .ef
162
    update
163
} {}
164
 
165
incr c
166
 
167
test Regexpfield-1.$c {Regexpfield destruction} {
168
    iwidgets::regexpfield .ef
169
    pack .ef
170
    destroy .ef
171
    update
172
} {}

powered by: WebSVN 2.1.0

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