OSDN Git Service

Please enter the commit message for your changes. Lines starting
[eos/base.git] / util / src / TclTk / tk8.6.12 / tests / get.test
1 # This file is a Tcl script to test out the procedures in the file
2 # tkGet.c.  It is organized in the standard fashion for Tcl
3 # white-box tests.
4 #
5 # Copyright (c) 1998 Sun Microsystems, Inc.
6 # Copyright (c) 1998-1999 by Scriptics Corporation.
7 # All rights reserved.
8
9 package require tcltest 2.2
10 eval tcltest::configure $argv
11 tcltest::loadTestedCommands
12 namespace import -force tcltest::test
13
14 test get-1.1 {Tk_GetAnchorFromObj} -setup {
15     button .b
16 } -body {
17     .b configure -anchor n
18     .b cget -anchor
19 } -cleanup {
20     destroy .b
21 } -result {n}
22 test get-1.2 {Tk_GetAnchorFromObj} -setup {
23     button .b
24 } -body {
25     .b configure -anchor ne
26     .b cget -anchor
27 } -cleanup {
28     destroy .b
29 } -result {ne}
30 test get-1.3 {Tk_GetAnchorFromObj} -setup {
31     button .b
32 } -body {
33     .b configure -anchor e
34     .b cget -anchor
35 } -cleanup {
36     destroy .b
37 } -result {e}
38 test get-1.4 {Tk_GetAnchorFromObj} -setup {
39     button .b
40 } -body {
41     .b configure -anchor se
42     .b cget -anchor
43 } -cleanup {
44     destroy .b
45 } -result {se}
46 test get-1.5 {Tk_GetAnchorFromObj} -setup {
47     button .b
48 } -body {
49     .b configure -anchor s
50     .b cget -anchor
51 } -cleanup {
52     destroy .b
53 } -result {s}
54 test get-1.6 {Tk_GetAnchorFromObj} -setup {
55     button .b
56 } -body {
57     .b configure -anchor sw
58     .b cget -anchor
59 } -cleanup {
60     destroy .b
61 } -result {sw}
62 test get-1.7 {Tk_GetAnchorFromObj} -setup {
63     button .b
64 } -body {
65     .b configure -anchor w
66     .b cget -anchor
67 } -cleanup {
68     destroy .b
69 } -result {w}
70 test get-1.8 {Tk_GetAnchorFromObj} -setup {
71     button .b
72 } -body {
73     .b configure -anchor nw
74     .b cget -anchor
75 } -cleanup {
76     destroy .b
77 } -result {nw}
78 test get-1.9 {Tk_GetAnchorFromObj} -setup {
79     button .b
80 } -body {
81     .b configure -anchor n
82     .b cget -anchor
83 } -cleanup {
84     destroy .b
85 } -result {n}
86 test get-1.10 {Tk_GetAnchorFromObj} -setup {
87     button .b
88 } -body {
89     .b configure -anchor center
90     .b cget -anchor
91 } -cleanup {
92     destroy .b
93 } -result {center}
94 test get-1.11 {Tk_GetAnchorFromObj - error} -setup {
95     button .b
96 } -body {
97     .b configure -anchor unknown
98 } -cleanup {
99     destroy .b
100 } -returnCodes {error} -result {bad anchor "unknown": must be n, ne, e, se, s, sw, w, nw, or center}
101
102
103 test get-2.1 {Tk_GetJustifyFromObj} -setup {
104     button .b
105 } -body {
106     .b configure -justify left
107     .b cget -justify
108 } -cleanup {
109     destroy .b
110 } -result {left}
111 test get-2.2 {Tk_GetJustifyFromObj} -setup {
112     button .b
113 } -body {
114     .b configure -justify right
115     .b cget -justify
116 } -cleanup {
117     destroy .b
118 } -result {right}
119 test get-2.3 {Tk_GetJustifyFromObj} -setup {
120     button .b
121 } -body {
122     .b configure -justify center
123     .b cget -justify
124 } -cleanup {
125     destroy .b
126 } -result {center}
127 test get-2.4 {Tk_GetJustifyFromObj - error} -setup {
128     button .b
129 } -body {
130     .b configure -justify stupid
131 } -cleanup {
132     destroy .b
133 } -returnCodes {error} -result {bad justification "stupid": must be left, right, or center}
134
135 # cleanup
136 cleanupTests
137 return
138