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

Subversion Repositories or1k_old

[/] [or1k_old/] [tags/] [start/] [insight/] [itcl/] [iwidgets3.0.0/] [tests/] [canvasprintdialog.test] - Blame information for rev 579

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] Canvasprintdialog
2
# class.  It is organized in the standard fashion for Tcl tests with the
3
# following 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 Tako Schotanus
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
 
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 Canvasprintdialog-1.$c {Canvasprintdialog construction} {
33
    iwidgets::Canvasprintdialog .cpd
34
    .cpd activate
35
} {}
36
 
37
incr c
38
 
39
#
40
# Option tests which are successful.
41
#
42
test Canvasprintdialog-2.$o {configuration option} {
43
    llength [.cpd configure]
44
} {28}
45
 
46
incr o
47
 
48
foreach test {
49
    {-background #d9d9d9 #d9d9d9}
50
    {-buttonboxpadx 15 15}
51
    {-buttonboxpady 15 15}
52
    {-buttonboxpos e e}
53
    {-buttonboxpos n n}
54
    {-buttonboxpos s s}
55
    {-buttonboxpos w w}
56
    {-cursor gumby gumby}
57
    {-filename test.ps test.ps}
58
    {-foreground Black Black}
59
    {-hpagecnt 2 2}
60
    {-modality application application}
61
    {-modality global global}
62
    {-modality none none}
63
    {-orient portrait portrait}
64
    {-orient landscape landscape}
65
    {-output file file}
66
    {-output printer printer}
67
    {-padx 15 15}
68
    {-pady 15 15}
69
    {-pagesize a5 a5}
70
    {-pagesize a4 a4}
71
    {-pagesize a3 a3}
72
    {-pagesize a2 a2}
73
    {-pagesize a1 a1}
74
    {-pagesize legal legal}
75
    {-pagesize letter letter}
76
    {-posterize 1 1}
77
    {-posterize 0 0}
78
    {-printcmd test test}
79
    {-printcmd lpr lpr}
80
    {-printregion {10 10 100 100} {10 10 100 100}}
81
    {-printregion {} {}}
82
    {-separator off off}
83
    {-separator on on}
84
    {-stretch 1 1}
85
    {-stretch 0 0}
86
    {-thickness 4 4}
87
    {-title Test Test}
88
    {-vpagecnt 2 2}} {
89
        set option [lindex $test 0]
90
        test Canvasprintdialog-2.$o "configuration options, $option" {
91
            .cpd configure $option [lindex $test 1]
92
            lindex [.cpd configure $option] 4
93
        } [lindex $test 2]
94
        update
95
        incr o
96
}
97
 
98
#
99
# Option tests which fail and produce errors.
100
#
101
#foreach test {
102
#  {-printregion bogus {bad option "printregion": should contain 4 coordinates}}
103
#  {-output bogus {bad option "output": should be file or printer}}
104
#  {-orient bogus {bad option "orient": should be portrait or landscape}}
105
#  {-stretch bogus {bad option "stretch": should be a boolean}}
106
#  {-posterize bogus {bad option "posterize": should be a boolean}}
107
#  } {
108
#       set option [lindex $test 0]
109
#        test Canvasprintdialog-2.$o "configuration options, $option" {
110
#           list [catch {.cpd configure $option [lindex $test 1]} msg] $msg
111
#       } [list 1 [lindex $test 2]]
112
#       incr o
113
#}
114
 
115
#
116
# Method tests which are successful.
117
#
118
canvas .c
119
foreach test {
120
    {{.cpd getoutput} {lpr}}
121
    {{.cpd refresh} {}}
122
    {{.cpd setcanvas .c} {}}
123
    {{.cpd hide Help} {}}
124
    {{.cpd hide Cancel} {}}
125
    {{.cpd default Apply} {}}
126
    {{.cpd show Cancel} {}}
127
    {{.cpd deactivate} {}}} {
128
        set method [lindex [lindex $test 0] 1]
129
        test Canvasprintdialog-3.$m "object methods, $method" {
130
            list [catch {eval [lindex $test 0]} msg] $msg
131
        } [list 0 [lindex $test 1]]
132
        update
133
        incr m
134
}
135
 
136
#
137
# Conclusion of constrcution/destruction tests
138
#
139
test Canvasprintdialog-1.$c {Canvasprintdialog destruction} {
140
    destroy .c
141
    destroy .cpd
142
    update
143
} {}
144
 
145
incr c
146
 
147
test Canvasprintdialog-1.$c {Canvasprintdialog construction} {
148
    iwidgets::Canvasprintdialog .cpd
149
    update
150
} {}
151
 
152
incr c
153
 
154
test Canvasprintdialog-1.$c {Canvasprintdialog destruction} {
155
    destroy .cpd
156
    update
157
} {}
158
 
159
incr c
160
 
161
test Canvasprintdialog-1.$c {Canvasprintdialog destruction} {
162
    iwidgets::Canvasprintdialog .cpd
163
    destroy .cpd
164
    update
165
} {}

powered by: WebSVN 2.1.0

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