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

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [itcl/] [iwidgets3.0.0/] [tests/] [canvasprintbox.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] Canvasprintbox 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 Tako Schotanus
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
 
15
package require Iwidgets 3.0
16
 
17
if {[string compare test [info procs test]] == 1} {
18
    source defs
19
}
20
 
21
wm geometry . {}
22
raise .
23
 
24
set c 1
25
set o 1
26
set m 1
27
 
28
#
29
# Initial construction test
30
#
31
test Canvasprintbox-1.$c {Canvasprintbox construction} {
32
    iwidgets::Canvasprintbox .cpb
33
    pack .cpb -padx 10 -pady 10 -fill both -expand yes
34
    update
35
} {}
36
 
37
incr c
38
 
39
#
40
# Option tests which are successful.
41
#
42
test Canvasprintbox-2.$o {configuration option} {
43
    llength [.cpb configure]
44
} {34}
45
 
46
incr o
47
 
48
foreach test {
49
    {-background #d9d9d9 #d9d9d9}
50
    {-cursor gumby gumby}
51
    {-hpagecnt 2 2}
52
    {-orient portrait portrait}
53
    {-orient landscape landscape}
54
    {-output file file}
55
    {-filename test.ps test.ps}
56
    {-output printer printer}
57
    {-pagesize a5 a5}
58
    {-pagesize a4 a4}
59
    {-pagesize a3 a3}
60
    {-pagesize a2 a2}
61
    {-pagesize a1 a1}
62
    {-pagesize legal legal}
63
    {-pagesize letter letter}
64
    {-posterize 1 1}
65
    {-posterize 0 0}
66
    {-printcmd test test}
67
    {-printcmd lpr lpr}
68
    {-printregion {10 10 100 100} {10 10 100 100}}
69
    {-printregion {} {}}
70
    {-stretch 1 1}
71
    {-stretch 0 0}
72
    {-vpagecnt 2 2}} {
73
        set option [lindex $test 0]
74
        test Canvasprintbox-2.$o "configuration options, $option" {
75
            .cpb configure $option [lindex $test 1]
76
            lindex [.cpb configure $option] 4
77
        } [lindex $test 2]
78
        update
79
        incr o
80
}
81
 
82
#
83
# Option tests which fail and produce errors.
84
#
85
#foreach test {
86
#  {-printregion bogus {bad option "printregion": should contain 4 coordinates}}
87
#  {-output bogus {bad option "output": should be file or printer}}
88
#  {-orient bogus {bad option "orient": should be portrait or landscape}}
89
#  {-stretch bogus {bad option "stretch": should be a boolean}}
90
#  {-posterize bogus {bad option "posterize": should be a boolean}}
91
#  } {
92
#       set option [lindex $test 0]
93
#        test Canvasprintbox-2.$o "configuration options, $option" {
94
#           list [catch {.cpb configure $option [lindex $test 1]} msg] $msg
95
#       } [list 1 [lindex $test 2]]
96
#       incr o
97
#}
98
 
99
#
100
# Method tests which are successful.
101
#
102
canvas .c
103
foreach test {
104
    {{.cpb getoutput} {lpr}}
105
    {{.cpb refresh} {}}
106
    {{.cpb setcanvas .c} {}}} {
107
        set method [lindex [lindex $test 0] 1]
108
        test Canvasprintbox-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 Canvasprintbox-1.$c {Canvasprintbox destruction} {
119
    destroy .c
120
    destroy .cpb
121
    update
122
} {}
123
 
124
incr c
125
 
126
test Canvasprintbox-1.$c {Canvasprintbox construction} {
127
    iwidgets::canvasprintbox .cpb
128
    pack .cpb -padx 10 -pady 10 -fill both -expand yes
129
    update
130
} {}
131
 
132
incr c
133
 
134
test Canvasprintbox-1.$c {Canvasprintbox destruction} {
135
    destroy .cpb
136
    update
137
} {}
138
 
139
incr c
140
 
141
test Canvasprintbox-1.$c {Canvasprintbox destruction} {
142
    iwidgets::canvasprintbox .cpb
143
    pack .cpb
144
    destroy .cpb
145
    update
146
} {}

powered by: WebSVN 2.1.0

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