xset : test about input argument added. Obsolete properties removed.
[scilab.git] / scilab / modules / graphics / tests / unit_tests / xset_xget.tst
1 // =============================================================================
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2011 - Scilab Enterprises - Bruno JOFRET
4 //
5 //  This file is distributed under the same license as the Scilab package.
6 // =============================================================================
7
8 // <-- TEST WITH GRAPHIC -->
9
10 // test xset and xget
11
12
13 // colormap
14 c_map = graycolormap(512);
15 xset("colormap", c_map);
16 out = xget("colormap");
17 assert_checkequal(out, c_map);
18
19 // mark size
20 xset("mark size", 456);
21 out = xget("mark size");
22 assert_checkequal(out, 456);
23
24 // mark
25 xset("mark", 4, 5);
26 out = xget("mark");
27 assert_checkequal(out, [4 5]);
28
29 // font
30 out = xget("font");
31 assert_checkequal(out, [6 1]);
32 xset("font", 8, 2);
33 out = xget("font");
34 assert_checkequal(out, [8 2]);
35
36 // line style
37 xset("line style", 8);
38 out = xget("line style");
39 assert_checkequal(out, 8);
40
41 // font size
42 out = xget("font size");
43 assert_checkequal(out, 2);
44 xset("font size", 42);
45 out = xget("font size");
46 assert_checkequal(out, 42);
47
48 // fpf
49 out = xget("fpf");
50 assert_checkequal(out, "");
51 xset("fpf", "%s.%s");
52 out = xget("fpf");
53 assert_checkequal(out, "%s.%s");
54
55
56 // auto clear
57 out = xget("auto clear");
58 assert_checkequal(out, "off");
59 xset("auto clear", "on")
60 out = xget("auto clear");
61 assert_checkequal(out, "on");
62
63 // dashes
64 out = xget("dashes");
65 assert_checkequal(out, 8);
66 xset("dashes", 2);
67 out = xget("dashes");
68 assert_checkequal(out, 2);
69
70 // hidden3d
71 out = xget("hidden3d");
72 assert_checkequal(out, 4);
73 xset("hidden3d", 21);
74 out = xget("hidden3d");
75 assert_checkequal(out, 21);
76
77 // window figure
78 f = gcf();
79 out = xget("window");
80 assert_checkequal(out, f.figure_id);
81 out = xget("figure");
82 assert_checkequal(out, f.figure_id);
83
84 // thickness
85 out = xget("thickness");
86 assert_checkequal(out, 1);
87 xset("thickness", 5);
88 out = xget("thickness");
89 assert_checkequal(out, 5);
90
91 // wdim wpdim
92 out = xget("wdim");
93 assert_checkequal(out, f.figure_size);
94 out = xget("wpdim");
95 assert_checkequal(out, f.figure_size);
96
97 // wpos
98 out = xget("wpos");
99 assert_checkequal(out, f.position([1, 2]));
100
101 // viewport
102 out = xget("viewport");
103 assert_checkequal(out, f.viewport);
104
105 // background
106 out = xget("background");
107 assert_checkequal(out, -2);
108
109 // color foreground pattern
110 out = xget("color");
111 assert_checkequal(out, -1);
112 out = xget("foreground");
113 assert_checkequal(out, -1);
114 out = xget("pattern");
115 assert_checkequal(out, -1);
116
117 // lastpattern
118 out = xget("lastpattern");
119 assert_checkequal(out, 512);
120
121 // line mode
122 out = xget("line mode");
123 assert_checkequal(out, 1);
124
125 // pixmap
126 out = xget("pixmap");
127 assert_checkequal(out, 0);
128
129 // white
130 out = xget("white");
131 assert_checkequal(out, 514);
132
133 // wresize
134 out = xget("wresize");
135 assert_checkequal(out, 1);
136
137 // clipgrf
138 out = xget("clipgrf");
139 assert_checkequal(out, 0);
140
141 // clipoff
142 out = xget("clipoff");
143 assert_checkequal(out, 1);
144
145 // clipping => clip_box + clip_state
146 xset("clipping", 1,2,3,4);
147 out = xget("clipping");
148 assert_checkequal(out, [1,2,3,4]);
149
150 // XSET
151
152 // wdim
153 xset("wdim",1000,500)
154 assert_checkequal(xget("wdim"), [1000,500]);
155 xset("wdim",[1000,500]) // 500 is ignored here
156 wdim=xget("wdim");
157 assert_checkequal(wdim(1), 1000);
158
159 ierr = execstr("xset(""colormap"");","errcatch");
160 assert_checkequal(ierr, 999);
161 ierr = execstr("xset(""mark size"");","errcatch");
162 assert_checkequal(ierr, 999);
163 ierr = execstr("xset(""mark"");","errcatch");
164 assert_checkequal(ierr, 999);
165 ierr = execstr("xset(""font size"");","errcatch");
166 assert_checkequal(ierr, 999);
167 ierr = execstr("xset(""line style"");","errcatch");
168 assert_checkequal(ierr, 999);
169 ierr = execstr("xset(""font size"");","errcatch");
170 assert_checkequal(ierr, 999);
171 ierr = execstr("xset(""fpf"");","errcatch");
172 assert_checkequal(ierr, 999);
173 ierr = execstr("xset(""auto clear"");","errcatch");
174 assert_checkequal(ierr, 999);
175 ierr = execstr("xset(""dashes"");","errcatch");
176 assert_checkequal(ierr, 999);
177 ierr = execstr("xset(""hidden3d"");","errcatch");
178 assert_checkequal(ierr, 999);
179 ierr = execstr("xset(""figure"");","errcatch");
180 assert_checkequal(ierr, 999);
181 ierr = execstr("xset(""window"");","errcatch");
182 assert_checkequal(ierr, 999);
183 ierr = execstr("xset(""thickness"");","errcatch");
184 assert_checkequal(ierr, 999);
185 ierr = execstr("xset(""wdim"");","errcatch");
186 assert_checkequal(ierr, 999);
187 ierr = execstr("xset(""wpdim"");","errcatch");
188 assert_checkequal(ierr, 999);
189 ierr = execstr("xset(""wpos"");","errcatch");
190 assert_checkequal(ierr, 999);
191 ierr = execstr("xset(""viewport"");","errcatch");
192 assert_checkequal(ierr, 999);
193 ierr = execstr("xset(""background"");","errcatch");
194 assert_checkequal(ierr, 999);
195 ierr = execstr("xset(""color"");","errcatch");
196 assert_checkequal(ierr, 999);
197 ierr = execstr("xset(""foreground"");","errcatch");
198 assert_checkequal(ierr, 999);
199 ierr = execstr("xset(""pattern"");","errcatch");
200 assert_checkequal(ierr, 999);
201 ierr = execstr("xset(""line mode"");","errcatch");
202 assert_checkequal(ierr, 999);
203 ierr = execstr("xset(""pixmap"");","errcatch");
204 assert_checkequal(ierr, 999);
205 ierr = execstr("xset(""wresize"");","errcatch");
206 assert_checkequal(ierr, 999);
207 ierr = execstr("xset(""default"", ""test"");","errcatch");
208 assert_checkequal(ierr, 999);