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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [itcl/] [iwidgets3.0.0/] [tests/] [panedwindow.test] - Blame information for rev 1770

Go to most recent revision | 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] Panedwindow 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: panedwindow.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 Panedwindow-1.$c {Panedwindow construction} {
33
    iwidgets::Panedwindow .pw -width 200 -height 200
34
    .pw add top
35
    .pw add bottom
36
    pack .pw -fill both -expand yes
37
    update
38
} {}
39
 
40
incr c
41
 
42
#
43
# Option tests which are successful.
44
#
45
test Panedwindow-2.$o {configuration option} {
46
    llength [.pw configure]
47
} {12}
48
 
49
incr o
50
 
51
foreach test {
52
    {-background #d9d9d9 #d9d9d9}
53
    {-cursor gumby gumby}
54
    {-height 300 300}
55
    {-orient vertical vertical}
56
    {-sashborderwidth 3 3}
57
    {-sashcursor arrow arrow}
58
    {-sashheight 12 12}
59
    {-sashindent -20 -20}
60
    {-sashwidth 12 12}
61
    {-thickness 5 5}
62
    {-orient horizontal horizontal}
63
    {-width 300 300}} {
64
        set option [lindex $test 0]
65
        test Panedwindow-2.$o "configuration options, $option" {
66
            .pw configure $option [lindex $test 1]
67
            lindex [.pw configure $option] 4
68
        } [lindex $test 2]
69
        update
70
        incr o
71
}
72
 
73
#
74
# Method tests which are successful.
75
#
76
foreach test {
77
    {{.pw index 0} {0}}
78
    {{.pw index end} {1}}
79
    {{.pw index top} {0}}
80
    {{.pw index b*} {1}}
81
    {{.pw childsite 0} {.pw.pane0.childsite}}
82
    {{.pw childsite end} {.pw.pane1.childsite}}
83
    {{.pw childsite 1} {.pw.pane1.childsite}}
84
    {{.pw childsite} {.pw.pane0.childsite .pw.pane1.childsite}}
85
    {{.pw fraction 25 75} {}}
86
    {{.pw add middle -margin 10 -minimum 10} {.pw.pane2}}
87
    {{.pw delete middle} {}}
88
    {{.pw insert 1 middle} {.pw.pane3}}
89
    {{.pw fraction 20 30 50} {}}
90
    {{.pw reset} {}}
91
    {{.pw hide end} {}}
92
    {{.pw show bottom} {}}
93
    {{.pw paneconfigure 0 -minimum} {-minimum minimum Minimum 10 10}}
94
    {{.pw paneconfigure end -margin 10} {}}} {
95
        set method [lindex [lindex $test 0] 1]
96
        test Panedwindow-3.$m "object methods, $method" {
97
            list [catch {eval [lindex $test 0]} msg] $msg
98
        } [list 0 [lindex $test 1]]
99
        update
100
        incr m
101
}
102
 
103
#
104
# Method tests which fail and produce errors
105
#
106
foreach test {
107
    {{.pw index 5} {Panedwindow index "5" is out of range}}
108
    {{.pw index bogus} {bad Panedwindow index "bogus": must be number, end, or pattern}}
109
    {{.pw fraction 10 20 30} {bad fraction arguments "10 20 30": they should add up to 100}}
110
    {{.pw fraction 10 20} {wrong # args: should be ".pw fraction percentage percentage ?percentage ...?", where the number of percentages is 3 and equal 100}}} {
111
        set method [lindex [lindex $test 0] 1]
112
        test Panedwindow-3.$m "object methods, $method" {
113
            list [catch {eval [lindex $test 0]} msg] $msg
114
        } [list 1 [lindex $test 1]]
115
        incr m
116
}
117
 
118
#
119
# Conclusion of constrcution/destruction tests
120
#
121
test Panedwindow-1.$c {Panedwindow destruction} {
122
    destroy .pw
123
    update
124
} {}
125
 
126
incr c
127
 
128
test Panedwindow-1.$c {Panedwindow construction} {
129
    iwidgets::panedwindow .pw -width 200 -height 300
130
    .pw add pane0
131
    .pw add pane1
132
    .pw add pane2
133
    .pw add pane3
134
    foreach pane [.pw childsite] {
135
        button $pane.b -text $pane -relief raised -borderwidth 3
136
        pack $pane.b -fill both -expand yes
137
    }
138
    .pw fraction 20 20 30 30
139
    pack .pw -fill both -expand yes
140
    update
141
} {}
142
 
143
incr c
144
 
145
test Panedwindow-1.$c {Panedwindow destruction} {
146
    destroy .pw
147
    update
148
} {}
149
 
150
incr c
151
 
152
test Panedwindow-1.$c {Panedwindow destruction} {
153
    iwidgets::panedwindow .pw
154
    pack .pw
155
    destroy .pw
156
    update
157
} {}

powered by: WebSVN 2.1.0

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