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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [itcl/] [iwidgets3.0.0/] [tests/] [finddialog.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] Finddialog 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
#   4.x - Other tests
9
#
10
# Copyright (c) 1995 DSC Technologies Corporation
11
#
12
# See the file "license.terms" for information on usage and redistribution
13
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14
#
15
# @(#) $Id: finddialog.test,v 1.1.1.1 2002-01-16 10:24:51 markom Exp $
16
 
17
package require Iwidgets 3.0
18
 
19
if {[string compare test [info procs test]] == 1} {
20
    source defs
21
}
22
 
23
wm geometry . {}
24
raise .
25
 
26
set c 1
27
set o 1
28
set m 1
29
 
30
#
31
# Initial construction test
32
#
33
test Finddialog-1.$c {Finddialog construction} {
34
    iwidgets::Scrolledlistbox .slb
35
    iwidgets::Scrolledtext .st
36
    pack .st
37
    .st insert end "Now is the time for all good men\\n"
38
    .st insert end "to come to the aid of their country"
39
 
40
    iwidgets::Finddialog .fd
41
    .fd center .st
42
    .fd activate
43
} {}
44
 
45
incr c
46
 
47
#
48
# Option tests which are successful.
49
#
50
test Finddialog-2.$o {configuration option} {
51
    llength [.fd configure]
52
} {43}
53
 
54
incr o
55
 
56
foreach test {
57
    {-background #d9d9d9 #d9d9d9}
58
    {-buttonboxpadx 10 10}
59
    {-buttonboxpady 10 10}
60
    {-cursor gumby gumby}
61
    {-textwidget .st .st}
62
    {-patternbackground blue blue}
63
    {-patternforeground white white}
64
    {-searchbackground skyblue skyblue}
65
    {-searchforeground white white}
66
    {-title "Find Dialog" "Find Dialog"}} {
67
        set option [lindex $test 0]
68
        test Finddialog-2.$o "configuration options, $option" {
69
            .fd configure $option [lindex $test 1]
70
            lindex [.fd configure $option] 4
71
        } [lindex $test 2]
72
        update
73
        incr o
74
}
75
 
76
#
77
# Option tests which fail and produce errors.
78
#
79
foreach test {
80
  {-buttonboxpos bogus {bad buttonboxpos option "bogus": should be n, s, e, or w}}
81
  {-modality bogus {bad modality option "bogus": should be none, application, or global}}} {
82
        set option [lindex $test 0]
83
        test Finddialog-2.$o "configuration options, $option" {
84
            list [catch {.fd configure $option [lindex $test 1]} msg] $msg
85
        } [list 1 [lindex $test 2]]
86
        incr o
87
}
88
 
89
#
90
# Method tests which are successful.
91
#
92
foreach test {
93
    {{.fd component pattern insert end "the"} {}}
94
    {{.fd find} 1.7}
95
    {{.fd find} 1.45}
96
    {{.fd clear} {}}
97
    {{.fd invoke Find} {}}
98
    {{.fd buttonconfigure Find -text Search} {}}} {
99
        set method [lindex [lindex $test 0] 1]
100
        test Finddialog-3.$m "object methods, $method" {
101
            list [catch {eval [lindex $test 0]} msg] $msg
102
        } [list 0 [lindex $test 1]]
103
        update
104
        incr m
105
}
106
 
107
.fd configure -textwidget .bogus
108
 
109
#
110
# Method tests which fail and produce errors
111
#
112
test Finddialog-3.$m "Non existant textwidget" {
113
    list [catch {.fd find} msg] $msg
114
} [list 1 {bad finddialog text widget value: ".bogus", the widget doesn't exist}]
115
update
116
incr m
117
 
118
.fd configure -textwidget .slb
119
 
120
test Finddialog-3.$m "Wrong class of textwidget" {
121
    list [catch {.fd find} msg] $msg
122
} [list 1 {bad finddialog text widget value: ".slb", must be of the class Text or based on Scrolledtext}]
123
update
124
incr m
125
 
126
#
127
# Destruction test
128
#
129
test Finddialog-1.$c {Finddialog destruction} {
130
    destroy .slb
131
    destroy .st
132
    destroy .fd
133
    update
134
} {}
135
incr c
136
 
137
#
138
# Initial construction test
139
#
140
test Finddialog-1.$c {Finddialog construction} {
141
    iwidgets::Finddialog .fd
142
} {.fd}
143
 
144
incr c
145
 
146
#
147
# Destruction test
148
#
149
test Finddialog-1.$c {Finddialog destruction} {
150
    destroy .fd
151
    update
152
} {}

powered by: WebSVN 2.1.0

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