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

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [itcl/] [iwidgets3.0.0/] [tests/] [checkbox.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] Checkbox 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: checkbox.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 Checkbox-1.$c {Checkbox construction} {
33
    iwidgets::Checkbox .cb -labeltext "Styles"
34
    pack .cb -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 Checkbox-2.$o {configuration option} {
44
    llength [.cb configure]
45
} {18}
46
 
47
incr o
48
 
49
test Checkbox-1.$c {Checkbox add method} {
50
    .cb add foo -text "Foo Bar"
51
    .cb add bar -text "Bar Foo"
52
    update
53
} {}
54
 
55
incr m
56
 
57
foreach test {
58
    {-background #d9d9d9 #d9d9d9}
59
    {-borderwidth 4 4}
60
    {-borderwidth 2 2}
61
    {-cursor gumby gumby}
62
    {-foreground Green Green}
63
    {-foreground Black Black}
64
    {-labelmargin 5 5}
65
    {-labelpos w w}
66
    {-labelpos n n}
67
    {-labelpos ne ne}
68
    {-labelpos e e}
69
    {-labelpos se se}
70
    {-labelpos s s}
71
    {-labelpos sw sw}
72
    {-labeltext Label Label}
73
    {-labeltext Styles Styles}
74
    {-labelpos nw nw}
75
    {-relief raised raised}
76
    {-relief sunken sunken}} {
77
        set option [lindex $test 0]
78
        test Checkbox-2.$o "configuration options, $option" {
79
            .cb configure $option [lindex $test 1]
80
            lindex [.cb configure $option] 4
81
        } [lindex $test 2]
82
        update
83
        incr o
84
}
85
 
86
#
87
# Method tests which are successful.
88
#
89
foreach test {
90
    {{.cb delete foo} {}}
91
    {{.cb delete bar} {}}
92
    {{.cb add bold -text Bold} bold}
93
    {{.cb insert bold italic -text Italic} italic}
94
    {{.cb add underline -text Underline} underline}
95
    {{.cb insert underline strikethrough -text "Strike Through"} strikethrough}
96
    {{.cb index b*} 1}
97
    {{.cb select bold} {}}
98
    {{.cb get} bold}
99
    {{.cb get bold} 1}
100
    {{.cb get italic} 0}
101
    {{.cb delete end} {}}
102
    {{.cb deselect bold} {}}
103
    {{.cb get} {}}
104
    {{.cb index end} 2}
105
    {{.cb flash 1} {}}
106
    {{.cb buttonconfigure bold -text BOLD} {}}} {
107
        set method [lindex [lindex $test 0] 1]
108
        test Checkbox-3.$m "object methods, $method" {
109
            list [catch {eval [lindex $test 0]} msg] $msg
110
        } [list 0 [lindex $test 1]]
111
        update
112
        incr m
113
}
114
 
115
#
116
# Conclusion of constrcution/destruction tests
117
#
118
test Checkbox-1.$c {Checkbox destruction} {
119
    destroy .cb
120
    update
121
} {}
122
 
123
incr c
124
 
125
test Checkbox-1.$c {Checkbox construction} {
126
    iwidgets::checkbox .cb
127
    pack .cb -padx 10 -pady 10
128
    update
129
} {}
130
 
131
incr c
132
 
133
test Checkbox-1.$c {Checkbox destruction} {
134
    destroy .cb
135
    update
136
} {}
137
 
138
incr c
139
 
140
test Checkbox-1.$c {Checkbox destruction} {
141
    iwidgets::checkbox .cb
142
    pack .cb
143
    destroy .cb
144
    update
145
} {}

powered by: WebSVN 2.1.0

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