xtestlib.xml revision 25b89263
1<?xml version="1.0" encoding="UTF-8" ?>
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
4
5
6<!-- lifted from troff+ms+XMan by doclifter -->
7<book id="xtestlib">
8
9<bookinfo>
10   <title>XTEST Extension Library</title>
11   <subtitle>X Consortium Standard</subtitle>
12   <releaseinfo>X Version 11, Release 6.4</releaseinfo>
13   <authorgroup>
14      <author>
15         <firstname>Kieron</firstname><surname>Drake</surname>
16      </author>
17   </authorgroup>
18   <corpname>UniSoft Ltd.</corpname>
19   <copyright><year>1992</year><holder>UniSoft Group Ltd.</holder></copyright>
20   <copyright><year>1992</year><holder>X Consortium</holder></copyright>
21   <copyright><year>1994</year><holder>X Consortium</holder></copyright>
22   <releaseinfo>Version 2.2</releaseinfo>
23   <affiliation><orgname>X Consortium</orgname></affiliation>
24   <productnumber>X Version 11, Release 7</productnumber>
25
26<legalnotice>
27
28<para>
29Permission to use, copy, modify, and distribute this documentation for
30any purpose and without fee is hereby granted, provided that the above
31copyright notice and this permission notice appear in all copies.  UniSoft
32makes no representations about the suitability for any purpose of the
33information in this document.  This documentation is provided
34&ldquo;as is&rdquo; without express or implied warranty.
35</para>
36
37<para>
38Permission is hereby granted, free of charge, to any person obtaining a copy
39of this software and associated documentation files
40(the &ldquo;Software&rdquo;), to deal in the Software without restriction,
41including without limitation the rights to use, copy, modify, merge, publish,
42distribute, sublicense, and/or sell copies of the Software, and to permit
43persons to whom the Software is furnished to do so, subject to the following
44conditions:
45</para>
46
47<para>
48The above copyright notice and this permission notice shall be included in all
49copies or substantial portions of the Software.
50</para>
51
52<para>
53THE SOFTWARE IS PROVIDED &ldquo;AS IS&rdquo;, WITHOUT WARRANTY OF ANY KIND,
54EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
55MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN
56NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
57LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
58OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
59THE SOFTWARE.
60</para>
61
62<para>
63Except as contained in this notice, the name of the X Consortium shall not
64be used in advertising or otherwise to promote the sale, use or other dealings
65in this Software without prior written authorization from the X Consortium.
66</para>
67
68<para>X Window System is a trademark of The Open Group.</para>
69
70<para>
71Except as contained in this notice, the name of the X Consortium shall not be
72used in advertising or otherwise to promote the sale, use or other dealings
73in this Software without prior written authorization from the X Consortium.
74</para>
75</legalnotice>
76</bookinfo>
77
78<chapter id='overview'>
79<title>Overview</title>
80
81<para>
82This extension is a minimal set of client and server extensions
83required to completely test the X11 server with no user intervention.
84</para>
85
86<para>
87This extension is not intended to support general journaling and
88playback of user actions.  This is a difficult area [XTrap, 89] as it attempts
89to synchronize synthetic user interactions with their effects; it is at the
90higher level of dialogue recording/playback rather than at the strictly lexical
91level.  We are interested only in the latter, simpler, case.  A more detailed
92discussion and justification of the extension functionality is given in
93[Drake, 91].
94</para>
95
96<para>
97We are aiming only to provide a minimum set of facilities that
98solve immediate testing and validation problems.  The testing extension
99itself needs testing, where possible, and so should be as simple as possible.
100</para>
101
102<para>We have also tried to:</para>
103<itemizedlist mark='bullet'>
104  <listitem>
105    <para>
106Confine the extension to an appropriate high level
107within the server to minimize portability problems.  In practice this
108means that the extension should be at the DIX level or use the
109DIX/DDX interface, or both.  This has effects, in particular, on the
110level at which "input synthesis" can occur.
111    </para>
112  </listitem>
113  <listitem>
114    <para>
115Minimize the changes required in the rest of the server.
116    </para>
117  </listitem>
118  <listitem>
119    <para>
120Minimize performance penalties on normal server operation.
121    </para>
122  </listitem>
123</itemizedlist>
124</chapter>
125
126<chapter id='description'>
127<title>Description</title>
128
129<para>The functions provided by this extension fall into two groups:</para>
130
131<itemizedlist>
132    <listitem>
133      <para>Client Operations</para>
134      <para>
135These routines manipulate otherwise hidden client-side behavior.
136The actual implementation will depend on the details of the actual language
137binding and what degree of request buffering, GContext caching, and so on, is
138provided.  In the C binding, defined in section 7, routines are provided
139to access the internals of two opaque data structures -
140<symbol role='Pn'>GC</symbol>s
141and
142<function>Visual</function>s - and to discard any requests pending within the
143output buffer of a connection.  The exact details can be expected to differ for
144other language bindings.
145      </para>
146    </listitem>
147    <listitem>
148      <para>Server Requests</para>
149      <para>
150The first of these requests is similar to that provided in most
151extensions: it allows a client to specify a major and minor version
152number to the server and for the server to respond with major and minor
153versions of its own.  The remaining two requests allow the following:
154      </para>
155    </listitem>
156    <listitem>
157      <itemizedlist>
158        <listitem>
159          <para>
160Access to an otherwise "write-only" server resource: the
161cursor associated with a given window
162          </para>
163        </listitem>
164        <listitem>
165          <para>
166Perhaps most importantly, limited synthesis of input
167device events, almost as if a cooperative user had moved the pointing device
168or pressed a key or button.
169          </para>
170        </listitem>
171      </itemizedlist>
172    </listitem>
173</itemizedlist>
174</chapter>
175
176<chapter id='c_language_binding'>
177<title>C Language Binding</title>
178
179<para>
180The C functions either provide direct access to the protocol and add no
181additional semantics to those defined in section 5 or they correspond
182directly to the abstract descriptions of client operations in section 4.
183</para>
184
185<para>
186All XTEST extension functions and procedures, and all manifest constants
187and macros, will start with the string "XTest".  All operations are
188classified as server/client (Server) or client-only (Client).
189All routines that have return type Status will return nonzero for
190"success" and zero for "failure."  Even if the XTEST extension is
191supported, the server may withdraw such facilities arbitrarily; in which case
192they will subsequently return zero.
193</para>
194
195<para>
196The include file for this extension is
197&lt;<symbol role='Pn'>X11/extensions/XTest.h</symbol>&gt;.
198</para>
199
200<funcsynopsis>
201<funcprototype>
202<funcdef>Bool<function> XTestQueryExtension</function></funcdef>
203<paramdef>Display<parameter> *display</parameter></paramdef>
204<paramdef>int<parameter> *event_base</parameter></paramdef>
205<paramdef>int<parameter> *error_base</parameter></paramdef>
206<paramdef>int<parameter> *major_version</parameter></paramdef>
207<paramdef>int<parameter> *minor_version</parameter></paramdef>
208</funcprototype>
209</funcsynopsis>
210
211<para>
212<function>XTestQueryExtension</function>
213returns
214<function>True</function>
215if the specified display supports the XTEST extension, else
216<function>False</function>
217If the extension is supported, *event_base would be set to the event number
218for the first event for this extension and *error_base would be set to the
219error number for the first error for this extension.  As no errors or
220events are defined for this version of the extension, the values returned
221here are not defined (nor useful).  If the extension is supported,
222*major_version and *minor_version are set to the major and minor version
223numbers of the extension supported by the display.  Otherwise, none of
224the arguments are set.
225</para>
226
227<funcsynopsis>
228<funcprototype>
229<funcdef>Bool<function> XTestCompareCursorWithWindow</function></funcdef>
230<paramdef>Display<parameter> *display</parameter></paramdef>
231<paramdef>Window<parameter> *window</parameter></paramdef>
232<paramdef>Cursor<parameter> cursor</parameter></paramdef>
233</funcprototype>
234</funcsynopsis>
235
236<para>If the extension is supported,
237<function>XTestCompareCursorWithWindow</function>
238performs a comparison of the cursor whose ID is specified by cursor (which
239may be
240<function>None</function>
241with the cursor of the window specified by window returning
242<function>True</function>
243if they are the same and
244<function>False</function>
245otherwise.  If the extension is not supported, then the request is ignored and
246zero is returned.
247</para>
248
249<funcsynopsis>
250<funcprototype>
251<funcdef>Bool<function>XTestCompareCurrentCursorWithWindow</function></funcdef>
252<paramdef>Display<parameter> *display</parameter></paramdef>
253<paramdef>Window<parameter> window</parameter></paramdef>
254</funcprototype>
255</funcsynopsis>
256
257<para>If the extension is supported,
258<function>XTestCompareCurrentCursorWithWindow</function>
259performs a comparison of the current cursor with the cursor of the specified
260window returning
261<function>True</function>
262if they are the same and
263<function>False</function>
264otherwise.  If the extension is not supported, then the request is ignored and
265zero is returned.
266</para>
267
268<funcsynopsis>
269<funcprototype>
270<funcdef><function>XTestFakeKeyEvent</function></funcdef>
271<paramdef>Display<parameter> *display</parameter></paramdef>
272<paramdef>unsigned int<parameter> keycode</parameter></paramdef>
273<paramdef>Bool<parameter> is_press</parameter></paramdef>
274<paramdef>unsigned long<parameter> delay</parameter></paramdef>
275</funcprototype>
276</funcsynopsis>
277
278<para>If the extension is supported,
279<function>XTestFakeKeyEvent</function>
280requests the server to simulate either a
281<function>KeyPress</function>
282(if is_press is
283<function>True</function>
284or a
285<function>KeyRelease</function>
286(if is_press is
287<function>False</function>
288of the key with the specified keycode; otherwise, the request is ignored.
289</para>
290
291<para>
292If the extension is supported, the simulated event will not be processed
293until delay milliseconds after the request is received (if delay is
294<function>CurrentTime</function>
295then this is interpreted as no delay at all).  No other requests from
296this client will be processed until this delay, if any, has expired
297and subsequent processing of the simulated event has been completed.
298</para>
299
300<funcsynopsis>
301<funcprototype>
302<funcdef><function>XTestFakeButtonEvent</function></funcdef>
303<paramdef>Display<parameter> *display</parameter></paramdef>
304<paramdef>unsigned int<parameter> button</parameter></paramdef>
305<paramdef>Bool<parameter> is_press</parameter></paramdef>
306<paramdef>unsigned long<parameter> delay</parameter></paramdef>
307</funcprototype>
308</funcsynopsis>
309
310<para>If the extension is supported,
311<function>XTestFakeButtonEvent</function>
312requests the server to simulate either a
313<function>ButtonPress</function>
314(if is_press is
315<function>True</function>
316or a
317<function>ButtonRelease</function>
318(if is_press is
319<function>False</function>
320of the logical button numbered by the specified button; otherwise, the
321request is ignored.
322</para>
323
324<para>If the extension is supported,
325the simulated event will not be processed until delay milliseconds
326after the request is received (if delay is
327<function>CurrentTime</function>
328then this is interpreted as no delay at all).  No other requests from
329this client will be processed until this delay, if any, has expired
330and subsequent processing of the simulated event has been completed.
331</para>
332
333<funcsynopsis>
334<funcprototype>
335<funcdef><function>XTestFakeMotionEvent</function></funcdef>
336<paramdef>Display<parameter> *display</parameter></paramdef>
337<paramdef>int<parameter> screen_number</parameter></paramdef>
338<paramdef>int<parameter> x</parameter></paramdef>
339<paramdef>int<parameter> y</parameter></paramdef>
340<paramdef>unsigned long<parameter> delay</parameter></paramdef>
341</funcprototype>
342</funcsynopsis>
343
344<para>If the extension is supported,
345<function>XTestFakeMotionEvent</function>
346requests the server to simulate a movement of the pointer to the specified
347position (x, y) on the root window of screen_number; otherwise, the request
348is ignored.  If screen_number is -1, the current screen (that the pointer
349is on) is used.
350</para>
351
352<para>
353If the extension is supported, the simulated event will not be processed
354until delay milliseconds after the request is received (if delay is
355<function>CurrentTime</function>
356then this is interpreted as no delay at all).  No other requests from
357this client will be processed until this delay, if any, has expired
358and subsequent processing of the simulated event has been completed.
359</para>
360
361<funcsynopsis>
362<funcprototype>
363<funcdef><function>XTestFakeRelativeMotionEvent</function></funcdef>
364<paramdef>Display<parameter> *display</parameter></paramdef>
365<paramdef>int<parameter> screen_number</parameter></paramdef>
366<paramdef>int<parameter> x</parameter></paramdef>
367<paramdef>int<parameter> y</parameter></paramdef>
368<paramdef>unsigned long<parameter> delay</parameter></paramdef>
369</funcprototype>
370</funcsynopsis>
371
372<para>
373If the extension is supported,
374<function>XTestFakeRelativeMotionEvent</function>
375requests the server to simulate a movement of the pointer by the specified
376offsets (x, y) relative to the current pointer position on screen_number;
377otherwise, the request is ignored.  If screen_number is -1, the
378current screen (that the pointer is on) is used.
379</para>
380
381<para>
382If the extension is supported, the simulated event will not be processed
383until delay milliseconds after the request is received (if delay is
384<function>CurrentTime</function>
385then this is interpreted as no delay at all).  No other requests from
386this client will be processed until this delay, if any, has expired
387and subsequent processing of the simulated event has been completed.
388</para>
389
390<funcsynopsis>
391<funcprototype>
392<funcdef><function>XTestGrabControl</function></funcdef>
393<paramdef>Display<parameter> *display</parameter></paramdef>
394<paramdef>Bool<parameter> impervious</parameter></paramdef>
395</funcprototype>
396</funcsynopsis>
397
398<para>If impervious is
399<function>True</function>
400then the executing client becomes impervious to server grabs.  If impervious is
401<function>False</function>
402then the executing client returns to the normal state of being susceptible
403to server grabs.
404</para>
405
406<funcsynopsis>
407<funcprototype>
408<funcdef>Bool<function> XTestSetGContextOfGC</function></funcdef>
409<paramdef>GC<parameter> gc</parameter></paramdef>
410<paramdef>GContext<parameter> gid</parameter></paramdef>
411</funcprototype>
412</funcsynopsis>
413
414<para>
415<function>XTestSetGContextOfGC</function>
416sets the GContext within the opaque datatype referenced by gc to
417be that specified by gid.
418</para>
419
420<funcsynopsis>
421<funcprototype>
422<funcdef><function>XTestSetVisualIDOfVisual</function></funcdef>
423<paramdef>Visual<parameter> *visual</parameter></paramdef>
424<paramdef>VisualID<parameter> visualid</parameter></paramdef>
425</funcprototype>
426</funcsynopsis>
427
428<para>
429<function>XTestSetVisualIDOfVisual</function>
430sets the VisualID within the opaque datatype referenced by visual to
431be that specified by visualid.
432</para>
433
434<funcsynopsis>
435<funcprototype>
436<funcdef>Bool<function> XTestDiscard</function></funcdef>
437<paramdef>Display<parameter> *display</parameter></paramdef>
438</funcprototype>
439</funcsynopsis>
440
441<para>
442<function>XTestDiscard</function>
443discards any requests within the output buffer for the specified display.
444It returns
445<function>True</function>
446if any requests were discarded; otherwise, it returns
447<function>False</function>
448</para>
449</chapter>
450
451<chapter id='references'>
452<title>References</title>
453
454<para>
455Annicchiarico, D., et al., <emphasis remap='I'>XTrap: The XTrap
456Architecture</emphasis>.
457Digital Equipment Corporation, July 1991.
458</para>
459
460<para>
461Drake, K. J., <emphasis remap='I'>Some Proposals for a Minimum X11
462Testing Extension</emphasis>.
463UniSoft Ltd., June 1991.
464</para>
465
466</chapter>
467</book>
468