Mercurial > freewnn
comparison Xwnmo/test/chkpsset.c @ 0:bbc77ca4def5
initial import
author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
---|---|
date | Thu, 13 Dec 2007 04:30:14 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:bbc77ca4def5 |
---|---|
1 /* | |
2 * $Id: chkpsset.c,v 1.2 2001/06/14 18:16:11 ura Exp $ | |
3 */ | |
4 | |
5 /* | |
6 * FreeWnn is a network-extensible Kana-to-Kanji conversion system. | |
7 * This file is part of FreeWnn. | |
8 * | |
9 * Copyright OMRON Corporation. 1987, 1988, 1989, 1990, 1991, 1992, 1999 | |
10 * | |
11 * Author: OMRON SOFTWARE Co., Ltd. <freewnn@rd.kyoto.omronsoft.co.jp> | |
12 * | |
13 * This program is free software; you can redistribute it and/or modify | |
14 * it under the terms of the GNU General Public License as published by | |
15 * the Free Software Foundation; either version 2, or (at your option) | |
16 * any later version. | |
17 * | |
18 * This program is distributed in the hope that it will be useful, | |
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 * GNU General Public License for more details. | |
22 * | |
23 * You should have received a copy of the GNU General Public License | |
24 * along with GNU Emacs; see the file COPYING. If not, write to the | |
25 * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
26 * | |
27 * Commentary: | |
28 * | |
29 * Change log: | |
30 * | |
31 * Last modified date: 8,Feb.1999 | |
32 * | |
33 * Code: | |
34 * | |
35 */ | |
36 | |
37 /* | |
38 * X11R5 Input Method Test Program | |
39 * chkpsset.c v 1.0 Wed Mar 13 11:16:00 JST 1991 | |
40 */ | |
41 | |
42 /* | |
43 * Author: Takashi Inoue OMRON Corporation | |
44 * takashi@ari.ncl.omron.co.jp | |
45 */ | |
46 | |
47 #include <stdio.h> | |
48 | |
49 #include "exvalue.h" | |
50 #include "func.h" | |
51 | |
52 /* *INDENT-OFF* */ | |
53 FLAG | |
54 sarea (ic, mode) /* Set AREA */ | |
55 XIC ic; | |
56 FLAG mode; | |
57 /* *INDENT-ON* */ | |
58 { | |
59 XRectangle *gparea, *gsarea; | |
60 VALUABLE *area[CHKAREA]; | |
61 XVaNestedList spe_nelist, sst_nelist; | |
62 XVaNestedList gpe_nelist, gst_nelist; | |
63 int cnt, sum; | |
64 | |
65 if ((mode == ONSP) || (mode == ROOTW)) | |
66 { | |
67 prerrfunc (); | |
68 return (COMP); | |
69 } | |
70 else | |
71 { | |
72 cls (prdisp); /* clear screen */ | |
73 /* create nestedlist for set values */ | |
74 prstatus ("Creating NestedList for set values \"Area\"..."); | |
75 if (usta.area.width == ST_WIDTH) | |
76 { | |
77 usta.area.width += WIN_ITV; | |
78 } | |
79 else | |
80 { | |
81 usta.area.width -= WIN_ITV; | |
82 } | |
83 if (mode == OVERSP) | |
84 { | |
85 upea.area.width = (upea.area.width == WPOVER1) ? WPOVER2 : WPOVER1; | |
86 } | |
87 else if (mode == OFFSP) | |
88 { | |
89 upea.area.x = usta.area.width + 2 * WIN_ITV; | |
90 } | |
91 spe_nelist = XVaCreateNestedList (DUMMY, XNArea, &upea.area, NULL); | |
92 sst_nelist = XVaCreateNestedList (DUMMY, XNArea, &usta.area, NULL); | |
93 prstatus ("done."); | |
94 /* test of XSetICValues */ | |
95 prstatus ("Test of XSetICValues() for change \"Area\"..."); | |
96 XSetICValues (ic, XNPreeditAttributes, spe_nelist, XNStatusAttributes, sst_nelist, NULL); | |
97 prstatus ("done."); | |
98 /* create nestedlist for get values */ | |
99 prstatus ("Creating NestedList for get values \"Area\" ..."); | |
100 gpe_nelist = XVaCreateNestedList (DUMMY, XNArea, &gparea, NULL); | |
101 gst_nelist = XVaCreateNestedList (DUMMY, XNArea, &gsarea, NULL); | |
102 prstatus ("done."); | |
103 /* test of XGetICValues */ | |
104 prstatus ("Test of XGetICValues() \"Area\"..."); | |
105 XGetICValues (ic, XNPreeditAttributes, gpe_nelist, XNStatusAttributes, gst_nelist, NULL); | |
106 prstatus ("done."); | |
107 /* verify values */ | |
108 sum = 0; | |
109 area[0] = mkstruct (PAX, DEC, upea.area.x, gparea->x); | |
110 area[1] = mkstruct (PAY, DEC, upea.area.y, gparea->y); | |
111 area[2] = mkstruct (PAW, DEC, upea.area.width, gparea->width); | |
112 area[3] = mkstruct (PAH, DEC, upea.area.height, gparea->height); | |
113 area[4] = mkstruct (SAX, DEC, usta.area.x, gsarea->x); | |
114 area[5] = mkstruct (SAY, DEC, usta.area.y, gsarea->y); | |
115 area[6] = mkstruct (SAW, DEC, usta.area.width, gsarea->width); | |
116 area[7] = mkstruct (SAH, DEC, usta.area.height, gsarea->height); | |
117 for (cnt = 0; cnt < CHKAREA; cnt++) | |
118 { | |
119 sum += verval (area[cnt]); | |
120 } | |
121 /* output of results */ | |
122 cls (prdisp); | |
123 prveres (sum); | |
124 if (sum != NOERR) | |
125 { | |
126 prprint ("Test of XSetICValues() \"Preedit/Status Area\" is failed.\n"); | |
127 prprint ("Preedit/Status Area has not changed.\n\n"); | |
128 prprint ("I will destroy IC and continue test.\n"); | |
129 prprint ("Check log file after this test.\n\n"); | |
130 fprintf (icfp, "...Test of XSetICValues() \"Preedit/Status Area\" is failed.\n\n"); | |
131 XFree ((char *) spe_nelist); | |
132 XFree ((char *) sst_nelist); | |
133 XFree ((char *) gpe_nelist); | |
134 XFree ((char *) gst_nelist); | |
135 XFree ((XRectangle *) gparea); | |
136 XFree ((XRectangle *) gsarea); | |
137 prpng (); | |
138 return (DIC); | |
139 } | |
140 prprint ("Test of XSetICValues() \"Preedit/Status Area\" is succeeded.\n"); | |
141 prprint ("Preedit/Status Area has changed.\n\n"); | |
142 prprint ("Check on your own eyes and move next test.\n"); | |
143 fprintf (icfp, "...Test of XSetICValues() \"Preedit/Status Area\" is succeeded.\n\n"); | |
144 XFree ((char *) spe_nelist); | |
145 XFree ((char *) sst_nelist); | |
146 XFree ((char *) gpe_nelist); | |
147 XFree ((char *) gst_nelist); | |
148 XFree ((XRectangle *) gparea); | |
149 XFree ((XRectangle *) gsarea); | |
150 prpok (); | |
151 return (COMP); | |
152 } | |
153 } | |
154 | |
155 /* *INDENT-OFF* */ | |
156 FLAG | |
157 sneeded (ic, mode) /* Set areaNEEDED */ | |
158 XIC ic; | |
159 FLAG mode; | |
160 /* *INDENT-ON* */ | |
161 | |
162 { | |
163 XRectangle *gpneeded, *gsneeded; | |
164 XRectangle wparea, wsarea, *gparea, *gsarea; | |
165 VALUABLE *needed[CHKNEEDED]; | |
166 VALUABLE *area[CHKAREA]; | |
167 XVaNestedList spe_nelist, sst_nelist; | |
168 XVaNestedList gpe_nelist, gst_nelist; | |
169 int cnt, sum; | |
170 | |
171 if (mode != OFFSP) | |
172 { | |
173 prerrfunc (); | |
174 return (COMP); | |
175 } | |
176 else | |
177 { | |
178 cls (prdisp); /* clear screen */ | |
179 /* create nestedlist for set values */ | |
180 prstatus ("Creating NestedList for set values \"AreaNeeded\"..."); | |
181 upea.needed.width = 100; | |
182 upea.needed.height = 100; | |
183 usta.needed.width = 100; | |
184 usta.needed.height = 100; | |
185 spe_nelist = XVaCreateNestedList (DUMMY, XNAreaNeeded, &upea.needed, NULL); | |
186 sst_nelist = XVaCreateNestedList (DUMMY, XNAreaNeeded, &upea.needed, NULL); | |
187 prstatus ("done."); | |
188 /* test of XSetICValues */ | |
189 prstatus ("Test of XSetICValues() for change \"AreaNeeded\"..."); | |
190 XSetICValues (ic, XNPreeditAttributes, spe_nelist, XNStatusAttributes, sst_nelist, NULL); | |
191 prstatus ("done."); | |
192 /* create nestedlist for get values */ | |
193 prstatus ("Creating NestedList for get values \"AreaNeeded\" ..."); | |
194 gpe_nelist = XVaCreateNestedList (DUMMY, XNAreaNeeded, &gpneeded, NULL); | |
195 gst_nelist = XVaCreateNestedList (DUMMY, XNAreaNeeded, &gsneeded, NULL); | |
196 prstatus ("done."); | |
197 /* test of XGetICValues */ | |
198 prstatus ("Test of XGetICValues() \"AreaNeeded\"..."); | |
199 XGetICValues (ic, XNPreeditAttributes, gpe_nelist, XNStatusAttributes, gst_nelist, NULL); | |
200 prstatus ("done."); | |
201 /* verify values */ | |
202 needed[0] = mkstruct (PNW, DEC, upea.needed.width, gpneeded->width); | |
203 needed[1] = mkstruct (PNH, DEC, upea.needed.height, gpneeded->height); | |
204 needed[2] = mkstruct (SNW, DEC, usta.needed.width, gsneeded->width); | |
205 needed[3] = mkstruct (SNH, DEC, usta.needed.height, gsneeded->height); | |
206 for (cnt = 0; cnt < CHKNEEDED; cnt++) | |
207 { | |
208 verval (needed[cnt]); | |
209 } | |
210 wparea = upea.area; | |
211 wsarea = usta.area; | |
212 upea.area.width = gpneeded->width; | |
213 upea.area.height = gpneeded->height; | |
214 usta.area.width = gsneeded->width; | |
215 usta.area.height = gsneeded->height; | |
216 spe_nelist = XVaCreateNestedList (DUMMY, XNArea, &upea.area, NULL); | |
217 sst_nelist = XVaCreateNestedList (DUMMY, XNArea, &usta.area, NULL); | |
218 prstatus ("done."); | |
219 /* test of XSetICValues */ | |
220 prstatus ("Test of XSetICValues() for change \"Area\"..."); | |
221 XSetICValues (ic, XNPreeditAttributes, spe_nelist, XNStatusAttributes, sst_nelist, NULL); | |
222 prstatus ("done."); | |
223 /* create nestedlist for get values */ | |
224 prstatus ("Creating NestedList for get values \"Area\" ..."); | |
225 gpe_nelist = XVaCreateNestedList (DUMMY, XNArea, &gparea, NULL); | |
226 gst_nelist = XVaCreateNestedList (DUMMY, XNArea, &gsarea, NULL); | |
227 prstatus ("done."); | |
228 /* test of XGetICValues */ | |
229 prstatus ("Test of XGetICValues() \"Area\"..."); | |
230 XGetICValues (ic, XNPreeditAttributes, gpe_nelist, XNStatusAttributes, gst_nelist, NULL); | |
231 prstatus ("done."); | |
232 /* verify values */ | |
233 sum = 0; | |
234 area[0] = mkstruct (PAX, DEC, upea.area.x, gparea->x); | |
235 area[1] = mkstruct (PAY, DEC, upea.area.y, gparea->y); | |
236 area[2] = mkstruct (PAW, DEC, upea.area.width, gparea->width); | |
237 area[3] = mkstruct (PAH, DEC, upea.area.height, gparea->height); | |
238 area[4] = mkstruct (SAX, DEC, usta.area.x, gsarea->x); | |
239 area[5] = mkstruct (SAY, DEC, usta.area.y, gsarea->y); | |
240 area[6] = mkstruct (SAW, DEC, usta.area.width, gsarea->width); | |
241 area[7] = mkstruct (SAH, DEC, usta.area.height, gsarea->height); | |
242 for (cnt = 0; cnt < CHKAREA; cnt++) | |
243 { | |
244 sum += verval (area[cnt]); | |
245 } | |
246 /* output of results */ | |
247 cls (prdisp); | |
248 prveres (sum); | |
249 if (sum != NOERR) | |
250 { | |
251 prprint ("Test of XSetICValues() \"Preedit/Status AreaNeeded\" is failed.\n"); | |
252 prprint ("Preedit/Status Area has not changed, "); | |
253 prprint ("but I will continue test.\n\n"); | |
254 prprint ("Check log file after this test.\n\n"); | |
255 fprintf (icfp, "...Test of XSetICValues() \"Preedit/Status AreaNeeded\" is failed.\n\n"); | |
256 } | |
257 else | |
258 { | |
259 prprint ("Test of XSetICValues() \"Preedit/Status AreaNeeded\" is succeeded.\n"); | |
260 prprint ("Preedit/Status Area has changed.\n\n"); | |
261 prprint ("Check on your own eyes and move next test.\n"); | |
262 prprint ("Check log file after this test.\n\n"); | |
263 fprintf (icfp, "...Test of XSetICValues() \"Preedit/Status AreaNeeded\" is succeeded.\n\n"); | |
264 } | |
265 upea.area = wparea; | |
266 usta.area = wsarea; | |
267 spe_nelist = XVaCreateNestedList (DUMMY, XNArea, &upea.area, NULL); | |
268 sst_nelist = XVaCreateNestedList (DUMMY, XNArea, &usta.area, NULL); | |
269 prstatus ("done."); | |
270 /* test of XSetICValues */ | |
271 prstatus ("Test of XSetICValues() for change \"Area\"..."); | |
272 XSetICValues (ic, XNPreeditAttributes, spe_nelist, XNStatusAttributes, sst_nelist, NULL); | |
273 prstatus ("done."); | |
274 XFree ((char *) spe_nelist); | |
275 XFree ((char *) sst_nelist); | |
276 XFree ((char *) gpe_nelist); | |
277 XFree ((char *) gst_nelist); | |
278 XFree ((XRectangle *) gparea); | |
279 XFree ((XRectangle *) gsarea); | |
280 XFree ((XRectangle *) gpneeded); | |
281 XFree ((XRectangle *) gsneeded); | |
282 prpok (); | |
283 return (COMP); | |
284 } | |
285 } | |
286 | |
287 /* *INDENT-OFF* */ | |
288 FLAG | |
289 sspot (ic, mode) /* Set SPOTlocation */ | |
290 XIC ic; | |
291 FLAG mode; | |
292 /* *INDENT-ON* */ | |
293 | |
294 { | |
295 XPoint *gspot; | |
296 VALUABLE *spot[CHKSPOT]; | |
297 XVaNestedList spe_nelist; | |
298 XVaNestedList gpe_nelist; | |
299 int cnt, sum; | |
300 | |
301 if (mode != OVERSP) | |
302 { | |
303 prerrfunc (); | |
304 return (COMP); | |
305 } | |
306 else | |
307 { | |
308 cls (prdisp); /* clear screen */ | |
309 /* create nestedlist for set values */ | |
310 prstatus ("Creating NestedList for set values \"SpotLocation\"..."); | |
311 upea.spot.x = (upea.spot.x == XPSL1) ? XPSL2 : XPSL1; | |
312 upea.spot.y = YPSL; | |
313 spe_nelist = XVaCreateNestedList (DUMMY, XNSpotLocation, &upea.spot, NULL); | |
314 prstatus ("done."); | |
315 /* test of XSetICValues */ | |
316 prstatus ("Test of XSetICValues() for change \"SpotLocation\"..."); | |
317 XSetICValues (ic, XNPreeditAttributes, spe_nelist, NULL); | |
318 prstatus ("done."); | |
319 /* create nestedlist for get values */ | |
320 prstatus ("Creating NestedList for get values \"SpotLocation\" ..."); | |
321 gpe_nelist = XVaCreateNestedList (DUMMY, XNSpotLocation, &gspot, NULL); | |
322 prstatus ("done."); | |
323 /* test of XGetICValues */ | |
324 prstatus ("Test of XGetICValues() \"SpotLocation\"..."); | |
325 XGetICValues (ic, XNPreeditAttributes, gpe_nelist, NULL); | |
326 prstatus ("done."); | |
327 /* verify values */ | |
328 sum = 0; | |
329 spot[0] = mkstruct (PSLX, DEC, upea.spot.x, gspot->x); | |
330 spot[1] = mkstruct (PSLY, DEC, upea.spot.y, gspot->y); | |
331 for (cnt = 0; cnt < CHKSPOT; cnt++) | |
332 { | |
333 sum += verval (spot[cnt]); | |
334 } | |
335 /* output of results */ | |
336 cls (prdisp); | |
337 prveres (sum); | |
338 if (sum != NOERR) | |
339 { | |
340 prprint ("Test of XSetICValues() \"Preedit SpotLocation\" is failed.\n"); | |
341 prprint ("Preedit SpotLocation has not changed.\n\n"); | |
342 prprint ("I will destroy IC and continue test.\n"); | |
343 prprint ("Check log file after this test.\n\n"); | |
344 fprintf (icfp, "...Test of XSetICValues() \"Preedit SpotLocation\" is failed.\n\n"); | |
345 XFree ((char *) spe_nelist); | |
346 XFree ((char *) gpe_nelist); | |
347 prpng (); | |
348 return (DIC); | |
349 } | |
350 prprint ("Test of XSetICValues() \"Preedit SpotLocation\" is succeeded.\n"); | |
351 prprint ("Preedit SpotLocation has changed.\n\n"); | |
352 prprint ("Check on your own eyes and move next test.\n"); | |
353 fprintf (icfp, "...Test of XSetICValues() \"Preedit SpotLocation\" is succeeded.\n\n"); | |
354 XFree ((char *) spe_nelist); | |
355 XFree ((char *) gpe_nelist); | |
356 XFree ((XPoint *) gspot); | |
357 prpok (); | |
358 return (COMP); | |
359 } | |
360 } | |
361 | |
362 | |
363 /* *INDENT-OFF* */ | |
364 FLAG | |
365 scmap (ic, mode) /* Set ColorMAP */ | |
366 XIC ic; | |
367 FLAG mode; | |
368 /* *INDENT-ON* */ | |
369 | |
370 { | |
371 Colormap gpcmap, gscmap; | |
372 VALUABLE *colormap[CHKCMAP]; | |
373 XVaNestedList spe_nelist, sst_nelist; | |
374 XVaNestedList gpe_nelist, gst_nelist; | |
375 int cnt, sum; | |
376 | |
377 if (mode == ONSP) | |
378 { | |
379 prerrfunc (); | |
380 return (COMP); | |
381 } | |
382 else | |
383 { | |
384 cls (prdisp); /* clear screen */ | |
385 /* create nestedlist for get values */ | |
386 prstatus ("Creating NestedList for set values \"Colormap\"..."); | |
387 cmflag = (cmflag == 1) ? 0 : 1; | |
388 XSetWindowColormap (dpy, window1.win, cmap[cmflag]); | |
389 XSetWindowColormap (dpy, window2.win, cmap[cmflag]); | |
390 XSetWindowColormap (dpy, window3.win, cmap[cmflag]); | |
391 XSetWindowColormap (dpy, mroot, cmap[cmflag]); | |
392 upea.cmap = usta.cmap = cmap[cmflag]; | |
393 spe_nelist = XVaCreateNestedList (DUMMY, XNColormap, upea.cmap, NULL); | |
394 sst_nelist = XVaCreateNestedList (DUMMY, XNColormap, usta.cmap, NULL); | |
395 prstatus ("done."); | |
396 /* test of XSetICValues */ | |
397 prstatus ("Test of XSetICValues() for change \"Colormap\"..."); | |
398 XSetICValues (ic, XNPreeditAttributes, spe_nelist, XNStatusAttributes, sst_nelist, NULL); | |
399 prstatus ("done."); | |
400 /* create nestedlist for get values */ | |
401 prstatus ("Creating NestedList for get values \"Colormap\" ..."); | |
402 gpe_nelist = XVaCreateNestedList (DUMMY, XNColormap, &gpcmap, NULL); | |
403 gst_nelist = XVaCreateNestedList (DUMMY, XNColormap, &gscmap, NULL); | |
404 prstatus ("done."); | |
405 /* test of XGetICValues */ | |
406 prstatus ("Test of XGetICValues() \"Colormap\"..."); | |
407 XGetICValues (ic, XNPreeditAttributes, gpe_nelist, XNStatusAttributes, gst_nelist, NULL); | |
408 prstatus ("done."); | |
409 /* verify values */ | |
410 sum = 0; | |
411 colormap[0] = mkstruct (PCM, HEX, upea.cmap, gpcmap); | |
412 colormap[1] = mkstruct (SCM, HEX, usta.cmap, gscmap); | |
413 for (cnt = 0; cnt < CHKCMAP; cnt++) | |
414 { | |
415 sum += verval (colormap[cnt]); | |
416 } | |
417 /* output of results */ | |
418 cls (prdisp); | |
419 prveres (sum); | |
420 if (sum != NOERR) | |
421 { | |
422 prprint ("Test of XSetICValues() for change \"Preedit/Status Colormap\" is failed.\n"); | |
423 prprint ("Preedit/Status Colormap has not changed.\n\n"); | |
424 prprint ("I will destroy IC and continue test.\n"); | |
425 prprint ("Check log file after this test.\n\n"); | |
426 fprintf (icfp, "...Test of XSetICValues() for change \"Preedit/Status Cmap\" is failed.\n\n"); | |
427 XFree ((char *) spe_nelist); | |
428 XFree ((char *) sst_nelist); | |
429 XFree ((char *) gpe_nelist); | |
430 XFree ((char *) gst_nelist); | |
431 prpng (); | |
432 return (DIC); | |
433 } | |
434 prprint ("Test of XSetICValues() for change \"Preedit/Status Colormap\" is succeeded.\n"); | |
435 prprint ("Preedit/Status Colormap has changed.\n\n"); | |
436 prprint ("Check on your own eyes and move next test.\n"); | |
437 prprint ("Check log file after this test.\n\n"); | |
438 fprintf (icfp, "...Test of XSetICValues() for change \"Preedit/Status Colormap\" is succeeded.\n\n"); | |
439 XFree ((char *) spe_nelist); | |
440 XFree ((char *) sst_nelist); | |
441 XFree ((char *) gpe_nelist); | |
442 XFree ((char *) gst_nelist); | |
443 prpok (); | |
444 return (COMP); | |
445 } | |
446 } | |
447 | |
448 /* *INDENT-OFF* */ | |
449 FLAG | |
450 sground (ic, mode) /* Set fore/backGROUND */ | |
451 XIC ic; | |
452 FLAG mode; | |
453 /* *INDENT-ON* */ | |
454 | |
455 { | |
456 u_long gpfg, gpbg, gsfg, gsbg; | |
457 VALUABLE *ground[CHKFBGND]; | |
458 XVaNestedList spe_nelist, sst_nelist; | |
459 XVaNestedList gpe_nelist, gst_nelist; | |
460 int cnt, sum; | |
461 static int i = 0, j = PIX_MAX - 1; | |
462 | |
463 if (mode == ONSP) | |
464 { | |
465 prerrfunc (); | |
466 return (COMP); | |
467 } | |
468 else | |
469 { | |
470 cls (prdisp); /* clear screen */ | |
471 i++, j--; | |
472 if (i == PIX_MAX) | |
473 { | |
474 i = 0; | |
475 } | |
476 if (j == -1) | |
477 { | |
478 j = PIX_MAX - 1; | |
479 } | |
480 upea.fg = pixel[cmflag][j]; | |
481 upea.bg = pixel[cmflag][i]; | |
482 usta.fg = pixel[cmflag][i]; | |
483 usta.bg = pixel[cmflag][j]; | |
484 /* Create nestedlist for set values */ | |
485 prstatus ("Creating NestedList for set values \"Fg/Bg\"..."); | |
486 spe_nelist = XVaCreateNestedList (DUMMY, XNForeground, upea.fg, XNBackground, upea.bg, NULL); | |
487 sst_nelist = XVaCreateNestedList (DUMMY, XNForeground, usta.fg, XNBackground, usta.bg, NULL); | |
488 prstatus ("done."); | |
489 /* test of XSetICValues */ | |
490 prstatus ("Using XSetICValues() for change \"Fg/Bg\"..."); | |
491 XSetICValues (ic, XNPreeditAttributes, spe_nelist, XNStatusAttributes, sst_nelist, NULL); | |
492 prstatus ("done."); | |
493 /* create nestedlist for get values */ | |
494 prstatus ("Creating NestedList for get values \"Fg/Bg\" ..."); | |
495 gpe_nelist = XVaCreateNestedList (DUMMY, XNForeground, &gpfg, XNBackground, &gpbg, NULL); | |
496 gst_nelist = XVaCreateNestedList (DUMMY, XNForeground, &gsfg, XNBackground, &gsbg, NULL); | |
497 prstatus ("done."); | |
498 /* test of XGetICValues */ | |
499 prstatus ("Test of XGetICValues() \"Fg/Bg\"..."); | |
500 XGetICValues (ic, XNPreeditAttributes, gpe_nelist, XNStatusAttributes, gst_nelist, NULL); | |
501 prstatus ("done."); | |
502 /* verify values */ | |
503 sum = 0; | |
504 ground[0] = mkstruct (PFG, HEX, upea.fg, gpfg); | |
505 ground[1] = mkstruct (PBG, HEX, upea.bg, gpbg); | |
506 ground[2] = mkstruct (SFG, HEX, usta.fg, gsfg); | |
507 ground[3] = mkstruct (SBG, HEX, usta.bg, gsbg); | |
508 for (cnt = 0; cnt < CHKFBGND; cnt++) | |
509 { | |
510 sum += verval (ground[cnt]); | |
511 } | |
512 /* output of results */ | |
513 cls (prdisp); | |
514 prveres (sum); | |
515 if (sum != NOERR) | |
516 { | |
517 prprint ("Test of XSetICValues() for change \"Preedit/Status Fg/Bg\" is failed.\n"); | |
518 prprint ("Preedit/Status Fg/Bg has not changed.\n\n"); | |
519 prprint ("I will destroy IC and continue test.\n"); | |
520 prprint ("Check log file after this test.\n\n"); | |
521 fprintf (icfp, "...Test of XSetICValues() for change \"Preedit/Status Fg/Bg\" is failed.\n\n"); | |
522 XFree ((char *) spe_nelist); | |
523 XFree ((char *) sst_nelist); | |
524 XFree ((char *) gpe_nelist); | |
525 XFree ((char *) gst_nelist); | |
526 prpng (); | |
527 return (DIC); | |
528 } | |
529 prprint ("Test of XSetICValues() for change \"Preedit/Status Fg/Bg\" is succeeded.\n"); | |
530 prprint ("Preedit/Status Fg/Bg has changed.\n\n"); | |
531 prprint ("Check on your own eyes and move next test.\n"); | |
532 prprint ("Check log file after this test.\n\n"); | |
533 fprintf (icfp, "...Test of XSetICValues() for change \"Preedit/Status Fg/Bg\" is succeeded.\n\n"); | |
534 XFree ((char *) spe_nelist); | |
535 XFree ((char *) sst_nelist); | |
536 XFree ((char *) gpe_nelist); | |
537 XFree ((char *) gst_nelist); | |
538 prpok (); | |
539 return (COMP); | |
540 } | |
541 } | |
542 | |
543 /* *INDENT-OFF* */ | |
544 FLAG | |
545 spixmap (ic, mode) /* Set bg/ PIXMAP */ | |
546 XIC ic; | |
547 FLAG mode; | |
548 /* *INDENT-ON* */ | |
549 | |
550 { | |
551 Pixmap gppix, gspix; | |
552 VALUABLE *pixmap[CHKPIX]; | |
553 XVaNestedList spe_nelist, sst_nelist; | |
554 XVaNestedList gpe_nelist, gst_nelist; | |
555 int cnt, sum; | |
556 | |
557 if (mode == ONSP) | |
558 { | |
559 prerrfunc (); | |
560 return (COMP); | |
561 } | |
562 else | |
563 { | |
564 cls (prdisp); /* clear screen */ | |
565 /* create nestedlist for get values */ | |
566 prstatus ("Creating NestedList for set values \"Bg/ Pixmap\"..."); | |
567 upea.bgpm = (upea.bgpm == pix[0]) ? pix[1] : pix[0]; | |
568 usta.bgpm = (usta.bgpm == pix[0]) ? pix[1] : pix[0]; | |
569 spe_nelist = XVaCreateNestedList (DUMMY, XNBackgroundPixmap, upea.bgpm, NULL); | |
570 sst_nelist = XVaCreateNestedList (DUMMY, XNBackgroundPixmap, usta.bgpm, NULL); | |
571 prstatus ("done."); | |
572 /* test of XSetICValues */ | |
573 prstatus ("Test of XSetICValues() \"Bg/ Pixmap\"..."); | |
574 XSetICValues (ic, XNPreeditAttributes, spe_nelist, XNStatusAttributes, sst_nelist, NULL); | |
575 prstatus ("done."); | |
576 /* create nestedlist for get values */ | |
577 prstatus ("Creating NestedList for get values \"Bg/ Pixmap\" again..."); | |
578 gpe_nelist = XVaCreateNestedList (DUMMY, XNBackgroundPixmap, &gppix, NULL); | |
579 gst_nelist = XVaCreateNestedList (DUMMY, XNBackgroundPixmap, &gspix, NULL); | |
580 prstatus ("done."); | |
581 /* test of XGetICValues */ | |
582 prstatus ("Test of XGetICValues() \"Bg/ Pixmap\"..."); | |
583 XGetICValues (ic, XNPreeditAttributes, gpe_nelist, XNStatusAttributes, gst_nelist, NULL); | |
584 prstatus ("done."); | |
585 /* verify values */ | |
586 sum = 0; | |
587 pixmap[0] = mkstruct (PBP, HEX, upea.bgpm, gppix); | |
588 pixmap[1] = mkstruct (SBP, HEX, usta.bgpm, gspix); | |
589 for (cnt = 0; cnt < CHKPIX; cnt++) | |
590 { | |
591 sum += verval (pixmap[cnt]); | |
592 } | |
593 /* output of results */ | |
594 cls (prdisp); | |
595 prveres (sum); | |
596 if (sum != NOERR) | |
597 { | |
598 prprint ("Test of XSetICValues() for change \"Preedit/Status Bg/ Pixmap\" is failed.\n"); | |
599 prprint ("Preedit/Status Bg/ Pixmap has not changed. "); | |
600 prprint ("but I will continue test.\n"); | |
601 prprint ("Check log file after this test.\n\n"); | |
602 fprintf (icfp, "...Test of XSetICValues() for change \"Preedit/Status Bg/ Pixmap\" is failed.\n\n"); | |
603 } | |
604 else | |
605 { | |
606 prprint ("Test of XSetICValues() for change \"Preedit/Status Bg/ Pixmap\" is succeeded.\n"); | |
607 prprint ("Preedit/Status Bg/ Pixmap has changed.\n\n"); | |
608 prprint ("Check on your own eyes and move next test.\n"); | |
609 prprint ("Check log file after this test.\n\n"); | |
610 fprintf (icfp, "...Test of XSetICValues() for change \"Preedit/Status Bg/ Pixmap\" is succeeded.\n\n"); | |
611 } | |
612 XFree ((char *) spe_nelist); | |
613 XFree ((char *) sst_nelist); | |
614 XFree ((char *) gpe_nelist); | |
615 XFree ((char *) gst_nelist); | |
616 prpok (); | |
617 return (COMP); | |
618 } | |
619 } | |
620 | |
621 /* *INDENT-OFF* */ | |
622 FLAG | |
623 sfontset (ic, mode) /* Set FONTSET */ | |
624 XIC ic; | |
625 FLAG mode; | |
626 /* *INDENT-ON* */ | |
627 | |
628 { | |
629 XFontSet gpfont, gsfont; | |
630 VALUABLE *font[CHKFONT]; | |
631 XVaNestedList spe_nelist, sst_nelist; | |
632 XVaNestedList gpe_nelist, gst_nelist; | |
633 int cnt, sum; | |
634 | |
635 if (mode == ONSP) | |
636 { | |
637 prerrfunc (); | |
638 return (COMP); | |
639 } | |
640 else | |
641 { | |
642 cls (prdisp); /* clear screen */ | |
643 /* create nestedlist for get values */ | |
644 prstatus ("Creating NestedList for set values \"FontSet\"..."); | |
645 upea.fset = (upea.fset == fontset[0]) ? fontset[1] : fontset[0]; | |
646 usta.fset = (usta.fset == fontset[0]) ? fontset[1] : fontset[0]; | |
647 spe_nelist = XVaCreateNestedList (DUMMY, XNFontSet, upea.fset, NULL); | |
648 sst_nelist = XVaCreateNestedList (DUMMY, XNFontSet, usta.fset, NULL); | |
649 prstatus ("done."); | |
650 /* test of XSetICValues */ | |
651 prstatus ("Test of XSetICValues() for change \"FontSet\"..."); | |
652 XSetICValues (ic, XNPreeditAttributes, spe_nelist, XNStatusAttributes, sst_nelist, NULL); | |
653 prstatus ("done."); | |
654 /* create nestedlist for get values */ | |
655 prstatus ("Creating NestedList for get values \"FontSet\" ..."); | |
656 gpe_nelist = XVaCreateNestedList (DUMMY, XNFontSet, &gpfont, NULL); | |
657 gst_nelist = XVaCreateNestedList (DUMMY, XNFontSet, &gsfont, NULL); | |
658 prstatus ("done."); | |
659 /* test of XGetICValues */ | |
660 prstatus ("Test of XGetICValues() \"FontSet\"..."); | |
661 XGetICValues (ic, XNPreeditAttributes, gpe_nelist, XNStatusAttributes, gst_nelist, NULL); | |
662 prstatus ("done."); | |
663 /* verify values */ | |
664 sum = 0; | |
665 font[0] = mkstruct (PFS, HEX, upea.fset, gpfont); | |
666 font[1] = mkstruct (SFS, HEX, usta.fset, gsfont); | |
667 for (cnt = 0; cnt < CHKFONT; cnt++) | |
668 { | |
669 sum += verval (font[cnt]); | |
670 } | |
671 /* output of results */ | |
672 cls (prdisp); | |
673 prveres (sum); | |
674 if (sum != NOERR) | |
675 { | |
676 prprint ("Test of XSetICValues() for change \"Preedit/Status FontSet\" is failed.\n"); | |
677 prprint ("Preedit/Status FontSet has not changed.\n\n"); | |
678 prprint ("I will destroy IC and continue test.\n"); | |
679 prprint ("Check log file after this test.\n\n"); | |
680 fprintf (icfp, "...Test of XSetICValues() for change \"Preedit/Status FontSet\" is failed.\n\n"); | |
681 XFree ((char *) spe_nelist); | |
682 XFree ((char *) sst_nelist); | |
683 XFree ((char *) gpe_nelist); | |
684 XFree ((char *) gst_nelist); | |
685 prpng (); | |
686 return (DIC); | |
687 } | |
688 prprint ("Test of XSetICValues() for change \"Preedit/Status FontSet\" is succeeded.\n"); | |
689 prprint ("Preedit/Status FontSet has changed.\n\n"); | |
690 prprint ("Check on your own eyes and move next test.\n"); | |
691 prprint ("Check log file after this test.\n\n"); | |
692 fprintf (icfp, "...Test of XSetICValues() for change \"Preedit/Status FontSet\" is succeeded.\n\n"); | |
693 XFree ((char *) spe_nelist); | |
694 XFree ((char *) sst_nelist); | |
695 XFree ((char *) gpe_nelist); | |
696 XFree ((char *) gst_nelist); | |
697 prpok (); | |
698 return (COMP); | |
699 } | |
700 } | |
701 | |
702 /* *INDENT-OFF* */ | |
703 FLAG | |
704 slinespc (ic, mode) /* Set LINESPaCing */ | |
705 XIC ic; | |
706 FLAG mode; | |
707 /* *INDENT-ON* */ | |
708 | |
709 { | |
710 XRectangle *gplspc; | |
711 VALUABLE *plspc; | |
712 XVaNestedList spe_nelist; | |
713 XVaNestedList gpe_nelist; | |
714 int sum; | |
715 | |
716 if (mode != OVERSP) | |
717 { | |
718 prerrfunc (); | |
719 return (COMP); | |
720 } | |
721 else | |
722 { | |
723 cls (prdisp); /* clear screen */ | |
724 /* create nestedlist for set values */ | |
725 prstatus ("Creating NestedList for set values \"LineSpacing\"..."); | |
726 upea.lspc = (upea.lspc == LSPC1) ? LSPC2 : LSPC1; | |
727 spe_nelist = XVaCreateNestedList (DUMMY, XNLineSpace, upea.lspc, NULL); | |
728 prstatus ("done."); | |
729 /* test of XSetICValues */ | |
730 prstatus ("Test of XSetICValues() for change \"LineSpacing\"..."); | |
731 XSetICValues (ic, XNPreeditAttributes, spe_nelist, NULL); | |
732 prstatus ("done."); | |
733 /* create nestedlist for get values */ | |
734 prstatus ("Creating NestedList for get values \"LineSpacing\" ..."); | |
735 gpe_nelist = XVaCreateNestedList (DUMMY, XNLineSpace, &gplspc, NULL); | |
736 prstatus ("done."); | |
737 /* test of XGetICValues */ | |
738 prstatus ("Test of XGetICValues() \"LineSpacing\"..."); | |
739 XGetICValues (ic, XNPreeditAttributes, gpe_nelist, NULL); | |
740 prstatus ("done."); | |
741 /* verify values */ | |
742 sum = 0; | |
743 plspc = mkstruct (PLS, DEC, upea.lspc, gplspc); | |
744 sum += verval (plspc); | |
745 /* output of results */ | |
746 cls (prdisp); | |
747 prveres (sum); | |
748 if (sum != NOERR) | |
749 { | |
750 prprint ("Test of XSetICValues() for change \"Preedit LineSpacing\" is failed.\n"); | |
751 prprint ("Preedit LineSpacing has not changed.\n\n"); | |
752 prprint ("I will destroy IC and continue test.\n"); | |
753 prprint ("Check log file after this test.\n\n"); | |
754 fprintf (icfp, "...Test of XSetICValues() for change \"Preedit LineSpacing\" is faled.\n\n"); | |
755 XFree ((char *) spe_nelist); | |
756 XFree ((char *) gpe_nelist); | |
757 prpng (); | |
758 return (DIC); | |
759 } | |
760 prprint ("Test of XSetICValues() for change \"Preedit LineSpacing\" is succeeded.\n"); | |
761 prprint ("Status LineSpacing has changed.\n\n"); | |
762 prprint ("Check on your own eyes and move next test.\n"); | |
763 prprint ("Check log file after this test.\n\n"); | |
764 fprintf (icfp, "...Test of XSetICValues() for change \"Preedit LineSpacing\" is succeeded.\n\n"); | |
765 XFree ((char *) spe_nelist); | |
766 XFree ((char *) gpe_nelist); | |
767 prpok (); | |
768 return (COMP); | |
769 } | |
770 } | |
771 | |
772 /* *INDENT-OFF* */ | |
773 FLAG | |
774 scursor (ic, mode) /* Set CURSOR */ | |
775 XIC ic; | |
776 FLAG mode; | |
777 /* *INDENT-ON* */ | |
778 | |
779 { | |
780 Cursor gpcursor, gscursor; | |
781 VALUABLE *cur[CHKCUR]; | |
782 XVaNestedList spe_nelist, sst_nelist; | |
783 XVaNestedList gpe_nelist, gst_nelist; | |
784 int cnt, sum; | |
785 | |
786 if (mode == ONSP) | |
787 { | |
788 prerrfunc (); | |
789 return (COMP); | |
790 } | |
791 else | |
792 { | |
793 cls (prdisp); /* clear screen */ | |
794 /* create nestedlist for get values */ | |
795 prstatus ("Creating NestedList for set values \"Cursor\"..."); | |
796 upea.cursor = (upea.cursor == cursor[0]) ? cursor[1] : cursor[0]; | |
797 usta.cursor = (usta.cursor == cursor[0]) ? cursor[1] : cursor[0]; | |
798 spe_nelist = XVaCreateNestedList (DUMMY, XNCursor, upea.cursor, NULL); | |
799 sst_nelist = XVaCreateNestedList (DUMMY, XNCursor, usta.cursor, NULL); | |
800 prstatus ("done."); | |
801 /* test of XSetICValues */ | |
802 prstatus ("Test of XSetICValues() for change \"Cursor\"..."); | |
803 XSetICValues (ic, XNPreeditAttributes, spe_nelist, XNStatusAttributes, sst_nelist, NULL); | |
804 prstatus ("done."); | |
805 /* create nestedlist for get values */ | |
806 prstatus ("Creating NestedList for get values \"Cursor\" ..."); | |
807 gpe_nelist = XVaCreateNestedList (DUMMY, XNCursor, &gpcursor, NULL); | |
808 gst_nelist = XVaCreateNestedList (DUMMY, XNCursor, &gscursor, NULL); | |
809 prstatus ("done."); | |
810 /* test of XGetICValues */ | |
811 prstatus ("Test of XGetICValues() \"Cursor\"..."); | |
812 XGetICValues (ic, XNPreeditAttributes, gpe_nelist, XNStatusAttributes, gst_nelist, NULL); | |
813 prstatus ("done."); | |
814 /* verify values */ | |
815 sum = 0; | |
816 cur[0] = mkstruct (PCU, HEX, upea.cursor, gpcursor); | |
817 cur[1] = mkstruct (SCU, HEX, usta.cursor, gscursor); | |
818 for (cnt = 0; cnt < CHKCUR; cnt++) | |
819 { | |
820 sum += verval (cur[cnt]); | |
821 } | |
822 /* output of results */ | |
823 cls (prdisp); | |
824 prveres (sum); | |
825 if (sum != NOERR) | |
826 { | |
827 prprint ("Test of XSetICValues() for change \"Preedit/Status Cursor\" is failed.\n"); | |
828 prprint ("Preedit/Status Cursor has not changed, "); | |
829 prprint ("but I will continue test.\n\n"); | |
830 prprint ("Check log file after this test.\n\n"); | |
831 fprintf (icfp, "...Test of XSetICValues() for change \"Preedit/Status Cursor\" is failed.\n\n"); | |
832 } | |
833 else | |
834 { | |
835 prprint ("Test of XSetICValues() for change \"Preedit/Status Cursor\" is succeeded.\n"); | |
836 prprint ("Preedit/Status Cursor has changed.\n\n"); | |
837 prprint ("Check on your own eyes and move next test.\n"); | |
838 prprint ("Check log file after this test.\n\n"); | |
839 fprintf (icfp, "...Test of XSetICValues() for change \"Preedit/Status Cursor\" is succeeded.\n\n"); | |
840 } | |
841 XFree ((char *) spe_nelist); | |
842 XFree ((char *) sst_nelist); | |
843 XFree ((char *) gpe_nelist); | |
844 XFree ((char *) gst_nelist); | |
845 prpok (); | |
846 return (COMP); | |
847 } | |
848 } |