1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
/*
* Copyright 1990, 1991 by the Massachusetts Institute of Technology and
* UniSoft Group Limited.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation, and that the names of MIT and UniSoft not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission. MIT and UniSoft
* make no representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
* $XConsortium$
*/
>>TITLE IsCursorKey CH10
IsCursorKey(keysym)
KeySym keysym;
>>EXTERN
#define XK_LATIN1
#define XK_MISCELLANY
#include "keysymdef.h"
#undef XK_MISCELLANY
#undef XK_LATIN1
>>ASSERTION Good A
When the
.A keysym
argument is a cursor key, then
invocation of the xname macro returns
.S True .
>>STRATEGY
For each cursor key KeySym:
Verify that xname returns True.
>>CODE
static KeySym cks[] = {
XK_Home,
XK_Left,
XK_Up,
XK_Right,
XK_Down,
XK_Prior,
XK_Next,
XK_End,
XK_Begin,
0 };
KeySym *ksp;
Bool res;
for(ksp = cks; *ksp; ksp++) {
keysym = *ksp;
res = XCALL;
if(res != True) {
char *kstr = XKeysymToString(*ksp);
report("%s() did not return True for KeySym XK_%s (value %lu).",
TestName, kstr != (char *) NULL ? kstr : "<KeySym Undefined>", *ksp);
FAIL;
} else
CHECK;
}
CHECKPASS(NELEM(cks) - 1);
>>ASSERTION Good A
When the
.A keysym
argument is not a cursor key, then
invocation of the xname macro returns
.S False .
>>STRATEGY
Verify that xname returns False for the KeySym XK_A.
>>CODE
Bool res;
keysym = XK_A;
res = XCALL;
if(res != False) {
char *kstr = XKeysymToString(keysym);
report("%s() did not return False for KeySym XK_%s (value %lu).",
TestName, kstr != (char *) NULL ? kstr : "<KeySym Undefined>", keysym);
FAIL;
} else
CHECK;
CHECKPASS(1);
|