diff options
author | Dan Nicholson <dbn.lists@gmail.com> | 2009-09-16 12:20:41 -0700 |
---|---|---|
committer | Dan Nicholson <dbn.lists@gmail.com> | 2009-09-16 12:20:41 -0700 |
commit | 704eb8d4cbfa2f8c47882a8ea6c7732cf5fa20d1 (patch) | |
tree | 1f48212ecf5556fbff17172c6904e525481e8653 /xts5/Xlib11 | |
parent | 5d01bd434ff7186701c931883b110c179d4fa8b8 (diff) |
xts5: Move tests out of tset directory
The tset directory was mostly useless and causes extra baggage if the
scenario files are going to be used on an installed package. The test
directories are now flattened into xts5.
Diffstat (limited to 'xts5/Xlib11')
35 files changed, 25999 insertions, 0 deletions
diff --git a/xts5/Xlib11/.gitignore b/xts5/Xlib11/.gitignore new file mode 100644 index 00000000..c7dcfe29 --- /dev/null +++ b/xts5/Xlib11/.gitignore @@ -0,0 +1,33 @@ +ButtonPress/ButtonPress +ButtonRelease/ButtonRelease +ClientMessage/ClientMessage +ColormapNotify/ColormapNotify +ConfigureNotify/ConfigureNotify +ConfigureRequest/ConfigureRequest +CirculateNotify/CirculateNotify +CirculateRequest/CirculateRequest +CreateNotify/CreateNotify +DestroyNotify/DestroyNotify +EnterNotify/EnterNotify +Expose/Expose +FocusIn/FocusIn +FocusOut/FocusOut +GraphicsExpose/GraphicsExpose +GravityNotify/GravityNotify +KeymapNotify/KeymapNotify +KeyPress/KeyPress +KeyRelease/KeyRelease +LeaveNotify/LeaveNotify +MapNotify/MapNotify +MappingNotify/MappingNotify +MapRequest/MapRequest +MotionNotify/MotionNotify +NoExpose/NoExpose +PropertyNotify/PropertyNotify +ReparentNotify/ReparentNotify +ResizeRequest/ResizeRequest +SelectionClear/SelectionClear +SelectionNotify/SelectionNotify +SelectionRequest/SelectionRequest +UnmapNotify/UnmapNotify +VisibilityNotify/VisibilityNotify diff --git a/xts5/Xlib11/ButtonPress/ButtonPress.m b/xts5/Xlib11/ButtonPress/ButtonPress.m new file mode 100644 index 00000000..27471bb3 --- /dev/null +++ b/xts5/Xlib11/ButtonPress/ButtonPress.m @@ -0,0 +1,1005 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/ButtonPress/ButtonPress.m,v 1.2 2005-11-03 08:42:20 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/ButtonPress/ButtonPress.m +>># +>># Description: +>># Tests for ButtonPress() +>># +>># Modifications: +>># $Log: bttnprss.m,v $ +>># Revision 1.2 2005-11-03 08:42:20 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:16 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:06 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:50:33 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:22:48 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:21 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:00:56 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:57:12 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE ButtonPress Xlib11 +>>EXTERN +#define EVENT ButtonPress +#define EVENTMASK ButtonPressMask +#define PTRX 4 +#define PTRY 3 +>>SET end-function restoredevstate +>>ASSERTION Good B 1 +When any pointer button is pressed, +then a xname event is generated. +>>STRATEGY +If extended testing is enabled: + Create window. + Select for xname events. + Generate xname event. + Verify that a xname event was delivered. + Verify that event member fields are correctly set. +>>CODE +Display *display = Dsp; +Window w; +XEvent event_return; +XButtonPressedEvent good; +PointerPlace *ptr; + + if(noext(1)) + return; + +/* Create window. */ + w = defwin(display); + +/* Select for events. */ + XSelectInput(display, w, EVENTMASK); + XSync(display, True); + +/* Generate xname event. */ + XSync(display, True); + ptr = warppointer(display, w, PTRX, PTRY); + buttonpress(display, Button1); + +/* Verify that event was delivered. */ +/* Verify that event member fields are correctly set. */ + if (!XCheckTypedWindowEvent(display, w, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } + else + CHECK; + + good = event_return.xbutton; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.window = w; + good.root = DRW(display); + good.subwindow = None; + good.x = PTRX; + good.y = PTRY; + good.x_root = ptr->nx; + good.y_root = ptr->ny; + good.state = 0L; + good.button = Button1; + good.same_screen = True; + + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; + + + CHECKPASS(2); + +>>ASSERTION Good B 1 +When a xname event is generated +and no active pointer grab is in progress +and at least one ancestor of the source window has a matching passive grab +on the pressed pointer button, +then the X server activates a passive grab for +the first ancestor of the source window, +searching from the root window down. +>>STRATEGY +If extended testing is enabled : + Create a window. + Create a child window. + Create a child of the child. + Select input on EnterNotify events for all of the windows. + Select passive grabs for all the windows on Button1. + Simulate a ButtonPress event. + Verify that the child windows did not receive EnterNotify events. + Verify that the oldest ancestor window received an EnterNotify with mode NotifyGrab. + Simulate a ButtonRelease event. + Release the passive grabs. +>>CODE +Window w; +Window w1; +Window w2; +XEvent ev; +struct area area; +char *unexpstr = "Unexpected event on a child window."; + + if (noext(1)) + return; + + w = defwin(Dsp); + setarea(&area, 10, 10, 30, 30); + w1 = crechild(Dsp, w, &area); + w2 = crechild(Dsp, w1, &area); + (void) warppointer(Dsp, w2, 1,1); + + XSelectInput(Dsp, w, EnterWindowMask); + XSelectInput(Dsp, w1, EnterWindowMask); + XSelectInput(Dsp, w2, EnterWindowMask); + + XGrabButton(Dsp, Button1, AnyModifier, w, False, 0L, GrabModeAsync, GrabModeAsync, None, None); + XGrabButton(Dsp, Button1, AnyModifier, w1, False, 0L, GrabModeAsync, GrabModeAsync, None, None); + XGrabButton(Dsp, Button1, AnyModifier, w2, False, 0L, GrabModeAsync, GrabModeAsync, None, None); + + XSync(Dsp, True); + buttonpress(Dsp, Button1); + + if(XCheckWindowEvent(Dsp, w1, EnterWindowMask, &ev) != False) { + report(unexpstr); + FAIL; + } else + CHECK; + + if(XCheckWindowEvent(Dsp, w2, EnterWindowMask, &ev) != False) { + report(unexpstr); + FAIL; + } else + CHECK; + + if(XCheckWindowEvent(Dsp, w, EnterWindowMask, &ev) == False) { + report("No event was activated on the oldest ancestor window."); + FAIL; + } else { + + CHECK; + if(ev.xcrossing.mode != NotifyGrab) { + report("Passive grab was not activated on oldest ancestor window."); + FAIL; + } else + CHECK; + } + + buttonrel(Dsp, Button1); + XUngrabButton(Dsp, Button1, AnyModifier, w); + XUngrabButton(Dsp, Button1, AnyModifier, w1); + XUngrabButton(Dsp, Button1, AnyModifier, w2); + + CHECKPASS(4); + +>>ASSERTION Good B 1 +When a xname event is generated +and no active pointer grab is in progress +and no ancestor of the source window has a matching passive grab +on the pressed pointer button, +then the X server automatically starts an active grab +for the client receiving the event and +sets the last-pointer-grab time to the current server time. +>>ASSERTION Good B 1 +When a xname event is generated +and no active pointer grab is in progress +and no ancestor of the source window has a matching passive grab +on the pressed pointer button and +no client has selected for button presses on the event window, +then the event is discarded. +>>STRATEGY +If extended testing is enabled: + Create window. + Select for all events except ButtonPress. + Generate xname event. + Verify that no event was delivered. +>>CODE +Display *display = Dsp; +Window w; +int count; + + if(noext(1)) + return; + +/* Create window. */ + w = defwin(display); + + (void) warppointer(display, w, PTRX, PTRY); + XSelectInput(display, w, ALLEVENTS & ~ButtonPressMask); + XSync(display, True); +/* Generate xname event. */ + XSync(display, True); + buttonpress(display, Button1); + +/* Verify no events were delivered. */ + + count = XPending(display); + if (count != 0) { + report("Got %d unexpected events.", count); + FAIL; + } + else + PASS; + +>>ASSERTION Good B 1 +When a xname event is generated, +then +all clients having set +.S ButtonPressMask +event mask bits on the event window are delivered +a xname event. +>>#COMMENT +>># This assertion is misleading, there can only ever be one client +>># selecting ButtonPress events on any particular window. +>># For the time-being this test is a copy of the single client test. +>># Cal 12/2/92. +>># +>>STRATEGY +If extended testing is enabled: + Create window. + Select for xname events. + Generate xname event. + Verify that a xname event was delivered. + Verify that event member fields are correctly set. +Otherwise: + Create window. + Set ButtonPressMask event mask bits on window. + Verify that no error occurred. +>>CODE +Display *display = Dsp; +Window w; +XEvent event_return; +XButtonPressedEvent good; +PointerPlace *ptr; + + + if(config.extensions) { + + if(noext(1)) + return; + /* Create window. */ + w = defwin(display); + + /* Select for events. */ + XSelectInput(display, w, EVENTMASK); + XSync(display, True); + + /* Generate xname event. */ + XSync(display, True); + ptr = warppointer(display, w, PTRX, PTRY); + buttonpress(display, Button1); + + /* Verify that event was delivered. */ + /* Verify that event member fields are correctly set. */ + if (!XCheckTypedWindowEvent(display, w, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } else + CHECK; + + good = event_return.xbutton; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.window = w; + good.root = DRW(display); + good.subwindow = None; + good.x = PTRX; + good.y = PTRY; + good.x_root = ptr->nx; + good.y_root = ptr->ny; + good.state = 0L; + good.button = Button1; + good.same_screen = True; + + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; + + CHECKPASS(2); + + } else { + + /* Create window. */ + w = mkwin(display, (XVisualInfo *) NULL, (struct area *) NULL, False); + /* Set ButtonPressMask event mask bits on window. */ + XSelectInput(display, w, ButtonPressMask); + XSync(display, True); + /* Verify that no error occurred. */ + if (geterr() != Success) { + delete("Error setting up for test."); + return; + } + else + CHECK; + CHECKUNTESTED(1); + } + +>>ASSERTION Good B 1 +>>#NOTE True for most events (except MappingNotify and selection stuff). +When a xname event is generated, +then +clients not having set +.S ButtonPressMask +event mask bits on the event window are not delivered +a xname event. +>>STRATEGY +If extended testing is enabled: + Create window. + Select for all events except ButtonPress. + Create a second client. + Select for ButtonPress events on the window + Generate xname event. + Verify that a xname event was delivered. + Verify that no event was delivered to the other client. +>>CODE +Display *display = Dsp; +Display *client2; +XEvent ev; +Window w; +int count; + + if(noext(1)) + return; + + client2 = opendisplay(); + +/* Create window. */ + w = defwin(display); + + (void) warppointer(display, w, PTRX, PTRY); + XSelectInput(display, w, ALLEVENTS & ~ButtonPressMask); + XSelectInput(client2, w, ButtonPressMask); + XSync(display, True); + XSync(client2, True); +/* Generate xname event. */ + buttonpress(display, Button1); + + XSync(client2, False); + + +/* Verify a ButtonPress was generated. */ + if(XCheckWindowEvent(client2, w, ButtonPressMask, &ev) == False) { + report("No ButtonPress event was generated."); + FAIL; + } else + CHECK; + +/* Verify no events were delivered. */ + count = XPending(display); + if (count != 0) { + report("Got %d unexpected events.", count); + FAIL; + } else + CHECK; + + CHECKPASS(2); + +>>ASSERTION Good B 1 +When a xname event is generated +and no client has selected +.S ButtonPressMask +on the source window, +then the event propagates, +with propagation stopping at the root window of the screen or +at the first window with +.S ButtonPressMask +in its do-not-propagate mask, +from the source window to +the first ancestor window for which +some client has selected +for xname events. +>>STRATEGY +If extended testing is required: + Create a window. + Create a child of that window. + Create a child of the child. + Select xname events on the root window. + Simulate a xname event on the youngest child. + Verify that a xname event was generated on the root. + Select xname events on the oldest window. + Set the do_not_propagate mask of its child to xname events. + Simulate a xname event on the youngest child. + Verify that no created window received a xname event. + Clear the do_not_propagate mask on the oldest child. + Set the do_not_propagate mask on the oldest window. + Select for xname events on the oldest child. + Simulate a xname on the youngest child. + Verify that no xname event was sent to the oldest window. + Verify that no xname event was sent to the youngest window. + Verify that a xname event was sent to the oldest child. + +>>CODE +XEvent ev; +Window w; +Window w1; +Window w2; +XSetWindowAttributes atts; + + if(noext(1)) + return; + + w = defwin(Dsp); + w1 = crechild(Dsp, w, (struct area *) NULL); + w2 = crechild(Dsp, w1, (struct area *) NULL); + XSelectInput(Dsp, DRW(Dsp), ButtonPressMask); + (void) warppointer(Dsp, w2, 1,1); + + XSync(Dsp, True); + buttonpress(Dsp, Button1); + + if (XCheckWindowEvent(Dsp, DRW(Dsp), ButtonPressMask, &ev) == False) { + report("Expected event (%s) not received.", eventname(ButtonPress)); + FAIL; + } else + CHECK; + + XSelectInput(Dsp, DRW(Dsp), NoEventMask); + XSelectInput(Dsp, w, ButtonPressMask); + + atts.do_not_propagate_mask = ButtonPressMask; + XChangeWindowAttributes(Dsp, w1, CWDontPropagate, &atts); + + buttonrel(Dsp, Button1); + buttonpress(Dsp, Button1); + + if (XCheckWindowEvent(Dsp, w2, ButtonPressMask, &ev) != False) { + report("Unexpected event (%s) received.", eventname(ButtonPress)); + FAIL; + } else + CHECK; + + if (XCheckWindowEvent(Dsp, w1, ButtonPressMask, &ev) != False) { + report("Unexpected event (%s) received.", eventname(ButtonPress)); + FAIL; + } else + CHECK; + + if (XCheckWindowEvent(Dsp, w, ButtonPressMask, &ev) != False) { + report("Unexpected event (%s) received.", eventname(ButtonPress)); + FAIL; + } else + CHECK; + + XSelectInput(Dsp, w1, ButtonPressMask); + XChangeWindowAttributes(Dsp, w, CWDontPropagate, &atts); + + atts.do_not_propagate_mask = NoEventMask; + XChangeWindowAttributes(Dsp, w1, CWDontPropagate, &atts); + + buttonrel(Dsp, Button1); + buttonpress(Dsp, Button1); + + if (XCheckWindowEvent(Dsp, w2, ButtonPressMask, &ev) != False) { + report("Unexpected event (%s) received.", eventname(ButtonPress)); + FAIL; + } else + CHECK; + + if (XCheckWindowEvent(Dsp, w, ButtonPressMask, &ev) != False) { + report("Unexpected event (%s) received.", eventname(ButtonPress)); + FAIL; + } else + CHECK; + + if (XCheckWindowEvent(Dsp, w1, ButtonPressMask, &ev) == False) { + report("ButtonPress event was not delivered to selecting child window."); + FAIL; + } else + CHECK; + +CHECKPASS(7); + +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE Global except for MappingNotify and KeymapNotify. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M window +>>#NOTEs is set to +>>#NOTEs the +>>#NOTEs ifdef(`WINDOWTYPE', WINDOWTYPE, event) +>>#NOTEs window. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M root +>>#NOTEs is set to the source window's root window. +>>ASSERTION Good B 1 +>># +>>#COMMENT +>># This assertion contains a tautology; a child is an inferior. +>># Cal 12/2/92. +>># +When a xname event is delivered +and the source window is an inferior of the event window +and the source window is a child of the event window, +then +.M subwindow +is set to +the source window. +>>STRATEGY +If extended testing is required: + Create a window. + Select xname events on that window. + Create a child of that window. + Simulate a xname event on the child. + Verify that a xname event was delivered to the parent. + Verify that the subwindow component was the child of the event window. +>>CODE +XEvent ev; +Window w; +Window w1; + + if(noext(1)) + return; + + w = defwin(Dsp); + w1 = crechild(Dsp, w, (struct area *) NULL); + XSelectInput(Dsp, w, ButtonPressMask); + (void) warppointer(Dsp, w1, 1,1); + + XSync(Dsp, True); + buttonpress(Dsp, Button1); + + if (XCheckWindowEvent(Dsp, w, ButtonPressMask, &ev) == False) { + report("Expected event (%s) not received.", eventname(ButtonPress)); + FAIL; + } else { + CHECK; + if(ev.xbutton.subwindow != w1) { + report("The subwindow component of the %s event was not set correctly.", eventname(ButtonPress)); + FAIL; + } else + CHECK; + } + + CHECKPASS(2); + +>>ASSERTION Good B 1 +When a xname event is delivered +and the source window is an inferior of the event window +and the source window is not a child of the event window, +then +.M subwindow +is set to +the child of the event window that is +an ancestor of the source window. +>>STRATEGY +If extended testing is required: + Create a window. + Select xname events on that window. + Create a child of that window. + Create a child of the child. + Simulate a xname event on the youngest child. + Verify that a xname event was generated on the oldest parent. + Verify that the subwindow component was the child of the event window. +>>CODE +Window w; +Window w1; +Window w2; +XEvent ev; +struct area area; + + if (noext(1)) + return; + + w = defwin(Dsp); + setarea(&area, 10, 10, 30, 30); + w1 = crechild(Dsp, w, &area); + w2 = crechild(Dsp, w1, &area); + (void) warppointer(Dsp, w2, 1,1); + XSelectInput(Dsp, w, ButtonPressMask); + + XSync(Dsp, True); + buttonpress(Dsp, Button1); + + if (XCheckWindowEvent(Dsp, w, ButtonPressMask, &ev) == False) { + report("Expected event (%s) not received.", eventname(ButtonPress)); + FAIL; + } else { + CHECK; + if(ev.xbutton.subwindow != w1) { + report("The subwindow component of the %s event was not set correctly.", eventname(ButtonPress)); + FAIL; + } else + CHECK; + + } + + CHECKPASS(2); + +>>ASSERTION Good B 1 +When a xname event is delivered +and the source window is not an inferior of the event window, +then +.M subwindow +is set to +.S None . +>>STRATEGY +If extended testing is required: + Create a window. + Select xname events on that window. + Simulate a xname event on the window. + Verify that a xname event was generated. + Verify that the subwindow component was None. + Create a window. + Grab the pointer with owner_events set to False. + Simulate a xname event on the window. + Verify that a xname event was generated on the grabbing window. + Verify that the subwindow component was None. +>>CODE +Window w; +Window w2; +XEvent ev; + + if (noext(1)) + return; + + w = defwin(Dsp); + + (void) warppointer(Dsp, w, 1,1); + XSelectInput(Dsp, w, ButtonPressMask); + + XSync(Dsp, True); + buttonpress(Dsp, Button1); + + if (XCheckWindowEvent(Dsp, w, ButtonPressMask, &ev) == False) { + report("Expected event (%s) not received.", eventname(ButtonPress)); + FAIL; + } else { + CHECK; + if(ev.xbutton.subwindow != None) { + report("The subwindow component of the %s event was not set correctly.", eventname(ButtonPress)); + FAIL; + } else + CHECK; + } + + w2 = defwin(Dsp); + + if( XGrabPointer(Dsp, w, False, ButtonPressMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime) != GrabSuccess) { + delete("XGrabPointer() did not return GrabSuccess."); + return; + } else + CHECK; + + (void) warppointer(Dsp, w2, 1,1); + XSync(Dsp, True); + buttonpress(Dsp, Button1); + + if (XCheckWindowEvent(Dsp, w, ButtonPressMask, &ev) == False) { + report("Expected event (%s) not received.", eventname(ButtonPress)); + FAIL; + } else { + CHECK; + if(ev.xbutton.subwindow != None) { + report("The subwindow component of the %s event was not set correctly.", eventname(ButtonPress)); + FAIL; + } else + CHECK; + } + + XUngrabPointer(Dsp, CurrentTime); + + CHECKPASS(5); + +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M time +>>#NOTEs is set to +>>#NOTEs the time in milliseconds at which the event was generated. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event window is on the same screen as the root window, +>>#NOTEs then +>>#NOTEs .M x +>>#NOTEs and +>>#NOTEs .M y +>>#NOTEs are set to +>>#NOTEs the coordinates of +>>#NOTEs the final pointer position relative to the event window's origin. +>>ASSERTION Good D 1 +If multiple screens are supported: +When a xname event is delivered +and the event and root windows are not on the same screen, +then +.M x +and +.M y +are set to +zero. +>>STRATEGY +If multiple screens are supported: + If extended testing is required: + Create a window. + Select xname events on that window. + Create a window on the alternate screen. + Grab the pointer with owner_events set to False. + Simulate a xname event on the window. + Verify that a xname event was generated on the grabbing window. + Verify that the x and y components are set to zero. +>>CODE +Window w; +Window w2; +XEvent ev; + +/* Report unsupported if multiple screens are not supported. */ + if (config.alt_screen == -1) { + unsupported("Multiple screens not supported."); + return; + } else + CHECK; + + if(noext(1)) + return; + + w = defwin(Dsp); + + (void) warppointer(Dsp, w, 1,1); + XSelectInput(Dsp, w, ButtonPressMask); + + w2 = defdraw(Dsp, VI_ALT_WIN); + + if( XGrabPointer(Dsp, w, False, ButtonPressMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime) != GrabSuccess) { + delete("XGrabPointer() did not return GrabSuccess."); + return; + } else + CHECK; + + (void) warppointer(Dsp, w2, 1,1); + XSync(Dsp, True); + buttonpress(Dsp, Button1); + + if (XCheckWindowEvent(Dsp, w, ButtonPressMask, &ev) == False) { + report("Expected event (%s) not received.", eventname(ButtonPress)); + FAIL; + } else { + CHECK; + if(ev.xbutton.x != 0 || ev.xbutton.y != 0) { + report("The x and y components of the %s event were not set correctly.", eventname(ButtonPress)); + FAIL; + } else + CHECK; + } + + XUngrabPointer(Dsp, CurrentTime); + + CHECKPASS(4); + +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M x_root +>>#NOTEs and +>>#NOTEs .M y_root +>>#NOTEs are set to coordinates of the pointer +>>#NOTEs when the event was generated +>>#NOTEs relative to the root window's origin. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M state +>>#NOTEs is set to +>>#NOTEs indicate the logical state +>>#NOTEs of the pointer buttons, +>>#NOTEs which is the bitwise OR of one or more of +>>#NOTEs the button or modifier key masks +>>#NOTEs .S Button1Mask , +>>#NOTEs .S Button2Mask , +>>#NOTEs .S Button3Mask , +>>#NOTEs .S Button4Mask , +>>#NOTEs .S Button5Mask , +>>#NOTEs .S ShiftMask , +>>#NOTEs .S LockMask , +>>#NOTEs .S ControlMask , +>>#NOTEs .S Mod1Mask , +>>#NOTEs .S Mod2Mask , +>>#NOTEs .S Mod3Mask , +>>#NOTEs .S Mod4Mask , +>>#NOTEs and +>>#NOTEs .S Mod5Mask . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M button +>>#NOTEs represents the pointer button which changed state +>>#NOTEs and is set to either +>>#NOTEs .S Button1 , +>>#NOTEs .S Button2 , +>>#NOTEs .S Button3 , +>>#NOTEs .S Button4 , +>>#NOTEs or +>>#NOTEs .S Button5 . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event and root windows are on the same screen, +>>#NOTEs then +>>#NOTEs .M same_screen +>>#NOTEs is set to +>>#NOTEs .S True . +>>ASSERTION Good D 1 +If multiple screens are supported: +When a xname event is delivered +and the event and root windows are not on the same screen, +then +.M same_screen +is set to +.S False . +>>STRATEGY +If multiple screens are supported: + If extended testing is required: + Create a window. + Select xname events on that window. + Create a window on the alternate screen. + Grab the pointer with owner_events set to False. + Simulate a xname event on the window. + Verify that a xname event was generated on the grabbing window. + Verify that the same_screen component is set to zero. +>>CODE +Window w; +Window w2; +XEvent ev; + + if (config.alt_screen == -1) { + unsupported("Multiple screens not supported."); + return; + } else + CHECK; + + if(noext(1)) + return; + + w = defwin(Dsp); + + (void) warppointer(Dsp, w, 1,1); + XSelectInput(Dsp, w, ButtonPressMask); + + w2 = defdraw(Dsp, VI_ALT_WIN); + + if( XGrabPointer(Dsp, w, False, ButtonPressMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime) != GrabSuccess) { + delete("XGrabPointer() did not return GrabSuccess."); + return; + } else + CHECK; + + (void) warppointer(Dsp, w2, 1,1); + XSync(Dsp, True); + buttonpress(Dsp, Button1); + + if (XCheckWindowEvent(Dsp, w, ButtonPressMask, &ev) == False) { + report("Expected event (%s) not received.", eventname(ButtonPress)); + FAIL; + } else { + CHECK; + if(ev.xbutton.same_screen != False ) { + report("The same_screen component of the %s event was not set correctly.", eventname(ButtonPress)); + FAIL; + } else + CHECK; + } + + XUngrabPointer(Dsp, CurrentTime); + + CHECKPASS(4); diff --git a/xts5/Xlib11/ButtonRelease/ButtonRelease.m b/xts5/Xlib11/ButtonRelease/ButtonRelease.m new file mode 100644 index 00000000..a139b8ea --- /dev/null +++ b/xts5/Xlib11/ButtonRelease/ButtonRelease.m @@ -0,0 +1,978 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/ButtonRelease/ButtonRelease.m,v 1.2 2005-11-03 08:42:20 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/ButtonRelease/ButtonRelease.m +>># +>># Description: +>># Tests for ButtonRelease() +>># +>># Modifications: +>># $Log: bttnrls.m,v $ +>># Revision 1.2 2005-11-03 08:42:20 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:16 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:06 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:50:34 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:22:49 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:21 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:00:58 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:57:16 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE ButtonRelease Xlib11 +>>EXTERN +#include <stdio.h> +#define EVENT ButtonRelease +#define EVENTMASK ButtonReleaseMask +#define PTRX 4 +#define PTRY 3 +>>SET end-function restoredevstate +>>ASSERTION Good B 1 +When any pointer button is released, +then a xname event is generated. +>>STRATEGY +If extended testing is required: + Create a window. + Select for xname events. + Simulate a xname event. + Verify that event was delivered. + Verify that event member fields are correctly set. +>>CODE +Display *display = Dsp; +Window w; +XEvent event_return; +XButtonReleasedEvent good; +PointerPlace *ptr; + + /* If extended testing is required: */ + if(noext(1)) + return; + + /* Create a window. */ + w = defwin(display); + + /* Select for xname events. */ + XSelectInput(display, w, EVENTMASK); + + /* Simulate a xname event. */ + ptr = warppointer(display, w, PTRX, PTRY); + buttonpress(display, Button1); + XSync(display, True); + buttonrel(display, Button1); + + /* Verify that event was delivered. */ + /* Verify that event member fields are correctly set. */ + if (!XCheckTypedWindowEvent(display, w, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } + else + CHECK; + + good = event_return.xbutton; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.window = w; + good.root = DRW(display); + good.subwindow = None; + good.x = PTRX; + good.y = PTRY; + good.x_root = ptr->nx; + good.y_root = ptr->ny; + good.state = Button1Mask; + good.button = Button1; + good.same_screen = True; + + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; + + + CHECKPASS(2); + +>>ASSERTION Good B 1 +>># +>>#COMMENT +>># Note that clients can have selected ButtonRelease events +>># and not get them since a buttonpress starts an implicit +>># pointer grab. We can avoid this by either: +>># (i) Not selecting on ButtonPressMask events on any client. +>># (ii) Not simulating a ButtonPress event. +>># (iii) Selecting after the button press has been simulated. +>># (iv) Explicitly performing an XUngrabPointer after the button press. +>># I choose (i). +>># +>># Cal 18/02/92. +>># +When a xname event is generated, +then +all clients having set +.S ButtonReleaseMask +event mask bits on the event window are delivered +a xname event. +>>STRATEGY +If extended testing is required: + Create a second client. + Create a third client. + Create a window. + Select for xname events on all the clients. + Simulate a xname event on the window. + Verify that a xname event was delivered to all clients. + Verify that the event member fields are correctly set. +Otherwise: + Create window. + Set ButtonReleaseMask event mask bits on window. + Verify that no error occurred. +>>CODE +Display *display = Dsp; +Display *client2; +Display *client3; +Window w; +XEvent event_return; +XButtonReleasedEvent good; +PointerPlace *ptr; + + + /* If extended testing is required: */ + if(config.extensions) { + + if(noext(1)) + return; + + /* Create a second client. */ + client2 = opendisplay(); + /* Create a third client. */ + client3 = opendisplay(); + + /* Create a window. */ + w = defwin(display); + + /* Select for xname events on all the clients. */ + XSelectInput(client2, w, EVENTMASK); + XSelectInput(client3, w, EVENTMASK); + XSelectInput(display, w, EVENTMASK); + + /* Simulate a xname event on the window. */ + ptr = warppointer(display, w, PTRX, PTRY); + buttonpress(display, Button1); + + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + + buttonrel(display, Button1); + + XSync(client2, False); + XSync(client3, False); + + good = event_return.xbutton; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.window = w; + good.root = DRW(display); + good.subwindow = None; + good.x = PTRX; + good.y = PTRY; + good.x_root = ptr->nx; + good.y_root = ptr->ny; + good.state = Button1Mask; + good.button = Button1; + good.same_screen = True; + + /* Verify that a xname event was delivered to all clients. */ + /* Verify that the event member fields are correctly set. */ + if (!XCheckTypedWindowEvent(display, w, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } else { + CHECK; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } + + if (!XCheckTypedWindowEvent(client2, w, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } else { + CHECK; + + good.display = client2; + + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } + + + if (!XCheckTypedWindowEvent(client3, w, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } else { + CHECK; + + good.display = client3; + + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } + + CHECKPASS(6); + + + } else { + + /* Otherwise: */ + /* Create window. */ + w = mkwin(display, (XVisualInfo *) NULL, (struct area *) NULL, False); + /* Set ButtonReleaseMask event mask bits on window. */ + XSelectInput(display, w, ButtonReleaseMask); + XSync(display, True); + /* Verify that no error occurred. */ + if (geterr() != Success) { + delete("Error setting up for test."); + return; + } + else + CHECK; + CHECKUNTESTED(1); + } + +>>ASSERTION Good B 1 +>>#NOTE True for most events (except MappingNotify and selection stuff). +When a xname event is generated, +then +clients not having set +.S ButtonReleaseMask +event mask bits on the event window are not delivered +a xname event. +>>STRATEGY +If extended testing is enabled: + Create window. + Select for ButtonReleaseEvents. + Create a second client. + Generate xname event. + Verify that a xname event was delivered to the selecting client. + Verify that no events were delivered to the other client. +>>CODE +Display *display = Dsp; +Display *client2; +XEvent ev; +Window w; +int count; + + if(noext(1)) + return; + + client2 = opendisplay(); + +/* Create window. */ + w = defwin(display); + + (void) warppointer(display, w, PTRX, PTRY); + + buttonpress(display, Button1); + + XSelectInput(display, w, ALLEVENTS & ~ButtonReleaseMask); + XSelectInput(client2, w, EVENTMASK); + +/* Generate xname event. */ + + XSync(display, True); + XSync(client2, True); + + buttonrel(display, Button1); + + XSync(client2, False); + +/* Verify a ButtonRelease was generated. */ + if(XCheckWindowEvent(client2, w, EVENTMASK, &ev) == False) { + report("No ButtonRelease event was generated."); + FAIL; + } else + CHECK; + +/* Verify no events were delivered. */ + count = XPending(display); + if (count != 0) { + report("Got %d unexpected events.", count); + FAIL; + } else + CHECK; + + CHECKPASS(2); + + +>>ASSERTION Good B 1 +When a xname event is generated +and no client has selected +.S ButtonReleaseMask +on the source window, +then the event propagates, +with propagation stopping at the root window of the screen or +at the first window with +.S ButtonReleaseMask +in its do-not-propagate mask, +from the source window to +the first ancestor window for which +some client has selected +for xname events. +>>STRATEGY +If extended testing is required: + Create a window. + Create a child of that window. + Create a child of the child. + Select xname events on the root window. + Simulate a xname event on the youngest child. + Verify that a xname event was generated on the root. + Select xname events on the oldest window. + Set the do_not_propagate mask of its child to xname events. + Simulate a xname event on the youngest child. + Verify that no created window received a xname event. + Clear the do_not_propagate mask on the oldest child. + Set the do_not_propagate mask on the oldest window. + Select for xname events on the oldest child. + Simulate a xname on the youngest child. + Verify that no xname event was sent to the oldest window. + Verify that no xname event was sent to the youngest window. + Verify that a xname event was sent to the oldest child. +>>CODE +XEvent ev; +Window w; +Window w1; +Window w2; +XSetWindowAttributes atts; + + if(noext(1)) + return; + + w = defwin(Dsp); + w1 = crechild(Dsp, w, (struct area *) NULL); + w2 = crechild(Dsp, w1, (struct area *) NULL); + XSelectInput(Dsp, DRW(Dsp), EVENTMASK); + (void) warppointer(Dsp, w2, 1,1); + + buttonpress(Dsp, Button1); + XSync(Dsp, True); + buttonrel(Dsp, Button1); + + if (XCheckWindowEvent(Dsp, DRW(Dsp), EVENTMASK, &ev) == False) { + report("Expected event (%s) not received.", eventname(EVENT)); + FAIL; + } else + CHECK; + + XSelectInput(Dsp, DRW(Dsp), NoEventMask); + XSelectInput(Dsp, w, EVENTMASK); + + atts.do_not_propagate_mask = EVENTMASK; + XChangeWindowAttributes(Dsp, w1, CWDontPropagate, &atts); + + buttonpress(Dsp, Button1); + XSync(Dsp, True); + buttonrel(Dsp, Button1); + + if (XCheckWindowEvent(Dsp, w2, EVENTMASK, &ev) != False) { + report("Unexpected event (%s) received.", eventname(EVENT)); + FAIL; + } else + CHECK; + + if (XCheckWindowEvent(Dsp, w1, EVENTMASK, &ev) != False) { + report("Unexpected event (%s) received.", eventname(EVENT)); + FAIL; + } else + CHECK; + + if (XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) != False) { + report("Unexpected event (%s) received.", eventname(EVENT)); + FAIL; + } else + CHECK; + + XSelectInput(Dsp, w1, EVENTMASK); + XChangeWindowAttributes(Dsp, w, CWDontPropagate, &atts); + + atts.do_not_propagate_mask = NoEventMask; + XChangeWindowAttributes(Dsp, w1, CWDontPropagate, &atts); + + buttonpress(Dsp, Button1); + XSync(Dsp, True); + buttonrel(Dsp, Button1); + + if (XCheckWindowEvent(Dsp, w2, EVENTMASK, &ev) != False) { + report("Unexpected event (%s) received.", eventname(EVENT)); + FAIL; + } else + CHECK; + + if (XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) != False) { + report("Unexpected event (%s) received.", eventname(EVENT)); + FAIL; + } else + CHECK; + + if (XCheckWindowEvent(Dsp, w1, EVENTMASK, &ev) == False) { + report("ButtonRelease event was not delivered to selecting child window."); + FAIL; + } else + CHECK; + + CHECKPASS(7); + +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE Global except for MappingNotify and KeymapNotify. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M window +>>#NOTEs is set to +>>#NOTEs the +>>#NOTEs ifdef(`WINDOWTYPE', WINDOWTYPE, event) +>>#NOTEs window. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M root +>>#NOTEs is set to the source window's root window. +>>ASSERTION Good B 1 +>># +>>#COMMENT +>># This assertion contains a tautology; a child is an inferior. +>># - Cal 12/2/92. +>># +When a xname event is delivered +and the source window is an inferior of the event window +and the source window is a child of the event window, +then +.M subwindow +is set to +the source window. +>>STRATEGY +If extended testing is required: + Create a window. + Select xname events on that window. + Create a child of that window. + Simulate a xname event on the child. + Verify that a xname event was delivered to the parent. + Verify that the subwindow component was the child of the event window. +>>CODE +XEvent ev; +Window w; +Window w1; + + /* If extended testing is required: */ + if(noext(1)) + return; + + /* Create a window. */ + w = defwin(Dsp); + /* Create a child of the window. */ + w1 = crechild(Dsp, w, (struct area *) NULL); + /* Select xname events on the child. */ + XSelectInput(Dsp, w, EVENTMASK); + (void) warppointer(Dsp, w1, 1,1); + + /* Simulate a xname event on the child. */ + buttonpress(Dsp, Button1); + XSync(Dsp, True); + buttonrel(Dsp, Button1); + + /* Verify that a xname event was generated on the parent. */ + if (XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) == False) { + report("Expected event (%s) not received.", eventname(EVENT)); + FAIL; + } else { + CHECK; + + /* Verify that the subwindow component was set to the child. */ + if(ev.xbutton.subwindow != w1) { + report("The subwindow component of the %s event was not set correctly.", eventname(EVENT)); + FAIL; + } else + CHECK; + } + + CHECKPASS(2); + + +>>ASSERTION Good B 1 +When a xname event is delivered +and the source window is an inferior of the event window +and the source window is not a child of the event window, +then +.M subwindow +is set to +the child of the event window that is +an ancestor of the source window. +>>STRATEGY +If extended testing is required: + Create a window. + Select xname events on that window. + Create a child of that window. + Create a child of the child. + Simulate a xname event on the youngest child. + Verify that a xname event was generated on the oldest parent. + Verify that the subwindow component was the child of the event window. +>>CODE +Window w; +Window w1; +Window w2; +XEvent ev; +struct area area; + + if (noext(1)) + return; + + w = defwin(Dsp); + setarea(&area, 10, 10, 30, 30); + w1 = crechild(Dsp, w, &area); + w2 = crechild(Dsp, w1, &area); + (void) warppointer(Dsp, w2, 1,1); + XSelectInput(Dsp, w, EVENTMASK); + + buttonpress(Dsp, Button1); + XSync(Dsp, True); + buttonrel(Dsp, Button1); + + if (XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) == False) { + report("Expected event (%s) not received.", eventname(EVENT)); + FAIL; + } else { + CHECK; + if(ev.xbutton.subwindow != w1) { + report("The subwindow component of the %s event was not set correctly.", eventname(EVENT)); + FAIL; + } else + CHECK; + } + + CHECKPASS(2); + + + +>>ASSERTION Good B 1 +When a xname event is delivered +and the source window is not an inferior of the event window, +then +.M subwindow +is set to +.S None . +>>STRATEGY +If extended testing is required: + Create a window. + Select xname events on that window. + Simulate a xname event on the window. + Verify that a xname event was generated. + Verify that the subwindow component was None. + Create a window. + Grab the pointer with owner_events set to False. + Simulate a xname event on the window. + Verify that a xname event was generated on the grabbing window. + Verify that the subwindow component was None. +>>CODE +Window w; +Window w2; +XEvent ev; + + if (noext(1)) + return; + + w = defwin(Dsp); + + (void) warppointer(Dsp, w, 1,1); + XSelectInput(Dsp, w, EVENTMASK); + + buttonpress(Dsp, Button1); + XSync(Dsp, True); + buttonrel(Dsp, Button1); + + if (XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) == False) { + report("Expected event (%s) not received.", eventname(EVENT)); + FAIL; + } else { + CHECK; + if(ev.xbutton.subwindow != None) { + report("The subwindow component of the %s event was not set correctly.", eventname(EVENT)); + FAIL; + } else + CHECK; + } + + w2 = defwin(Dsp); + + if( XGrabPointer(Dsp, w, False, EVENTMASK, GrabModeAsync, GrabModeAsync, None, None, CurrentTime) != GrabSuccess) { + delete("XGrabPointer() did not return GrabSuccess."); + return; + } else + CHECK; + + (void) warppointer(Dsp, w2, 1,1); + buttonpress(Dsp, Button1); + XSync(Dsp, True); + buttonrel(Dsp, Button1); + + if (XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) == False) { + report("Expected event (%s) not received.", eventname(EVENT)); + FAIL; + } else { + CHECK; + if(ev.xbutton.subwindow != None) { + report("The subwindow component of the %s event was not set correctly.", eventname(EVENT)); + FAIL; + } else + CHECK; + } + + XUngrabPointer(Dsp, CurrentTime); + + CHECKPASS(5); + +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M time +>>#NOTEs is set to +>>#NOTEs the time in milliseconds at which the event was generated. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event window is on the same screen as the root window, +>>#NOTEs then +>>#NOTEs .M x +>>#NOTEs and +>>#NOTEs .M y +>>#NOTEs are set to +>>#NOTEs the coordinates of +>>#NOTEs the final pointer position relative to the event window's origin. +>>ASSERTION Good D 1 +If multiple screens are supported: +When a xname event is delivered +and the event and root windows are not on the same screen, +then +.M x +and +.M y +are set to +zero. +>>STRATEGY +If multiple screens are supported: + If extended testing is required: + Create a window. + Select for xname events. + Create a window on the alternate screen. + Grab the pointer for the first window with owner_events set to False. + Simulate a xname event on the alternate window. + Verify that a xname event was generated with respect to the grabbing window. + Verify that the x and y components were set to zero. +>>CODE +Window w; +Window w2; +XEvent ev; + + /* If multiple screens are supported: */ + if (config.alt_screen == -1) { + unsupported("Multiple screens not supported."); + return; + } else + CHECK; + + /* If extended testing is required: */ + if(noext(1)) + return; + + /* Create a window. */ + w = defwin(Dsp); + + (void) warppointer(Dsp, w, 1,1); + /* Select for xname events. */ + XSelectInput(Dsp, w, EVENTMASK); + + /* Create a window on the alternate screen. */ + w2 = defdraw(Dsp, VI_ALT_WIN); + + /* Grab the pointer for the first window with owner_events set to False. */ + if( XGrabPointer(Dsp, w, False, EVENTMASK, GrabModeAsync, GrabModeAsync, None, None, CurrentTime) != GrabSuccess) { + delete("XGrabPointer() did not return GrabSuccess."); + return; + } else + CHECK; + + /* Simulate a xname event on the alternate window. */ + (void) warppointer(Dsp, w2, 1,1); + buttonpress(Dsp, Button1); + XSync(Dsp, True); + buttonrel(Dsp, Button1); + + /* Verify that a xname event was generated with respect to the grabbing window. */ + if (XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) == False) { + report("Expected event (%s) not received.", eventname(EVENT)); + FAIL; + } else { + CHECK; + /* Verify that the x and y components were set to zero. */ + if(ev.xbutton.x != 0 || ev.xbutton.y != 0) { + report("The x and y components of the %s event were not set correctly.", eventname(EVENT)); + FAIL; + } else + CHECK; + } + + XUngrabPointer(Dsp, CurrentTime); + + CHECKPASS(4); + +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M x_root +>>#NOTEs and +>>#NOTEs .M y_root +>>#NOTEs are set to coordinates of the pointer +>>#NOTEs when the event was generated +>>#NOTEs relative to the root window's origin. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M state +>>#NOTEs is set to +>>#NOTEs indicate the logical state +>>#NOTEs of the pointer buttons, +>>#NOTEs which is the bitwise OR of one or more of +>>#NOTEs the button or modifier key masks +>>#NOTEs .S Button1Mask , +>>#NOTEs .S Button2Mask , +>>#NOTEs .S Button3Mask , +>>#NOTEs .S Button4Mask , +>>#NOTEs .S Button5Mask , +>>#NOTEs .S ShiftMask , +>>#NOTEs .S LockMask , +>>#NOTEs .S ControlMask , +>>#NOTEs .S Mod1Mask , +>>#NOTEs .S Mod2Mask , +>>#NOTEs .S Mod3Mask , +>>#NOTEs .S Mod4Mask , +>>#NOTEs and +>>#NOTEs .S Mod5Mask . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M button +>>#NOTEs represents the pointer button which changed state +>>#NOTEs and is set to either +>>#NOTEs .S Button1 , +>>#NOTEs .S Button2 , +>>#NOTEs .S Button3 , +>>#NOTEs .S Button4 , +>>#NOTEs or +>>#NOTEs .S Button5 . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event and root windows are on the same screen, +>>#NOTEs then +>>#NOTEs .M same_screen +>>#NOTEs is set to +>>#NOTEs .S True . +>>ASSERTION Good D 1 +If multiple screens are supported: +When a xname event is delivered +and the event and root windows are not on the same screen, +then +.M same_screen +is set to +.S False . +>>STRATEGY +If multiple screens are supported: + If extended testing is required: + Create a window on the default screen. + Select xname events on the window. + Create a window on the alternative screen. + Grab the keyboard for the first window. + Simulate a xname event on the alternate window. + Verify that a xname event was generated on the grabbing window. + Verify that the same_screen component was False. +>>CODE +Window w; +Window w2; +XEvent ev; + + + /* If multiple screens are supported: */ + if (config.alt_screen == -1) { + unsupported("Multiple screens not supported."); + return; + } else + CHECK; + + /* If extended testing is required: */ + if(noext(1)) + return; + + /* Create a window on the default screen. */ + w = defwin(Dsp); + + (void) warppointer(Dsp, w, 1,1); + /* Select xname events on the window. */ + XSelectInput(Dsp, w, EVENTMASK); + + /* Create a window on the alternative screen. */ + w2 = defdraw(Dsp, VI_ALT_WIN); + + /* Grab the keyboard for the first window. */ + if( XGrabPointer(Dsp, w, False, EVENTMASK, GrabModeAsync, GrabModeAsync, None, None, CurrentTime) != GrabSuccess) { + delete("XGrabPointer() did not return GrabSuccess."); + return; + } else + CHECK; + + /* Simulate a xname event on the alternate window. */ + (void) warppointer(Dsp, w2, 1,1); + buttonpress(Dsp, Button1); + XSync(Dsp, True); + buttonrel(Dsp, Button1); + + /* Verify that a xname event was generated on the grabbing window. */ + if (XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) == False) { + report("Expected event (%s) not received.", eventname(EVENT)); + FAIL; + } else { + CHECK; + /* Verify that the same_screen component was False. */ + if(ev.xbutton.same_screen != False ) { + report("The same_screen component of the %s event was not set correctly.", eventname(EVENT)); + FAIL; + } else + CHECK; + } + + XUngrabPointer(Dsp, CurrentTime); + + CHECKPASS(4); diff --git a/xts5/Xlib11/CirculateNotify/CirculateNotify.m b/xts5/Xlib11/CirculateNotify/CirculateNotify.m new file mode 100644 index 00000000..37389056 --- /dev/null +++ b/xts5/Xlib11/CirculateNotify/CirculateNotify.m @@ -0,0 +1,591 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/CirculateNotify/CirculateNotify.m,v 1.2 2005-11-03 08:42:21 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/CirculateNotify/CirculateNotify.m +>># +>># Description: +>># Tests for CirculateNotify() +>># +>># Modifications: +>># $Log: crcltntfy.m,v $ +>># Revision 1.2 2005-11-03 08:42:21 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:16 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:09 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:50:39 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:22:51 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:24 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:01:08 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:57:37 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE CirculateNotify Xlib11 +>>EXTERN +#define EVENT CirculateNotify +#define MASK StructureNotifyMask +#define MASKP SubstructureNotifyMask +>>ASSERTION Good A +When a xname event is generated, +then all clients having set +.S StructureNotifyMask +event mask bits on the restacked window are delivered +a xname event. +>>STRATEGY +Create clients client2 and client3. +Build and create window hierarchy. +Select for CirculateNotify events using StructureNotifyMask. +Select for CirculateNotify events using StructureNotifyMask with client2. +Select for no events with client3. +Circulate lowest window to top. +Verify that a CirculateNotify event is delivered. +Verify that a CirculateNotify event is delivered to client2. +Verify that no events are delivered to client3. +Verify that, in the delivered event corresponding to the restacked +window which is now on top of all siblings, place is set to PlaceOnTop. +Circulate top window to bottom. +Verify that CirculateNotify events are delivered. +Verify that CirculateNotify events are delivered to client2. +Verify that no events are delivered to client3. +Verify that, in the delivered event corresponding to the restacked +window which is now on below all siblings, place is set to PlaceOnBottom. +>>CODE +Display *display = Dsp; +Display *client2; +Display *client3; +Winh *parent, *eventw, *winh; +Winhg winhg; +int i; +int status; +int numchildren = 4; +XEvent event; + +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; +/* Build and create window hierarchy. */ + /* can't use winh() because the windows need to overlap */ + winhg.border_width = 1; + winhg.area.x = 1; + winhg.area.y = 1; + winhg.area.width = 100; + winhg.area.height = 100; + parent = winh_adopt(display, (Winh *) NULL, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (parent == (Winh *) NULL) { + report("Could not create parent"); + return; + } + else + CHECK; + winhg.area.x = 1; + winhg.area.y = 1; + winhg.area.width = 30; + winhg.area.height = 30; + for (i=0; i<numchildren; i++) { + if (!i) + CHECK; + winh = winh_adopt(display, parent, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (winh == (Winh *) NULL) { + report("Could not create child %d", i); + return; + } + winhg.area.x += 10; + winhg.area.y += 10; + } + if (winh_create(display, (Winh *) NULL, WINH_MAP)) + return; + else + CHECK; +/* Select for CirculateNotify events using StructureNotifyMask. */ + if (winh_selectinput(display, (Winh *) NULL, MASK)) { + report("Selection with first client failed."); + return; + } + else + CHECK; +/* Select for CirculateNotify events using StructureNotifyMask with client2. */ + if (winh_selectinput(client2, (Winh *) NULL, MASK)) { + report("Selection with client2 failed."); + return; + } + else + CHECK; +/* Select for no events with client3. */ + if (winh_selectinput(client3, (Winh *) NULL, NoEventMask)) { + report("Selection with client3 failed."); + return; + } + else + CHECK; +/* Circulate lowest window to top. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XCirculateSubwindows(display, parent->window, RaiseLowest); + eventw = parent->firstchild; + event.xany.type = EVENT; + event.xany.window = eventw->window; + if (winh_plant(eventw, &event, MASK, WINH_NOMASK)) { + report("Could not plant events for eventw"); + return; + } + else + CHECK; + XSync(display, False); + XSync(client2, False); + XSync(client3, False); +/* Verify that a CirculateNotify event is delivered. */ +/* Verify that a CirculateNotify event is delivered to client2. */ +/* Verify that no events are delivered to client3. */ + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events for display"); + return; + } + else + CHECK; + if (winh_harvest(client2, (Winh *) NULL)) { + report("Could not harvest events for client2"); + return; + } + else + CHECK; + if (winh_harvest(client3, (Winh *) NULL)) { + report("Could not harvest events for client3"); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status == -1) + return; + else if (status) { + report("Event delivery not as expected"); + FAIL; + } + else { + XCirculateEvent *e; + +/* Verify that, in the delivered event corresponding to the restacked */ +/* window which is now on top of all siblings, place is set to PlaceOnTop. */ + e = &(winh_qdel->event->xcirculate); + if (e->place != PlaceOnTop) { + report("Got %d value for place, expected PlaceOnTop (%d)", + e->place, PlaceOnTop); + FAIL; + } + else + CHECK; + } +/* Circulate top window to bottom. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XCirculateSubwindows(display, parent->window, LowerHighest); + if (winh_plant(eventw, &event, MASK, WINH_NOMASK)) { + report("Could not plant events for eventw"); + return; + } + else + CHECK; + XSync(display, False); + XSync(client2, False); + XSync(client3, False); +/* Verify that CirculateNotify events are delivered. */ +/* Verify that CirculateNotify events are delivered to client2. */ +/* Verify that no events are delivered to client3. */ + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events for display"); + return; + } + else + CHECK; + if (winh_harvest(client2, (Winh *) NULL)) { + report("Could not harvest events for client2"); + return; + } + else + CHECK; + if (winh_harvest(client3, (Winh *) NULL)) { + report("Could not harvest events for client3"); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status == -1) + return; + else if (status) { + report("Event delivery not as expected"); + FAIL; + } + else { + XCirculateEvent *e; + +/* Verify that, in the delivered event corresponding to the restacked */ +/* window which is now on below all siblings, place is set to PlaceOnBottom. */ + e = &(winh_qdel->event->xcirculate); + if (e->place != PlaceOnBottom) { + report("Got %d value for place, expected PlaceOnBottom (%d)", + e->place, PlaceOnBottom); + FAIL; + } + else + CHECK; + } + + CHECKPASS(18); +>>ASSERTION Good A +When a xname event is generated, +then all clients having set +.S SubstructureNotifyMask +event mask bits on the parent of the restacked window are delivered +a xname event. +>>STRATEGY +Create clients client2 and client3. +Build and create window hierarchy. +Select for CirculateNotify events using SubstructureNotifyMask. +Select for CirculateNotify events using SubstructureNotifyMask with client2. +Select for no events with client3. +Circulate lowest window to top. +Verify that a CirculateNotify event is delivered. +Verify that a CirculateNotify event is delivered to client2. +Verify that no events are delivered to client3. +Verify that, in the delivered event corresponding to the restacked +window which is now on top of all siblings, place is set to PlaceOnTop. +Verify that window member is set to restacked window. +>>CODE +Display *display = Dsp; +Display *client2; +Display *client3; +Winh *parent, *eventw, *winh; +Winhg winhg; +int i; +int status; +int numchildren = 4; +XEvent event; + +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; +/* Build and create window hierarchy. */ + /* can't use winh() because the windows need to overlap */ + winhg.border_width = 1; + winhg.area.x = 1; + winhg.area.y = 1; + winhg.area.width = 100; + winhg.area.height = 100; + parent = winh_adopt(display, (Winh *) NULL, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (parent == (Winh *) NULL) { + report("Could not create parent"); + return; + } + else + CHECK; + winhg.area.x = 1; + winhg.area.y = 1; + winhg.area.width = 30; + winhg.area.height = 30; + for (i=0; i<numchildren; i++) { + if (!i) + CHECK; + winh = winh_adopt(display, parent, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (winh == (Winh *) NULL) { + report("Could not create child %d", i); + return; + } + winhg.area.x += 10; + winhg.area.y += 10; + } + if (winh_create(display, (Winh *) NULL, WINH_MAP)) + return; + else + CHECK; +/* Select for CirculateNotify events using SubstructureNotifyMask. */ + if (winh_selectinput(display, (Winh *) NULL, MASKP)) { + report("Selection with first client failed."); + return; + } + else + CHECK; +/* Select for CirculateNotify events using SubstructureNotifyMask with client2. */ + if (winh_selectinput(client2, (Winh *) NULL, MASKP)) { + report("Selection with client2 failed."); + return; + } + else + CHECK; +/* Select for no events with client3. */ + if (winh_selectinput(client3, (Winh *) NULL, NoEventMask)) { + report("Selection with client3 failed."); + return; + } + else + CHECK; +/* Circulate lowest window to top. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XCirculateSubwindows(display, parent->window, RaiseLowest); + eventw = parent->firstchild; + event.xany.type = EVENT; + event.xany.window = parent->window; + if (winh_plant(parent, &event, MASKP, WINH_NOMASK)) { + report("Could not plant events for eventw"); + return; + } + else + CHECK; + XSync(display, False); + XSync(client2, False); + XSync(client3, False); +/* Verify that a CirculateNotify event is delivered. */ +/* Verify that a CirculateNotify event is delivered to client2. */ +/* Verify that no events are delivered to client3. */ + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events for display"); + return; + } + else + CHECK; + if (winh_harvest(client2, (Winh *) NULL)) { + report("Could not harvest events for client2"); + return; + } + else + CHECK; + if (winh_harvest(client3, (Winh *) NULL)) { + report("Could not harvest events for client3"); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status == -1) + return; + else if (status) { + report("Event delivery not as expected"); + FAIL; + } + else { + XCirculateEvent *e; + +/* Verify that, in the delivered event corresponding to the restacked */ +/* window which is now on top of all siblings, place is set to PlaceOnTop. */ + e = &(winh_qdel->event->xcirculate); + if (e->place != PlaceOnTop) { + report("Got %d value for place, expected PlaceOnTop (%d)", + e->place, PlaceOnTop); + FAIL; + } + else + CHECK; +/* Verify that window member is set to restacked window. */ + if (e->window != eventw->window) { + report("Got 0x%x value for window, expected 0x%x", + e->window, eventw->window); + FAIL; + } + else + CHECK; + } + + CHECKPASS(14); +>>ASSERTION def +>>#NOTE Tested for in two previous assertions. +When a xname event is generated, +then +clients not having set +.S StructureNotifyMask +event mask bits on the +restacked window +and also not having set +.S SubstructureNotifyMask +event mask bits on the +parent of the restacked window +are not delivered +a xname event. +>>#NOTEm >>ASSERTION +>>#NOTEm When a window is restacked as a result of a call to +>>#NOTEm .F XCirculateSubwindows , +>>#NOTEm .F XCirculateSubwindowsUp , +>>#NOTEm or +>>#NOTEm .F XCirculateSubwindowsDown , +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and +>>#NOTEs .S StructureNotify +>>#NOTEs was selected, +>>#NOTEs then +>>#NOTEs .M event +>>#NOTEs is set to +>>#NOTEs the WINDOWTYPE window. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and +>>#NOTEs .S SubstructureNotify +>>#NOTEs was selected, +>>#NOTEs then +>>#NOTEs .M event +>>#NOTEs is set to +>>#NOTEs the WINDOWTYPE window's parent. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE Global except for MappingNotify and KeymapNotify. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M window +>>#NOTEs is set to +>>#NOTEs the +>>#NOTEs ifdef(`WINDOWTYPE', WINDOWTYPE, event) +>>#NOTEs window. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the restacked window is now on top of all siblings, +>>#NOTEs then +>>#NOTEs .M place +>>#NOTEs is set to +>>#NOTEs .S PlaceOnTop . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the restacked window is now below all siblings, +>>#NOTEs then +>>#NOTEs .M place +>>#NOTEs is set to +>>#NOTEs .S PlaceOnBottom . diff --git a/xts5/Xlib11/CirculateRequest/CirculateRequest.m b/xts5/Xlib11/CirculateRequest/CirculateRequest.m new file mode 100644 index 00000000..d780f842 --- /dev/null +++ b/xts5/Xlib11/CirculateRequest/CirculateRequest.m @@ -0,0 +1,449 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/CirculateRequest/CirculateRequest.m,v 1.2 2005-11-03 08:42:21 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/CirculateRequest/CirculateRequest.m +>># +>># Description: +>># Tests for CirculateRequest() +>># +>># Modifications: +>># $Log: crcltrqst.m,v $ +>># Revision 1.2 2005-11-03 08:42:21 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:16 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:10 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:50:40 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:22:52 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:24 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:01:10 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:57:42 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE CirculateRequest Xlib11 +>>EXTERN +#define EVENT CirculateRequest +#define MASK SubstructureRedirectMask +>>ASSERTION Good A +When a xname event is generated, +then +all clients having set +.S SubstructureRedirectMask +event mask bits on the parent of the window +for which the circulate request was issued are delivered +a xname event. +>>STRATEGY +Create clients client2 and client3. +Build and create window hierarchy. +Create inferiors with override-redirect set to True. +Change one inferior's override-redirect attribute to False. +Select for CirculateRequest events using SubstructureRedirectMask. +Select for no events with client3. +Circulate lowest window to top. +Initialize for expected events. +Verify that a CirculateRequest event is delivered. +Verify that no events are delivered to client3. +Verify members of event structure. +Verify that no events were delivered to client3. +Circulate highest window (override-redirect set to False) to bottom. +Initialize for expected events. +Verify that a CirculateRequest event is delivered. +Verify that no events are delivered to client3. +Verify members of event structure. +Verify that no events were delivered to client3. +>>CODE +Display *display = Dsp; +Display *client2, *client3; +Winh *parent, *lastw, *winh; +Winhg winhg; +XEvent event; +int i; +int status; +int numchildren = 4; +int count; +XSetWindowAttributes attrs; +unsigned long valuemask; + +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; +/* Build and create window hierarchy. */ + /* can't use winh() because the windows need to overlap */ + winhg.border_width = 1; + winhg.area.x = 1; + winhg.area.y = 1; + winhg.area.width = 100; + winhg.area.height = 100; + parent = winh_adopt(display, (Winh *) NULL, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (parent == (Winh *) NULL) { + report("Could not create parent"); + return; + } + else + CHECK; + winhg.area.x = 1; + winhg.area.y = 1; + winhg.area.width = 30; + winhg.area.height = 30; +/* Create inferiors with override-redirect set to True. */ + attrs.override_redirect = True; + attrs.border_pixel = W_FG; + attrs.background_pixel = W_BG; + valuemask = CWOverrideRedirect | CWBorderPixel | CWBackPixel; + for (i=0; i<numchildren; i++) { + if (!i) + CHECK; + lastw = winh_adopt(display, parent, valuemask, &attrs, &winhg, WINH_NOMASK); + if (lastw == (Winh *) NULL) { + report("Could not create child %d", i); + return; + } + winhg.area.x += 10; + winhg.area.y += 10; + } + if (winh_create(display, (Winh *) NULL, WINH_MAP)) + return; + else + CHECK; +/* Change one inferior's override-redirect attribute to False. */ + attrs.override_redirect = False; + valuemask = CWOverrideRedirect; + if (winh_changewindowattributes(display, lastw, valuemask, &attrs)) { + report("Failed to change attribute for subwindow"); + return; + } +/* Select for CirculateRequest events using SubstructureRedirectMask. */ + /* + * Selection with a single client because only one can select + * for this event at a time. + */ + if (winh_selectinput(display, parent, MASK)) { + report("Selection failed."); + return; + } + else + CHECK; +/* Select for no events with client3. */ + if (winh_selectinput(client3, (Winh *) NULL, NoEventMask)) { + report("Selection with client3 failed."); + return; + } + else + CHECK; +/* Circulate lowest window to top. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XCirculateSubwindows(client2, parent->window, RaiseLowest); + XSync(client2, False); + XSync(display, False); + XSync(client3, False); +/* Initialize for expected events. */ + event.xany.type = EVENT; + event.xany.window = parent->window; + if (winh_plant(parent, &event, MASK, WINH_NOMASK)) { + report("Could not plant events for parent"); + return; + } + else + CHECK; +/* Verify that a CirculateRequest event is delivered. */ +/* Verify that no events are delivered to client3. */ + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; + if (winh_harvest(client3, (Winh *) NULL)) { + report("Could not harvest events for client3"); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status == -1) + return; + else if (status) { + report("Event delivery not as expected"); + FAIL; + } + else { + XEvent *event_return; + XCirculateRequestEvent good; + +/* Verify members of event structure. */ + event_return = winh_qdel->event; + good = event_return->xcirculaterequest; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.parent = parent->window; + good.window = parent->firstchild->window; + good.place = PlaceOnTop; + if (checkevent((XEvent *) &good, event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; + } +/* Verify that no events were delivered to client3. */ + count = XPending(client3); + if (count != 0) { + report("Got %d events, expected %d for client3", count, 0); + FAIL; + } + else + CHECK; +/* Circulate highest window (override-redirect set to False) to bottom. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XCirculateSubwindows(client2, parent->window, LowerHighest); + XSync(client2, False); + XSync(display, False); + XSync(client3, False); +/* Initialize for expected events. */ + event.xany.type = EVENT; + event.xany.window = parent->window; + if (winh_plant(parent, &event, MASK, WINH_NOMASK)) { + report("Could not plant events for parent"); + return; + } + else + CHECK; +/* Verify that a CirculateRequest event is delivered. */ +/* Verify that no events are delivered to client3. */ + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; + if (winh_harvest(client3, (Winh *) NULL)) { + report("Could not harvest events for client3"); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status == -1) + return; + else if (status) { + report("Event delivery not as expected"); + FAIL; + } + else { + XEvent *event_return; + XCirculateRequestEvent good; + +/* Verify members of event structure. */ + event_return = winh_qdel->event; + good = event_return->xcirculaterequest; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.parent = parent->window; + good.window = lastw->window; + good.place = PlaceOnBottom; + if (checkevent((XEvent *) &good, event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; + } +/* Verify that no events were delivered to client3. */ + count = XPending(client3); + if (count != 0) { + report("Got %d events, expected %d for client3", count, 0); + FAIL; + return; + } + else + CHECK; + + CHECKPASS(17); +>>ASSERTION def +>>#NOTE Tested for in previous test. +When a xname event is generated, +then +clients not having set +.S SubstructureRedirectMask +event mask bits on the event window are not delivered +a xname event. +>>#NOTEm >>ASSERTION +>>#NOTEm When a client calls +>>#NOTEm .F XCirculateSubwindows , +>>#NOTEm .F XCirculateSubwindowsUp , +>>#NOTEm or +>>#NOTEm .F XCirculateSubwindowsDown +>>#NOTEm and a subwindow actually needs to be restacked, +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is generated +>>#NOTEm and a client has selected xname events on the child's parent +>>#NOTEm and the override-redirect attribute of the child window is set to +>>#NOTEm .S False , +>>#NOTEm then +>>#NOTEm .M window +>>#NOTEm is not WINDOWTYPE. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M parent +>>#NOTEs is set to +>>#NOTEs the parent window of +>>#NOTEs .M window . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M window +>>#NOTEs is set to +>>#NOTEs the child window to be WINDOWTYPE. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the new position of +>>#NOTEs .M window +>>#NOTEs should be on top of all siblings, +>>#NOTEs then +>>#NOTEs .M place +>>#NOTEs is set to +>>#NOTEs .S PlaceOnTop . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the new position of +>>#NOTEs .M window +>>#NOTEs should be below all siblings, +>>#NOTEs then +>>#NOTEs .M place +>>#NOTEs is set to +>>#NOTEs .S PlaceOnBottom . diff --git a/xts5/Xlib11/ClientMessage/ClientMessage.m b/xts5/Xlib11/ClientMessage/ClientMessage.m new file mode 100644 index 00000000..515f65e3 --- /dev/null +++ b/xts5/Xlib11/ClientMessage/ClientMessage.m @@ -0,0 +1,188 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/ClientMessage/ClientMessage.m,v 1.2 2005-11-03 08:42:20 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/ClientMessage/ClientMessage.m +>># +>># Description: +>># Tests for ClientMessage() +>># +>># Modifications: +>># $Log: clntmssg.m,v $ +>># Revision 1.2 2005-11-03 08:42:20 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:16 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:07 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:50:35 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:22:49 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:22 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:01:00 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:57:20 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE ClientMessage Xlib11 +>>ASSERTION Good A +There are no assertions in sections 8.1-8.4 for xname events. +Delivery of xname events is covered by the first test for +.F XSendEvent . +>>STRATEGY +Put out a message explaining that there are no specific assertions for +xname events in sections 8.1-8.4, and that delivery of xname events is +covered by the first test for XSendEvent. +>>CODE + + report("There are no specific assertions for %s events in sections 8.1-8.4.", TestName); + report("Delivery of %s events is covered by the first test for XSendEvent.", TestName); + tet_result(TET_NOTINUSE); + +>>#NOTEm >>ASSERTION +>>#NOTEm When the +>>#NOTEm .M format +>>#NOTEm field of ARTICLE xname event is not one of 8, 16, or 32, +>>#NOTEm then a +>>#NOTEm .S BadValue +>>#NOTEm error occurs. +>>#NOTEd >>ASSERTION +>>#NOTEd >>#NOTE +>>#NOTEd >>#NOTE Untestable? +>>#NOTEd >>#NOTE +>>#NOTEd The server generates xname events only when a client calls +>>#NOTEd .F XSendEvent . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEm >>ASSERTION +>>#NOTEm >>#NOTE +>>#NOTEm >>#NOTE Looks like a pretty easy test (sizeof(...)). +>>#NOTEm >>#NOTE +>>#NOTEm The size of the +>>#NOTEm .M b +>>#NOTEm member of the +>>#NOTEm .M data +>>#NOTEm union is 20 bytes. +>>#NOTEm >>ASSERTION +>>#NOTEm >>#NOTE +>>#NOTEm >>#NOTE Looks like a pretty easy test (sizeof(...)). +>>#NOTEm >>#NOTE +>>#NOTEm The size of the +>>#NOTEm .M s +>>#NOTEm member of the +>>#NOTEm .M data +>>#NOTEm union is 20 bytes. +>>#NOTEm >>ASSERTION +>>#NOTEm >>#NOTE +>>#NOTEm >>#NOTE Looks like a pretty easy test (sizeof(...)). +>>#NOTEm >>#NOTE +>>#NOTEm The size of the +>>#NOTEm .M l +>>#NOTEm member of the +>>#NOTEm .M data +>>#NOTEm union is 20 bytes. diff --git a/xts5/Xlib11/ColormapNotify/ColormapNotify.m b/xts5/Xlib11/ColormapNotify/ColormapNotify.m new file mode 100644 index 00000000..f549bc45 --- /dev/null +++ b/xts5/Xlib11/ColormapNotify/ColormapNotify.m @@ -0,0 +1,347 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/ColormapNotify/ColormapNotify.m,v 1.2 2005-11-03 08:42:20 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/ColormapNotify/ColormapNotify.m +>># +>># Description: +>># Tests for ColormapNotify() +>># +>># Modifications: +>># $Log: clrmpntfy.m,v $ +>># Revision 1.2 2005-11-03 08:42:20 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:16 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:07 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:50:36 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:22:50 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:22 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:01:02 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:57:23 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE ColormapNotify Xlib11 +>>EXTERN +#define EVENT ColormapNotify +#define MASK ColormapChangeMask +>>ASSERTION Good A +When a xname event is generated, +then +all clients having set +.S ColormapChangeMask +event mask bits on the event window are delivered +a xname event. +>>STRATEGY +Create clients client2 and client3. +Create window. +Select for ColormapNotify events using ColormapChangeMask. +Select for ColormapNotify events using ColormapChangeMask with client2. +Select for no events with client3. +Get visual of window. +Create colormap. +Generate ColormapNotify event. +Verify that a ColormapNotify event was delivered. +Verify that event member fields are correctly set. +Verify that a ColormapNotify event was delivered to client2. +Verify that event member fields are correctly set. +Verify that no events were delivered to client3. +>>CODE +Display *display = Dsp; +Display *client2; +Display *client3; +Window w; +int count; +XEvent event_return; +XColormapEvent good; +Colormap colormap; +XWindowAttributes attrs; + +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; +/* Create window. */ + w = mkwin(display, (XVisualInfo *) NULL, (struct area *) NULL, False); +/* Select for ColormapNotify events using ColormapChangeMask. */ + XSelectInput(display, w, MASK); +/* Select for ColormapNotify events using ColormapChangeMask with client2. */ + XSelectInput(client2, w, MASK); +/* Select for no events with client3. */ + XSelectInput(client3, w, NoEventMask); +/* Get visual of window. */ + XSync(display, True); + if (!XGetWindowAttributes(display, w, &attrs)) { + report("Can't get window attributes for window 0x%x", w); + report("XGetWindowAttributes failed"); + return; + } + else + CHECK; +/* Create colormap. */ + colormap = makecolmap(display, attrs.visual, AllocNone); +/* Generate ColormapNotify event. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XSetWindowColormap(display, w, colormap); + XSync(display, False); + XSync(client2, False); + XSync(client3, False); +/* Verify that a ColormapNotify event was delivered. */ +/* Verify that event member fields are correctly set. */ + if (!XCheckTypedWindowEvent(display, w, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } + else + CHECK; + good = event_return.xcolormap; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.window = w; + good.colormap = colormap; + good.new = True; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; +/* Verify that a ColormapNotify event was delivered to client2. */ +/* Verify that event member fields are correctly set. */ + if (!XCheckTypedWindowEvent(client2, w, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } + else + CHECK; + good = event_return.xcolormap; + good.type = EVENT; + good.send_event = False; + good.display = client2; + good.window = w; + good.colormap = colormap; + good.new = True; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event for client2"); + FAIL; + } + else + CHECK; +/* Verify that no events were delivered to client3. */ + count = XPending(client3); + if (count != 0) { + report("Got %d events, expected %d for client3", count, 0); + FAIL; + return; + } + else + CHECK; + + CHECKPASS(8); +>>ASSERTION def +>>#NOTE Tested for in previous assertion. +When a xname event is generated, +then +clients not having set +.S ColormapChangeMask +event mask bits on the event window are not delivered +a xname event. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEm >>ASSERTION +>>#NOTEm When a client changes the colormap of a window by calling +>>#NOTEm .F XChangeWindowAttributes , +>>#NOTEm .F XFreeColormap , +>>#NOTEm or +>>#NOTEm .F XSetWindowColormap , +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEm >>ASSERTION +>>#NOTEm When a client installs or uninstalls the colormap of a window by calling +>>#NOTEm .F XInstallColormap +>>#NOTEm or +>>#NOTEm .F XUninstallColormap , +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M window +>>#NOTEs is set to +>>#NOTEs the window whose associated colormap was +>>#NOTEs changed, installed, or uninstalled. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the colormap associated with +>>#NOTEs .M window +>>#NOTEs was changed by a call to +>>#NOTEs .F XFreeColormap , +>>#NOTEs then +>>#NOTEs .M colormap +>>#NOTEs is set to +>>#NOTEs .S None . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the colormap associated with +>>#NOTEs .M window +>>#NOTEs was not changed by a call to +>>#NOTEs .F XFreeColormap , +>>#NOTEs then +>>#NOTEs .M colormap +>>#NOTEs is set to +>>#NOTEs the changed, +>>#NOTEs installed, +>>#NOTEs or +>>#NOTEs uninstalled colormap. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the colormap was changed, +>>#NOTEs then +>>#NOTEs .M new +>>#NOTEs is set to +>>#NOTEs .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the colormap was installed or uninstalled, +>>#NOTEs then +>>#NOTEs .M new +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the colormap was installed, +>>#NOTEs then +>>#NOTEs .M state +>>#NOTEs is set to +>>#NOTEs .S ColormapInstalled . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the colormap was uninstalled, +>>#NOTEs then +>>#NOTEs .M state +>>#NOTEs is set to +>>#NOTEs .S ColormapUninstalled . diff --git a/xts5/Xlib11/ConfigureNotify/ConfigureNotify.m b/xts5/Xlib11/ConfigureNotify/ConfigureNotify.m new file mode 100644 index 00000000..2c8948bb --- /dev/null +++ b/xts5/Xlib11/ConfigureNotify/ConfigureNotify.m @@ -0,0 +1,594 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/ConfigureNotify/ConfigureNotify.m,v 1.2 2005-11-03 08:42:20 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/ConfigureNotify/ConfigureNotify.m +>># +>># Description: +>># Tests for ConfigureNotify() +>># +>># Modifications: +>># $Log: cnfgrntfy.m,v $ +>># Revision 1.2 2005-11-03 08:42:20 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:16 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:08 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:50:37 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:22:50 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:23 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:01:03 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:57:27 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE ConfigureNotify Xlib11 +>>EXTERN +#define EVENT ConfigureNotify +#define MASK StructureNotifyMask +#define MASKP SubstructureNotifyMask +>>ASSERTION Good A +When a xname event is generated, +then all clients having set +.S StructureNotifyMask +event mask bits on the reconfigured window are delivered +a xname event. +>>STRATEGY +Create clients client2 and client3. +Build and create window hierarchy. +Select for ConfigureNotify events using StructureNotifyMask. +Select for ConfigureNotify events using StructureNotifyMask with client2. +Select for no events with client3. +Raise lowest window to top. +Verify that a ConfigureNotify event is delivered. +Verify that a ConfigureNotify event is delivered to client2. +Verify that no events are delivered to client3. +Verify that event member fields are correctly set. +>>CODE +Display *display = Dsp; +Display *client2; +Display *client3; +Winh *parent, *eventw, *lastw; +Winhg winhg; +int i; +int status; +int numchildren = 4; +XEvent event; + +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; +/* Build and create window hierarchy. */ + /* can't use winh() because the windows need to overlap */ + winhg.border_width = 1; + winhg.area.x = 1; + winhg.area.y = 1; + winhg.area.width = 100; + winhg.area.height = 100; + parent = winh_adopt(display, (Winh *) NULL, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (parent == (Winh *) NULL) { + report("Could not create parent"); + return; + } + else + CHECK; + winhg.area.x = 1; + winhg.area.y = 1; + winhg.area.width = 30; + winhg.area.height = 30; + for (i=0; i<numchildren; i++) { + if (!i) + CHECK; + lastw = winh_adopt(display, parent, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (lastw == (Winh *) NULL) { + report("Could not create child %d", i); + return; + } + winhg.area.x += 10; + winhg.area.y += 10; + } + if (winh_create(display, (Winh *) NULL, WINH_MAP)) + return; + else + CHECK; +/* Select for ConfigureNotify events using StructureNotifyMask. */ + if (winh_selectinput(display, (Winh *) NULL, MASK)) { + report("Selection with first client failed."); + return; + } + else + CHECK; +/* Select for ConfigureNotify events using StructureNotifyMask with client2. */ + if (winh_selectinput(client2, (Winh *) NULL, MASK)) { + report("Selection with client2 failed."); + return; + } + else + CHECK; +/* Select for no events with client3. */ + if (winh_selectinput(client3, (Winh *) NULL, NoEventMask)) { + report("Selection with client3 failed."); + return; + } + else + CHECK; +/* Raise lowest window to top. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + eventw = parent->firstchild; + XRaiseWindow(display, eventw->window); + event.xany.type = EVENT; + event.xany.window = eventw->window; + if (winh_plant(eventw, &event, MASK, WINH_NOMASK)) { + report("Could not plant events for eventw"); + return; + } + else + CHECK; + XSync(display, False); + XSync(client2, False); + XSync(client3, False); +/* Verify that a ConfigureNotify event is delivered. */ +/* Verify that a ConfigureNotify event is delivered to client2. */ +/* Verify that no events are delivered to client3. */ + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events for display"); + return; + } + else + CHECK; + if (winh_harvest(client2, (Winh *) NULL)) { + report("Could not harvest events for client2"); + return; + } + else + CHECK; + if (winh_harvest(client3, (Winh *) NULL)) { + report("Could not harvest events for client3"); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status == -1) + return; + else if (status) { + report("Event delivery not as expected"); + FAIL; + } + else { + XConfigureEvent good; + +/* Verify that event member fields are correctly set. */ + good = winh_qdel->event->xconfigure; + good.window = good.event; + good.x = 1; + good.y = 1; + good.width = 30; + good.height = 30; + good.border_width = 1; + good.above = lastw->window; + if (checkevent((XEvent *) &good, winh_qdel->event)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; + } + + CHECKPASS(13); +>>ASSERTION Good A +When a xname event is generated, +then all clients having set +.S SubstructureNotifyMask +event mask bits on the parent of the reconfigured window are delivered +a xname event. +>>STRATEGY +Create clients client2 and client3. +Build and create window hierarchy. +Select for ConfigureNotify events using SubstructureNotifyMask. +Select for ConfigureNotify events using SubstructureNotifyMask with client2. +Select for no events with client3. +Raise lowest window to top. +Verify that a ConfigureNotify event is delivered. +Verify that a ConfigureNotify event is delivered to client2. +Verify that no events are delivered to client3. +Verify that event member fields are correctly set. +>>CODE +Display *display = Dsp; +Display *client2; +Display *client3; +Winh *parent, *eventw, *lastw; +Winhg winhg; +int i; +int status; +int numchildren = 4; +XEvent event; + +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; +/* Build and create window hierarchy. */ + /* can't use winh() because the windows need to overlap */ + winhg.border_width = 1; + winhg.area.x = 1; + winhg.area.y = 1; + winhg.area.width = 100; + winhg.area.height = 100; + parent = winh_adopt(display, (Winh *) NULL, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (parent == (Winh *) NULL) { + report("Could not create parent"); + return; + } + else + CHECK; + winhg.area.x = 1; + winhg.area.y = 1; + winhg.area.width = 30; + winhg.area.height = 30; + for (i=0; i<numchildren; i++) { + if (!i) + CHECK; + lastw = winh_adopt(display, parent, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (lastw == (Winh *) NULL) { + report("Could not create child %d", i); + return; + } + winhg.area.x += 10; + winhg.area.y += 10; + } + if (winh_create(display, (Winh *) NULL, WINH_MAP)) + return; + else + CHECK; +/* Select for ConfigureNotify events using SubstructureNotifyMask. */ + if (winh_selectinput(display, (Winh *) NULL, MASKP)) { + report("Selection with first client failed."); + return; + } + else + CHECK; +/* Select for ConfigureNotify events using SubstructureNotifyMask with client2. */ + if (winh_selectinput(client2, (Winh *) NULL, MASKP)) { + report("Selection with client2 failed."); + return; + } + else + CHECK; +/* Select for no events with client3. */ + if (winh_selectinput(client3, (Winh *) NULL, NoEventMask)) { + report("Selection with client3 failed."); + return; + } + else + CHECK; +/* Raise lowest window to top. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + eventw = parent->firstchild; + XRaiseWindow(display, eventw->window); + event.xany.type = EVENT; + event.xany.window = parent->window; + if (winh_plant(parent, &event, MASKP, WINH_NOMASK)) { + report("Could not plant events for eventw"); + return; + } + else + CHECK; + XSync(display, False); + XSync(client2, False); + XSync(client3, False); +/* Verify that a ConfigureNotify event is delivered. */ +/* Verify that a ConfigureNotify event is delivered to client2. */ +/* Verify that no events are delivered to client3. */ + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events for display"); + return; + } + else + CHECK; + if (winh_harvest(client2, (Winh *) NULL)) { + report("Could not harvest events for client2"); + return; + } + else + CHECK; + if (winh_harvest(client3, (Winh *) NULL)) { + report("Could not harvest events for client3"); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status == -1) + return; + else if (status) { + report("Event delivery not as expected"); + FAIL; + } + else { + XConfigureEvent good; + +/* Verify that event member fields are correctly set. */ + good = winh_qdel->event->xconfigure; + good.window = eventw->window; + good.x = 1; + good.y = 1; + good.width = 30; + good.height = 30; + good.border_width = 1; + good.above = lastw->window; + } + + CHECKPASS(12); +>>ASSERTION def +>>#NOTE Tested for in previous two assertions. +When a xname event is generated, +then +clients not having set +.S StructureNotifyMask +event mask bits on the +reconfigured window +and also not having set +.S SubstructureNotifyMask +event mask bits on the +parent of the reconfigured window +are not delivered +a xname event. +>>#NOTEm >>ASSERTION +>>#NOTEm When a window's size is changed +>>#NOTEm as a result of a call to +>>#NOTEm .F XConfigureWindow , +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEm >>ASSERTION +>>#NOTEm When a window's position is changed +>>#NOTEm as a result of a call to +>>#NOTEm .F XConfigureWindow , +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEm >>ASSERTION +>>#NOTEm When a window's border is changed +>>#NOTEm as a result of a call to +>>#NOTEm .F XConfigureWindow , +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEm >>ASSERTION +>>#NOTEm When a window's stacking order is changed +>>#NOTEm as a result of a call to +>>#NOTEm .F XConfigureWindow , +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEm >>ASSERTION +>>#NOTEm When a window's position in the stacking order is changed +>>#NOTEm as a result of a call to +>>#NOTEm .F XLowerWindow , +>>#NOTEm .F XRaiseWindow , +>>#NOTEm or +>>#NOTEm .F XRestackWindows, +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEm >>ASSERTION +>>#NOTEm When a window is moved +>>#NOTEm as a result of a call to +>>#NOTEm .F XMoveWindow , +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEm >>ASSERTION +>>#NOTEm When a window's size is changed +>>#NOTEm as a result of a call to +>>#NOTEm .F XResizeWindow , +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEm >>ASSERTION +>>#NOTEm When a window's size and location is changed +>>#NOTEm as a result of a call to +>>#NOTEm .F XMoveResizeWindow , +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEm >>ASSERTION +>>#NOTEm When a window is mapped +>>#NOTEm and its position in the stacking order is changed +>>#NOTEm as a result of a call to +>>#NOTEm .F XMapRaised , +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEm >>ASSERTION +>>#NOTEm When a window's border width is changed +>>#NOTEm as a result of a call to +>>#NOTEm .F XSetWindowBorderWidth , +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE Global except for MappingNotify and KeymapNotify. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M window +>>#NOTEs is set to +>>#NOTEs the +>>#NOTEs ifdef(`WINDOWTYPE', WINDOWTYPE, event) +>>#NOTEs window. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M x +>>#NOTEs and +>>#NOTEs .M y +>>#NOTEs are set to +>>#NOTEs the coordinates of +>>#NOTEs .M window +>>#NOTEs relative to parent window's origin +>>#NOTEs and indicate the position of the upper-left outside corner of +>>#NOTEs .M window . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M width +>>#NOTEs and +>>#NOTEs .M height +>>#NOTEs are set to +>>#NOTEs the +>>#NOTEs ifdef(`REQUESTED', REQUESTED,) +>>#NOTEs inside size of +>>#NOTEs .M window , +>>#NOTEs not including the border. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M border_width +>>#NOTEs is set to +>>#NOTEs the width in pixels of +>>#NOTEs .M window 's +>>#NOTEs border. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and +>>#NOTEs .M window +>>#NOTEs is on the bottom of the stack with respect to sibilings, +>>#NOTEs then +>>#NOTEs .M above +>>#NOTEs is set to +>>#NOTEs .S None . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and +>>#NOTEs .M window +>>#NOTEs is not on the bottom of the stack with respect to sibilings, +>>#NOTEs then +>>#NOTEs .M above +>>#NOTEs is set to +>>#NOTEs the sibling immediately below +>>#NOTEs .M window . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M override_redirect +>>#NOTEs is set to the override-redirect attribute of +>>#NOTEs .M window . diff --git a/xts5/Xlib11/ConfigureRequest/ConfigureRequest.m b/xts5/Xlib11/ConfigureRequest/ConfigureRequest.m new file mode 100644 index 00000000..30473693 --- /dev/null +++ b/xts5/Xlib11/ConfigureRequest/ConfigureRequest.m @@ -0,0 +1,830 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/ConfigureRequest/ConfigureRequest.m,v 1.2 2005-11-03 08:42:20 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/ConfigureRequest/ConfigureRequest.m +>># +>># Description: +>># Tests for ConfigureRequest() +>># +>># Modifications: +>># $Log: cnfgrrqst.m,v $ +>># Revision 1.2 2005-11-03 08:42:20 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:16 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:09 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:50:38 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:22:51 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:23 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:01:05 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:57:32 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE ConfigureRequest Xlib11 +>>EXTERN +#define EVENT ConfigureRequest +#define MASK SubstructureRedirectMask +>>ASSERTION Good A +When a xname event is generated, +then +all clients having set +.S SubstructureRedirectMask +event mask bits on the parent of the window +for which the configure request was issued are delivered +a xname event. +>>STRATEGY +Create clients client2 and client3. +Build and create window hierarchy. +Create inferiors with override-redirect set to True. +Select for ConfigureRequest events using SubstructureRedirectMask. +Select for no events with client3. +Raise lowest window to top. +Verify that no events were delivered. +Verify that no events were delivered to client3. +Lower window back to original placement. +Set the override-redirect flag on inferiors to False. +Attempt to raise lowest window to top. +Initialize for expected events. +Verify that a ConfigureRequest event is delivered. +Verify that no events are delivered to client3. +Verify members of event structure. +Verify that no events were delivered to client3. +>>CODE +Display *display = Dsp; +Display *client2, *client3; +Winh *parent, *child, *lastw, *winh; +Winhg winhg; +XEvent event; +int i; +int status; +int numchildren = 4; +int count; +XSetWindowAttributes attrs; +unsigned long valuemask; + +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; +/* Build and create window hierarchy. */ + /* can't use winh() because the windows need to overlap */ + winhg.border_width = 1; + winhg.area.x = 1; + winhg.area.y = 1; + winhg.area.width = 100; + winhg.area.height = 100; + parent = winh_adopt(display, (Winh *) NULL, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (parent == (Winh *) NULL) { + report("Could not create parent"); + return; + } + else + CHECK; + winhg.area.x = 1; + winhg.area.y = 1; + winhg.area.width = 30; + winhg.area.height = 30; +/* Create inferiors with override-redirect set to True. */ + attrs.override_redirect = True; + attrs.border_pixel = W_FG; + attrs.background_pixel = W_BG; + valuemask = CWOverrideRedirect | CWBorderPixel | CWBackPixel; + for (i=0; i<numchildren; i++) { + if (!i) + CHECK; + lastw = winh_adopt(display, parent, valuemask, &attrs, &winhg, WINH_NOMASK); + if (lastw == (Winh *) NULL) { + report("Could not create child %d", i); + return; + } + winhg.area.x += 10; + winhg.area.y += 10; + } + child = parent->firstchild; + if (winh_create(display, (Winh *) NULL, WINH_MAP)) + return; + else + CHECK; +/* Select for ConfigureRequest events using SubstructureRedirectMask. */ + /* + * Selection with a single client because only one can select + * for this event at a time. + */ + if (winh_selectinput(display, parent, MASK)) { + report("Selection failed."); + return; + } + else + CHECK; +/* Select for no events with client3. */ + if (winh_selectinput(client3, (Winh *) NULL, NoEventMask)) { + report("Selection with client3 failed."); + return; + } + else + CHECK; +/* Raise lowest window to top. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XRaiseWindow(client2, child->window); + XSync(client2, False); + XSync(display, False); + XSync(client3, False); +/* Verify that no events were delivered. */ + count = XPending(display); + if (count != 0) { + report("Got %d events, expected %d (with override-redirect set)", count, 0); + FAIL; + } + else + CHECK; +/* Verify that no events were delivered to client3. */ + count = XPending(client3); + if (count != 0) { + report("Got %d events, expected %d for client3 (with override-redirect set)", count, 0); + FAIL; + } + else + CHECK; +/* Lower window back to original placement. */ + /* + * this assumes that it was raised in the first place + * which is not the case where the override-redirect flag is ignored + */ + XLowerWindow(client2, child->window); + XSync(client2, True); +/* Set the override-redirect flag on inferiors to False. */ + attrs.override_redirect = False; + valuemask = CWOverrideRedirect; + for (winh = parent->firstchild, i=0; i<numchildren; winh = winh->nextsibling, i++) { + if (!i) + CHECK; + if (winh_changewindowattributes(display, winh, valuemask, &attrs)) { + report("Failed to change attributes for subwindow %d", i); + return; + } + } +/* Attempt to raise lowest window to top. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XRaiseWindow(client2, child->window); + XSync(client2, False); + XSync(display, False); + XSync(client3, False); +/* Initialize for expected events. */ + event.xany.type = EVENT; + event.xany.window = parent->window; + if (winh_plant(parent, &event, MASK, WINH_NOMASK)) { + report("Could not plant events for parent"); + return; + } + else + CHECK; +/* Verify that a ConfigureRequest event is delivered. */ +/* Verify that no events are delivered to client3. */ + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; + if (winh_harvest(client3, (Winh *) NULL)) { + report("Could not harvest events for client3"); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status == -1) + return; + else if (status) { + report("Event delivery not as expected"); + FAIL; + } + else { + XEvent *event_return; + XConfigureRequestEvent good; + +/* Verify members of event structure. */ + event_return = winh_qdel->event; + good = event_return->xconfigurerequest; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.parent = parent->window; + good.window = child->window; + good.x = child->winhg.area.x; + good.y = child->winhg.area.y; + good.width = child->winhg.area.width; + good.height = child->winhg.area.height; + good.border_width = child->winhg.border_width; + good.above = Above; + good.detail = Above; + good.value_mask = CWStackMode; + if (checkevent((XEvent *) &good, event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; + } +/* Verify that no events were delivered to client3. */ + count = XPending(client3); + if (count != 0) { + report("Got %d events, expected %d for client3", count, 0); + FAIL; + return; + } + else + CHECK; + + CHECKPASS(15); +>>ASSERTION def +>>#NOTE Tested for in previous assertion. +When a xname event is generated, +then +clients not having set +.S SubstructureRedirectMask +event mask bits on the +parent of the window for which the configure request was issued +are not delivered +a xname event. +>>#NOTEm >>ASSERTION +>>#NOTEm When a +>>#NOTEm .S ConfigureWindow +>>#NOTEm protocol request is issued on a child window by another client, +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is generated +>>#NOTEm and a client has selected xname events on the child's parent +>>#NOTEm and the override-redirect attribute of the child window is set to +>>#NOTEm .S False , +>>#NOTEm then +>>#NOTEm .M window +>>#NOTEm is not WINDOWTYPE. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M parent +>>#NOTEs is set to +>>#NOTEs the parent window of +>>#NOTEs .M window . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M window +>>#NOTEs is set to +>>#NOTEs the child window to be WINDOWTYPE. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M x +>>#NOTEs and +>>#NOTEs .M y +>>#NOTEs are set to +>>#NOTEs the coordinates of +>>#NOTEs .M window +>>#NOTEs relative to parent window's origin +>>#NOTEs and indicate the position of the upper-left outside corner of +>>#NOTEs .M window . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M width +>>#NOTEs and +>>#NOTEs .M height +>>#NOTEs are set to +>>#NOTEs the +>>#NOTEs ifdef(`REQUESTED', REQUESTED,) +>>#NOTEs inside size of +>>#NOTEs .M window , +>>#NOTEs not including the border. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M border_width +>>#NOTEs is set to +>>#NOTEs the width in pixels of +>>#NOTEs .M window 's +>>#NOTEs border. +>>ASSERTION Good A +When a xname event is delivered +and a sibling attribute was specified in the protocol request +issued on the child window, +then +.M above +is set to +the value of the sibling attribute specified in the protocol request. +>>STRATEGY +Create clients client2 and client3. +Build and create window hierarchy. +Select for ConfigureRequest events using SubstructureRedirectMask. +Select for no events with client3. +Raise lowest window to just below the top window. +Initialize for expected events. +Verify that a ConfigureRequest event is delivered. +Verify that no events are delivered to client3. +Verify members of event structure. +Verify that no events were delivered to client3. +>>CODE +Display *display = Dsp; +Display *client2, *client3; +Winh *parent, *child, *sibling; +Winhg winhg; +XEvent event; +int i; +int status; +int numchildren = 4; +int count; +XWindowChanges values; +XSetWindowAttributes attrs; +unsigned long valuemask; + +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; +/* Build and create window hierarchy. */ + /* can't use winh() because the windows need to overlap */ + winhg.border_width = 1; + winhg.area.x = 1; + winhg.area.y = 1; + winhg.area.width = 100; + winhg.area.height = 100; + parent = winh_adopt(display, (Winh *) NULL, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (parent == (Winh *) NULL) { + report("Could not create parent"); + return; + } + else + CHECK; + winhg.area.x = 1; + winhg.area.y = 1; + winhg.area.width = 30; + winhg.area.height = 30; + attrs.override_redirect = False; + attrs.border_pixel = W_FG; + attrs.background_pixel = W_BG; + valuemask = CWOverrideRedirect | CWBorderPixel | CWBackPixel; + for (i=0; i<numchildren; i++) { + if (!i) + CHECK; + sibling = winh_adopt(display, parent, valuemask, &attrs, &winhg, WINH_NOMASK); + if (sibling == (Winh *) NULL) { + report("Could not create child %d", i); + return; + } + winhg.area.x += 10; + winhg.area.y += 10; + } + child = parent->firstchild; + if (winh_create(display, (Winh *) NULL, WINH_MAP)) + return; + else + CHECK; +/* Select for ConfigureRequest events using SubstructureRedirectMask. */ + /* + * Selection with a single client because only one can select + * for this event at a time. + */ + if (winh_selectinput(display, parent, MASK)) { + report("Selection failed."); + return; + } + else + CHECK; +/* Select for no events with client3. */ + if (winh_selectinput(client3, (Winh *) NULL, NoEventMask)) { + report("Selection with client3 failed."); + return; + } + else + CHECK; +/* Raise lowest window to just below the top window. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + values.sibling = sibling->window; + values.stack_mode = Below; + XConfigureWindow(client2, child->window, CWSibling|CWStackMode, &values); + XSync(client2, False); + XSync(display, False); + XSync(client3, False); +/* Initialize for expected events. */ + event.xany.type = EVENT; + event.xany.window = parent->window; + if (winh_plant(parent, &event, MASK, WINH_NOMASK)) { + report("Could not plant events for parent"); + return; + } + else + CHECK; +/* Verify that a ConfigureRequest event is delivered. */ +/* Verify that no events are delivered to client3. */ + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; + if (winh_harvest(client3, (Winh *) NULL)) { + report("Could not harvest events for client3"); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status == -1) + return; + else if (status) { + report("Event delivery not as expected"); + FAIL; + } + else { + XEvent *event_return; + XConfigureRequestEvent good; + +/* Verify members of event structure. */ + event_return = winh_qdel->event; + good = event_return->xconfigurerequest; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.parent = parent->window; + good.window = child->window; + good.x = child->winhg.area.x; + good.y = child->winhg.area.y; + good.width = child->winhg.area.width; + good.height = child->winhg.area.height; + good.border_width = child->winhg.border_width; + good.above = sibling->window; + good.detail = Below; + good.value_mask = CWSibling|CWStackMode; + if (checkevent((XEvent *) &good, event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; + } +/* Verify that no events were delivered to client3. */ + count = XPending(client3); + if (count != 0) { + report("Got %d events, expected %d for client3", count, 0); + FAIL; + return; + } + else + CHECK; + + CHECKPASS(12); +>>ASSERTION def +>>#NOTE Tested for in first assertion. +When a xname event is delivered +and a sibling attribute was not specified in the protocol request +issued on the child window, +then +.M above +is set to +.S None . +>>ASSERTION def +>>#NOTE Tested for in first assertion. +When a xname event is delivered +and a stack-mode attribute was specified in the protocol request +issued on the child window, +then +.M detail +is set to +the value of the stack-mode attribute specified in the protocol request. +>>ASSERTION Good A +>>#NOTE Reviewed assertion specified "Above" instead of "None": +>># +>># When a xname event is delivered +>># and a stack-mode attribute was not specified in the protocol request +>># issued on the child window, +>># then +>># .M detail +>># is set to +>># .S Above . +When a xname event is delivered +and a stack-mode attribute was not specified in the protocol request +issued on the child window, +then +.M detail +is set to +.S None . +>>STRATEGY +Create clients client2 and client3. +Build and create window hierarchy. +Select for ConfigureRequest events using SubstructureRedirectMask. +Select for no events with client3. +Attempt to change window's border width. +Initialize for expected events. +Verify that a ConfigureRequest event is delivered. +Verify that no events are delivered to client3. +Verify members of event structure. +Verify that no events were delivered to client3. +>>CODE +Display *display = Dsp; +Display *client2, *client3; +Winh *parent, *child, *sibling; +Winhg winhg; +XEvent event; +int i; +int status; +int numchildren = 4; +int count; +XWindowChanges values; +XSetWindowAttributes attrs; +unsigned long valuemask; + +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; +/* Build and create window hierarchy. */ + /* can't use winh() because the windows need to overlap */ + winhg.border_width = 1; + winhg.area.x = 1; + winhg.area.y = 1; + winhg.area.width = 100; + winhg.area.height = 100; + parent = winh_adopt(display, (Winh *) NULL, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (parent == (Winh *) NULL) { + report("Could not create parent"); + return; + } + else + CHECK; + winhg.area.x = 1; + winhg.area.y = 1; + winhg.area.width = 30; + winhg.area.height = 30; + attrs.override_redirect = False; + attrs.border_pixel = W_FG; + attrs.background_pixel = W_BG; + valuemask = CWOverrideRedirect | CWBorderPixel | CWBackPixel; + for (i=0; i<numchildren; i++) { + if (!i) + CHECK; + sibling = winh_adopt(display, parent, valuemask, &attrs, &winhg, WINH_NOMASK); + if (sibling == (Winh *) NULL) { + report("Could not create child %d", i); + return; + } + winhg.area.x += 10; + winhg.area.y += 10; + } + child = parent->firstchild; + if (winh_create(display, (Winh *) NULL, WINH_MAP)) + return; + else + CHECK; +/* Select for ConfigureRequest events using SubstructureRedirectMask. */ + /* + * Selection with a single client because only one can select + * for this event at a time. + */ + if (winh_selectinput(display, parent, MASK)) { + report("Selection failed."); + return; + } + else + CHECK; +/* Select for no events with client3. */ + if (winh_selectinput(client3, (Winh *) NULL, NoEventMask)) { + report("Selection with client3 failed."); + return; + } + else + CHECK; +/* Attempt to change window's border width. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + child->winhg.border_width += 5; + XSetWindowBorderWidth(client2, child->window, child->winhg.border_width); + XSync(client2, False); + XSync(display, False); + XSync(client3, False); +/* Initialize for expected events. */ + event.xany.type = EVENT; + event.xany.window = parent->window; + if (winh_plant(parent, &event, MASK, WINH_NOMASK)) { + report("Could not plant events for parent"); + return; + } + else + CHECK; +/* Verify that a ConfigureRequest event is delivered. */ +/* Verify that no events are delivered to client3. */ + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; + if (winh_harvest(client3, (Winh *) NULL)) { + report("Could not harvest events for client3"); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status == -1) + return; + else if (status) { + report("Event delivery not as expected"); + FAIL; + } + else { + XEvent *event_return; + XConfigureRequestEvent good; + +/* Verify members of event structure. */ + event_return = winh_qdel->event; + good = event_return->xconfigurerequest; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.parent = parent->window; + good.window = child->window; + good.x = child->winhg.area.x; + good.y = child->winhg.area.y; + good.width = child->winhg.area.width; + good.height = child->winhg.area.height; + good.border_width = child->winhg.border_width; + good.above = Above; + good.detail = None; + good.value_mask = CWBorderWidth; + if (checkevent((XEvent *) &good, event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; + } +/* Verify that no events were delivered to client3. */ + count = XPending(client3); + if (count != 0) { + report("Got %d events, expected %d for client3", count, 0); + FAIL; + return; + } + else + CHECK; + + CHECKPASS(12); +>>ASSERTION def +>>#NOTE Tested for in first assertion. +When a xname event is delivered, +then +.M value_mask +is set to +the components specified in the protocol request. diff --git a/xts5/Xlib11/CreateNotify/CreateNotify.m b/xts5/Xlib11/CreateNotify/CreateNotify.m new file mode 100644 index 00000000..4d38bd30 --- /dev/null +++ b/xts5/Xlib11/CreateNotify/CreateNotify.m @@ -0,0 +1,327 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/CreateNotify/CreateNotify.m,v 1.2 2005-11-03 08:42:21 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/CreateNotify/CreateNotify.m +>># +>># Description: +>># Tests for CreateNotify() +>># +>># Modifications: +>># $Log: crtntfy.m,v $ +>># Revision 1.2 2005-11-03 08:42:21 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:16 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:10 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:50:41 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:22:52 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:25 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:01:11 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:57:47 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE CreateNotify Xlib11 +>>EXTERN +#define EVENT CreateNotify +#define MASK SubstructureNotifyMask +>>ASSERTION Good A +When a xname event is generated, +then all clients having set +.S SubstructureNotifyMask +event mask bits on the parent of the created window are delivered +a xname event. +>>STRATEGY +Create clients client2 and client3. +Create parent window. +Select for CreateNotify events using StructureNotifyMask. +Select for CreateNotify events using StructureNotifyMask with client2. +Select for no events with client3. +Generate CreateNotify event. +Verify that a CreateNotify event was delivered. +Verify that event member fields are correctly set. +Verify that a CreateNotify event was delivered to client2. +Verify that no events were delivered to client3. +>>CODE +Display *display = Dsp; +Display *client2; +Display *client3; +Window parent, child; +int count; +XEvent event_return; +XCreateWindowEvent good; + +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; +/* Create parent window. */ + parent = mkwin(display, (XVisualInfo *) NULL, (struct area *) NULL, False); +/* Select for CreateNotify events using StructureNotifyMask. */ + XSelectInput(display, parent, MASK); +/* Select for CreateNotify events using StructureNotifyMask with client2. */ + XSelectInput(client2, parent, MASK); +/* Select for no events with client3. */ + XSelectInput(client3, parent, NoEventMask); +/* Generate CreateNotify event. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + child = mkwinchild(display, (XVisualInfo *) NULL, (struct area *) NULL, False, parent, 1); + XSync(display, False); + XSync(client2, False); + XSync(client3, False); +/* Verify that a CreateNotify event was delivered. */ +/* Verify that event member fields are correctly set. */ + count = XPending(display); + if (count != 1) { + report("Got %d events, expected %d", count, 1); + FAIL; + return; + } + else + CHECK; + XNextEvent(display, &event_return); + good = event_return.xcreatewindow; + good.type = EVENT; + good.parent = parent; + good.window = child; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; +/* Verify that a CreateNotify event was delivered to client2. */ + count = XPending(client2); + if (count != 1) { + report("Got %d events, expected %d for client2", count, 1); + FAIL; + return; + } + else + CHECK; + XNextEvent(client2, &event_return); + good = event_return.xcreatewindow; + good.type = EVENT; + good.parent = parent; + good.window = child; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event to client2"); + FAIL; + } + else + CHECK; +/* Verify that no events were delivered to client3. */ + count = XPending(client3); + if (count != 0) { + report("Got %d events, expected %d for client3", count, 0); + FAIL; + return; + } + else + CHECK; + + CHECKPASS(7); +>>ASSERTION def +>>#NOTE Tested for in previous assertion. +When a xname event is generated, +then +clients not having set +.S SubstructureNotifyMask +event mask bits on the event window are not delivered +a xname event. +>>#NOTEm >>ASSERTION +>>#NOTEm When a window is created +>>#NOTEm as a result of a call to +>>#NOTEm .F XCreateWindow +>>#NOTEm or +>>#NOTEm .F XCreateSimpleWindow , +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M parent +>>#NOTEs is set to +>>#NOTEs the parent window of +>>#NOTEs .M window . +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE Global except for MappingNotify and KeymapNotify. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M window +>>#NOTEs is set to +>>#NOTEs the +>>#NOTEs ifdef(`WINDOWTYPE', WINDOWTYPE, event) +>>#NOTEs window. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M x +>>#NOTEs and +>>#NOTEs .M y +>>#NOTEs are set to +>>#NOTEs the coordinates of +>>#NOTEs .M window +>>#NOTEs relative to parent window's origin +>>#NOTEs and indicate the position of the upper-left outside corner of +>>#NOTEs .M window . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M width +>>#NOTEs and +>>#NOTEs .M height +>>#NOTEs are set to +>>#NOTEs the +>>#NOTEs ifdef(`REQUESTED', REQUESTED,) +>>#NOTEs inside size of +>>#NOTEs .M window , +>>#NOTEs not including the border. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs then +>>#NOTEs .M width +>>#NOTEs and +>>#NOTEs .M height +>>#NOTEs are always non-zero. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M border_width +>>#NOTEs is set to +>>#NOTEs the width in pixels of +>>#NOTEs .M window 's +>>#NOTEs border. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M override_redirect +>>#NOTEs is set to the override-redirect attribute of +>>#NOTEs .M window . diff --git a/xts5/Xlib11/DestroyNotify/DestroyNotify.m b/xts5/Xlib11/DestroyNotify/DestroyNotify.m new file mode 100644 index 00000000..4617068e --- /dev/null +++ b/xts5/Xlib11/DestroyNotify/DestroyNotify.m @@ -0,0 +1,413 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/DestroyNotify/DestroyNotify.m,v 1.2 2005-11-03 08:42:26 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/DestroyNotify/DestroyNotify.m +>># +>># Description: +>># Tests for DestroyNotify() +>># +>># Modifications: +>># $Log: dstryntfy.m,v $ +>># Revision 1.2 2005-11-03 08:42:26 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:16 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:11 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:50:42 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:22:53 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:25 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:01:13 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:57:50 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE DestroyNotify Xlib11 +>>EXTERN +#define EVENT DestroyNotify +#define MASK StructureNotifyMask +#define MASKP SubstructureNotifyMask +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is generated for a particular window, +>>#NOTEm then ARTICLE xname event will not be generated for +>>#NOTEm any inferiors of this window. +>>#NOTEm >>ASSERTION +>>#NOTEm When a window is destroyed +>>#NOTEm as a result of a call to +>>#NOTEm .F XDestroyWindow +>>#NOTEm or +>>#NOTEm .F XDestroySubwindows , +>>#NOTEm then ARTICLE xname event is generated. +>>ASSERTION Good A +When a xname event is generated, +then all clients having set +.S StructureNotifyMask +event mask bits on the destroyed window are delivered +a xname event. +>>STRATEGY +Create clients client2 and client3. +Create window. +Select for DestroyNotify events using StructureNotifyMask. +Select for DestroyNotify events using StructureNotifyMask with client2. +Select for no events with client3. +Generate DestroyNotify event. +Verify that a DestroyNotify event was delivered. +Verify that event member fields are correctly set. +Verify that a DestroyNotify event was delivered to client2. +Verify that no events were delivered to client3. +>>CODE +Display *display = Dsp; +Display *client2; +Display *client3; +Window w; +int count; +XEvent event_return; +XDestroyWindowEvent good; + +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; +/* Create window. */ + w = XCreateSimpleWindow(display, DRW(display), 1, 1, W_STDWIDTH, W_STDHEIGHT, 1, 0L, 0L); +/* Select for DestroyNotify events using StructureNotifyMask. */ + XSelectInput(display, w, MASK); +/* Select for DestroyNotify events using StructureNotifyMask with client2. */ + XSelectInput(client2, w, MASK); +/* Select for no events with client3. */ + XSelectInput(client3, w, NoEventMask); +/* Generate DestroyNotify event. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XDestroyWindow(display, w); + XSync(display, False); + XSync(client2, False); + XSync(client3, False); +/* Verify that a DestroyNotify event was delivered. */ +/* Verify that event member fields are correctly set. */ + count = XPending(display); + if (count != 1) { + report("Got %d events, expected %d", count, 1); + FAIL; + return; + } + else + CHECK; + XNextEvent(display, &event_return); + good = event_return.xdestroywindow; + good.type = EVENT; + good.event = w; + good.window = w; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; +/* Verify that a DestroyNotify event was delivered to client2. */ + count = XPending(client2); + if (count != 1) { + report("Got %d events, expected %d for client2", count, 1); + FAIL; + return; + } + else + CHECK; + XNextEvent(client2, &event_return); + good = event_return.xdestroywindow; + good.type = EVENT; + good.event = w; + good.window = w; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event to client2"); + FAIL; + } + else + CHECK; +/* Verify that no events were delivered to client3. */ + count = XPending(client3); + if (count != 0) { + report("Got %d events, expected %d for client3", count, 0); + FAIL; + return; + } + else + CHECK; + + CHECKPASS(7); +>>ASSERTION Good A +When a xname event is generated, +then all clients having set +.S SubstructureNotifyMask +event mask bits on the parent of the destroyed window are delivered +a xname event. +>>STRATEGY +Create clients client2 and client3. +Create parent window. +Create window. +Select for DestroyNotify events using SubstructureNotifyMask. +Select for DestroyNotify events using SubstructureNotifyMask with client2. +Select for no events with client3. +Generate DestroyNotify event. +Verify that a DestroyNotify event was delivered. +Verify that event member fields are correctly set. +Verify that a DestroyNotify event was delivered to client2. +Verify that no events were delivered to client3. +>>CODE +Display *display = Dsp; +Display *client2; +Display *client3; +Window parent, w; +int count; +XEvent event_return; +XDestroyWindowEvent good; + +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; +/* Create parent window. */ + parent = mkwin(display, (XVisualInfo *) NULL, (struct area *) NULL, False); +/* Create window. */ + w = XCreateSimpleWindow(display, parent, 1, 1, W_STDWIDTH, W_STDHEIGHT, 1, 0L, 0L); +/* Select for DestroyNotify events using SubstructureNotifyMask. */ + XSelectInput(display, parent, MASKP); +/* Select for DestroyNotify events using SubstructureNotifyMask with client2. */ + XSelectInput(client2, parent, MASKP); +/* Select for no events with client3. */ + XSelectInput(client3, parent, NoEventMask); +/* Generate DestroyNotify event. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XDestroyWindow(display, w); + XSync(display, False); + XSync(client2, False); + XSync(client3, False); +/* Verify that a DestroyNotify event was delivered. */ +/* Verify that event member fields are correctly set. */ + count = XPending(display); + if (count != 1) { + report("Got %d events, expected %d", count, 1); + FAIL; + return; + } + else + CHECK; + XNextEvent(display, &event_return); + good = event_return.xdestroywindow; + good.type = EVENT; + good.event = parent; + good.window = w; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; +/* Verify that a DestroyNotify event was delivered to client2. */ + count = XPending(client2); + if (count != 1) { + report("Got %d events, expected %d for client2", count, 1); + FAIL; + return; + } + else + CHECK; + XNextEvent(client2, &event_return); + good = event_return.xdestroywindow; + good.type = EVENT; + good.event = parent; + good.window = w; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event to client2"); + FAIL; + } + else + CHECK; +/* Verify that no events were delivered to client3. */ + count = XPending(client3); + if (count != 0) { + report("Got %d events, expected %d for client3", count, 0); + FAIL; + return; + } + else + CHECK; + + CHECKPASS(7); +>>ASSERTION def +>>#NOTE Tested for in previous two assertions. +When a xname event is generated, +then +clients not having set +.S StructureNotifyMask +event mask bits on the +destroyed window +and also not having set +.S SubstructureNotifyMask +event mask bits on the +parent of the destroyed window +are not delivered +a xname event. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and +>>#NOTEs .S StructureNotify +>>#NOTEs was selected, +>>#NOTEs then +>>#NOTEs .M event +>>#NOTEs is set to +>>#NOTEs the WINDOWTYPE window. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and +>>#NOTEs .S SubstructureNotify +>>#NOTEs was selected, +>>#NOTEs then +>>#NOTEs .M event +>>#NOTEs is set to +>>#NOTEs the WINDOWTYPE window's parent. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE Global except for MappingNotify and KeymapNotify. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M window +>>#NOTEs is set to +>>#NOTEs the +>>#NOTEs ifdef(`WINDOWTYPE', WINDOWTYPE, event) +>>#NOTEs window. diff --git a/xts5/Xlib11/EnterNotify/EnterNotify.m b/xts5/Xlib11/EnterNotify/EnterNotify.m new file mode 100644 index 00000000..9531eb84 --- /dev/null +++ b/xts5/Xlib11/EnterNotify/EnterNotify.m @@ -0,0 +1,1577 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/EnterNotify/EnterNotify.m,v 1.2 2005-11-03 08:42:27 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/EnterNotify/EnterNotify.m +>># +>># Description: +>># Tests for EnterNotify() +>># +>># Modifications: +>># $Log: entrntfy.m,v $ +>># Revision 1.2 2005-11-03 08:42:27 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:16 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:12 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:50:43 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:22:53 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:26 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:01:15 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:57:55 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE EnterNotify Xlib11 +>>EXTERN +#define EVENT EnterNotify +#define OTHEREVENT LeaveNotify +#define MASK EnterWindowMask +#define OTHERMASK LeaveWindowMask +#define BOTHMASKS (MASK|OTHERMASK) +#define EVENTMASK MASK +#define OTHEREVENTMASK LeaveWindowMask + +static int _detail_; +static XEvent good; + +static int +plant(start, stop, current, previous) +Winh *start, *stop, *current, *previous; +{ +#ifdef lint + winh_free(start); + winh_free(stop); + winh_free(previous); +#endif + good.xany.window = current->window; + return(winh_plant(current, &good, NoEventMask, WINH_NOMASK)); +} + +static Bool increasing; /* event sequence increases as we climb */ + +static int +checksequence(start, stop, current, previous) +Winh *start, *stop, *current, *previous; +{ + Winhe *d; + int current_sequence; + int status; + static int last_sequence; + +#ifdef lint + winh_free(start); + winh_free(stop); +#endif + /* look for desired event type */ + for (d = current->delivered; d != (Winhe *) NULL; d = d->next) { + if (d->event->type == good.type) { + current_sequence = d->sequence; + break; + } + } + if (d == (Winhe *) NULL) { + report("%s event not delivered", eventname(good.type)); + delete("Missing event"); + return(-1); + } + if (previous == (Winh *) NULL) + status = 0; /* first call, no previous sequence value */ + else { + /* assume sequence numbers are not the same */ + status = (current_sequence < last_sequence); + if (increasing) + status = (status ? 0 : 1); + if (status) + report("Ordering problem between 0x%x (%d) and 0x%x (%d)", + current->window, current_sequence, + previous->window, last_sequence); + } + last_sequence = current_sequence; + return(status); +} + +static int +checkdetail(start, stop, current, previous) +Winh *start, *stop, *current, *previous; +{ + Winhe *d; + +#ifdef lint + winh_free(start); + winh_free(stop); + winh_free(previous); +#endif + /* look for desired event type */ + for (d = current->delivered; d != (Winhe *) NULL; d = d->next) + if (d->event->type == good.type) + break; + if (d == (Winhe *) NULL) { + report("%s event not delivered to window 0x%x", + eventname(good.type), current->window); + delete("Missing event"); + return(-1); + } + /* check detail */ + if (_detail_ != d->event->xcrossing.detail) { + report("Expected detail of %d, got %d on window 0x%x", + _detail_, d->event->xcrossing.detail, current->window); + return(1); + } + return(0); +} +>>ASSERTION Good A +>>#NOTE +>>#NOTE Hierarchy events are: +>>#NOTE UnmapNotify, +>>#NOTE MapNotify, +>>#NOTE ConfigureNotify, +>>#NOTE GravityNotify, and +>>#NOTE CirculateNotify. +>>#NOTE +When an xname event is generated by a hierarchy change, +then the xname event is delivered after any hierarchy event. +>>STRATEGY +Create client2. +Create window1. +Create window2 on top of window1. +Select for xname events on window1. +Select for xname events on window1 with client2. +Select for UnmapNotify events on window2. +Move pointer to window2. +Call XUnmapWindow on window2. +Verify that UnmapNotify event was received on window2. +Verify that xname event was received on window1. +Verify that xname event was received on window1 by client2. +Verify that pointer has remained where it was moved. +>>CODE +int i; +Display *display = Dsp; +Display *client2; +Window w1, w2; +XEvent event; +struct area area; +PointerPlace *warp; + +/* Create client2. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; +/* Create window1. */ + area.x = 0; + area.y = 0; + area.width = W_STDWIDTH; + area.height = W_STDHEIGHT; + w1 = mkwin(display, (XVisualInfo *) NULL, &area, True); +/* Create window2 on top of window1. */ + w2 = mkwin(display, (XVisualInfo *) NULL, &area, True); +/* Select for xname events on window1. */ + XSelectInput(display, w1, MASK); +/* Select for xname events on window1 with client2. */ + XSelectInput(client2, w1, MASK); +/* Select for UnmapNotify events on window2. */ + XSelectInput(display, w2, StructureNotifyMask); +/* Move pointer to window2. */ + warp = warppointer(display, w2, 0, 0); + if (warp == (PointerPlace *) NULL) + return; + else + CHECK; + XSync(display, True); + XSync(client2, True); +/* Call XUnmapWindow on window2. */ + XUnmapWindow(display, w2); + XSync(display, False); + XSync(client2, False); +/* Verify that UnmapNotify event was received on window2. */ + if (XPending(display) < 1) { + report("Expected UnmapNotify event not delivered."); + FAIL; + return; + } + else + CHECK; + XNextEvent(display, &event); + if (event.type != UnmapNotify) { + report("Expected %s, got %s", eventname(UnmapNotify), eventname(event.type)); + FAIL; + } + else + CHECK; +/* Verify that xname event was received on window1. */ + if (XPending(display) < 1) { + report("Expected %s event not delivered.", TestName); + FAIL; + return; + } + else + CHECK; + XNextEvent(display, &event); + if (event.type != EVENT) { + report("Expected %s, got %s", eventname(EVENT), eventname(event.type)); + FAIL; + } + else + CHECK; + if ((i = XPending(display)) > 0) { + report("Expected 2 events, got %d", i+2); + FAIL; + } + else + CHECK; +/* Verify that xname event was received on window1 by client2. */ + if (XPending(client2) < 1) { + report("Expected %s event not delivered to client2.", TestName); + FAIL; + return; + } + else + CHECK; + XNextEvent(client2, &event); + if (event.type != EVENT) { + report("Expected %s, got %s with client2", eventname(EVENT), eventname(event.type)); + FAIL; + } + else + CHECK; + if ((i = XPending(client2)) > 0) { + report("For client2: Expected 1 event, got %d", i+1); + FAIL; + } + else + CHECK; + + /* Additional possible testing: */ + /* Select for no events on window1. */ + /* Select for MapNotify events on window2. */ + /* Select for xname events on window2. */ + /* Select for xname events on window2 with client2. */ + /* Call XMapWindow on window2. */ + /* Verify that MapNotify event was received on window2. */ + /* Verify that xname event was received on window2. */ + /* Verify that xname event was received on window2 by client2. */ + /* Verify that pointer has remained where it was moved. */ + /* Select for xname events on window1. */ + /* Select for xname events on window1 with client2. */ + /* Select for ConfigureNotify events on window2. */ + /* Call XLowerWindow on window2. */ + /* Verify that ConfigureNotify event was received on window2. */ + /* Verify that xname event was received on window1. */ + /* Verify that xname event was received on window1 by client2. */ + /* Verify that pointer has remained where it was moved. */ + + /* Others: GravityNotify, CirculateNotify. */ + +/* Verify that pointer has remained where it was moved. */ + if (pointermoved(display, warp)) { + delete("Pointer moved unexpectedly"); + return; + } + else + CHECK; + CHECKPASS(11); +>>#NOTEd >>ASSERTION +>>#NOTEd When the window which contains the pointer changes, +>>#NOTEd then ARTICLE xname event is generated. +>>#NOTEm >>ASSERTION +>>#NOTEm When a client calls +>>#NOTEm .F XGrabPointer +>>#NOTEm or +>>#NOTEm .F XUngrabPointer , +>>#NOTEm then ARTICLE xname event is generated. +>>ASSERTION def +>>#NOTE Checked in previous test. +When an xname event is generated, +then +all clients having set +.S EnterWindowMask +event mask bits on the event window are delivered +an xname event. +>>ASSERTION Good A +>>#NOTE True for most events (except MappingNotify and selection stuff). +When an xname event is generated, +then +clients not having set +.S EnterWindowMask +event mask bits on the event window are not delivered +an xname event. +>>STRATEGY +Create client2. +Create window. +Move pointer outside of window. +Select for xname events on window. +Select for no events on window with client2. +Warp pointer to window. +Verify that a single xname event was received. +Verify that no events were received by client2. +>>CODE +int i; +Display *display = Dsp; +Display *client2; +Window w; +XEvent event; +XEvent good; +struct area area; +PointerPlace *warp1, *warp2; + +/* Create client2. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; +/* Create window. */ + area.x = 10; + area.y = 10; + area.width = W_STDWIDTH; + area.height = W_STDHEIGHT; + w = mkwin(display, (XVisualInfo *) NULL, &area, True); +/* Move pointer outside of window. */ + warp1 = warppointer(display, DRW(display), 0, 0); + if (warp1 == (PointerPlace *) NULL) + return; + else + CHECK; +/* Select for xname events on window. */ + XSelectInput(display, w, MASK); +/* Select for no events on window with client2. */ + XSelectInput(client2, w, NoEventMask); +/* Warp pointer to window. */ + XSync(display, True); + XSync(client2, True); + warp2 = warppointer(display, w, 2, 3); + if (warp2 == (PointerPlace *) NULL) + return; + else + CHECK; + XSync(display, False); + XSync(client2, False); +/* Verify that a single xname event was received. */ + if (XPending(display) < 1) { + report("Expected %s event not delivered.", TestName); + FAIL; + return; + } + else + CHECK; + XNextEvent(display, &event); + good.xcrossing.type = EVENT; + good.xcrossing.serial = event.xcrossing.serial; + good.xcrossing.send_event = False; + good.xcrossing.display = display; + good.xcrossing.window = w; + good.xcrossing.root = DRW(display); + good.xcrossing.subwindow = None; + good.xcrossing.time = event.xcrossing.time; + good.xcrossing.x = 2; + good.xcrossing.y = 3; + ROOTCOORDSET(display, &(good.xcrossing)); /* x_root and y_root */ + good.xcrossing.mode = NotifyNormal; + /* under virtual root windows detail gets set to NotifyNonlinear */ + good.xcrossing.detail = NotifyAncestor; + good.xcrossing.same_screen = True; + good.xcrossing.focus = True; /* assumes focus follows pointer */ + good.xcrossing.state = 0; + if (checkevent(&good, &event)) { + FAIL; + } + else + CHECK; + if ((i = XPending(display)) > 0) { + report("Expected 1 event, got %d", i+1); + FAIL; + } + else + CHECK; +/* Verify that no events were received by client2. */ + if ((i = XPending(client2)) > 0) { + report("For client2: Expected 0 events, got %d", i); + FAIL; + } + else + CHECK; + CHECKPASS(7); +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE Global except for MappingNotify and KeymapNotify. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M window +>>#NOTEs is set to +>>#NOTEs the +>>#NOTEs ifdef(`WINDOWTYPE', WINDOWTYPE, event) +>>#NOTEs window. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M root +>>#NOTEs is set to the source window's root window. +>>ASSERTION Good A +When an xname event is delivered +and the child of the event window contains the final pointer position, +then +.M subwindow +is set to +that child. +>>STRATEGY +Build window hierarchy. +Create the hierarchy. +Move pointer to outside of window. +Select no events on the sourcew. +Set EnterWindowMask event mask bits on the eventw. +Move pointer to child of event window. +Verify that a xname event was received. +Verify that subwindow is set to the source window. +>>CODE +int status; +Display *display = Dsp; +Winh *eventw; +Winh *sourcew; +XEvent good; +Winhg winhg; +PointerPlace *warp1, *warp2; + +/* Build window hierarchy. */ + winhg.area.x = 1; + winhg.area.y = 1; + winhg.area.width = W_STDWIDTH; + winhg.area.height = W_STDHEIGHT; + winhg.border_width = 1; + eventw = winh_adopt(display, (Winh *) NULL, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (eventw == (Winh *) NULL) { + report("Could not create eventw"); + return; + } + else + CHECK; + winhg.area.width /= 2; + winhg.area.height /= 2; + sourcew = winh_adopt(display, eventw, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (sourcew == (Winh *) NULL) { + report("Could not create sourcew"); + return; + } + else + CHECK; +/* Create the hierarchy. */ + if (winh_create(display, (Winh *) NULL, WINH_MAP)) + return; + else + CHECK; +/* Move pointer to outside of window. */ + warp1 = warppointer(display, DRW(display), 0, 0); + if (warp1 == (PointerPlace *) NULL) + return; + else + CHECK; +/* Select no events on the sourcew. */ + if (winh_selectinput(display, sourcew, NoEventMask)) + return; + else + CHECK; +/* Set EnterWindowMask event mask bits on the eventw. */ + if (winh_selectinput(display, eventw, MASK)) + return; + else + CHECK; + XSync(display, True); + good.type = EVENT; + good.xcrossing.display = display; + good.xcrossing.window = eventw->window; + good.xcrossing.subwindow = sourcew->window; +/* Move pointer to child of event window. */ + warp2 = warppointer(display, sourcew->window, 2, 2); + if (warp2 == (PointerPlace *) NULL) + return; + else + CHECK; +/* Verify that a xname event was received. */ + XSync(display, False); + if (winh_plant(eventw, &good, NoEventMask, WINH_NOMASK)) + return; + else + CHECK; + if (winh_harvest(display, (Winh *) NULL)) + return; + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that subwindow is set to the source window. */ + /* since only one event was expected, it must be first in list */ + if (eventw->delivered->event->xcrossing.subwindow != sourcew->window) { + report("Subwindow set to 0x%x, expected 0x%x", + eventw->delivered->event->xcrossing.subwindow, sourcew->window); + FAIL; + } + else + CHECK; + } + + CHECKPASS(10); + +>>ASSERTION def +>>#NOTE Already tested for in a test with only a single window involved. +When an xname event is delivered +and the child of the event window does not contain the final pointer position, +then +.M subwindow +is set to +.S None . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M time +>>#NOTEs is set to +>>#NOTEs the time in milliseconds at which the event was generated. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event window is on the same screen as the root window, +>>#NOTEs then +>>#NOTEs .M x +>>#NOTEs and +>>#NOTEs .M y +>>#NOTEs are set to +>>#NOTEs the coordinates of +>>#NOTEs the final pointer position relative to the event window's origin. +>>#REMOVED >>ASSERTION Good C +>>#COMMENT: +>># This assertion was removed April 1992 because +>># an enter notify event is not generated when the root +>># is on the alternate screen (bug report 0234). +>># -stuart. +>>#REMOVED >>#COMMENT: +>>#REMOVED >># Assertion category changed March 1992 since it was found not to require +>>#REMOVED >># device events. +>>#REMOVED >># - Cal. +>>#REMOVED If multiple screens are supported: +>>#REMOVED When an xname event is delivered +>>#REMOVED and the event and root windows are not on the same screen, +>>#REMOVED then +>>#REMOVED .M x +>>#REMOVED and +>>#REMOVED .M y +>>#REMOVED are set to +>>#REMOVED zero. +>>#REMOVED >>STRATEGY +>>#REMOVED If multiple screens are supported: +>>#REMOVED Create a window on the default screen. +>>#REMOVED Create a window on the alternate screen. +>>#REMOVED Warp the pointer into the first window. +>>#REMOVED Grab the pointer for the first window. +>>#REMOVED Warp the pointer into the alternate screen window. +>>#REMOVED Verify that an xname event was generated relative to the grab window. +>>#REMOVED Verify that the x and y components were set to zero. +>>#REMOVED >>CODE +>>#REMOVED Window wg; +>>#REMOVED Window w2; +>>#REMOVED XEvent ev; +>>#REMOVED int gr; +>>#REMOVED +>>#REMOVED /* If multiple screens are supported: */ +>>#REMOVED if (config.alt_screen == -1) { +>>#REMOVED unsupported("Multiple screens not supported."); +>>#REMOVED return; +>>#REMOVED } else +>>#REMOVED CHECK; +>>#REMOVED +>>#REMOVED /* Create a window on the default screen. */ +>>#REMOVED wg = defwin(Dsp); +>>#REMOVED /* Create a window on the alternate screen. */ +>>#REMOVED w2 = defdraw(Dsp, VI_ALT_WIN); +>>#REMOVED +>>#REMOVED /* Warp the pointer into the first window. */ +>>#REMOVED (void) warppointer(Dsp, wg, 13, 17); +>>#REMOVED XSync(Dsp, True); +>>#REMOVED +>>#REMOVED /* Grab the pointer for the first window. */ +>>#REMOVED if((gr = XGrabPointer(Dsp, wg, False, EVENTMASK|PointerMotionMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime)) != GrabSuccess) { +>>#REMOVED delete("XGrabPointer() returned %s instead of GrabSuccess.", grabreplyname(gr)); +>>#REMOVED return; +>>#REMOVED } else +>>#REMOVED CHECK; +>>#REMOVED +>>#REMOVED /* Warp the pointer into the alternate screen window. */ +>>#REMOVED XSync(Dsp, True); +>>#REMOVED (void) warppointer(Dsp, w2, 7,11); +>>#REMOVED XSync(Dsp, False); +>>#REMOVED +>>#REMOVED /* Verify that an xname event was generated relative to the grab window. */ +>>#REMOVED if (XCheckWindowEvent(Dsp, wg, EVENTMASK, &ev) == False) { +>>#REMOVED report("Expected %s event was not received.", eventname(EVENT)); +>>#REMOVED FAIL; +>>#REMOVED } else { +>>#REMOVED CHECK; +>>#REMOVED +>>#REMOVED /* Verify that the x and y components were set to zero. */ +>>#REMOVED if(ev.xcrossing.x != 0 || ev.xcrossing.y != 0) { +>>#REMOVED report("The x (value %d) and y (value %d) components of the %s event were not set to zero.", +>>#REMOVED ev.xcrossing.x, ev.xcrossing.y, eventname(EVENT)); +>>#REMOVED FAIL; +>>#REMOVED } else +>>#REMOVED CHECK; +>>#REMOVED } +>>#REMOVED +>>#REMOVED XUngrabPointer(Dsp, CurrentTime); +>>#REMOVED CHECKPASS(4); +>>#REMOVED +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M x_root +>>#NOTEs and +>>#NOTEs .M y_root +>>#NOTEs are set to coordinates of the pointer +>>#NOTEs when the event was generated +>>#NOTEs relative to the root window's origin. +>>#NOTEm >>ASSERTION +>>#NOTEm >>#NOTE +>>#NOTEm >>#NOTE The spec does not actually state this. What the spec states is that +>>#NOTEm >>#NOTE things behave as if the pointer moved from the confine-to window to +>>#NOTEm >>#NOTE the grab window, the opposite of what one might expect. +>>#NOTEm >>#NOTE +>>#NOTEm When ARTICLE xname event is generated as the result of a grab activation, +>>#NOTEm then xname event generation occurs as if the pointer moved from +>>#NOTEm the grab window to the confine-to window with +>>#NOTEm .M mode +>>#NOTEm set to +>>#NOTEm .S NotifyGrab . +>>#NOTEm >>ASSERTION +>>#NOTEm >>#NOTE +>>#NOTEm >>#NOTE The spec does not actually state this. What the spec states is that +>>#NOTEm >>#NOTE things behave as if the pointer moved from the grab window to +>>#NOTEm >>#NOTE the confine-to window, the opposite of what one might expect. +>>#NOTEm >>#NOTE +>>#NOTEm When ARTICLE xname event is generated as the result of a grab deactivation, +>>#NOTEm then xname event generation occurs as if the pointer moved from +>>#NOTEm the confine-to window to the grab window with +>>#NOTEm .M mode +>>#NOTEm set to +>>#NOTEm .S NotifyUngrab . +>>ASSERTION def +All xname events are delivered after +any related +.S LeaveNotify +are delivered. +>>#NOTE +>>#NOTE It would not surprise me in the least if these assertions could +>>#NOTE be simplified and/or reduced in number. +>>#NOTE +>>ASSERTION Good A +When the pointer moves from window A to window B +and A is an inferior of B, +then an xname event is generated on window B with +.M detail +set to +.S NotifyInferior . +>>STRATEGY +Build window hierarchy. +Move pointer to known location. +Set window B. +Set window A to child of window B. +Select for xname and LeaveNotify events on windows A and B. +Move pointer from window A to window B. +Verify xname event received on window B. +Verify that detail is set to NotifyInferior. +Verify that all xname events are delivered after all +LeaveNotify events. +>>CODE +Display *display = Dsp; +int depth = 3; +Winh *A, *B; +int status; +XEvent *event; + +/* Build window hierarchy. */ + if (winh(display, depth, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set window B. */ + B = guardian->firstchild; +/* Set window A to child of window B. */ + A = B->firstchild; +/* Select for xname and LeaveNotify events on windows A and B. */ + if (winh_selectinput(display, A, BOTHMASKS)) { + report("Error selecting for events."); + return; + } + else + CHECK; + if (winh_selectinput(display, B, BOTHMASKS)) { + report("Error selecting for events."); + return; + } + else + CHECK; + +/* Move pointer from window A to window B. */ + XWarpPointer(display, None, A->window, 0, 0, 0, 0, 0, 0); + XSync(display, True); + XWarpPointer(display, None, B->window, 0, 0, 0, 0, 0, 0); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify xname event received on window B. */ + if (B->delivered == (Winhe *) NULL || (event = B->delivered->event)->type != EVENT) { + report("Expected event not generated"); + FAIL; + } + else + { +/* Verify that detail is set to NotifyInferior. */ + if (event->xcrossing.detail != NotifyInferior) { + report("Got detail %d, expected %d", event->xcrossing.detail, NotifyInferior); + FAIL; + } + else + CHECK; +/* Verify that all xname events are delivered after all */ +/* LeaveNotify events. */ + status = winh_ordercheck(OTHEREVENT, EVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(7); +>>ASSERTION Good A +When the pointer moves from window A to window B +and B is an inferior of A, +then an xname event is generated once on each window +between window A and window B, exclusive, +in window hierarchy order, +with +.M detail +set to +.S NotifyVirtual +and then on window B with +.M detail +set to +.S NotifyAncestor . +>>STRATEGY +Create client. +Build window hierarchy. +Move pointer to known location. +Set window A. +Set window B to inferior of window A. +Select for xname and LeaveNotify events on all windows. +Move pointer from window A to window B. +Verify events delivered, between window A and window B, exclusive, +in proper order. +Verify that detail is set to NotifyVirtual. +Verify that event delivered to window B with detail set to NotifyAncestor. +Verify that all xname events are delivered after all +LeaveNotify events. +>>CODE +Display *display; +int depth = 4; +Winh *A, *B; +int status; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy. */ + if (winh(display, depth, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set window A. */ + A = guardian->firstchild; +/* Set window B to inferior of window A. */ + B = A->firstchild->firstchild->firstchild; +/* Select for xname and LeaveNotify events on all windows. */ + if (winh_selectinput(display, (Winh *) NULL, BOTHMASKS)) { + report("Could not select for events"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(B, A->firstchild, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; +/* Move pointer from window A to window B. */ + XWarpPointer(display, None, A->window, 0, 0, 0, 0, 0, 0); + XSync(display, True); + XWarpPointer(display, None, B->window, 0, 0, 0, 0, 0, 0); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) + return; + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify events delivered, between window A and window B, exclusive, */ +/* in proper order. */ + increasing = True; + if (winh_climb(B, A->firstchild, checksequence)) + FAIL; + else + CHECK; +/* Verify that detail is set to NotifyVirtual. */ + _detail_ = NotifyVirtual; + if (winh_climb(B->parent, A->firstchild, checkdetail)) + FAIL; + else + CHECK; +/* Verify that event delivered to window B with detail set to NotifyAncestor. */ + _detail_ = NotifyAncestor; + if (winh_climb(B, B, checkdetail)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered after all */ +/* LeaveNotify events. */ + status = winh_ordercheck(OTHEREVENT, EVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(11); +>>ASSERTION Good A +When the pointer moves from window A to window B +and there exists a window C that is their least common ancestor, +then an xname event is generated once on each window +between window C and window B, exclusive, with +.M detail +set to +.S NotifyNonlinearVirtual +and then on window B with +.M detail +set to +.S NotifyNonlinear . +>>STRATEGY +Create client. +Build window hierarchy. +Move pointer to known location. +Set windows A, B, and C. +Select for xname and LeaveNotify events on all windows. +Move pointer from window A to window B. +Verify events delivered, between window C and window B, exclusive, +in proper order. +Verify that detail is set to NotifyNonlinearVirtual. +Verify that event delivered to window B with detail set to NotifyNonlinear. +Verify that all xname events are delivered after all +LeaveNotify events. +>>CODE +Display *display; +int depth = 5; +Winh *A, *B, *C; +int status; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy. */ + if (winh(display, depth, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set windows A, B, and C. */ + C = guardian->firstchild; + A = C->firstchild->nextsibling->firstchild->firstchild; + B = C->firstchild-> firstchild->firstchild; +/* Select for xname and LeaveNotify events on all windows. */ + if (winh_selectinput(display, (Winh *) NULL, BOTHMASKS)) { + report("Could not select for events"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(B, C->firstchild, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; +/* Move pointer from window A to window B. */ + XWarpPointer(display, None, A->window, 0, 0, 0, 0, 0, 0); + XSync(display, True); + XWarpPointer(display, None, B->window, 0, 0, 0, 0, 0, 0); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) + return; + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify events delivered, between window C and window B, exclusive, */ +/* in proper order. */ + increasing = True; + if (winh_climb(B, C->firstchild, checksequence)) + FAIL; + else + CHECK; +/* Verify that detail is set to NotifyNonlinearVirtual. */ + _detail_ = NotifyNonlinearVirtual; + if (winh_climb(B->parent, C->firstchild, checkdetail)) + FAIL; + else + CHECK; +/* Verify that event delivered to window B with detail set to NotifyNonlinear. */ + _detail_ = NotifyNonlinear; + if (winh_climb(B, B, checkdetail)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered after all */ +/* LeaveNotify events. */ + status = winh_ordercheck(OTHEREVENT, EVENT); + if (status == -1) + return; + else if (status) { + report("Incorrect event ordering."); + FAIL; + } + else + CHECK; + } + CHECKPASS(11); +>>ASSERTION Good A +If the implementation supports multiple screens: +When the pointer moves from window A to window B +and window A and window B are on different screens +and window B is not a root window, +then an xname event is generated on +each window from window B's root down to but not including window B with +.M detail +set to +.S NotifyNonlinearVirtual +and then on window B with +.M detail +set to +.S NotifyNonlinear . +>>STRATEGY +Check to see if multiple screens are supported. +Build window hierarchy. +Move pointer to known location. +Select for xname and LeaveNotify events between windows B and +B's root window. +Move pointer from window A to window B. +Verify events delivered on each window from window B's root +down to but not including window B in proper order. +Verify that detail is set to NotifyNonlinearVirtual. +Verify that event delivered to window B with detail set to NotifyNonlinear. +Verify that all xname events are delivered after all +LeaveNotify events. +>>CODE +Display *display; +int depth = 5; +Winh *A, *B, *Broot; +int status; + +/* Check to see if multiple screens are supported. */ + if (config.alt_screen == -1) { + unsupported("Multiple screens not supported."); + return; + } + else + CHECK; +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy. */ + if (winh(display, depth, WINH_MAP|WINH_BOTH_SCREENS)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set windows A and B. */ + A = guardian->firstchild; + Broot = guardian->nextsibling; + B = Broot->firstchild->firstchild->firstchild; +/* Select for xname and LeaveNotify events on all windows. */ + if (winh_selectinput(display, (Winh *) NULL, BOTHMASKS)) { + report("Could not select for events"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(B, Broot, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; +/* Move pointer from window A to window B. */ + XWarpPointer(display, None, A->window, 0, 0, 0, 0, 0, 0); + XSync(display, True); + XWarpPointer(display, None, B->window, 0, 0, 0, 0, 0, 0); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) + return; + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify events delivered on each window from window B's root */ +/* down to but not including window B in proper order. */ + increasing = True; + if (winh_climb(B, Broot, checksequence)) + FAIL; + else + CHECK; +/* Verify that detail is set to NotifyNonlinearVirtual. */ + _detail_ = NotifyNonlinearVirtual; + if (winh_climb(B->parent, Broot, checkdetail)) + FAIL; + else + CHECK; +/* Verify that event delivered to window B with detail set to NotifyNonlinear. */ + _detail_ = NotifyNonlinear; + if (winh_climb(B, B, checkdetail)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered after all */ +/* LeaveNotify events. */ + status = winh_ordercheck(OTHEREVENT, EVENT); + if (status == -1) + return; + else if (status) { + report("Incorrect event ordering."); + FAIL; + } + else + CHECK; + } + CHECKPASS(12); +>>ASSERTION def +>>#NOTE Tested above. +If the implementation supports multiple screens: +When the pointer moves from window A to window B +and window A and window B are on different screens, +then an xname event is generated on window B with +.M detail +set to +.S NotifyNonlinear . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event and root windows are on the same screen, +>>#NOTEs then +>>#NOTEs .M same_screen +>>#NOTEs is set to +>>#NOTEs .S True . +>>#REMOVED >>ASSERTION Good C +>>#COMMENT: +>># This assertion was removed April 1992 because +>># an enter notify event is not generated when the root +>># is on the alternate screen (bug report 0234). +>># -stuart. +>>#REMOVED >>#COMMENT: +>>#REMOVED >># Assertion category changed March 1992 since it was found not to require +>>#REMOVED >># device events. +>>#REMOVED >># - Cal. +>>#REMOVED If multiple screens are supported: +>>#REMOVED When an xname event is delivered +>>#REMOVED and the event and root windows are not on the same screen, +>>#REMOVED then +>>#REMOVED .M same_screen +>>#REMOVED is set to +>>#REMOVED .S False . +>>#REMOVED >>STRATEGY +>>#REMOVED If multiple screens are supported: +>>#REMOVED Create a window on the default screen. +>>#REMOVED Create a window on the alternate screen. +>>#REMOVED Warp the pointer into the first window. +>>#REMOVED Grab the pointer for the first window. +>>#REMOVED Warp the pointer into the alternate screen window. +>>#REMOVED Verify that an xname event was generated relative to the grab window. +>>#REMOVED Verify that the same_screen component was False. +>>#REMOVED >>CODE +>>#REMOVED Window wg; +>>#REMOVED Window w2; +>>#REMOVED XEvent ev; +>>#REMOVED int gr; +>>#REMOVED +>>#REMOVED +>>#REMOVED /* If multiple screens are supported: */ +>>#REMOVED if (config.alt_screen == -1) { +>>#REMOVED unsupported("Multiple screens not supported."); +>>#REMOVED return; +>>#REMOVED } else +>>#REMOVED CHECK; +>>#REMOVED +>>#REMOVED /* Create a window on the default screen. */ +>>#REMOVED wg = defwin(Dsp); +>>#REMOVED /* Create a window on the alternate screen. */ +>>#REMOVED w2 = defdraw(Dsp, VI_ALT_WIN); +>>#REMOVED +>>#REMOVED /* Warp the pointer into the first window. */ +>>#REMOVED (void) warppointer(Dsp, wg, 13, 17); +>>#REMOVED XSync(Dsp, True); +>>#REMOVED +>>#REMOVED /* Grab the pointer for the first window. */ +>>#REMOVED if((gr = XGrabPointer(Dsp, wg, False, EVENTMASK|PointerMotionMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime)) != GrabSuccess) { +>>#REMOVED delete("XGrabPointer() returned %s instead of GrabSuccess.", grabreplyname(gr)); +>>#REMOVED return; +>>#REMOVED } else +>>#REMOVED CHECK; +>>#REMOVED +>>#REMOVED /* Warp the pointer into the alternate screen window. */ +>>#REMOVED XSync(Dsp, True); +>>#REMOVED (void) warppointer(Dsp, w2, 7,11); +>>#REMOVED XSync(Dsp, False); +>>#REMOVED +>>#REMOVED /* Verify that an xname event was generated relative to the grab window. */ +>>#REMOVED if (XCheckWindowEvent(Dsp, wg, EVENTMASK, &ev) == False) { +>>#REMOVED report("Expected %s event was not received.", eventname(EVENT)); +>>#REMOVED FAIL; +>>#REMOVED } else { +>>#REMOVED +>>#REMOVED CHECK; +>>#REMOVED /* Verify that the same_screen component was False. */ +>>#REMOVED if(ev.xcrossing.same_screen != False) { +>>#REMOVED report("The same_screen component of the %s event was not set to False.", eventname(EVENT)); +>>#REMOVED FAIL; +>>#REMOVED } else +>>#REMOVED CHECK; +>>#REMOVED } +>>#REMOVED +>>#REMOVED XUngrabPointer(Dsp, CurrentTime); +>>#REMOVED CHECKPASS(4); +>>#REMOVED +>>ASSERTION Good A +When an xname event is delivered +and the event window is the focus window, +then +.M focus +is set to +.S True . +>>STRATEGY +Build window hierarchy. +Set input focus to eventw. +Move pointer to known location. +Select xname events on the eventw. +Call XWarpPointer to move the pointer to eventw. +Verify event was delivered with focus set to True. +Move pointer back to known location. +Clear event expectations. +Set input focus to known window. +Call XWarpPointer to move the pointer to eventw. +Verify event was delivered with focus set to False. +>>CODE +Display *display = Dsp; +Winh *eventw; +int status; + +/* Build window hierarchy. */ + if (winh(display, 1, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; + eventw = guardian->firstchild; +/* Set input focus to eventw. */ + XSetInputFocus(display, eventw->window, RevertToPointerRoot, CurrentTime); +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Select xname events on the eventw. */ + if (winh_selectinput(display, eventw, MASK)) + return; + else + CHECK; +/* Call XWarpPointer to move the pointer to eventw. */ + XSync(display, True); + XWarpPointer(display, None, eventw->window, 0, 0, 0, 0, 0, 0); + XSync(display, False); +/* Verify event was delivered with focus set to True. */ + good.type = EVENT; + good.xany.display = display; + good.xany.window = eventw->window; + if (winh_plant(eventw, &good, NoEventMask, WINH_NOMASK)) { + report("Could not initialize for event delivery"); + return; + } + else + CHECK; + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { + if (eventw->delivered->event->xcrossing.focus != True) { + report("Focus set to %d, expected %d", + eventw->delivered->event->xcrossing.focus,True); + FAIL; + } + else + CHECK; + } +/* Move pointer back to known location. */ + XWarpPointer(display, None, DRW(display), 0, 0, 0, 0, 0, 0); +/* Set input focus to known window. */ + XSetInputFocus(display, eventw->nextsibling->window, RevertToPointerRoot, CurrentTime); +/* Call XWarpPointer to move the pointer to eventw. */ + XSync(display, True); + XWarpPointer(display, None, eventw->window, 0, 0, 0, 0, 0, 0); + XSync(display, False); +/* Verify event was delivered with focus set to False. */ + if (winh_plant(eventw, &good, NoEventMask, WINH_NOMASK)) { + report("Could not initialize for event delivery"); + return; + } + else + CHECK; + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { + if (eventw->delivered->event->xcrossing.focus != False) { + report("Focus set to %d, expected %d", + eventw->delivered->event->xcrossing.focus, False); + FAIL; + } + else + CHECK; + } + CHECKPASS(9); +>>ASSERTION Good A +When an xname event is delivered +and the event window is an inferior of the focus window, +then +.M focus +is set to +.S True . +>>STRATEGY +Build window hierarchy. +Set input focus to ancestor of window eventw. +Move pointer to known location. +Select xname events on the eventw. +Call XWarpPointer to move the pointer to eventw. +Verify event was delivered with focus set to True. +>>CODE +Display *display = Dsp; +Winh *eventw, *focusw; +int status; + +/* Build window hierarchy. */ + if (winh(display, 2, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; + focusw = guardian->firstchild; + eventw = guardian->firstchild->firstchild; +/* Set input focus to ancestor of window eventw. */ + XSetInputFocus(display, focusw->window, RevertToPointerRoot, CurrentTime); +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Select xname events on the eventw. */ + if (winh_selectinput(display, eventw, MASK)) + return; + else + CHECK; +/* Call XWarpPointer to move the pointer to eventw. */ + XSync(display, True); + XWarpPointer(display, None, eventw->window, 0, 0, 0, 0, 2, 2); + XSync(display, False); +/* Verify event was delivered with focus set to True. */ + good.type = EVENT; + good.xany.display = display; + good.xany.window = eventw->window; + if (winh_plant(eventw, &good, NoEventMask, WINH_NOMASK)) { + report("Could not initialize for event delivery"); + return; + } + else + CHECK; + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { + if (eventw->delivered->event->xcrossing.focus != True) { + report("Focus set to %d, expected %d", + eventw->delivered->event->xcrossing.focus, True); + FAIL; + } + else + CHECK; + } + CHECKPASS(6); +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event window is not the focus window or +>>#NOTEs an inferior of the focus window, +>>#NOTEs then +>>#NOTEs .M focus +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M state +>>#NOTEs is set to +>>#NOTEs indicate the logical state +>>#NOTEs of the pointer buttons, +>>#NOTEs which is the bitwise OR of one or more of +>>#NOTEs the button or modifier key masks +>>#NOTEs .S Button1Mask , +>>#NOTEs .S Button2Mask , +>>#NOTEs .S Button3Mask , +>>#NOTEs .S Button4Mask , +>>#NOTEs .S Button5Mask , +>>#NOTEs .S ShiftMask , +>>#NOTEs .S LockMask , +>>#NOTEs .S ControlMask , +>>#NOTEs .S Mod1Mask , +>>#NOTEs .S Mod2Mask , +>>#NOTEs .S Mod3Mask , +>>#NOTEs .S Mod4Mask , +>>#NOTEs and +>>#NOTEs .S Mod5Mask . diff --git a/xts5/Xlib11/Expose/Expose.m b/xts5/Xlib11/Expose/Expose.m new file mode 100644 index 00000000..c17110f0 --- /dev/null +++ b/xts5/Xlib11/Expose/Expose.m @@ -0,0 +1,462 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/Expose/Expose.m,v 1.2 2005-11-03 08:42:27 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/Expose/Expose.m +>># +>># Description: +>># Tests for Expose() +>># +>># Modifications: +>># $Log: exps.m,v $ +>># Revision 1.2 2005-11-03 08:42:27 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:16 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:12 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:50:44 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:22:54 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:26 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:01:18 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:58:01 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE Expose Xlib11 +>>EXTERN +#define EVENT Expose +#define MASK ExposureMask +>>ASSERTION Good A +The server does not generate xname events +on windows whose class is specified as +.S InputOnly . +>>STRATEGY +Create InputOnly window. +Select for Expose and MapNotify events on window. +Map window. +Verify that a MapNotify event was received. +Verify that no Expose events were received. +>>CODE +Display *display = Dsp; +Window w; +XEvent event_return; +int events; + +#ifdef OTHERMASK +#undef OTHERMASK +#endif +#define OTHERMASK StructureNotifyMask +#ifdef OTHEREVENT +#undef OTHEREVENT +#endif +#define OTHEREVENT MapNotify + +/* Create InputOnly window. */ + w = iponlywin(display); +/* Select for Expose and MapNotify events on window. */ + XSelectInput(display, w, MASK|OTHERMASK); +/* Map window. */ + XSync(display, True); + XMapWindow(display, w); + XSync(display, False); +/* Verify that a MapNotify event was received. */ + if (!XCheckTypedWindowEvent(display, w, OTHEREVENT, &event_return)) { + delete("Expected %s event, got none", eventname(OTHEREVENT)); + return; + } + else + CHECK; +/* Verify that no Expose events were received. */ + if (XCheckTypedWindowEvent(display, w, EVENT, &event_return)) { + delete("Got %s event, expected none", eventname(EVENT)); + return; + } + else + CHECK; + events = XPending(display); + if (events > 0) { + delete("Received %d more events than expected", events); + return; + } + else + CHECK; + + CHECKPASS(3); +>>ASSERTION def +>>#NOTE Tested below in the "...all clients having set..." assertion. +When no valid contents are available for regions of a window +and the regions are visible, +then an xname event is generated. +>>ASSERTION Good B 1 +>>#NOTE Can't predict when/how the server will perform backing-store. +When no valid contents are available for regions of a window +and the regions are viewable but not visible +and the server is maintaining backing store on the window, +then an xname event is generated. +>>ASSERTION Good B 1 +>>#NOTE Can't predict when/how the server will perform backing-store. +When no valid contents are available for regions of a window +and the window is not viewable but the server is honoring +the window's backing-store attribute of +.S Always +or +.S WhenMapped , +then an xname event is generated. +>>ASSERTION Good A +When an xname events are generated, +then they are contiguously delivered by the server. +>>STRATEGY +Create client. +Build and create window hierarchy. +Choose event window. +Select for Visibility events on all windows. +Select for Expose events on event window. +Unmap and remap event window to generate Expose events. +Verify that Expose events are contiguously delivered. +>>CODE +Display *display; +Winh *eventw; +Winh *child; +Winhe *winhe; +int expected; +int lastcount; + +/* Create client. */ + /* + * Do not use Dsp because we are selecting on root window. + * We could instead de-select on root window prior to returning, + * but this is actually easier. + */ + display = opendisplay(); + if (display == (Display *) NULL) { + delete("Could not open display."); + return; + } + else + CHECK; +/* Build and create window hierarchy. */ + if (winh(display, 2, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Choose event window. */ + eventw = guardian->firstchild; +/* Select for Visibility events on all windows. */ + if (winh_selectinput(display, (Winh *)NULL, VisibilityChangeMask)) + return; + else + CHECK; +/* Select for Expose events on event window. */ + if (winh_selectinput(display, eventw, VisibilityChangeMask|MASK)) + return; + else + CHECK; +/* Unmap and remap event window to generate Expose events. */ + XUnmapWindow(display, eventw->window); + XSync(display, True); + XMapWindow(display, eventw->window); + XSync(display, False); +/* Verify that events are contiguously delivered. */ + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; + if (winh_qdel == (Winhe *) NULL) { + delete("No events delivered."); + return; + } + else + CHECK; + winhe = winh_qdel; + while (winhe && winhe->event->type == VisibilityNotify) + winhe = winhe->next; + expected = -1; + for ( ; winhe && expected; winhe = winhe->next) { + if (expected == -1) + CHECK; + if (winhe->event->type != EVENT) { + report("Received %s event while only expecting %s types", + eventname(winhe->event->type), eventname(EVENT)); + delete("Unexpected event received."); + return; + } + if (winhe->event->xexpose.window != eventw->window) { + report("Received event on wrong window, got %d expecting %d", + winhe->event->xexpose.window, eventw->window); + delete("Unexpected event received."); + return; + } + lastcount = winhe->event->xexpose.count; + if (lastcount < expected) + expected--; + else + expected = lastcount; + } + if (lastcount != 0) { + report("Last %s had count set to %d, not zero", + eventname(EVENT), lastcount); + FAIL; + } + else + CHECK; + while (winhe && winhe->event->type == VisibilityNotify) + winhe = winhe->next; + if (winhe) { + report("Received %s event while only expecting %s types", + eventname(winhe->event->type), eventname(VisibilityNotify)); + FAIL; + } + else + CHECK; + CHECKPASS(9); +>>ASSERTION Good A +When an xname event is generated, +then +all clients having set +.S ExposureMask +event mask bits on the event window are delivered +an xname event. +>>STRATEGY +Create clients client2 and client3. +Build and create window hierarchy. +Choose event window. +Select for Expose events on event window. +Select for Expose events on event window with client2. +Select for no events on event window with client3. +Unmap and remap event window to generate Expose events. +Verify that events are delivered to selecting clients. +Verify that no Expose events are received for client3. +>>CODE +Display *display = Dsp; +Display *client2, *client3; +Winh *eventw; +int events; +Window w; +XEvent event_return; + +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; +/* Build and create window hierarchy. */ + if (winh(display, 2, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Choose event window. */ + eventw = guardian->firstchild; + w = eventw->window; +/* Select for Expose events on event window. */ + XSelectInput(display, w, MASK); +/* Select for Expose events on event window with client2. */ + XSelectInput(client2, w, MASK); +/* Select for no events on event window with client3. */ + XSelectInput(client3, w, NoEventMask); +/* Unmap and remap event window to generate Expose events. */ + XUnmapWindow(display, eventw->window); + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XMapWindow(display, eventw->window); + XSync(display, False); + XSync(client2, False); + XSync(client3, False); +/* Verify that events are delivered to selecting clients. */ + if (!XCheckTypedWindowEvent(display, w, EVENT, &event_return)) { + delete("Expected %s event, got none", eventname(EVENT)); + return; + } + else + CHECK; + if (!XCheckTypedWindowEvent(client2, w, EVENT, &event_return)) { + delete("Expected %s event, got none with client2", eventname(EVENT)); + return; + } + else + CHECK; +/* Verify that no Expose events are received for client3. */ + if (XCheckTypedWindowEvent(client3, w, EVENT, &event_return)) { + delete("Got %s event, expected none", eventname(EVENT)); + return; + } + else + CHECK; + + CHECKPASS(6); +>>ASSERTION def +>>#NOTE True for most events (except MappingNotify and selection stuff). +When an xname event is generated, +then +clients not having set +.S ExposureMask +event mask bits on the event window are not delivered +an xname event. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE Global except for MappingNotify and KeymapNotify. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M window +>>#NOTEs is set to +>>#NOTEs the +>>#NOTEs ifdef(`WINDOWTYPE', WINDOWTYPE, event) +>>#NOTEs window. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M x +>>#NOTEs and +>>#NOTEs .M y +>>#NOTEs are set to +>>#NOTEs the coordinates relative to the window's origin +>>#NOTEs and indicate the upper-left corner of the rectangle defining the exposed region. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M width +>>#NOTEs and +>>#NOTEs .M height +>>#NOTEs are set to +>>#NOTEs the size (extent) of the rectangle. +>>#NOTEs >>ASSERTION +>>#NOTEs When +>>#NOTEs .M count +>>#NOTEs is set to zero, +>>#NOTEs then no further xname events are to follow for the exposed DRAWABLE. +>>#NOTEs >>ASSERTION +>>#NOTEs When +>>#NOTEs .M count +>>#NOTEs is greater than zero, +>>#NOTEs then at least +>>#NOTEs .M count +>>#NOTEs xname events +>>#NOTEs are to follow for the exposed DRAWABLE. diff --git a/xts5/Xlib11/FocusIn/FocusIn.m b/xts5/Xlib11/FocusIn/FocusIn.m new file mode 100644 index 00000000..b86c06c8 --- /dev/null +++ b/xts5/Xlib11/FocusIn/FocusIn.m @@ -0,0 +1,3103 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/FocusIn/FocusIn.m,v 1.2 2005-11-03 08:42:28 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/FocusIn/FocusIn.m +>># +>># Description: +>># Tests for FocusIn() +>># +>># Modifications: +>># $Log: fcsin.m,v $ +>># Revision 1.2 2005-11-03 08:42:28 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:16 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:13 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:50:46 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:22:54 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:27 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:01:21 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:58:06 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE FocusIn Xlib11 +>>SET startup focusstartup +>>SET cleanup focuscleanup +>>EXTERN +#define EVENT FocusIn +#define OTHEREVENT FocusOut +#define MASK FocusChangeMask + +static Display *_display_; +static int _detail_; +static long _event_mask_; +static XEvent good; + +static int +selectinput(start, stop, current, previous) +Winh *start, *stop, *current, *previous; +{ +#ifdef lint + winh_free(start); + winh_free(stop); + winh_free(previous); +#endif + return(winh_selectinput(_display_, current, _event_mask_)); +} + +static int +plant(start, stop, current, previous) +Winh *start, *stop, *current, *previous; +{ +#ifdef lint + winh_free(start); + winh_free(stop); + winh_free(previous); +#endif + good.xany.window = current->window; + return(winh_plant(current, &good, NoEventMask, WINH_NOMASK)); +} + +static Bool increasing; /* event sequence increases as we climb */ + +static int +checksequence(start, stop, current, previous) +Winh *start, *stop, *current, *previous; +{ + Winhe *d; + int current_sequence; + int status; + static int last_sequence; + +#ifdef lint + winh_free(start); + winh_free(stop); +#endif + /* look for desired event type */ + for (d = current->delivered; d != (Winhe *) NULL; d = d->next) { + if (d->event->type == good.type) { + current_sequence = d->sequence; + break; + } + } + if (d == (Winhe *) NULL) { + report("%s event not delivered", eventname(good.type)); + delete("Missing event"); + return(-1); + } + if (previous == (Winh *) NULL) + status = 0; /* first call, no previous sequence value */ + else { + /* assume sequence numbers are not the same */ + status = (current_sequence < last_sequence); + if (increasing) + status = (status ? 0 : 1); + if (status) + report("Ordering problem between 0x%x (%d) and 0x%x (%d)", + current->window, current_sequence, + previous->window, last_sequence); + } + last_sequence = current_sequence; + return(status); +} + +static int +checkdetail(start, stop, current, previous) +Winh *start, *stop, *current, *previous; +{ + Winhe *d; + +#ifdef lint + winh_free(start); + winh_free(stop); + winh_free(previous); +#endif + /* look for desired event type */ + for (d = current->delivered; d != (Winhe *) NULL; d = d->next) + if (d->event->type == good.type) + break; + if (d == (Winhe *) NULL) { + report("%s event not delivered to window 0x%x", + eventname(good.type), current->window); + delete("Missing event"); + return(-1); + } + /* check detail */ + if (_detail_ != d->event->xfocus.detail) { + report("Expected detail of %d, got %d on window 0x%x", + _detail_, d->event->xfocus.detail, current->window); + return(1); + } + return(0); +} +>>ASSERTION Good A +When a xname event is generated, +then +all clients having set +.S FocusChangeMask +event mask bits on the event window are delivered +a xname event. +>>STRATEGY +Create client. +Create clients client2 and client3. +Create window. +Move pointer to known location. +Select for xname events on window. +Select for xname events on window with client2. +Select for no events on window with client3. +Generate xname event by changing focus to window. +Verify that xname event was delivered. +Verify members in delivered xname event structure. +Verify that xname event was delivered to client2. +Verify members in delivered xname event structure. +Verify that no events were delivered to client3. +>>CODE +int i; +Display *display; +Display *client2, *client3; +Window w; +XEvent event; +XFocusChangeEvent good; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; +/* Create window. */ + w = mkwin(display, (XVisualInfo *) NULL, (struct area *) NULL, True); +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) { + report("Couldn't move pointer"); + return; + } + else + CHECK; +/* Select for xname events on window. */ + XSelectInput(display, w, MASK); +/* Select for xname events on window with client2. */ + XSelectInput(client2, w, MASK); +/* Select for no events on window with client3. */ + XSelectInput(client3, w, NoEventMask); +/* Generate xname event by changing focus to window. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XSetInputFocus(display, w, RevertToNone, CurrentTime); + XSync(display, False); + XSync(client2, False); + XSync(client3, False); +/* Verify that xname event was delivered. */ + if (XPending(display) < 1) { + report("Expected %s event not delivered.", eventname(EVENT)); + FAIL; + return; + } + else + CHECK; +/* Verify members in delivered xname event structure. */ + XNextEvent(display, &event); + good = event.xfocus; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.window = w; + good.mode = NotifyNormal; + good.detail = NotifyAncestor; + if (checkevent((XEvent*)&good, &event)) { + report("Unexpected event structure member value(s)"); + FAIL; + } + else + CHECK; + if ((i = XPending(display)) > 0) { + report("Expected 1 event, got %d", i+1); + FAIL; + } + else + CHECK; +/* Verify that xname event was delivered to client2. */ + if (XPending(client2) < 1) { + report("Expected %s event not delivered to client2.", eventname(EVENT)); + FAIL; + return; + } + else + CHECK; +/* Verify members in delivered xname event structure. */ + XNextEvent(client2, &event); + good = event.xfocus; + good.type = EVENT; + good.send_event = False; + good.display = client2; + good.window = w; + good.mode = NotifyNormal; + good.detail = NotifyAncestor; + if (checkevent((XEvent*)&good, &event)) { + report("Unexpected event structure member value(s) for client2"); + FAIL; + } + else + CHECK; + if ((i = XPending(client2)) > 0) { + report("Expected 1 event, got %d for client2", i+1); + FAIL; + } + else + CHECK; +/* Verify that no events were delivered to client3. */ + if ((i = XPending(client3)) > 0) { + report("Expected 0 events, got %d for client3", i); + FAIL; + } + else + CHECK; + CHECKPASS(11); +>>ASSERTION def +>>#NOTE Tested for in pervious assertion. +When a xname event is generated, +then +clients not having set +.S FocusChangeMask +event mask bits on the event window are not delivered +a xname event. +>>#NOTEd >>ASSERTION +>>#NOTEd When the input focus changes, +>>#NOTEd then ARTICLE xname event is generated. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE Global except for MappingNotify and KeymapNotify. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M window +>>#NOTEs is set to +>>#NOTEs the +>>#NOTEs ifdef(`WINDOWTYPE', WINDOWTYPE, event) +>>#NOTEs window. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is generated while the pointer is not grabbed, +>>#NOTEs then +>>#NOTEs .A mode +>>#NOTEs is set to +>>#NOTEs .S NotifyNormal . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is generated while the pointer is grabbed, +>>#NOTEs then +>>#NOTEs .A mode +>>#NOTEs is set to +>>#NOTEs .S NotifyWhileGrabbed . +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is generated +>>#NOTEm and a keyboard grab activates, +>>#NOTEm then xname events are generated as if the focus were to change from +>>#NOTEm the old focus to the grab window with +>>#NOTEm .A mode +>>#NOTEm is set to +>>#NOTEm .S NotifyGrab . +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is generated +>>#NOTEm and a keyboard grab deactivates, +>>#NOTEm then xname events are generated as if the focus were to change from +>>#NOTEm the grab window to the new focus with +>>#NOTEm .A mode +>>#NOTEm is set to +>>#NOTEm .S NotifyUngrab . +>>ASSERTION def +>>#NOTE Tested for in most assertions. +All xname events are delivered after +any related +.S FocusOut +are delivered. +>>ASSERTION Good A +>>#NOTE Am getting a detail of NotifyAncestor instead of NotifyInferior +>>#NOTE (i.e. the test fails). +When the input focus moves from window A to window B +and window A is an inferior of window B +and the pointer is in window P, +then a xname event is generated on window B, +with +.M detail +set to +.S NotifyInferior . +>>STRATEGY +Create client. +Build window hierarchy. +Move pointer to known location. +Set window B. +Set window A to inferior of window B. +Set input focus to window A. +Select for Focus events on windows. +Generate xname event by changing focus from A to B. +Verify that the expected events were delivered. +Verify that event delivered to window B with detail set to NotifyInferior. +Verify that all xname events are delivered after all +FocusOut events. +>>CODE +Display *display; +int depth = 3; +Winh *A, *B; +int status; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy. */ + if (winh(display, depth, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set window B. */ + B = guardian->firstchild; +/* Set window A to inferior of window B. */ + A = B->firstchild; +/* Set input focus to window A. */ + XSetInputFocus(display, A->window, RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + _event_mask_ = MASK; + _display_ = display; + if (winh_climb(A, B, selectinput)) { + report("Could not select for events"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(B, B, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; +/* Generate xname event by changing focus from A to B. */ + XSync(display, True); + XSetInputFocus(display, B->window, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event(A, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered to window B with detail set to NotifyInferior. */ + _detail_ = NotifyInferior; + if (winh_climb(B, B, checkdetail)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered after all */ +/* FocusOut events. */ + status = winh_ordercheck(OTHEREVENT, EVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(9); +>>ASSERTION Good A +When the input focus moves from window A to window B +and window A is an inferior of window B +and the pointer is in window P +and window P is an inferior of window B +and window P is not the same window as window A +and window P is not an inferior of window A +and window P is not an ancestor of window A, +then, after a xname event is generated on window B +with +.M detail +set to +.S NotifyInferior , +a xname event is generated on each window +below window B, +down to and including window P, +with +.M detail +set to +.S NotifyPointer . +>>STRATEGY +Create client. +Build window hierarchy. +Move pointer to known location. +Set window B. +Set window A to inferior of window B. +Set window P to inferior of sibling of window A. +Move pointer to window P. +Set input focus to window A. +Select for Focus events on windows. +Generate xname event by changing focus from A to B. +Verify that the expected events were delivered. +Verify that event delivered to window B with detail set to NotifyInferior. +Verify that event delivered below window B, down to and including +window P, with detail set to NotifyPointer. +Verify order of xname event delivery. +Verify that all xname events are delivered after all +FocusOut events. +>>CODE +Display *display; +int depth = 4; +Winh *A, *B, *P, *Pancestor; +int status; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy. */ + if (winh(display, depth, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set window B. */ + B = guardian->firstchild; +/* Set window A to inferior of window B. */ + A = B->firstchild; +/* Set window P to inferior of sibling of window A. */ + Pancestor = B->firstchild->nextsibling; + P = Pancestor->firstchild->firstchild; +/* Move pointer to window P. */ + XWarpPointer(display, None, P->window, 0, 0, 0, 0, 0, 0); +/* Set input focus to window A. */ + XSetInputFocus(display, A->window, RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + _event_mask_ = MASK; + _display_ = display; + if (winh_climb(P, Pancestor, selectinput)) { + report("Could not select for events"); + return; + } + else + CHECK; + if (winh_climb(A, B, selectinput)) { + report("Could not select for events between A and B"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(P, B, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; +/* Generate xname event by changing focus from A to B. */ + XSync(display, True); + XSetInputFocus(display, B->window, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered to window B with detail set to NotifyInferior. */ + _detail_ = NotifyInferior; + if (winh_climb(B, B, checkdetail)) + FAIL; + else + CHECK; +/* Verify that event delivered below window B, down to and including */ +/* window P, with detail set to NotifyPointer. */ + _detail_ = NotifyPointer; + if (winh_climb(P, Pancestor, checkdetail)) + FAIL; + else + CHECK; +/* Verify order of xname event delivery. */ + increasing = True; + if (winh_climb(P, B, checksequence)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered after all */ +/* FocusOut events. */ + status = winh_ordercheck(OTHEREVENT, EVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(12); +>>ASSERTION Good A +When the input focus moves from window A to window B +and window B is an inferior of window A +and the pointer is in window P, +then a xname event is generated on each window +between window A and window B, +exclusive, +with +.M detail +set to +.S NotifyVirtual +and then on window B +with +.M detail +set to +.S NotifyAncestor . +>>STRATEGY +Create client. +Build window hierarchy. +Move pointer to known location. +Set window A. +Set window B to inferior of window A. +Set input focus to window A. +Select for Focus events on windows. +Generate xname event by changing focus from A to B. +Verify that the expected events were delivered. +Verify that event delivered to windows between window A and window B, exclusive, +with detail set to NotifyVirtual. +Verify that event delivered to window B with detail set to NotifyAncestor. +Verify order of xname event delivery. +Verify that all xname events are delivered after all +FocusOut events. +>>CODE +Display *display; +int depth = 4; +Winh *A, *B; +int status; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy. */ + if (winh(display, depth, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set window A. */ + A = guardian->firstchild; +/* Set window B to inferior of window A. */ + B = A->firstchild->firstchild->firstchild; +/* Set input focus to window A. */ + XSetInputFocus(display, A->window, RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + _display_ = display; +#if 0 + _event_mask_ = MASK; + if (winh_climb(B, A->firstchild, selectinput)) { + report("Could not select for events"); + return; + } + else + CHECK; +#endif + if (winh_selectinput(display, (Winh *) NULL, MASK)) { + report("Could not select for events"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(B, A->firstchild, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; +/* Generate xname event by changing focus from A to B. */ + XSync(display, True); + XSetInputFocus(display, B->window, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered to windows between window A and window B, exclusive, */ +/* with detail set to NotifyVirtual. */ + _detail_ = NotifyVirtual; + if (winh_climb(B->parent, A->firstchild, checkdetail)) + FAIL; + else + CHECK; +/* Verify that event delivered to window B with detail set to NotifyAncestor. */ + _detail_ = NotifyAncestor; + if (winh_climb(B, B, checkdetail)) + FAIL; + else + CHECK; +/* Verify order of xname event delivery. */ + increasing = True; + if (winh_climb(B, A->firstchild, checksequence)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered after all */ +/* FocusOut events. */ + status = winh_ordercheck(OTHEREVENT, EVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(11); +>>ASSERTION Good A +When the input focus moves from window A to window B +and window C is their least common ancestor +and the pointer is in window P, +then a xname event is generated on +each window between C and B, exclusive, +with +.M detail +set to +.S NotifyNonlinearVirtual +and then on window B +with +.M detail +set to +.S NotifyNonlinear . +>>STRATEGY +Create client. +Build window hierarchy. +Move pointer to known location. +Set window C. +Set window B to inferior of window C. +Set window A to inferior of window C. +Set input focus to window A. +Select for Focus events on windows. +Generate xname event by changing focus from A to B. +Verify that the expected events were delivered. +Verify that event delivered to windows between window C and window B, exclusive, +with detail set to NotifyNonlinearVirtual. +Verify that event delivered to window B with detail set to NotifyNonlinear. +Verify order of xname event delivery. +Verify that all xname events are delivered after all +FocusOut events. +>>CODE +Display *display; +int depth = 4; +Winh *A, *B, *C; +int status; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy. */ + if (winh(display, depth, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set window C. */ + C = guardian->firstchild; +/* Set window B to inferior of window C. */ + B = C->firstchild->firstchild->firstchild; +/* Set window A to inferior of window C. */ + A = C->firstchild->nextsibling->firstchild; +/* Set input focus to window A. */ + XSetInputFocus(display, A->window, RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + _event_mask_ = MASK; + _display_ = display; + if (winh_climb(B, C->firstchild, selectinput)) { + report("Could not select for events"); + return; + } + else + CHECK; + if (winh_climb(A, C, selectinput)) { + report("Could not select for events between A and C"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(B, C->firstchild, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; +/* Generate xname event by changing focus from A to B. */ + XSync(display, True); + XSetInputFocus(display, B->window, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered to windows between window C and window B, exclusive, */ +/* with detail set to NotifyNonlinearVirtual. */ + _detail_ = NotifyNonlinearVirtual; + if (winh_climb(B->parent, C->firstchild, checkdetail)) + FAIL; + else + CHECK; +/* Verify that event delivered to window B with detail set to NotifyNonlinear. */ + _detail_ = NotifyNonlinear; + if (winh_climb(B, B, checkdetail)) + FAIL; + else + CHECK; +/* Verify order of xname event delivery. */ + increasing = True; + if (winh_climb(B, C->firstchild, checksequence)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered after all */ +/* FocusOut events. */ + status = winh_ordercheck(OTHEREVENT, EVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(12); +>>ASSERTION Good A +When the input focus moves from window A to window B +and window C is their least common ancestor +and the pointer is in window P +and window P is an inferior of window B, +then, after the related xname events are generated +with +.M detail +set to +.S NotifyNonlinearVirtual +and +.S NotifyNonlinear , +a xname event is generated on +each window below window B down to and including window P, +with +.M detail +set to +.S NotifyPointer . +>>STRATEGY +Create client. +Build window hierarchy. +Move pointer to known location. +Set window C. +Set window B to inferior of window C. +Set window P to inferior of window B. +Set window A to inferior of window C. +Move pointer to window P. +Set input focus to window A. +Select for Focus events on windows. +Generate xname event by changing focus from A to B. +Verify that the expected events were delivered. +Verify that event delivered to windows between window C and window B, exclusive, +with detail set to NotifyNonlinearVirtual. +Verify that event delivered to window B with detail set to NotifyNonlinear. +Verify that events were delivered to windows below window B down to and +including window P, exclusive, +with detail set to NotifyPointer. +Verify order of xname event delivery. +Verify that all xname events are delivered after all +FocusOut events. +>>CODE +Display *display; +int depth = 5; +Winh *A, *B, *C, *P; +int status; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy. */ + if (winh(display, depth, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set window C. */ + C = guardian->firstchild; +/* Set window B to inferior of window C. */ + B = C->firstchild->firstchild; +/* Set window P to inferior of window B. */ + P = B->firstchild->firstchild; +/* Set window A to inferior of window C. */ + A = C->firstchild->nextsibling->firstchild; +/* Move pointer to window P. */ + XWarpPointer(display, None, P->window, 0, 0, 0, 0, 0, 0); +/* Set input focus to window A. */ + XSetInputFocus(display, A->window, RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + _event_mask_ = MASK; + _display_ = display; + if (winh_climb(B, C->firstchild, selectinput)) { + report("Could not select for events"); + return; + } + else + CHECK; + if (winh_climb(A, C, selectinput)) { + report("Could not select for events between A and C"); + return; + } + else + CHECK; + if (winh_climb(P, B, selectinput)) { + report("Could not select for events between P and B"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(B, C->firstchild, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; + if (winh_climb(P, B->firstchild, plant)) { + report("Could not plant events below B"); + return; + } + else + CHECK; +/* Generate xname event by changing focus from A to B. */ + XSync(display, True); + XSetInputFocus(display, B->window, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered to windows between window C and window B, exclusive, */ +/* with detail set to NotifyNonlinearVirtual. */ + _detail_ = NotifyNonlinearVirtual; + if (winh_climb(B->parent, C->firstchild, checkdetail)) + FAIL; + else + CHECK; +/* Verify that event delivered to window B with detail set to NotifyNonlinear. */ + _detail_ = NotifyNonlinear; + if (winh_climb(B, B, checkdetail)) + FAIL; + else + CHECK; +/* Verify that events were delivered to windows below window B down to and */ +/* including window P, exclusive, */ +/* with detail set to NotifyPointer. */ + _detail_ = NotifyPointer; + if (winh_climb(P, B->firstchild, checkdetail)) + FAIL; + else + CHECK; +/* Verify order of xname event delivery. */ + increasing = True; + if (winh_climb(B, C->firstchild, checksequence)) + FAIL; + else + CHECK; + increasing = True; + if (winh_climb(P, B->firstchild, checksequence)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered after all */ +/* FocusOut events. */ + status = winh_ordercheck(OTHEREVENT, EVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(16); +>>ASSERTION Good C +If the implementation supports multiple screens: +When the input focus moves from window A to window B +and window A and window B are not on the same screens +and the pointer is in window P +and window B is not a root window, +then a xname event is generated on +each window from window B's root down to but not including window B, +with +.M detail +set to +.S NotifyNonlinearVirtual . +>>STRATEGY +Check to see if multiple screens are supported. +Create client. +Build window hierarchy on all supported screens. +Move pointer to known location. +Set window A. +Set window B to an inferior of the root window on a different screen than A. +Set input focus to window A. +Select for Focus events on windows. +Generate xname event by changing focus from A to B. +Verify that the expected events were delivered. +Verify that event delivered to each window from window B's root down +to but not including window B +with detail set to NotifyNonlinearVirtual. +Verify order of xname event delivery. +Verify that all xname events are delivered after all +FocusOut events. +>>CODE +Display *display; +int depth = 4; +Winh *A, *B, *Broot; +int status; + +/* Check to see if multiple screens are supported. */ + if (config.alt_screen == -1) { + unsupported("Multiple screens not supported."); + return; + } + else + CHECK; +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy on all supported screens. */ + if (winh(display, depth, WINH_MAP|WINH_BOTH_SCREENS)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set window A. */ + A = guardian->firstchild; +/* Set window B to an inferior of the root window on a different screen than A. */ + Broot = guardian->nextsibling; + B = Broot->firstchild->firstchild->firstchild; +/* Set input focus to window A. */ + XSetInputFocus(display, A->window, RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + _event_mask_ = MASK; + _display_ = display; + if (winh_climb(B->parent, Broot, selectinput)) { + report("Could not select for events"); + return; + } + else + CHECK; + if (winh_climb(A, A, selectinput)) { + report("Could not select for events on window A"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(B->parent, Broot, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; +/* Generate xname event by changing focus from A to B. */ + XSync(display, True); + XSetInputFocus(display, B->window, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered to each window from window B's root down */ +/* to but not including window B */ +/* with detail set to NotifyNonlinearVirtual. */ + _detail_ = NotifyNonlinearVirtual; + if (winh_climb(B->parent, Broot, checkdetail)) + FAIL; + else + CHECK; +/* Verify order of xname event delivery. */ + increasing = True; + if (winh_climb(B->parent, Broot, checksequence)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered after all */ +/* FocusOut events. */ + status = winh_ordercheck(OTHEREVENT, EVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(12); +>>ASSERTION Good C +If the implementation supports multiple screens: +When the input focus moves from window A to window B +and window A and window B are not on the same screens +and the pointer is in window P, +then, +after any related xname events are generated with +.M detail +set to +.S NotifyNonlinearVirtual , +a xname event is generated on window B +with +.M detail +set to +.S NotifyNonlinear . +>>STRATEGY +Check to see if multiple screens are supported. +Create client. +Build window hierarchy on all supported screens. +Move pointer to known location. +Set window A. +Set window B to an inferior of the root window on a different screen than A. +Set input focus to window A. +Select for Focus events on windows. +Generate xname event by changing focus from A to B. +Verify that the expected events were delivered. +Verify that event delivered to each window from window B's root down +to but not including window B +with detail set to NotifyNonlinearVirtual. +Verify that event delivered on window B with detail +set to NotifyNonlinear. +Verify order of xname event delivery. +Verify that all xname events are delivered after all +FocusOut events. +>>CODE +Display *display; +int depth = 4; +Winh *A, *B, *Broot; +int status; + +/* Check to see if multiple screens are supported. */ + if (config.alt_screen == -1) { + unsupported("Multiple screens not supported."); + return; + } + else + CHECK; +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy on all supported screens. */ + if (winh(display, depth, WINH_MAP|WINH_BOTH_SCREENS)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set window A. */ + A = guardian->firstchild; +/* Set window B to an inferior of the root window on a different screen than A. */ + Broot = guardian->nextsibling; + B = Broot->firstchild->firstchild->firstchild; +/* Set input focus to window A. */ + XSetInputFocus(display, A->window, RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + _event_mask_ = MASK; + _display_ = display; + if (winh_climb(B, Broot, selectinput)) { + report("Could not select for events"); + return; + } + else + CHECK; + if (winh_climb(A, A, selectinput)) { + report("Could not select for events on window A"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(B, Broot, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; +/* Generate xname event by changing focus from A to B. */ + XSync(display, True); + XSetInputFocus(display, B->window, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered to each window from window B's root down */ +/* to but not including window B */ +/* with detail set to NotifyNonlinearVirtual. */ + _detail_ = NotifyNonlinearVirtual; + if (winh_climb(B->parent, Broot, checkdetail)) + FAIL; + else + CHECK; +/* Verify that event delivered on window B with detail */ +/* set to NotifyNonlinear. */ + _detail_ = NotifyNonlinear; + if (winh_climb(B, B, checkdetail)) + FAIL; + else + CHECK; +/* Verify order of xname event delivery. */ + increasing = True; + if (winh_climb(B, Broot, checksequence)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered after all */ +/* FocusOut events. */ + status = winh_ordercheck(OTHEREVENT, EVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(13); +>>ASSERTION Good C +If the implementation supports multiple screens: +When the input focus moves from window A to window B +and window A and window B are not on the same screens +and the pointer is in window P +and window P is an inferior of window B, +then a xname event is generated on window B +with +.M detail +set to +.S NotifyNonlinear . +>>STRATEGY +Check to see if multiple screens are supported. +Create client. +Build window hierarchy on all supported screens. +Move pointer to known location. +Set window A. +Set window B. +Set P to inferior of window B. +Set input focus to window A. +Move pointer to window P. +Select for Focus events on windows. +Generate xname event by changing focus from A to B. +Verify that the expected events were delivered. +Verify that event delivered on window B with detail +set to NotifyNonlinear. +Verify that all xname events are delivered after all +FocusOut events. +>>CODE +Display *display; +int depth = 2; +Winh *A, *B, *P; +int status; + +/* Check to see if multiple screens are supported. */ + if (config.alt_screen == -1) { + unsupported("Multiple screens not supported."); + return; + } + else + CHECK; +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy on all supported screens. */ + if (winh(display, depth, WINH_MAP|WINH_BOTH_SCREENS)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set window A. */ + A = guardian->firstchild; +/* Set window B. */ + B = guardian->nextsibling->firstchild; +/* Set P to inferior of window B. */ + P = guardian->nextsibling->firstchild; +/* Set input focus to window A. */ + XSetInputFocus(display, A->window, RevertToNone, CurrentTime); +/* Move pointer to window P. */ + XWarpPointer(display, None, P->window, 0, 0, 0, 0, 0, 0); +/* Select for Focus events on windows. */ + _event_mask_ = MASK; + _display_ = display; + if (winh_climb(B, B, selectinput)) { + report("Could not select for events"); + return; + } + else + CHECK; + if (winh_climb(A, A, selectinput)) { + report("Could not select for events on window A"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(B, B, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; +/* Generate xname event by changing focus from A to B. */ + XSync(display, True); + XSetInputFocus(display, B->window, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered on window B with detail */ +/* set to NotifyNonlinear. */ + _detail_ = NotifyNonlinear; + if (winh_climb(B, B, checkdetail)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered after all */ +/* FocusOut events. */ + status = winh_ordercheck(OTHEREVENT, EVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(11); +>>ASSERTION Good C +If the implementation supports multiple screens: +When the input focus moves from window A to window B +and window A and window B are not on the same screens +and the pointer is in window P +and window P is an inferior of window B, +then, after the related xname events are generated +with +.M detail +set to +.S NotifyNonlinearVirtual +and +.S NotifyNonlinear , +a xname event is generated on +each window below window B down to and including window P +with +.M detail +set to +.S NotifyPointer . +>>STRATEGY +Check to see if multiple screens are supported. +Create client. +Build window hierarchy on all supported screens. +Move pointer to known location. +Set window A. +Set window B to an inferior of the root window on a different screen than A. +Set window P to an inferior of B. +Set input focus to window A. +Move pointer to window P. +Select for Focus events on windows. +Generate xname event by changing focus from A to B. +Verify that the expected events were delivered. +Verify that event delivered to each window from window B's root down +to but not including window B +with detail set to NotifyNonlinearVirtual. +Verify that event delivered on window B with detail +set to NotifyNonlinear. +Verify that event delivered to each window from window B down +to and including window P +with detail set to NotifyPointer. +Verify order of xname event delivery. +Verify that all xname events are delivered after all +FocusOut events. +>>CODE +Display *display; +int depth = 5; +Winh *A, *B, *Broot, *P; +int status; + +/* Check to see if multiple screens are supported. */ + if (config.alt_screen == -1) { + unsupported("Multiple screens not supported."); + return; + } + else + CHECK; +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy on all supported screens. */ + if (winh(display, depth, WINH_MAP|WINH_BOTH_SCREENS)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set window A. */ + A = guardian->firstchild; +/* Set window B to an inferior of the root window on a different screen than A. */ + Broot = guardian->nextsibling; + B = Broot->firstchild->firstchild; +/* Set window P to an inferior of B. */ + P = B->firstchild->firstchild; +/* Set input focus to window A. */ + XSetInputFocus(display, A->window, RevertToNone, CurrentTime); +/* Move pointer to window P. */ + XWarpPointer(display, None, P->window, 0, 0, 0, 0, 0, 0); +/* Select for Focus events on windows. */ + _event_mask_ = MASK; + _display_ = display; + if (winh_climb(P, Broot, selectinput)) { + report("Could not select for events"); + return; + } + else + CHECK; + if (winh_climb(A, A, selectinput)) { + report("Could not select for events on window A"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(P, Broot, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; +/* Generate xname event by changing focus from A to B. */ + XSync(display, True); + XSetInputFocus(display, B->window, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered to each window from window B's root down */ +/* to but not including window B */ +/* with detail set to NotifyNonlinearVirtual. */ + _detail_ = NotifyNonlinearVirtual; + if (winh_climb(B->parent, Broot, checkdetail)) + FAIL; + else + CHECK; +/* Verify that event delivered on window B with detail */ +/* set to NotifyNonlinear. */ + _detail_ = NotifyNonlinear; + if (winh_climb(B, B, checkdetail)) + FAIL; + else + CHECK; +/* Verify that event delivered to each window from window B down */ +/* to and including window P */ +/* with detail set to NotifyPointer. */ + _detail_ = NotifyPointer; + if (winh_climb(P, B->firstchild, checkdetail)) + FAIL; + else + CHECK; +/* Verify order of xname event delivery. */ + increasing = True; + if (winh_climb(P, Broot, checksequence)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered after all */ +/* FocusOut events. */ + status = winh_ordercheck(OTHEREVENT, EVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(14); +>>ASSERTION def +>>#NOTE Tested for in next test. +When the focus moves from window A to +.S PointerRoot +(events sent to the window under the pointer) +and the pointer is in window P, +then a xname event is generated on +the root window of all screens, +with +.M detail +set to +.S NotifyPointerRoot . +>>ASSERTION Good A +When the focus moves from window A to +.S PointerRoot +(events sent to the window under the pointer) +and the pointer is in window P, +then, after the related xname events are generated +with +.M detail +set to +.S NotifyPointerRoot , +a xname event is generated on +each window from window P's root down to and including window P, +with +.M detail +set to +.S NotifyPointer . +>>STRATEGY +Create client. +Build window hierarchy on all supported screens. +Set window A. +Set window P. +Move pointer to window P. +Set input focus to window A. +Select for Focus events on windows. +Generate xname event by changing focus from A to PointerRoot. +Verify that the expected events were delivered. +Verify that event delivered to the root window of all screens +with detail set to NotifyPointerRoot. +Verify that event generated on each window from window P's root down +to and including window P with detail set to NotifyPointer. +Verify that these events occurred in the correct order. +Verify that the NotifyPointerRoot events were delivered before +NotifyPointer events. +Verify that all xname events are delivered after all +FocusOut events. +>>CODE +Display *display; +int depth = 4; +Winh *A, *P, *Proot, *ptr; +Winhe *winhe; +int status; +int high; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy on all supported screens. */ + if (winh(display, depth, WINH_MAP|WINH_BOTH_SCREENS)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Set window A. */ + A = guardian->firstchild; +/* Set window P. */ + Proot = guardian; + P = Proot->firstchild->firstchild; +/* Move pointer to window P. */ + if (warppointer(display, P->window, 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set input focus to window A. */ + XSetInputFocus(display, A->window, RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + if (winh_selectinput(display, (Winh *) NULL, MASK)) { + report("Could not select for events"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + /* root window of all screens */ + for (ptr = guardian; ptr != (Winh *) NULL; ptr = ptr->nextsibling) { + if (ptr == guardian) + CHECK; + good.xany.window = ptr->window; + if (winh_plant(ptr, &good, MASK, WINH_NOMASK)) { + report("Could not plant events"); + return; + } + } + /* from P's root to P */ + if (winh_climb(P, Proot, plant)) { + report("Could not plant events between P's root and P"); + return; + } + else + CHECK; +/* Generate xname event by changing focus from A to PointerRoot. */ + XSync(display, True); + XSetInputFocus(display, PointerRoot, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered to the root window of all screens */ +/* with detail set to NotifyPointerRoot. */ + _detail_ = NotifyPointerRoot; + /* used to keep track of last NotifyPointerRoot event */ + high = 0; + for (ptr = guardian; ptr != (Winh *) NULL; ptr = ptr->nextsibling) { + if (ptr == guardian) + CHECK; + /* + * skip to first FocusIn-type event + */ + for (winhe = ptr->delivered; winhe != (Winhe *) NULL; winhe = winhe->next) { + if (winhe->event->type == EVENT) + break; + } + if (winhe == (Winhe *) NULL) { + delete("Lost %s event in delivered list", + eventname(EVENT)); + return; + } + if (winhe->sequence > high) + high = winhe->sequence; + if (winhe->event->xfocus.detail != _detail_) { + report("Got detail %d, expected %d on window 0x%x", + winhe->event->xfocus.detail, + _detail_, ptr->window); + FAIL; + } + else { + /* + * cause this event to be ignored during + * later checks for FocusIn events + */ + winhe->event->type = 0; + } + } +/* Verify that event generated on each window from window P's root down */ +/* to and including window P with detail set to NotifyPointer. */ + _detail_ = NotifyPointer; + if (winh_climb(P, Proot, checkdetail)) + FAIL; + else + CHECK; +/* Verify that these events occurred in the correct order. */ + increasing = True; + if (winh_climb(P, Proot, checksequence)) + FAIL; + else + CHECK; +/* Verify that the NotifyPointerRoot events were delivered before */ +/* NotifyPointer events. */ + for (winhe = Proot->delivered; winhe != (Winhe *) NULL; winhe = winhe->next) { + if (winhe == Proot->delivered) + CHECK; + if (winhe->event->type == EVENT) + break; + } + if (winhe == (Winhe *) NULL) { + delete("Lost %s event in delivered list of Proot", + eventname(EVENT)); + return; + } + else + CHECK; + if (high > winhe->sequence) { + report("NotifyPointerRoot events not delivered before all NotifyPointer events"); + FAIL; + } + else + CHECK; + +/* Verify that all xname events are delivered after all */ +/* FocusOut events. */ + status = winh_ordercheck(OTHEREVENT, EVENT); + if (status == -1) + return; + else if (status) { + int in, out; + + in = winh_eventindex(EVENT); + out = winh_eventindex(OTHEREVENT); + report("%s: %d, %s: %d", + eventname(EVENT), winh_event_stats[in].low, + eventname(OTHEREVENT), winh_event_stats[out].high + ); + FAIL; + } + else + CHECK; + } + CHECKPASS(15); +>>ASSERTION Good A +When the focus moves from window A to +.S None +(discard) +and the pointer is in window P, +then a xname event is generated on +the root window of all screens, +with +.M detail +set to +.S NotifyDetailNone . +>>STRATEGY +Create client. +Build window hierarchy on all supported screens. +Set window A. +Set input focus to window A. +Select for Focus events on windows. +Generate xname event by changing focus from A to None. +Verify that the expected events were delivered. +Verify that event delivered to the root window of all screens +with detail set to NotifyDetailNone. +Verify that all xname events are delivered after all +FocusOut events. +>>CODE +Display *display; +int depth = 1; +Winh *A, *ptr; +Winhe *winhe; +int status; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy on all supported screens. */ + if (winh(display, depth, WINH_MAP|WINH_BOTH_SCREENS)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Set window A. */ + A = guardian->firstchild; + /* Don't bother moving the pointer to known location. */ +/* Set input focus to window A. */ + XSetInputFocus(display, A->window, RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + if (winh_selectinput(display, (Winh *) NULL, MASK)) { + report("Could not select for events"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + /* root window of all screens */ + for (ptr = guardian; ptr != (Winh *) NULL; ptr = ptr->nextsibling) { + if (ptr == guardian) + CHECK; + good.xany.window = ptr->window; + if (winh_plant(ptr, &good, MASK, WINH_NOMASK)) { + report("Could not plant events"); + return; + } + } +/* Generate xname event by changing focus from A to None. */ + XSync(display, True); + XSetInputFocus(display, None, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered to the root window of all screens */ +/* with detail set to NotifyDetailNone. */ + _detail_ = NotifyDetailNone; + for (ptr = guardian; ptr != (Winh *) NULL; ptr = ptr->nextsibling) { + if (ptr == guardian) + CHECK; + /* + * skip to first FocusIn-type event + */ + for (winhe = ptr->delivered; winhe != (Winhe *) NULL; winhe = winhe->next) { + if (winhe->event->type == EVENT) + break; + } + if (winhe == (Winhe *) NULL) { + delete("Lost %s event in delivered list", + eventname(EVENT)); + return; + } + if (winhe->event->xfocus.detail != _detail_) { + report("Got detail %d, expected %d on window 0x%x", + winhe->event->xfocus.detail, + _detail_, ptr->window); + FAIL; + } + } +/* Verify that all xname events are delivered after all */ +/* FocusOut events. */ + status = winh_ordercheck(OTHEREVENT, EVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(8); +>>ASSERTION Good A +>>#NOTE One could argue that this is tested sufficiently in the next assertion. +When the focus moves from +.S PointerRoot +(events sent to the window under the pointer) +or +.S None +(discard) +to window A +and the pointer is in window P +and window A is not a root window, +then a xname event is generated on +each window from window A's root down to but not including window A, +with +.M detail +set to +.S NotifyNonlinearVirtual . +>>STRATEGY +Create client. +Build window hierarchy. +Set window A. +Move pointer to known location. +Set input focus to PointerRoot. +Select for Focus events on windows. +Generate xname event by changing focus from PointerRoot to A. +Verify that the expected events were delivered. +Verify that event delivered on each window from window A's root down to +but not including window A +with detail set to NotifyNonlinearVirtual. +Verify that these events occurred in the correct order. +Verify that all xname events are delivered after all +FocusOut events. +Repeat with focus initially set to None. +>>CODE +Display *display; +int depth = 4; +Winh *A, *Aroot; +int status; +int i; +static Window focuses[] = { + (Window) PointerRoot, + (Window) None +}; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy. */ + if (winh(display, depth, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Set window A. */ + Aroot = guardian; + A = Aroot->firstchild->firstchild->firstchild; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; + for (i = 0; i < NELEM(focuses); i++) { +/* Set input focus to PointerRoot. */ + XSetInputFocus(display, focuses[i], RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + if (winh_selectinput(display, (Winh *) NULL, MASK)) { + report("Could not select for events"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + /* + * Plant at A instead of A->parent because we will also be getting + * an xname event on A with detail set to NotifyNonlinear. + */ + if (winh_climb(A, Aroot, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; +/* Generate xname event by changing focus from PointerRoot to A. */ + XSync(display, True); + XSetInputFocus(display, A->window, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered on each window from window A's root down to */ +/* but not including window A */ +/* with detail set to NotifyNonlinearVirtual. */ + _detail_ = NotifyNonlinearVirtual; + if (winh_climb(A->parent, Aroot, checkdetail)) + FAIL; + else + CHECK; +/* Verify that these events occurred in the correct order. */ + increasing = True; + if (winh_climb(A->parent, Aroot, checksequence)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered after all */ +/* FocusOut events. */ + status = winh_ordercheck(OTHEREVENT, EVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } +/* Repeat with focus initially set to None. */ + } + CHECKPASS(3 + (7*NELEM(focuses))); +>>ASSERTION Good A +>>#NOTE One could argue that this is tested sufficiently in the next assertion. +>>#NOTE +>>#NOTE The approved (and incorrect) form of this assertion used to +>>#NOTE contain the following phrase: +>>#NOTE +>>#NOTE then a xname event is generated on +>>#NOTE +>>#NOTE Additional text was inserted after the "then" to reflect +>>#NOTE ordering with respect to NotifyNonlinearVirtual FocusIn events. +When the focus moves from +.S PointerRoot +(events sent to the window under the pointer) +or +.S None +(discard) +to window A +and the pointer is in window P, +then, after any related xname events are generated +with +.M detail +set to +.S NotifyNonlinearVirtual , +a xname event is generated +on window A +with +.M detail +set to +.S NotifyNonlinear . +>>STRATEGY +Create client. +Build window hierarchy. +Set window A. +Move pointer to known location. +Set input focus to PointerRoot. +Select for Focus events on windows. +Generate xname event by changing focus from PointerRoot to A. +Verify that the expected events were delivered. +Verify that event delivered on each window from window A's root down to +but not including window A +with detail set to NotifyNonlinearVirtual. +Verify that event delivered on to window A +with detail set to NotifyNonlinear. +Verify that these events occurred in the correct order. +Verify that all xname events are delivered after all +FocusOut events. +Repeat with focus initially set to None. +>>CODE +Display *display; +int depth = 4; +Winh *A, *Aroot; +int status; +int i; +static Window focuses[] = { + (Window) PointerRoot, + (Window) None +}; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy. */ + if (winh(display, depth, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Set window A. */ + Aroot = guardian; + A = Aroot->firstchild->firstchild->firstchild; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; + for (i = 0; i < NELEM(focuses); i++) { +/* Set input focus to PointerRoot. */ + XSetInputFocus(display, focuses[i], RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + if (winh_selectinput(display, (Winh *) NULL, MASK)) { + report("Could not select for events"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(A, Aroot, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; +/* Generate xname event by changing focus from PointerRoot to A. */ + XSync(display, True); + XSetInputFocus(display, A->window, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered on each window from window A's root down to */ +/* but not including window A */ +/* with detail set to NotifyNonlinearVirtual. */ + _detail_ = NotifyNonlinearVirtual; + if (winh_climb(A->parent, Aroot, checkdetail)) + FAIL; + else + CHECK; +/* Verify that event delivered on to window A */ +/* with detail set to NotifyNonlinear. */ + _detail_ = NotifyNonlinear; + if (winh_climb(A, A, checkdetail)) + FAIL; + else + CHECK; +/* Verify that these events occurred in the correct order. */ + increasing = True; + if (winh_climb(A, Aroot, checksequence)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered after all */ +/* FocusOut events. */ + status = winh_ordercheck(OTHEREVENT, EVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } +/* Repeat with focus initially set to None. */ + } + CHECKPASS(3 + (8*NELEM(focuses))); +>>ASSERTION Good A +When the focus moves from +.S PointerRoot +(events sent to the window under the pointer) +or +.S None +(discard) +to window A +and the pointer is in window P +and window P is an inferior of window A, +then, after the related xname events are generated +with +.M detail +set to +.S NotifyNonlinearVirtual +and +.S NotifyNonlinear , +a xname event is generated on +each window below window A down to and including window P, +with +.M detail +set to +.S NotifyPointer . +>>STRATEGY +Create client. +Build window hierarchy. +Set window A. +Set window P. +Move pointer to window P. +Set input focus to PointerRoot. +Select for Focus events on windows. +Generate xname event by changing focus from PointerRoot to A. +Verify that the expected events were delivered. +Verify that event delivered on each window from window A's root down to +but not including window A +with detail set to NotifyNonlinearVirtual. +Verify that event delivered on to window A +with detail set to NotifyNonlinear. +Verify that event delivered on each window below window A down to +and including window P +with detail set to NotifyPointer. +Verify that these events occurred in the correct order. +Verify that all xname events are delivered after all +FocusOut events. +Repeat with focus initially set to None. +>>CODE +Display *display; +int depth = 5; +Winh *A, *Aroot, *P; +int status; +int i; +static Window focuses[] = { + (Window) PointerRoot, + (Window) None +}; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy. */ + if (winh(display, depth, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Set window A. */ + Aroot = guardian; + A = Aroot->firstchild->firstchild; +/* Set window P. */ + P = A->firstchild->firstchild; +/* Move pointer to window P. */ + if (warppointer(display, P->window, 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; + for (i = 0; i < NELEM(focuses); i++) { +/* Set input focus to PointerRoot. */ + XSetInputFocus(display, focuses[i], RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + if (winh_selectinput(display, (Winh *) NULL, MASK)) { + report("Could not select for events"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(P, Aroot, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; +/* Generate xname event by changing focus from PointerRoot to A. */ + XSync(display, True); + XSetInputFocus(display, A->window, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered on each window from window A's root down to */ +/* but not including window A */ +/* with detail set to NotifyNonlinearVirtual. */ + _detail_ = NotifyNonlinearVirtual; + if (winh_climb(A->parent, Aroot, checkdetail)) { + report("Bad detail on some window above A's parent"); + FAIL; + } + else + CHECK; +/* Verify that event delivered on to window A */ +/* with detail set to NotifyNonlinear. */ + _detail_ = NotifyNonlinear; + if (winh_climb(A, A, checkdetail)) { + report("Bad detail on window A"); + FAIL; + } + else + CHECK; +/* Verify that event delivered on each window below window A down to */ +/* and including window P */ +/* with detail set to NotifyPointer. */ + _detail_ = NotifyPointer; + if (winh_climb(P, A->firstchild, checkdetail)) { + report("Bad detail on some window below window A down to window P"); + FAIL; + } + else + CHECK; +/* Verify that these events occurred in the correct order. */ + increasing = True; + if (winh_climb(P, Aroot, checksequence)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered after all */ +/* FocusOut events. */ + status = winh_ordercheck(OTHEREVENT, EVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } +/* Repeat with focus initially set to None. */ + } + CHECKPASS(3 + (9*NELEM(focuses))); +>>ASSERTION Good A +>>#NOTE +>>#NOTE The approved wording for this assertion specified that detail +>>#NOTE should be set to NotifyPointerRoot. This was incorrect and the +>>#NOTE wording has been changed to specify that detail should be set to +>>#NOTE NotifyDetailNone. +>>#NOTE +When the focus moves from +.S PointerRoot +(events sent to the window under the pointer) +to +.S None +(discard) +and the pointer is in window P, +then a xname event is generated on +the root window of all screens, +with +.M detail +set to +.S NotifyDetailNone . +>>STRATEGY +Create client. +Build window hierarchy on all supported screens. +Move pointer to known location. +Set input focus to PointerRoot. +Select for Focus events on windows. +Generate xname event by changing focus from PointerRoot to None. +Verify that the expected events were delivered. +Verify that event delivered to the root window of all screens +with detail set to NotifyDetailNone. +Verify that all xname events are delivered after all +FocusOut events. +>>CODE +Display *display; +int depth = 2; +Winh *ptr; +Winhe *winhe; +int status; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy on all supported screens. */ + if (winh(display, depth, WINH_MAP|WINH_BOTH_SCREENS)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set input focus to PointerRoot. */ + XSetInputFocus(display, PointerRoot, RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + if (winh_selectinput(display, (Winh *) NULL, MASK)) { + report("Could not select for events"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + /* root window of all screens */ + for (ptr = guardian; ptr != (Winh *) NULL; ptr = ptr->nextsibling) { + if (ptr == guardian) + CHECK; + good.xany.window = ptr->window; + if (winh_plant(ptr, &good, MASK, WINH_NOMASK)) { + report("Could not plant events"); + return; + } + } +/* Generate xname event by changing focus from PointerRoot to None. */ + XSync(display, True); + XSetInputFocus(display, None, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered to the root window of all screens */ +/* with detail set to NotifyDetailNone. */ + _detail_ = NotifyDetailNone; + for (ptr = guardian; ptr != (Winh *) NULL; ptr = ptr->nextsibling) { + if (ptr == guardian) + CHECK; + /* + * skip to first FocusIn-type event + */ + for (winhe = ptr->delivered; winhe != (Winhe *) NULL; winhe = winhe->next) { + if (winhe->event->type == EVENT) + break; + } + if (winhe == (Winhe *) NULL) { + delete("Lost %s event in delivered list", + eventname(EVENT)); + return; + } + if (winhe->event->xfocus.detail != _detail_) { + report("Got detail %d, expected %d on window 0x%x", + winhe->event->xfocus.detail, + _detail_, ptr->window); + FAIL; + } + else { + /* + * cause this event to be ignored during + * later checks for FocusIn events + */ + winhe->event->type = 0; + } + } +/* Verify that all xname events are delivered after all */ +/* FocusOut events. */ + status = winh_ordercheck(OTHEREVENT, EVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(9); +>>ASSERTION Good A +>>#NOTE +>>#NOTE The approved wording for this assertion specified that detail +>>#NOTE should be set to NotifyDetailNone. This was incorrect and the +>>#NOTE wording has been changed to specify that detail should be set to +>>#NOTE NotifyPointerRoot. +>>#NOTE +When the focus moves from +None to PointerRoot +and the pointer is in window P, +then a xname event is generated on +the root window of all screens, +with +.M detail +set to +.S NotifyPointerRoot . +>>STRATEGY +Create client. +Build window hierarchy on all supported screens. +Set window P. +Move pointer to known location. +Set input focus to None. +Select for Focus events on windows. +Generate xname event by changing focus from None to PointerRoot. +Verify that the expected events were delivered. +Verify that event delivered to the root window of all screens +with detail set to NotifyPointerRoot. +Verify that all xname events are delivered after all +FocusOut events. +>>CODE +Display *display; +int depth = 2; +Winh *P, *ptr; +Winhe *winhe; +int status; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy on all supported screens. */ + if (winh(display, depth, WINH_MAP|WINH_BOTH_SCREENS)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Set window P. */ + P = guardian; +/* Move pointer to known location. */ + if (warppointer(display, P->window, 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set input focus to None. */ + XSetInputFocus(display, None, RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + if (winh_selectinput(display, (Winh *) NULL, MASK)) { + report("Could not select for events"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + /* root window of all screens */ + for (ptr = guardian; ptr != (Winh *) NULL; ptr = ptr->nextsibling) { + if (ptr == guardian) + CHECK; + good.xany.window = ptr->window; + if (winh_plant(ptr, &good, MASK, WINH_NOMASK)) { + report("Could not plant events"); + return; + } + } + /* also expect a subsequent event on P */ + good.xany.window = P->window; + if (winh_plant(P, &good, MASK, WINH_NOMASK)) { + report("Could not plant events on P"); + return; + } + else + CHECK; +/* Generate xname event by changing focus from None to PointerRoot. */ + XSync(display, True); + XSetInputFocus(display, PointerRoot, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered to the root window of all screens */ +/* with detail set to NotifyPointerRoot. */ + _detail_ = NotifyPointerRoot; + for (ptr = guardian; ptr != (Winh *) NULL; ptr = ptr->nextsibling) { + if (ptr == guardian) + CHECK; + /* + * skip to first FocusIn-type event + */ + for (winhe = ptr->delivered; winhe != (Winhe *) NULL; winhe = winhe->next) { + if (winhe->event->type == EVENT) + break; + } + if (winhe == (Winhe *) NULL) { + delete("Lost %s event in delivered list", + eventname(EVENT)); + return; + } + if (winhe->event->xfocus.detail != _detail_) { + report("Got detail %d, expected %d on window 0x%x", + winhe->event->xfocus.detail, + _detail_, ptr->window); + FAIL; + } + else { + /* + * cause this event to be ignored during + * later checks for FocusIn events + */ + winhe->event->type = 0; + } + } +/* Verify that all xname events are delivered after all */ +/* FocusOut events. */ + status = winh_ordercheck(OTHEREVENT, EVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(10); +>>ASSERTION Good A +>>#NOTE +>>#NOTE The wording of this assertion was changed from that which was +>>#NOTE approved to eliminate extraneous wording: +>>#NOTE +>>#NOTE .S PointerRoot +>>#NOTE (events sent to the window under the pointer) +>>#NOTE to +>>#NOTE .S None +>>#NOTE (discard) +>>#NOTE +>>#NOTE .S NotifyDetailNone +>>#NOTE and +>>#NOTE +When the focus moves from +None to PointerRoot +and the pointer is in window P, +then, after the related xname events are generated +with +.M detail +set to +.S NotifyPointerRoot , +a xname event is generated on +each window from window P's root down to and including window P, +with +.M detail +set to +.S NotifyPointer . +>>STRATEGY +Create client. +Build window hierarchy on all supported screens. +Set window P. +Move pointer to known location. +Set input focus to None. +Select for Focus events on windows. +Generate xname event by changing focus from None to PointerRoot. +Verify that the expected events were delivered. +Verify that event delivered to the root window of all screens +with detail set to NotifyPointerRoot. +Verify that event delivered on each window from window P's root down to +and including window P +with detail set to NotifyPointer. +Verify that the NotifyPointerRoot events were delivered before +NotifyPointer events. +Verify that all xname events are delivered after all +FocusOut events. +>>CODE +Display *display; +int depth = 4; +Winh *P, *Proot, *ptr; +Winhe *winhe; +int status; +int high; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy on all supported screens. */ + if (winh(display, depth, WINH_MAP|WINH_BOTH_SCREENS)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Set window P. */ + Proot = guardian; + P = Proot->firstchild->firstchild->firstchild; +/* Move pointer to known location. */ + if (warppointer(display, P->window, 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set input focus to None. */ + XSetInputFocus(display, None, RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + if (winh_selectinput(display, (Winh *) NULL, MASK)) { + report("Could not select for events"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + /* root window of all screens */ + for (ptr = guardian; ptr != (Winh *) NULL; ptr = ptr->nextsibling) { + if (ptr == guardian) + CHECK; + good.xany.window = ptr->window; + if (winh_plant(ptr, &good, MASK, WINH_NOMASK)) { + report("Could not plant events"); + return; + } + } + if (winh_climb(P, Proot, plant)) { + report("Could not plant events from P's root to P"); + return; + } + else + CHECK; +/* Generate xname event by changing focus from None to PointerRoot. */ + XSync(display, True); + XSetInputFocus(display, PointerRoot, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered to the root window of all screens */ +/* with detail set to NotifyPointerRoot. */ + _detail_ = NotifyPointerRoot; + high = 0; + for (ptr = guardian; ptr != (Winh *) NULL; ptr = ptr->nextsibling) { + if (ptr == guardian) + CHECK; + /* + * skip to first FocusIn-type event + */ + for (winhe = ptr->delivered; winhe != (Winhe *) NULL; winhe = winhe->next) { + if (winhe->event->type == EVENT) + break; + } + if (winhe == (Winhe *) NULL) { + delete("Lost %s event in delivered list", + eventname(EVENT)); + return; + } + if (winhe->sequence > high) + high = winhe->sequence; + if (winhe->event->xfocus.detail != _detail_) { + report("Got detail %d, expected %d on window 0x%x", + winhe->event->xfocus.detail, + _detail_, ptr->window); + FAIL; + } + else { + /* + * cause this event to be ignored during + * later checks for FocusIn events + */ + winhe->event->type = 0; + } + } +/* Verify that event delivered on each window from window P's root down to */ +/* and including window P */ +/* with detail set to NotifyPointer. */ + _detail_ = NotifyPointer; + if (winh_climb(P, Proot, checkdetail)) { + report("Bad detail on some window between windows P's root and P"); + FAIL; + } + else + CHECK; +/* Verify that the NotifyPointerRoot events were delivered before */ +/* NotifyPointer events. */ + for (winhe = Proot->delivered; winhe != (Winhe *) NULL; winhe = winhe->next) { + if (winhe == Proot->delivered) + CHECK; + if (winhe->event->type == EVENT) + break; + } + if (winhe == (Winhe *) NULL) { + delete("Lost %s event in delivered list of Proot", + eventname(EVENT)); + return; + } + else + CHECK; + if (high > winhe->sequence) { + report("NotifyPointerRoot events not delivered before all NotifyPointer events"); + FAIL; + } + else + CHECK; +/* Verify that all xname events are delivered after all */ +/* FocusOut events. */ + status = winh_ordercheck(OTHEREVENT, EVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(14); diff --git a/xts5/Xlib11/FocusOut/FocusOut.m b/xts5/Xlib11/FocusOut/FocusOut.m new file mode 100644 index 00000000..82a9ee83 --- /dev/null +++ b/xts5/Xlib11/FocusOut/FocusOut.m @@ -0,0 +1,2807 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/FocusOut/FocusOut.m,v 1.2 2005-11-03 08:42:28 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/FocusOut/FocusOut.m +>># +>># Description: +>># Tests for FocusOut() +>># +>># Modifications: +>># $Log: fcsot.m,v $ +>># Revision 1.2 2005-11-03 08:42:28 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:16 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:14 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:50:47 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:22:55 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:28 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:01:26 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:58:15 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE FocusOut Xlib11 +>>SET startup focusstartup +>>SET cleanup focuscleanup +>>EXTERN +#define EVENT FocusOut +#define OTHEREVENT FocusIn +#define MASK FocusChangeMask + +static Display *_display_; +static int _detail_; +static long _event_mask_; +static XEvent good; + +static int +selectinput(start, stop, current, previous) +Winh *start, *stop, *current, *previous; +{ +#ifdef lint + winh_free(start); + winh_free(stop); + winh_free(previous); +#endif + return(winh_selectinput(_display_, current, _event_mask_)); +} + +static int +plant(start, stop, current, previous) +Winh *start, *stop, *current, *previous; +{ +#ifdef lint + winh_free(start); + winh_free(stop); + winh_free(previous); +#endif + good.xany.window = current->window; + return(winh_plant(current, &good, NoEventMask, WINH_NOMASK)); +} + +static Bool increasing; /* event sequence increases as we climb */ + +static int +checksequence(start, stop, current, previous) +Winh *start, *stop, *current, *previous; +{ + Winhe *d; + int current_sequence; + int status; + static int last_sequence; + +#ifdef lint + winh_free(start); + winh_free(stop); +#endif + /* look for desired event type */ + for (d = current->delivered; d != (Winhe *) NULL; d = d->next) { + if (d->event->type == good.type) { + current_sequence = d->sequence; + break; + } + } + if (d == (Winhe *) NULL) { + report("%s event not delivered", eventname(good.type)); + delete("Missing event"); + return(-1); + } + if (previous == (Winh *) NULL) + status = 0; /* first call, no previous sequence value */ + else { + /* assume sequence numbers are not the same */ + status = (current_sequence < last_sequence); + if (increasing) + status = (status ? 0 : 1); + if (status) + report("Ordering problem between 0x%x (%d) and 0x%x (%d)", + current->window, current_sequence, + previous->window, last_sequence); + } + last_sequence = current_sequence; + return(status); +} + +static int +checkdetail(start, stop, current, previous) +Winh *start, *stop, *current, *previous; +{ + Winhe *d; + +#ifdef lint + winh_free(start); + winh_free(stop); + winh_free(previous); +#endif + /* look for desired event type */ + for (d = current->delivered; d != (Winhe *) NULL; d = d->next) + if (d->event->type == good.type) + break; + if (d == (Winhe *) NULL) { + report("%s event not delivered to window 0x%x", + eventname(good.type), current->window); + delete("Missing event"); + return(-1); + } + /* check detail */ + if (_detail_ != d->event->xfocus.detail) { + report("Expected detail of %d, got %d on window 0x%x", + _detail_, d->event->xfocus.detail, current->window); + return(1); + } + return(0); +} +>>ASSERTION Good A +When a xname event is generated by a window unmap, +then the xname event is generated after the corresponding +.S UnmapNotify +event. +>>STRATEGY +Create client. +Create window hierarchy. +Select for xname and UnmapNotify events on window. +Set focus to window. +Generate events by unmapping window. +Verify that a UnmapNotify event was delivered. +Verify that a xname event was delivered. +Verify that the xname event was delivered after the UnmapNotify event. +>>CODE +Display *display; +Winh *winh; +int status; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Create window hierarchy. */ + winh = winh_adopt(display, (Winh *) NULL, 0L, (XSetWindowAttributes *) NULL, (Winhg *) NULL, WINH_NOMASK); + if (winh == (Winh *) NULL) + return; + else + CHECK; + if (winh_create(display, (Winh *) NULL, WINH_MAP)) + return; + else + CHECK; +/* Select for xname and UnmapNotify events on window. */ + if (winh_selectinput(display, winh, MASK|StructureNotifyMask)) + return; + else + CHECK; + good.type = EVENT; + good.xany.display = display; + good.xany.window = winh->window; + if (winh_plant(winh, &good, MASK, WINH_NOMASK)) { + report("Could not plant %s events", eventname(good.type)); + return; + } + else + CHECK; + good.type = UnmapNotify; + if (winh_plant(winh, &good, StructureNotifyMask, WINH_NOMASK)) { + report("Could not plant %s events", eventname(good.type)); + return; + } + else + CHECK; +/* Set focus to window. */ + XSetInputFocus(display, winh->window, RevertToNone, CurrentTime); +/* Generate events by unmapping window. */ + XSync(display, True); + XUnmapWindow(display, winh->window); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that a UnmapNotify event was delivered. */ +/* Verify that a xname event was delivered. */ + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that the xname event was delivered after the UnmapNotify event. */ + status = winh_ordercheck(UnmapNotify, EVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(8); +>>#NOTEd >>ASSERTION +>>#NOTEd When the input focus changes, +>>#NOTEd then ARTICLE xname event is generated. +>>#NOTEm >>ASSERTION +>>#NOTEm When the focus window is unmapped, +>>#NOTEm then ARTICLE xname event is generated. +>>ASSERTION Good A +When a xname event is generated, +then +all clients having set +.S FocusChangeMask +event mask bits on the event window are delivered +a xname event. +>>STRATEGY +Create client. +Create clients client2 and client3. +Create window. +Select for xname events on window. +Select for xname events on window with client2. +Select for no events on window with client3. +Set focus to window. +Generate xname event by changing focus from w to None. +Verify that xname event was delivered. +Verify members in delivered xname event structure. +Verify that xname event was delivered to client2. +Verify members in delivered xname event structure. +Verify that no events were delivered to client3. +>>CODE +int i; +Display *display; +Display *client2, *client3; +Window w; +XEvent event; +XFocusChangeEvent good; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; +/* Create window. */ + w = mkwin(display, (XVisualInfo *) NULL, (struct area *) NULL, True); +/* Select for xname events on window. */ + XSelectInput(display, w, MASK); +/* Select for xname events on window with client2. */ + XSelectInput(client2, w, MASK); +/* Select for no events on window with client3. */ + XSelectInput(client3, w, NoEventMask); +/* Set focus to window. */ + XSetInputFocus(display, w, RevertToNone, CurrentTime); +/* Generate xname event by changing focus from w to None. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XSetInputFocus(display, None, RevertToNone, CurrentTime); + XSync(display, False); + XSync(client2, False); + XSync(client3, False); +/* Verify that xname event was delivered. */ + if (XPending(display) < 1) { + report("Expected %s event not delivered.", eventname(EVENT)); + FAIL; + return; + } + else + CHECK; +/* Verify members in delivered xname event structure. */ + XNextEvent(display, &event); + good = event.xfocus; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.window = w; + good.mode = NotifyNormal; + good.detail = NotifyNonlinear; + if (checkevent((XEvent*)&good, &event)) { + report("Unexpected event structure member value(s)"); + FAIL; + } + else + CHECK; + if ((i = XPending(display)) > 0) { + report("Expected 1 event, got %d", i+1); + FAIL; + } + else + CHECK; +/* Verify that xname event was delivered to client2. */ + if (XPending(client2) < 1) { + report("Expected %s event not delivered to client2.", eventname(EVENT)); + FAIL; + return; + } + else + CHECK; +/* Verify members in delivered xname event structure. */ + XNextEvent(client2, &event); + good = event.xfocus; + good.type = EVENT; + good.send_event = False; + good.display = client2; + good.window = w; + good.mode = NotifyNormal; + good.detail = NotifyNonlinear; + if (checkevent((XEvent*)&good, &event)) { + report("Unexpected event structure member value(s) for client2"); + FAIL; + } + else + CHECK; + if ((i = XPending(client2)) > 0) { + report("Expected 1 event, got %d for client2", i+1); + FAIL; + } + else + CHECK; +/* Verify that no events were delivered to client3. */ + if ((i = XPending(client3)) > 0) { + report("Expected 0 events, got %d for client3", i); + FAIL; + } + else + CHECK; + CHECKPASS(10); +>>ASSERTION def +>>#NOTE Tested for in previous assertion. +When a xname event is generated, +then +clients not having set +.S FocusChangeMask +event mask bits on the event window are not delivered +a xname event. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE Global except for MappingNotify and KeymapNotify. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M window +>>#NOTEs is set to +>>#NOTEs the +>>#NOTEs ifdef(`WINDOWTYPE', WINDOWTYPE, event) +>>#NOTEs window. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is generated while the pointer is not grabbed, +>>#NOTEs then +>>#NOTEs .A mode +>>#NOTEs is set to +>>#NOTEs .S NotifyNormal . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is generated while the pointer is grabbed, +>>#NOTEs then +>>#NOTEs .A mode +>>#NOTEs is set to +>>#NOTEs .S NotifyWhileGrabbed . +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is generated +>>#NOTEm and a keyboard grab activates, +>>#NOTEm then xname events are generated as if the focus were to change from +>>#NOTEm the old focus to the grab window with +>>#NOTEm .A mode +>>#NOTEm is set to +>>#NOTEm .S NotifyGrab . +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is generated +>>#NOTEm and a keyboard grab deactivates, +>>#NOTEm then xname events are generated as if the focus were to change from +>>#NOTEm the grab window to the new focus with +>>#NOTEm .A mode +>>#NOTEm is set to +>>#NOTEm .S NotifyUngrab . +>>ASSERTION def +All xname events are delivered before +any related +.S FocusIn +are delivered. +>>ASSERTION Good A +>>#NOTE +>>#NOTE Some of these assertions have wording which is not relevant. +>>#NOTE For example, many state ``the pointer is in window P'' but +>>#NOTE make no other reference to window P. +>>#NOTE +When the input focus moves from window A to window B +and window A is an inferior of window B +and the pointer is in window P, +then a xname event is generated on window A, +with +.M detail +set to +.S NotifyAncestor +and then on each window +between window A and window B, +exclusive, +with +.M detail +set to +.S NotifyVirtual . +>>STRATEGY +Create client. +Build window hierarchy. +Move pointer to known location. +Set window B. +Set window A to inferior of window B. +Set input focus to window A. +Select for Focus events on windows. +Generate xname event by changing focus from A to B. +Verify that the expected events were delivered. +Verify that event delivered to window A with detail set to NotifyAncestor. +Verify that event delivered on each window +between window A and window B, exclusive, +with detail set to NotifyVirtual. +Verify that all xname events are delivered before all +FocusIn events. +>>CODE +Display *display; +int depth = 4; +Winh *A, *B; +int status; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy. */ + if (winh(display, depth, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set window B. */ + B = guardian->firstchild; +/* Set window A to inferior of window B. */ + A = B->firstchild->firstchild->firstchild; +/* Set input focus to window A. */ + XSetInputFocus(display, A->window, RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + _event_mask_ = MASK; + _display_ = display; + if (winh_climb(A, B, selectinput)) { + report("Could not select for events"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(A, B->firstchild, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; +/* Generate xname event by changing focus from A to B. */ + XSync(display, True); + XSetInputFocus(display, B->window, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event(B, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered to window A with detail set to NotifyAncestor. */ + _detail_ = NotifyAncestor; + if (winh_climb(A, A, checkdetail)) + FAIL; + else + CHECK; +/* Verify that event delivered on each window */ +/* between window A and window B, exclusive, */ +/* with detail set to NotifyVirtual. */ + _detail_ = NotifyVirtual; + if (winh_climb(A->parent, B->firstchild, checkdetail)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered before all */ +/* FocusIn events. */ + status = winh_ordercheck(EVENT, OTHEREVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(10); +>>ASSERTION Good A +When the input focus moves from window A to window B +and window B is an inferior of window A +and the pointer is in window P +and window P is an inferior of window A +and window P is not an inferior of window B +and window P is not an ancestor of window B, +then a xname event is generated on each window +from window P up to but not including window A, +with +.M detail +set to +.S NotifyPointer . +>>STRATEGY +Create client. +Build window hierarchy. +Move pointer to known location. +Set window A. +Set window B to inferior of window A. +Set window P to inferior of sibling of window B. +Move pointer to window P. +Set input focus to window A. +Select for Focus events on windows. +Generate xname event by changing focus from A to B. +Verify that the expected events were delivered. +Verify that event delivered to each window from window P +up to but not including window A, +with detail set to NotifyPointer. +Verify order of xname event delivery. +Verify that all xname events are delivered before all +FocusIn events. +>>CODE +Display *display; +int depth = 4; +Winh *A, *B, *P, *Pancestor; +int status; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy. */ + if (winh(display, depth, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set window A. */ + A = guardian->firstchild; +/* Set window B to inferior of window A. */ + B = A->firstchild; +/* Set window P to inferior of sibling of window B. */ + Pancestor = A->firstchild->nextsibling; + P = Pancestor->firstchild->firstchild; +/* Move pointer to window P. */ + XWarpPointer(display, None, P->window, 0, 0, 0, 0, 0, 0); +/* Set input focus to window A. */ + XSetInputFocus(display, A->window, RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + _event_mask_ = MASK; + _display_ = display; + if (winh_climb(P, Pancestor, selectinput)) { + report("Could not select for events"); + return; + } + else + CHECK; + if (winh_climb(B, A->firstchild, selectinput)) { + report("Could not select for events between B and A"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(P, Pancestor, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; +/* Generate xname event by changing focus from A to B. */ + XSync(display, True); + XSetInputFocus(display, B->window, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered to each window from window P */ +/* up to but not including window A, */ +/* with detail set to NotifyPointer. */ + _detail_ = NotifyPointer; + if (winh_climb(P, Pancestor, checkdetail)) + FAIL; + else + CHECK; +/* Verify order of xname event delivery. */ + increasing = False; + if (winh_climb(P, Pancestor, checksequence)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered before all */ +/* FocusIn events. */ + status = winh_ordercheck(EVENT, OTHEREVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(11); +>>ASSERTION Good A +When the input focus moves from window A to window B +and window B is an inferior of window A +and the pointer is in window P, +then, after any related xname events are generated +with +.M detail +set to +.S NotifyPointer , +a xname event is generated on window A, +with +.M detail +set to +.S NotifyInferior . +>>STRATEGY +Create client. +Build window hierarchy. +Move pointer to known location. +Set window A. +Set window B to inferior of window A. +Set window P to inferior of sibling of window B. +Move pointer to window P. +Set input focus to window A. +Select for Focus events on windows. +Generate xname event by changing focus from A to B. +Verify that the expected events were delivered. +Verify that event delivered to each window from window P +up to but not including window A, +with detail set to NotifyPointer. +Verify that event delivered on window A +with detail set to NotifyInferior. +Verify order of xname event delivery. +Verify that all xname events are delivered before all +FocusIn events. +>>CODE +Display *display; +int depth = 4; +Winh *A, *B, *P, *Pancestor; +int status; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy. */ + if (winh(display, depth, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set window A. */ + A = guardian->firstchild; +/* Set window B to inferior of window A. */ + B = A->firstchild; +/* Set window P to inferior of sibling of window B. */ + Pancestor = A->firstchild->nextsibling; + P = Pancestor->firstchild->firstchild; +/* Move pointer to window P. */ + XWarpPointer(display, None, P->window, 0, 0, 0, 0, 0, 0); +/* Set input focus to window A. */ + XSetInputFocus(display, A->window, RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + _event_mask_ = MASK; + _display_ = display; + if (winh_climb(P, A, selectinput)) { + report("Could not select for events"); + return; + } + else + CHECK; + if (winh_climb(B, A->firstchild, selectinput)) { + report("Could not select for events between B and A"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(P, A, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; +/* Generate xname event by changing focus from A to B. */ + XSync(display, True); + XSetInputFocus(display, B->window, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered to each window from window P */ +/* up to but not including window A, */ +/* with detail set to NotifyPointer. */ + _detail_ = NotifyPointer; + if (winh_climb(P, Pancestor, checkdetail)) + FAIL; + else + CHECK; +/* Verify that event delivered on window A */ +/* with detail set to NotifyInferior. */ + _detail_ = NotifyInferior; + if (winh_climb(A, A, checkdetail)) + FAIL; + else + CHECK; +/* Verify order of xname event delivery. */ + increasing = False; + if (winh_climb(P, A, checksequence)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered before all */ +/* FocusIn events. */ + status = winh_ordercheck(EVENT, OTHEREVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(12); +>>ASSERTION Good A +When the input focus moves from window A to window B +and window C is their least common ancestor +and the pointer is in window P +and window P is an inferior of window A, +then a xname event is generated on each window +from window P up to but not including window A, +with +.M detail +set to +.S NotifyPointer . +>>STRATEGY +Create client. +Build window hierarchy. +Move pointer to known location. +Set window C. +Set window A to inferior of window C. +Set window P to inferior of window A. +Set window B to inferior of window C. +Move pointer to window P. +Set input focus to window A. +Select for Focus events on windows. +Generate xname event by changing focus from A to B. +Verify that the expected events were delivered. +Verify that event delivered to windows from window P +up to but not including window A, +with detail set to NotifyPointer. +Verify order of xname event delivery. +Verify that all xname events are delivered before all +FocusIn events. +>>CODE +Display *display; +int depth = 5; +Winh *A, *B, *C, *P; +int status; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy. */ + if (winh(display, depth, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set window C. */ + C = guardian->firstchild; +/* Set window A to inferior of window C. */ + A = C->firstchild; +/* Set window P to inferior of window A. */ + P = A->firstchild->firstchild->firstchild; +/* Set window B to inferior of window C. */ + B = C->firstchild->nextsibling->firstchild; +/* Move pointer to window P. */ + XWarpPointer(display, None, P->window, 0, 0, 0, 0, 0, 0); +/* Set input focus to window A. */ + XSetInputFocus(display, A->window, RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + _event_mask_ = MASK; + _display_ = display; + if (winh_climb(P, A->firstchild, selectinput)) { + report("Could not select for events"); + return; + } + else + CHECK; + /* This gets us a FocusIn event. */ + if (winh_climb(B, B, selectinput)) { + report("Could not select for events on B"); + return; + } + else + CHECK; + if (winh_climb(P, A->firstchild, selectinput)) { + report("Could not select for events below A to P"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(P, A->firstchild, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; +/* Generate xname event by changing focus from A to B. */ + XSync(display, True); + XSetInputFocus(display, B->window, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered to windows from window P */ +/* up to but not including window A, */ +/* with detail set to NotifyPointer. */ + _detail_ = NotifyPointer; + if (winh_climb(P, A->firstchild, checkdetail)) + FAIL; + else + CHECK; +/* Verify order of xname event delivery. */ + increasing = False; + if (winh_climb(P, A->firstchild, checksequence)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered before all */ +/* FocusIn events. */ + status = winh_ordercheck(EVENT, OTHEREVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(12); +>>ASSERTION Good A +When the input focus moves from window A to window B +and window C is their least common ancestor +and the pointer is in window P, +then, after any related xname events are generated +with +.M detail +set to +.S NotifyPointer , +a xname event is generated on window A, +with +.M detail +set to +.S NotifyNonlinear +and then on +each window between window A and window C, exclusive, +with +.M detail +set to +.S NotifyNonlinearVirtual . +>>STRATEGY +Create client. +Build window hierarchy. +Move pointer to known location. +Set window C. +Set window A to inferior of window C. +Set window P to inferior of window A. +Set window B to inferior of window C. +Move pointer to window P. +Set input focus to window A. +Select for Focus events on windows. +Generate xname event by changing focus from A to B. +Verify that the expected events were delivered. +Verify that event delivered to windows from window P +up to but not including window A, +with detail set to NotifyPointer. +Verify that event delivered to window A +with detail set to NotifyNonlinear. +Verify that event delivered between window A and window C, exclusive, +with detail set to NotifyNonlinearVirtual. +Verify order of xname event delivery. +Verify that all xname events are delivered before all +FocusIn events. +>>CODE +Display *display; +int depth = 5; +Winh *A, *B, *C, *P; +int status; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy. */ + if (winh(display, depth, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set window C. */ + C = guardian->firstchild; +/* Set window A to inferior of window C. */ + A = C->firstchild->firstchild->firstchild; +/* Set window P to inferior of window A. */ + P = A->firstchild; +/* Set window B to inferior of window C. */ + B = C->firstchild->nextsibling->firstchild; +/* Move pointer to window P. */ + XWarpPointer(display, None, P->window, 0, 0, 0, 0, 0, 0); +/* Set input focus to window A. */ + XSetInputFocus(display, A->window, RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + _event_mask_ = MASK; + _display_ = display; + if (winh_climb(P, A, selectinput)) { + report("Could not select for events"); + return; + } + else + CHECK; + if (winh_climb(A->parent, C->firstchild, selectinput)) { + report("Could not select for events between A to C"); + return; + } + else + CHECK; + /* This gets us a FocusIn event. */ + if (winh_climb(B, B, selectinput)) { + report("Could not select for events on B"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(P, A, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; + if (winh_climb(A->parent, C->firstchild, plant)) { + report("Could not plant events between A and C"); + return; + } + else + CHECK; +/* Generate xname event by changing focus from A to B. */ + XSync(display, True); + XSetInputFocus(display, B->window, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered to windows from window P */ +/* up to but not including window A, */ +/* with detail set to NotifyPointer. */ + _detail_ = NotifyPointer; + if (winh_climb(P, A->firstchild, checkdetail)) { + report("Incorrect detail from P up to A"); + FAIL; + } + else + CHECK; +/* Verify that event delivered to window A */ +/* with detail set to NotifyNonlinear. */ + _detail_ = NotifyNonlinear; + if (winh_climb(A, A, checkdetail)) { + report("Incorrect detail for A"); + FAIL; + } + else + CHECK; +/* Verify that event delivered between window A and window C, exclusive, */ +/* with detail set to NotifyNonlinearVirtual. */ + _detail_ = NotifyNonlinearVirtual; + if (winh_climb(A->parent, C->firstchild, checkdetail)) { + report("Incorrect detail between A and C"); + FAIL; + } + else + CHECK; +/* Verify order of xname event delivery. */ + increasing = False; + if (winh_climb(P, A, checksequence)) + FAIL; + else + CHECK; + increasing = False; + if (winh_climb(A, C->firstchild, checksequence)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered before all */ +/* FocusIn events. */ + status = winh_ordercheck(EVENT, OTHEREVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(16); +>>ASSERTION Good C +>>#NOTE This is also tested for in the following assertion. +If the implementation supports multiple screens: +When the input focus moves from window A to window B +and window A and window B are not on the same screens +and the pointer is in window P +and window P is an inferior of window A, +then a xname event is generated on +each window from window P up to but not including window A, +with +.M detail +set to +.S NotifyPointer . +>>STRATEGY +Check to see if multiple screens are supported. +Create client. +Build window hierarchy on all supported screens. +Move pointer to known location. +Set window A. +Set window B to an inferior of the root window on a different screen than A. +Set window P. +Move pointer to window P. +Set input focus to window A. +Select for Focus events on windows. +Generate xname event by changing focus from A to B. +Verify that the expected events were delivered. +Verify that event delivered to each window from window P +up to but not including window A, +with detail set to NotifyPointer. +Verify order of xname event delivery. +Verify that all xname events are delivered before all +FocusIn events. +>>CODE +Display *display; +int depth = 4; +Winh *A, *B, *Broot, *P, *Pancestor; +int status; + +/* Check to see if multiple screens are supported. */ + if (config.alt_screen == -1) { + unsupported("Multiple screens not supported."); + return; + } + else + CHECK; +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy on all supported screens. */ + if (winh(display, depth, WINH_MAP|WINH_BOTH_SCREENS)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set window A. */ + A = guardian->firstchild; +/* Set window B to an inferior of the root window on a different screen than A. */ + Broot = guardian->nextsibling; + B = Broot->firstchild->firstchild; +/* Set window P. */ + Pancestor = A->firstchild; + P = Pancestor->firstchild->firstchild; +/* Move pointer to window P. */ + XWarpPointer(display, None, P->window, 0, 0, 0, 0, 0, 0); +/* Set input focus to window A. */ + XSetInputFocus(display, A->window, RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + _event_mask_ = MASK; + _display_ = display; + if (winh_climb(P, Pancestor, selectinput)) { + report("Could not select for events"); + return; + } + else + CHECK; + if (winh_climb(B, Broot, selectinput)) { + report("Could not select for events on windows B and above"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(P, Pancestor, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; +/* Generate xname event by changing focus from A to B. */ + XSync(display, True); + XSetInputFocus(display, B->window, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered to each window from window P */ +/* up to but not including window A, */ +/* with detail set to NotifyPointer. */ + _detail_ = NotifyPointer; + if (winh_climb(P, Pancestor, checkdetail)) + FAIL; + else + CHECK; +/* Verify order of xname event delivery. */ + increasing = False; + if (winh_climb(P, Pancestor, checksequence)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered before all */ +/* FocusIn events. */ + status = winh_ordercheck(EVENT, OTHEREVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(12); +>>ASSERTION Good C +If the implementation supports multiple screens: +When the input focus moves from window A to window B +and window A and window B are not on the same screens +and the pointer is in window P, +then, after any related xname events are generated +with +.M detail +set to +.S NotifyPointer , +a xname event is generated on +window A, +with +.M detail +set to +.S NotifyNonlinear . +>>STRATEGY +Check to see if multiple screens are supported. +Create client. +Build window hierarchy on all supported screens. +Move pointer to known location. +Set window A to a root window. +Set window B to an inferior of the root window on a different screen than A. +Set window P. +Move pointer to window P. +Set input focus to window A. +Select for Focus events on windows. +Generate xname event by changing focus from A to B. +Verify that the expected events were delivered. +Verify that event delivered to each window from window P +up to but not including window A, +with detail set to NotifyPointer. +Verify that event delivered to window A +with detail set to NotifyNonlinear. +Verify order of xname event delivery. +Verify that all xname events are delivered before all +FocusIn events. +>>CODE +Display *display; +int depth = 4; +Winh *A, *B, *Broot, *P, *Pancestor; +int status; + +/* Check to see if multiple screens are supported. */ + if (config.alt_screen == -1) { + unsupported("Multiple screens not supported."); + return; + } + else + CHECK; +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy on all supported screens. */ + if (winh(display, depth, WINH_MAP|WINH_BOTH_SCREENS)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set window A to a root window. */ + A = guardian; +/* Set window B to an inferior of the root window on a different screen than A. */ + Broot = guardian->nextsibling; + B = Broot->firstchild->firstchild; +/* Set window P. */ + Pancestor = A->firstchild; + P = Pancestor->firstchild->firstchild; +/* Move pointer to window P. */ + XWarpPointer(display, None, P->window, 0, 0, 0, 0, 0, 0); +/* Set input focus to window A. */ + XSetInputFocus(display, A->window, RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + _event_mask_ = MASK; + _display_ = display; + if (winh_climb(P, A, selectinput)) { + report("Could not select for events"); + return; + } + else + CHECK; + if (winh_climb(B, Broot, selectinput)) { + report("Could not select for events on windows B and above"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(P, A, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; +/* Generate xname event by changing focus from A to B. */ + XSync(display, True); + XSetInputFocus(display, B->window, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered to each window from window P */ +/* up to but not including window A, */ +/* with detail set to NotifyPointer. */ + _detail_ = NotifyPointer; + if (winh_climb(P, Pancestor, checkdetail)) + FAIL; + else + CHECK; +/* Verify that event delivered to window A */ +/* with detail set to NotifyNonlinear. */ + _detail_ = NotifyNonlinear; + if (winh_climb(A, A, checkdetail)) + FAIL; + else + CHECK; +/* Verify order of xname event delivery. */ + increasing = False; + if (winh_climb(P, A, checksequence)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered before all */ +/* FocusIn events. */ + status = winh_ordercheck(EVENT, OTHEREVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(13); +>>ASSERTION Good C +If the implementation supports multiple screens: +When the input focus moves from window A to window B +and window A and window B are not on the same screens +and the pointer is in window P +and window A is not a root window, +then, after the related xname event is generated +with +.M detail +set to +.S NotifyNonlinear , +a xname event is generated on +each window above window A up to and including its root, +with +.M detail +set to +.S NotifyNonlinearVirtual . +>>STRATEGY +Check to see if multiple screens are supported. +Create client. +Build window hierarchy on all supported screens. +Move pointer to known location. +Set window A to a non-root window. +Set window B to an inferior of the root window on a different screen than A. +Move pointer to window B. +Set input focus to window A. +Select for Focus events on windows. +Generate xname event by changing focus from A to B. +Verify that the expected events were delivered. +Verify that event delivered to window A +with detail set to NotifyNonlinear. +Verify that event delivered on each window above window A +up to and including its root, +with detail set to NotifyNonlinearVirtual. +Verify order of xname event delivery. +Verify that all xname events are delivered before all +FocusIn events. +>>CODE +Display *display; +int depth = 4; +Winh *A, *Aroot, *B, *Broot; +int status; + +/* Check to see if multiple screens are supported. */ + if (config.alt_screen == -1) { + unsupported("Multiple screens not supported."); + return; + } + else + CHECK; +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy on all supported screens. */ + if (winh(display, depth, WINH_MAP|WINH_BOTH_SCREENS)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set window A to a non-root window. */ + Aroot = guardian; + A = Aroot->firstchild->firstchild->firstchild; +/* Set window B to an inferior of the root window on a different screen than A. */ + Broot = guardian->nextsibling; + B = Broot->firstchild->firstchild; +/* Move pointer to window B. */ + XWarpPointer(display, None, B->window, 0, 0, 0, 0, 0, 0); +/* Set input focus to window A. */ + XSetInputFocus(display, A->window, RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + _event_mask_ = MASK; + _display_ = display; + if (winh_climb(A, Aroot, selectinput)) { + report("Could not select for events"); + return; + } + else + CHECK; + if (winh_climb(B, Broot, selectinput)) { + report("Could not select for events on windows B and above"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(A, Aroot, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; +/* Generate xname event by changing focus from A to B. */ + XSync(display, True); + XSetInputFocus(display, B->window, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered to window A */ +/* with detail set to NotifyNonlinear. */ + _detail_ = NotifyNonlinear; + if (winh_climb(A, A, checkdetail)) + FAIL; + else + CHECK; +/* Verify that event delivered on each window above window A */ +/* up to and including its root, */ +/* with detail set to NotifyNonlinearVirtual. */ + _detail_ = NotifyNonlinearVirtual; + if (winh_climb(A->parent, Aroot, checkdetail)) + FAIL; + else + CHECK; +/* Verify order of xname event delivery. */ + increasing = False; + if (winh_climb(A, Aroot, checksequence)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered before all */ +/* FocusIn events. */ + status = winh_ordercheck(EVENT, OTHEREVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(13); +>>ASSERTION Good A +When the focus moves from window A to +.S PointerRoot +(events sent to the window under the pointer) +or when the focus moves from window A to +.S None +(discard) +and the pointer is in window P +and window P is an inferior of window A, +then a xname event is generated on +each window from window P up to but not including window A, +with +.M detail +set to +.S NotifyPointer . +>>STRATEGY +Create client. +Build window hierarchy. +Set window A to a root window. +Set P to inferior of A. +Move pointer to P. +Set input focus to A. +Select for Focus events on windows. +Generate xname event by changing focus from A to PointerRoot. +Verify that the expected events were delivered. +Verify that event delivered on each window from window P up to +but not including window A +with detail set to NotifyPointer. +Verify that these events occurred in the correct order. +Verify that all xname events are delivered before all +FocusIn events. +Repeat with final focus set to None. +>>CODE +Display *display; +int depth = 4; +Winh *A, *P, *Pancestor; +int status; +int i; +static Window focuses[] = { + (Window) PointerRoot, + (Window) None +}; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy. */ + if (winh(display, depth, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Set window A to a root window. */ + A = guardian; +/* Set P to inferior of A. */ + Pancestor = A->firstchild; + P = Pancestor->firstchild->firstchild; +/* Move pointer to P. */ + if (warppointer(display, P->window, 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; + for (i = 0; i < NELEM(focuses); i++) { +/* Set input focus to A. */ + XSetInputFocus(display, A->window, RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + if (winh_selectinput(display, (Winh *) NULL, MASK)) { + report("Could not select for events"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + /* + * Select on A as well because we are selecting for events + * on all windows. + */ + if (winh_climb(P, A, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; +/* Generate xname event by changing focus from A to PointerRoot. */ + XSync(display, True); + XSetInputFocus(display, focuses[i], RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered on each window from window P up to */ +/* but not including window A */ +/* with detail set to NotifyPointer. */ + _detail_ = NotifyPointer; + if (winh_climb(P, Pancestor, checkdetail)) + FAIL; + else + CHECK; +/* Verify that these events occurred in the correct order. */ + increasing = False; + if (winh_climb(P, Pancestor, checksequence)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered before all */ +/* FocusIn events. */ + status = winh_ordercheck(EVENT, OTHEREVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } +/* Repeat with final focus set to None. */ + } + CHECKPASS(3 + (7*NELEM(focuses))); +>>ASSERTION Good A +When the focus moves from window A to +.S PointerRoot +(events sent to the window under the pointer) +or when the focus moves from window A to +.S None +(discard) +and the pointer is in window P, +then, after any related xname events are generated +with +.M detail +set to +.S NotifyPointer , +a xname event is generated on +window A, +with +.M detail +set to +.S NotifyNonlinear . +>>STRATEGY +Create client. +Build window hierarchy. +Set window A to a root window. +Set P to inferior of A. +Move pointer to P. +Set input focus to A. +Select for Focus events on windows. +Generate xname event by changing focus from A to PointerRoot. +Verify that the expected events were delivered. +Verify that event delivered on each window from window P up to +but not including window A +with detail set to NotifyPointer. +Verify that event delivered on window A +with detail set to NotifyNonlinear. +Verify that these events occurred in the correct order. +Verify that all xname events are delivered before all +FocusIn events. +Repeat with final focus set to None. +>>CODE +Display *display; +int depth = 4; +Winh *A, *P, *Pancestor; +int status; +int i; +static Window focuses[] = { + (Window) PointerRoot, + (Window) None +}; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy. */ + if (winh(display, depth, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Set window A to a root window. */ + A = guardian; +/* Set P to inferior of A. */ + Pancestor = A->firstchild; + P = Pancestor->firstchild->firstchild; +/* Move pointer to P. */ + if (warppointer(display, P->window, 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; + for (i = 0; i < NELEM(focuses); i++) { +/* Set input focus to A. */ + XSetInputFocus(display, A->window, RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + if (winh_selectinput(display, (Winh *) NULL, MASK)) { + report("Could not select for events"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + /* + * Select on A as well because we are selecting for events + * on all windows. + */ + if (winh_climb(P, A, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; +/* Generate xname event by changing focus from A to PointerRoot. */ + XSync(display, True); + XSetInputFocus(display, focuses[i], RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered on each window from window P up to */ +/* but not including window A */ +/* with detail set to NotifyPointer. */ + _detail_ = NotifyPointer; + if (winh_climb(P, Pancestor, checkdetail)) + FAIL; + else + CHECK; +/* Verify that event delivered on window A */ +/* with detail set to NotifyNonlinear. */ + _detail_ = NotifyNonlinear; + if (winh_climb(A, A, checkdetail)) + FAIL; + else + CHECK; +/* Verify that these events occurred in the correct order. */ + increasing = False; + if (winh_climb(P, A, checksequence)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered before all */ +/* FocusIn events. */ + status = winh_ordercheck(EVENT, OTHEREVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } +/* Repeat with final focus set to None. */ + } + CHECKPASS(3 + (8*NELEM(focuses))); +>>ASSERTION Good A +When the focus moves from window A to +.S PointerRoot +(events sent to the window under the pointer) +or when the focus moves from window A to +.S None +(discard) +and the pointer is in window P +and window A is not a root window, +then, after the related xname event is generated +with +.M detail +set to +.S NotifyNonlinear , +a xname event is generated on +each window above window A up to and including its root, +with +.M detail +set to +.S NotifyNonlinearVirtual . +>>STRATEGY +Create client. +Build window hierarchy. +Set window A to a non-root window. +Set P to root window. +Move pointer to P. +Set input focus to A. +Select for Focus events on windows. +Generate xname event by changing focus from A to PointerRoot. +Verify that the expected events were delivered. +Verify that event delivered on window A +with detail set to NotifyNonlinear. +Verify that event delivered on each window above window A up to +and including its root, +with detail set to NotifyNonlinearVirtual. +Verify that these events occurred in the correct order. +Verify that all xname events are delivered before all +FocusIn events. +Repeat with final focus set to None. +>>CODE +Display *display; +int depth = 4; +Winh *A, *Aroot, *P; +int status; +int i; +static Window focuses[] = { + (Window) PointerRoot, + (Window) None +}; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy. */ + if (winh(display, depth, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Set window A to a non-root window. */ + Aroot = guardian; + A = Aroot->firstchild->firstchild->firstchild; +/* Set P to root window. */ + P = guardian; +/* Move pointer to P. */ + if (warppointer(display, P->window, 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; + for (i = 0; i < NELEM(focuses); i++) { +/* Set input focus to A. */ + XSetInputFocus(display, A->window, RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + if (winh_selectinput(display, (Winh *) NULL, MASK)) { + report("Could not select for events"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(A, Aroot, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; +/* Generate xname event by changing focus from A to PointerRoot. */ + XSync(display, True); + XSetInputFocus(display, focuses[i], RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered on window A */ +/* with detail set to NotifyNonlinear. */ + _detail_ = NotifyNonlinear; + if (winh_climb(A, A, checkdetail)) + FAIL; + else + CHECK; +/* Verify that event delivered on each window above window A up to */ +/* and including its root, */ +/* with detail set to NotifyNonlinearVirtual. */ + _detail_ = NotifyNonlinearVirtual; + if (winh_climb(A->parent, Aroot, checkdetail)) + FAIL; + else + CHECK; +/* Verify that these events occurred in the correct order. */ + increasing = False; + if (winh_climb(A, Aroot, checksequence)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered before all */ +/* FocusIn events. */ + status = winh_ordercheck(EVENT, OTHEREVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } +/* Repeat with final focus set to None. */ + } + CHECKPASS(3 + (8*NELEM(focuses))); +>>ASSERTION def +>>#NOTE The approved wording was as follows: +>>#NOTE +>>#NOTE When the focus moves from +>>#NOTE .S PointerRoot +>>#NOTE (events sent to the window under the pointer) +>>#NOTE or +>>#NOTE .S None +>>#NOTE (discard) +>>#NOTE to window A +>>#NOTE and the pointer is in window P +>>#NOTE and the old focus was +>>#NOTE .S PointerRoot , +>>#NOTE then a xname event is generated on +>>#NOTE each window from window P up to and including window P's root, +>>#NOTE with +>>#NOTE .M detail +>>#NOTE set to +>>#NOTE .S NotifyPointer . +>>#NOTE Tested for in next assertion. +When the focus moves from +.S PointerRoot +(events sent to the window under the pointer) +to window A +and the pointer is in window P, +then a xname event is generated on +each window from window P up to and including window P's root, +with +.M detail +set to +.S NotifyPointer . +>>ASSERTION Good A +When the focus moves from +.S PointerRoot +(events sent to the window under the pointer) +to window A +and the pointer is in window P, +then, after any related xname events are generated +with +.M detail +set to +.S NotifyPointer , +a xname event is generated on +the root window of all screens, +with +.M detail +set to +.S NotifyPointerRoot . +>>STRATEGY +Create client. +Build window hierarchy on all supported screens. +Set window A. +Set window P. +Move pointer to window P. +Set input focus to PointerRoot. +Select for Focus events on windows. +Generate xname event by changing focus from PointerRoot to A. +Verify that the expected events were delivered. +Verify that event delivered to windows above window P +up to and including window P's root, +with detail set to NotifyPointer. +Verify that event delivered to the root window of all screens +with detail set to NotifyPointerRoot. +Verify that these events are delivered after the NotifyPointer events. +Verify order of xname event delivery from P to Proot. +Verify that all xname events are delivered before all +FocusIn events. +>>CODE +Display *display; +int depth = 4; +Winh *A, *P, *Proot, *root; +int status; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy on all supported screens. */ + if (winh(display, depth, WINH_MAP|WINH_BOTH_SCREENS)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Set window A. */ + A = guardian->firstchild->firstchild->firstchild; +/* Set window P. */ + Proot = guardian; + P = Proot->firstchild->nextsibling->firstchild->firstchild; +/* Move pointer to window P. */ + if (warppointer(display, P->window, 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set input focus to PointerRoot. */ + XSetInputFocus(display, PointerRoot, RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + _event_mask_ = MASK; + _display_ = display; + if (winh_selectinput(display, (Winh *) NULL, MASK)) { + report("Could not select for events"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(P, Proot, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; + /* root window of all screens */ + for (root = guardian; root != (Winh *) NULL; root = root->nextsibling) { + if (root == guardian) + CHECK; + good.xany.window = root->window; + if (winh_plant(root, &good, MASK, WINH_NOMASK)) { + report("Could not plant events"); + return; + } + } +/* Generate xname event by changing focus from PointerRoot to A. */ + XSync(display, True); + XSetInputFocus(display, A->window, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { + Winhe *winhe; + +/* Verify that event delivered to windows above window P */ +/* up to and including window P's root, */ +/* with detail set to NotifyPointer. */ + _detail_ = NotifyPointer; + if (winh_climb(P, Proot, checkdetail)) { + report("Incorrect detail from P up to P's root"); + FAIL; + } + else + CHECK; + /* + * Determine sequence number of first FocusOut event + * delivered to Proot. + */ + for (winhe = Proot->delivered; winhe != (Winhe *) NULL; winhe = winhe->next) { + + if (winhe == Proot->delivered) + CHECK; + if (winhe->event->type == EVENT) + break; + } +/* Verify that event delivered to the root window of all screens */ +/* with detail set to NotifyPointerRoot. */ +/* Verify that these events are delivered after the NotifyPointer events. */ + _detail_ = NotifyPointerRoot; + for (root = guardian; root != (Winh *) NULL; root = root->nextsibling) { + Winhe *ptr; + + if (root == guardian) + CHECK; + /* + * skip to first FocusOut-type event + */ + for (ptr = root->delivered; ptr != (Winhe *) NULL; ptr = ptr->next) { + if (ptr->event->type == EVENT) { + static int first = 1; + + /* + * The first FocusOut event on Proot is + * already claimed. + */ + if (root == Proot && first) { + first = 0; + continue; + } + else + break; + } + } + if (ptr == (Winhe *) NULL) { + delete("Lost %s event in delivered list", + eventname(EVENT)); + return; + } + if (ptr->event->xfocus.detail != _detail_) { + report("Got detail %d, expected %d on window 0x%x", + ptr->event->xfocus.detail, + _detail_, root->window); + FAIL; + continue; + } + if (ptr->sequence < winhe->sequence) { + report("Got NotifyPointerRoot-type event on 0x%x prior to all NotifyPointer events", root->window); + FAIL; + } + } +/* Verify order of xname event delivery from P to Proot. */ + increasing = False; + if (winh_climb(P, Proot, checksequence)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered before all */ +/* FocusIn events. */ + status = winh_ordercheck(EVENT, OTHEREVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(13); +>>ASSERTION Good A +>>#NOTE +>>#NOTE The approved form of this assertion is listed below: +>>#NOTE +>>#NOTE When the focus moves from +>>#NOTE .S None +>>#NOTE (discard) +>>#NOTE to window A +>>#NOTE and the pointer is in window P, +>>#NOTE then, after any related xname events are generated +>>#NOTE with +>>#NOTE .M detail +>>#NOTE set to +>>#NOTE .S NotifyPointer , +>>#NOTE a xname event is generated on +>>#NOTE the root windows of all screens, +>>#NOTE with +>>#NOTE .M detail +>>#NOTE set to +>>#NOTE .S NotifyDetailNone . +When the focus moves from +.S None +(discard) +to window A +and the pointer is in window P, +then a xname event is generated on +the root window of all screens, +with +.M detail +set to +.S NotifyDetailNone . +>>STRATEGY +Create client. +Build window hierarchy on all supported screens. +Set window P. +Move pointer to window P. +Set input focus to PointerRoot. +Select for Focus events on windows. +Generate xname event by changing focus from PointerRoot to None. +Verify that the expected events were delivered. +Verify that event delivered to windows above window P +up to and including window P's root, +with detail set to NotifyPointer. +Verify that event delivered to the root window of all screens +with detail set to NotifyPointerRoot. +Verify that these events are delivered after the NotifyPointer events. +Verify order of xname event delivery from P to Proot. +Verify that all xname events are delivered before all +FocusIn events. +>>CODE +Display *display; +int depth = 4; +Winh *P, *Proot, *root; +int status; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy on all supported screens. */ + if (winh(display, depth, WINH_MAP|WINH_BOTH_SCREENS)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Set window P. */ + Proot = guardian; + P = Proot->firstchild->nextsibling->firstchild->firstchild; +/* Move pointer to window P. */ + if (warppointer(display, P->window, 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set input focus to PointerRoot. */ + XSetInputFocus(display, PointerRoot, RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + _event_mask_ = MASK; + _display_ = display; + if (winh_selectinput(display, (Winh *) NULL, MASK)) { + report("Could not select for events"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(P, Proot, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; + /* root window of all screens */ + for (root = guardian; root != (Winh *) NULL; root = root->nextsibling) { + if (root == guardian) + CHECK; + good.xany.window = root->window; + if (winh_plant(root, &good, MASK, WINH_NOMASK)) { + report("Could not plant events"); + return; + } + } +/* Generate xname event by changing focus from PointerRoot to None. */ + XSync(display, True); + XSetInputFocus(display, None, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { + Winhe *winhe; + +/* Verify that event delivered to windows above window P */ +/* up to and including window P's root, */ +/* with detail set to NotifyPointer. */ + _detail_ = NotifyPointer; + if (winh_climb(P, Proot, checkdetail)) { + report("Incorrect detail from P up to P's root"); + FAIL; + } + else + CHECK; + /* + * Determine sequence number of first FocusOut event + * delivered to Proot. + */ + for (winhe = Proot->delivered; winhe != (Winhe *) NULL; winhe = winhe->next) { + + if (winhe == Proot->delivered) + CHECK; + if (winhe->event->type == EVENT) + break; + } +/* Verify that event delivered to the root window of all screens */ +/* with detail set to NotifyPointerRoot. */ +/* Verify that these events are delivered after the NotifyPointer events. */ + _detail_ = NotifyPointerRoot; + for (root = guardian; root != (Winh *) NULL; root = root->nextsibling) { + Winhe *ptr; + + if (root == guardian) + CHECK; + /* + * skip to first FocusOut-type event + */ + for (ptr = root->delivered; ptr != (Winhe *) NULL; ptr = ptr->next) { + if (ptr->event->type == EVENT) { + static int first = 1; + + /* + * The first FocusOut event on Proot is + * already claimed. + */ + if (root == Proot && first) { + first = 0; + continue; + } + else + break; + } + } + if (ptr == (Winhe *) NULL) { + delete("Lost %s event in delivered list", + eventname(EVENT)); + return; + } + if (ptr->event->xfocus.detail != _detail_) { + report("Got detail %d, expected %d on window 0x%x", + ptr->event->xfocus.detail, + _detail_, root->window); + FAIL; + continue; + } + if (ptr->sequence < winhe->sequence) { + report("Got NotifyPointerRoot-type event on 0x%x prior to all NotifyPointer events", root->window); + FAIL; + } + } +/* Verify order of xname event delivery from P to Proot. */ + increasing = False; + if (winh_climb(P, Proot, checksequence)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered before all */ +/* FocusIn events. */ + status = winh_ordercheck(EVENT, OTHEREVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(13); +>>ASSERTION Good A +>>#NOTE The approved wording for this assertion is listed below: +>>#NOTE +>>#NOTE When the focus moves from +>>#NOTE None to PointerRoot +>>#NOTE and the pointer is in window P, +>>#NOTE then, after any related xname events are generated +>>#NOTE with +>>#NOTE .M detail +>>#NOTE set to +>>#NOTE .S NotifyPointer , +>>#NOTE a xname event is generated on +>>#NOTE the root windows of all screens, +>>#NOTE with +>>#NOTE .M detail +>>#NOTE set to +>>#NOTE .S NotifyDetailNone . +When the focus moves from +None to PointerRoot +and the pointer is in window P, +then a xname event is generated on +the root window of all screens, +with +.M detail +set to +.S NotifyDetailNone . +>>STRATEGY +Create client. +Build window hierarchy on all supported screens. +Move pointer to known location. +Set input focus to None. +Select for Focus events on windows. +Generate xname event by changing focus from None to PointerRoot. +Verify that the expected events were delivered. +Verify that event delivered to the root window of all screens +with detail set to NotifyDetailNone. +Verify that all xname events are delivered before all +FocusIn events. +>>CODE +Display *display; +int depth = 1; +Winh *root; +int status; + +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy on all supported screens. */ + if (winh(display, depth, WINH_MAP|WINH_BOTH_SCREENS)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set input focus to None. */ + XSetInputFocus(display, None, RevertToNone, CurrentTime); +/* Select for Focus events on windows. */ + _event_mask_ = MASK; + _display_ = display; + if (winh_selectinput(display, (Winh *) NULL, MASK)) { + report("Could not select for events"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + /* root window of all screens */ + for (root = guardian; root != (Winh *) NULL; root = root->nextsibling) { + if (root == guardian) + CHECK; + good.xany.window = root->window; + if (winh_plant(root, &good, MASK, WINH_NOMASK)) { + report("Could not plant events"); + return; + } + } +/* Generate xname event by changing focus from None to PointerRoot. */ + XSync(display, True); + XSetInputFocus(display, PointerRoot, RevertToNone, CurrentTime); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered to the root window of all screens */ +/* with detail set to NotifyDetailNone. */ + _detail_ = NotifyDetailNone; + for (root = guardian; root != (Winh *) NULL; root = root->nextsibling) { + Winhe *ptr; + + if (root == guardian) + CHECK; + /* + * skip to first FocusOut-type event + */ + for (ptr = root->delivered; ptr != (Winhe *) NULL; ptr = ptr->next) { + if (ptr->event->type == EVENT) + break; + } + if (ptr == (Winhe *) NULL) { + delete("Lost %s event in delivered list", + eventname(EVENT)); + return; + } + if (ptr->event->xfocus.detail != _detail_) { + report("Got detail %d, expected %d on window 0x%x", + ptr->event->xfocus.detail, + _detail_, root->window); + FAIL; + continue; + } + } +/* Verify that all xname events are delivered before all */ +/* FocusIn events. */ + status = winh_ordercheck(EVENT, OTHEREVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(9); diff --git a/xts5/Xlib11/GraphicsExpose/GraphicsExpose.m b/xts5/Xlib11/GraphicsExpose/GraphicsExpose.m new file mode 100644 index 00000000..4fe9ee98 --- /dev/null +++ b/xts5/Xlib11/GraphicsExpose/GraphicsExpose.m @@ -0,0 +1,294 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/GraphicsExpose/GraphicsExpose.m,v 1.2 2005-11-03 08:42:28 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/GraphicsExpose/GraphicsExpose.m +>># +>># Description: +>># Tests for GraphicsExpose() +>># +>># Modifications: +>># $Log: grphcsexps.m,v $ +>># Revision 1.2 2005-11-03 08:42:28 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:16 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:14 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:50:48 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:22:56 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:28 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:01:30 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:58:22 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE GraphicsExpose Xlib11 +>>EXTERN +#define EVENT GraphicsExpose +>>ASSERTION Good A +When xname events are generated, +then they are contiguously delivered by the server. +>>STRATEGY +Create a pair of windows. +Create a gc with graphics-exposures flag set to True. +Generate GraphicsExpose events. +Verify that events were generated. +Verify that events were delivered contiguously. +>>CODE +Display *display = Dsp; +int i; +int expected; +int lastcount; +Window w1, w2; +XVisualInfo *vp; +GC gc; +int numevents; +unsigned int width; + +/* Create a pair of windows. */ + resetvinf(VI_WIN); + nextvinf(&vp); + + winpair(display, vp, &w1, &w2); + getsize(display, w1, &width, (unsigned int *) NULL); +/* Create a gc with graphics-exposures flag set to True. */ + gc = makegc(display, w2); + XSetGraphicsExposures(display, gc, True); + XSelectInput(display, w1, NoEventMask); /* is this necessary?...pc */ + XSelectInput(display, w2, NoEventMask); +/* Generate GraphicsExpose events. */ + XSync(display, True); + XCopyPlane(display, w1, w2, gc, 50, 0, width, 40, 0, 5, 1); + XSync(display, False); + +/* Verify that events were generated. */ + numevents = XPending(display); + if (numevents == 0) { + delete("No events delivered"); + return; + } + else + CHECK; +/* Verify that events were delivered contiguously. */ + expected = -1; + for (i=0; i<numevents; i++) { + XEvent event_return; + + if (i == 0) + CHECK; + XNextEvent(display, &event_return); + if (event_return.type != EVENT) { + report("Received %s event while only expecting %s types", + eventname(event_return.type), eventname(EVENT)); + delete("Unexpected event received."); + return; + } + lastcount = event_return.xexpose.count; + if (expected == -1) { + expected = lastcount; + } + else { + if (lastcount > expected) { + report("Count (%d) greater than expected (%d)", + lastcount, expected); + FAIL; + break; + } + else if (lastcount < expected) + expected--; + } + } + if (lastcount != 0) { + report("Last %s had count set to %d, not zero", + eventname(EVENT), lastcount); + FAIL; + } + else + CHECK; + + CHECKPASS(3); +>>#NOTEm >>ASSERTION +>>#NOTEm When a call to +>>#NOTEm .F XCopyArea +>>#NOTEm or +>>#NOTEm .F XCopyPlane +>>#NOTEm is made +>>#NOTEm and the source region is obscured +>>#NOTEm and the graphics-expose attribute +>>#NOTEm of the graphics context is set to +>>#NOTEm .S True , +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEm >>ASSERTION +>>#NOTEm When a call to +>>#NOTEm .F XCopyArea +>>#NOTEm or +>>#NOTEm .F XCopyPlane +>>#NOTEm is made +>>#NOTEm and the source region is out-of-bounds +>>#NOTEm and the graphics-expose attribute +>>#NOTEm of the graphics context is set to +>>#NOTEm .S True , +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M drawable +>>#NOTEs is set to +>>#NOTEs the drawable of the destination region on +>>#NOTEs which the graphics request was to be performed. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M x +>>#NOTEs and +>>#NOTEs .M y +>>#NOTEs are set to +>>#NOTEs the coordinates relative to the window's origin +>>#NOTEs and indicate the upper-left corner of the rectangle defining the exposed region. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M width +>>#NOTEs and +>>#NOTEs .M height +>>#NOTEs are set to +>>#NOTEs the size (extent) of the rectangle. +>>#NOTEs >>ASSERTION +>>#NOTEs When +>>#NOTEs .M count +>>#NOTEs is set to zero, +>>#NOTEs then no further xname events are to follow for the exposed DRAWABLE. +>>#NOTEs >>ASSERTION +>>#NOTEs When +>>#NOTEs .M count +>>#NOTEs is greater than zero, +>>#NOTEs then at least +>>#NOTEs .M count +>>#NOTEs xname events +>>#NOTEs are to follow for the exposed DRAWABLE. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M major_code +>>#NOTEs is set to either +>>#NOTEs .S X_CopyArea +>>#NOTEs or +>>#NOTEs .S X_CopyPlane +>>#NOTEs and +>>#NOTEs .M minor_code +>>#NOTEs is set to zero. diff --git a/xts5/Xlib11/GravityNotify/GravityNotify.m b/xts5/Xlib11/GravityNotify/GravityNotify.m new file mode 100644 index 00000000..afd53635 --- /dev/null +++ b/xts5/Xlib11/GravityNotify/GravityNotify.m @@ -0,0 +1,557 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/GravityNotify/GravityNotify.m,v 1.2 2005-11-03 08:42:28 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/GravityNotify/GravityNotify.m +>># +>># Description: +>># Tests for GravityNotify() +>># +>># Modifications: +>># $Log: grvtyntfy.m,v $ +>># Revision 1.2 2005-11-03 08:42:28 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:17 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:15 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:50:49 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:22:56 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:29 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:01:32 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:58:24 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE GravityNotify Xlib11 +>>EXTERN +#define EVENT GravityNotify +#define MASK StructureNotifyMask +#define MASKP SubstructureNotifyMask +>>ASSERTION Good A +When a xname event is generated, +then all clients having set +.S StructureNotifyMask +event mask bits on the moved window are delivered +a xname event. +>>STRATEGY +Create clients client2 and client3. +Build and create window hierarchy with child having +win-gravity SouthEastGravity. +Select for GravityNotify events using StructureNotifyMask. +Select for GravityNotify events using StructureNotifyMask with client2. +Select for no events with client3. +Generate GravityNotify event. +Verify that a GravityNotify event is delivered. +Verify that a GravityNotify event is delivered to client2. +Verify that no events are delivered to client3. +Verify delivered event structure members. +>>CODE +Display *display = Dsp; +Display *client2; +Display *client3; +Winh *parent, *eventw; +XSetWindowAttributes attrs; +Winhg winhg; +int status; +XEvent event; + +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; +/* Build and create window hierarchy with child having */ +/* win-gravity SouthEastGravity. */ + /* can't use winh() because the windows need to overlap */ + winhg.border_width = 1; + winhg.area.x = 1; + winhg.area.y = 1; + winhg.area.width = 100; + winhg.area.height = 100; + parent = winh_adopt(display, (Winh *) NULL, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (parent == (Winh *) NULL) { + report("Could not create parent"); + return; + } + else + CHECK; + winhg.area.x = 1; + winhg.area.y = 1; + winhg.area.width /= 2; + winhg.area.height /= 2; + attrs.win_gravity = SouthEastGravity; + eventw = winh_adopt(display, parent, CWWinGravity, &attrs, &winhg, WINH_NOMASK); + if (eventw == (Winh *) NULL) { + report("Could not create child"); + return; + } + else + CHECK; + if (winh_create(display, (Winh *) NULL, WINH_MAP)) + return; + else + CHECK; +/* Select for GravityNotify events using StructureNotifyMask. */ + if (winh_selectinput(display, (Winh *) NULL, MASK)) { + report("Selection with first client failed."); + return; + } + else + CHECK; +/* Select for GravityNotify events using StructureNotifyMask with client2. */ + if (winh_selectinput(client2, (Winh *) NULL, MASK)) { + report("Selection with client2 failed."); + return; + } + else + CHECK; +/* Select for no events with client3. */ + if (winh_selectinput(client3, (Winh *) NULL, NoEventMask)) { + report("Selection with client3 failed."); + return; + } + else + CHECK; +/* Generate GravityNotify event. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XResizeWindow(display, parent->window, ++(parent->winhg.area.width), ++(parent->winhg.area.height)); + event.xany.type = EVENT; + event.xany.window = eventw->window; + if (winh_plant(eventw, &event, MASK, WINH_NOMASK)) { + report("Could not plant events."); + return; + } + else + CHECK; + XSync(display, False); + XSync(client2, False); + XSync(client3, False); +/* Verify that a GravityNotify event is delivered. */ +/* Verify that a GravityNotify event is delivered to client2. */ +/* Verify that no events are delivered to client3. */ + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events for display"); + return; + } + else + CHECK; + if (winh_harvest(client2, (Winh *) NULL)) { + report("Could not harvest events for client2"); + return; + } + else + CHECK; + if (winh_harvest(client3, (Winh *) NULL)) { + report("Could not harvest events for client3"); + return; + } + else + CHECK; + /* not interested in resulting ConfigureNotify events */ + if (winh_ignore_event((Winh *) NULL, ConfigureNotify, WINH_NOMASK)) + return; + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status == -1) + return; + else if (status) { + report("Event delivery not as expected"); + FAIL; + } + else { + XGravityEvent good; + Winhe *winhe; + +/* Verify delivered event structure members. */ + /* ignore non-GravityNotify events */ + for (winhe=winh_qdel; winhe!=(Winhe *) NULL; winhe=winhe->next){ + if (winhe->event->type == EVENT) { + CHECK; + break; + } + } + if (winhe == (Winhe *) NULL) { + delete("Inconsistencies in delivered event queue"); + FAIL; + } + else + { + good = winhe->event->xgravity; + good.type = EVENT; + good.event = eventw->window; + good.window = eventw->window; + good.x = eventw->winhg.area.x + 1; + good.y = eventw->winhg.area.y + 1; + if (checkevent((XEvent *) &good, winhe->event)) { + report("Unexpected event member values"); + FAIL; + } + else + CHECK; + } + } + + CHECKPASS(15); +>>ASSERTION Good A +When a xname event is generated, +then all clients having set +.S SubstructureNotifyMask +event mask bits on the parent of the moved window are delivered +a xname event. +>>STRATEGY +Create clients client2 and client3. +Build and create window hierarchy with child having +win-gravity SouthEastGravity. +Select for GravityNotify events using SubstructureNotifyMask. +Select for GravityNotify events using SubstructureNotifyMask with client2. +Select for no events with client3. +Generate GravityNotify event. +Verify that a GravityNotify event is delivered. +Verify that a GravityNotify event is delivered to client2. +Verify that no events are delivered to client3. +Verify delivered event structure members. +>>CODE +Display *display = Dsp; +Display *client2; +Display *client3; +Winh *parent, *eventw; +XSetWindowAttributes attrs; +Winhg winhg; +int status; +XEvent event; + +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; +/* Build and create window hierarchy with child having */ +/* win-gravity SouthEastGravity. */ + /* can't use winh() because the windows need to overlap */ + winhg.border_width = 1; + winhg.area.x = 1; + winhg.area.y = 1; + winhg.area.width = 100; + winhg.area.height = 100; + parent = winh_adopt(display, (Winh *) NULL, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (parent == (Winh *) NULL) { + report("Could not create parent"); + return; + } + else + CHECK; + winhg.area.x = 1; + winhg.area.y = 1; + winhg.area.width /= 2; + winhg.area.height /= 2; + attrs.win_gravity = SouthEastGravity; + eventw = winh_adopt(display, parent, CWWinGravity, &attrs, &winhg, WINH_NOMASK); + if (eventw == (Winh *) NULL) { + report("Could not create child"); + return; + } + else + CHECK; + if (winh_create(display, (Winh *) NULL, WINH_MAP)) + return; + else + CHECK; +/* Select for GravityNotify events using SubstructureNotifyMask. */ + if (winh_selectinput(display, (Winh *) NULL, MASKP)) { + report("Selection with first client failed."); + return; + } + else + CHECK; +/* Select for GravityNotify events using SubstructureNotifyMask with client2. */ + if (winh_selectinput(client2, (Winh *) NULL, MASKP)) { + report("Selection with client2 failed."); + return; + } + else + CHECK; +/* Select for no events with client3. */ + if (winh_selectinput(client3, (Winh *) NULL, NoEventMask)) { + report("Selection with client3 failed."); + return; + } + else + CHECK; +/* Generate GravityNotify event. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XResizeWindow(display, parent->window, ++(parent->winhg.area.width), ++(parent->winhg.area.height)); + event.xany.type = EVENT; + event.xany.window = parent->window; + if (winh_plant(parent, &event, MASKP, WINH_NOMASK)) { + report("Could not plant events"); + return; + } + else + CHECK; + XSync(display, False); + XSync(client2, False); + XSync(client3, False); +/* Verify that a GravityNotify event is delivered. */ +/* Verify that a GravityNotify event is delivered to client2. */ +/* Verify that no events are delivered to client3. */ + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events for display"); + return; + } + else + CHECK; + if (winh_harvest(client2, (Winh *) NULL)) { + report("Could not harvest events for client2"); + return; + } + else + CHECK; + if (winh_harvest(client3, (Winh *) NULL)) { + report("Could not harvest events for client3"); + return; + } + else + CHECK; + /* not interested in resulting ConfigureNotify events */ + if (winh_ignore_event((Winh *) NULL, ConfigureNotify, WINH_NOMASK)) + return; + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status == -1) + return; + else if (status) { + report("Event delivery not as expected"); + FAIL; + } + else { + XGravityEvent good; + Winhe *winhe; + +/* Verify delivered event structure members. */ + /* ignore non-GravityNotify events */ + for (winhe=winh_qdel; winhe!=(Winhe *) NULL; winhe=winhe->next){ + if (winhe->event->type == EVENT) { + CHECK; + break; + } + } + if (winhe == (Winhe *) NULL) { + delete("Inconsistencies in delivered event queue"); + FAIL; + } + else + { + good = winhe->event->xgravity; + good.type = EVENT; + good.event = parent->window; + good.window = eventw->window; + good.x = eventw->winhg.area.x + 1; + good.y = eventw->winhg.area.y + 1; + if (checkevent((XEvent *) &good, winhe->event)) { + report("Unexpected event member values"); + FAIL; + } + else + CHECK; + } + } + + CHECKPASS(15); +>>ASSERTION def +>>#NOTE Tested for in previous two assertions. +When a xname event is generated, +then +clients not having set +.S StructureNotifyMask +event mask bits on the +moved window +and also not having set +.S SubstructureNotifyMask +event mask bits on the +parent of the moved window +are not delivered +a xname event. +>>#NOTEm >>ASSERTION +>>#NOTEm When a window is moved as a result of resizing its parent +>>#NOTEm as a result of a call to +>>#NOTEm .F XConfigureWindow , +>>#NOTEm .F XMoveResizeWindow , +>>#NOTEm or +>>#NOTEm .F XResizeWindow , +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and +>>#NOTEs .S StructureNotify +>>#NOTEs was selected, +>>#NOTEs then +>>#NOTEs .M event +>>#NOTEs is set to +>>#NOTEs the WINDOWTYPE window. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and +>>#NOTEs .S SubstructureNotify +>>#NOTEs was selected, +>>#NOTEs then +>>#NOTEs .M event +>>#NOTEs is set to +>>#NOTEs the WINDOWTYPE window's parent. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE Global except for MappingNotify and KeymapNotify. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M window +>>#NOTEs is set to +>>#NOTEs the +>>#NOTEs ifdef(`WINDOWTYPE', WINDOWTYPE, event) +>>#NOTEs window. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M x +>>#NOTEs and +>>#NOTEs .M y +>>#NOTEs are set to +>>#NOTEs the coordinates of +>>#NOTEs .M window +>>#NOTEs relative to parent window's origin +>>#NOTEs and indicate the position of the upper-left outside corner of +>>#NOTEs .M window . diff --git a/xts5/Xlib11/KeyPress/KeyPress.m b/xts5/Xlib11/KeyPress/KeyPress.m new file mode 100644 index 00000000..f541f3a4 --- /dev/null +++ b/xts5/Xlib11/KeyPress/KeyPress.m @@ -0,0 +1,1038 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/KeyPress/KeyPress.m,v 1.2 2005-11-03 08:42:29 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/KeyPress/KeyPress.m +>># +>># Description: +>># Tests for KeyPress() +>># +>># Modifications: +>># $Log: kyprss.m,v $ +>># Revision 1.2 2005-11-03 08:42:29 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:17 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:16 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:50:51 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:22:57 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:30 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:01:35 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:58:31 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE KeyPress Xlib11 +>>EXTERN +#define EVENT KeyPress +#define EVENTMASK KeyPressMask + +static void +presskey(Dpy, w, kc) +Display *Dpy; +Window w; +int kc; +{ + /* + * Note that we do not call XSetInputFocus() since 2 tests require + * the event window to be an ancestor of the source window. + */ + keypress(Dpy, kc); +} + +static int keyc = 0; + +static int +keycode() +{ +int tmp; + + if(keyc == 0) { + XDisplayKeycodes(Dsp, &keyc, &tmp); + if (keyc < 8) + keyc = 8; + } + return(keyc); +} +>>SET startup focusstartup +>>SET cleanup focuscleanup +>>ASSERTION Good B 1 +>>#NOTE The documentation does not explicitly state the following anywhere, +>>#NOTE it merely states something relative to logical changes in +>>#NOTE key state. In addition, I don't expect very many of these +>>#NOTE assertions to be testable. +When any key is pressed, +then a xname event is generated. +>>STRATEGY +If extended testing is required: + Create window. + Select for xname events. + Simulate a xname event on the window. + Verify that a xname event was delivered. + Verify that the event member fields are correctly set. +>>CODE +Window w; +XEvent event_return; +XKeyEvent good; +PointerPlace *ptr; +int kc; + + + /* If extended testing is required: */ + if(noext(0)) + return; + + /* Create window. */ + w = defwin(Dsp); + + /* Select for xname events. */ + XSelectInput(Dsp, w, EVENTMASK); + + /* Simulate a xname event on the window. */ + ptr = warppointer(Dsp, w, 0,0); + kc = keycode(); + presskey(Dsp, w, kc); + + /* Verify that a xname event was delivered. */ + if (!XCheckTypedWindowEvent(Dsp, w, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } else { + + CHECK; + + good = event_return.xkey; + good.type = EVENT; + good.send_event = False; + good.display = Dsp; + good.window = w; + good.root = DRW(Dsp); + good.subwindow = None; + good.x = 0; + good.y = 0; + good.x_root = ptr->nx; + good.y_root = ptr->ny; + good.state = 0; + good.keycode = kc; + good.same_screen = True; + + /* Verify that the event member fields are correctly set. */ + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } + + keyrel(Dsp, kc); + CHECKPASS(2); + +>>ASSERTION Good B 1 +When a xname event is generated, +then +all clients having set +.S KeyPressMask +event mask bits on the event window are delivered +a xname event. +>>STRATEGY +If extended testing is required: + Create a second client. + Create a third client. + Create a window. + Select for xname events on all clients. + Simulate a xname event on the window. + Verify that the event was delivered to all clients. + Verify that event member fields are correctly set. +Otherwise : + Create a window. + Select for xname events. + Verify no error was generated. +>>CODE +Display *display = Dsp; +Display *client2; +Display *client3; +Window w; +XEvent event_return; +XKeyPressedEvent good; +PointerPlace *ptr; +int kc; + + if(config.extensions) { + + /* If extended testing is required: */ + if(noext(0)) + return; + + client2 = opendisplay(); + client3 = opendisplay(); + + /* Create window. */ + w = defwin(display); + + /* Select for xname events on all the clients. */ + XSelectInput(display, w, EVENTMASK); + XSelectInput(client2, w, EVENTMASK); + XSelectInput(client3, w, EVENTMASK); + + /* Simulate a xname event on the window. */ + ptr = warppointer(display, w, 0,0); + kc = keycode(); + + XSync(client2, True); + XSync(client3, True); + + presskey(display, w, kc); + + XSync(client2, False); + XSync(client3, False); + + good = event_return.xkey; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.window = w; + good.root = DRW(display); + good.subwindow = None; + good.x = 0; + good.y = 0; + good.x_root = ptr->nx; + good.y_root = ptr->ny; + good.state = 0; + good.keycode = kc; + good.same_screen = True; + + /* Verify that the xname events were delivered. */ + /* Verify that xname event member fields are correctly set. */ + if (!XCheckTypedWindowEvent(display, w, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } else { + CHECK; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } +/* client 2 */ + if (!XCheckTypedWindowEvent(client2, w, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } else { + CHECK; + + good.display = client2; + + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } +/* client 3 */ + + if (!XCheckTypedWindowEvent(client3, w, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } else { + CHECK; + + good.display = client3; + + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } + + keyrel(display, kc); + CHECKPASS(6); + + } else { + + w = mkwin(display, (XVisualInfo *) NULL, (struct area *) NULL, False); + XSelectInput(display, w, KeyPressMask); + XSync(display, True); + if (geterr() != Success) { + delete("Error setting up for test."); + return; + } + else + CHECK; + + CHECKUNTESTED(1); + } + +>>ASSERTION Good B 1 +>>#NOTE True for most events (except MappingNotify and selection stuff). +When a xname event is generated, +then +clients not having set +.S KeyPressMask +event mask bits on the event window are not delivered +a xname event. +>>STRATEGY +If extended testing is required: + Create a window. + Create a second client. + Select for various events other than xname for the first client on the window. + Select for xname events for the second client on the window. + Simulate a xname event on the window. + Verify that a xname event was generated for the second client. + Verify that no events were generated for the first client. +>>CODE +Display *display = Dsp; +Display *client2; +XEvent ev; +Window w; +int count; +int kc; + + /* If extended testing is required: */ + if(noext(0)) + return; + + /* Create a window. */ + w = defwin(display); + + /* Create a second client. */ + client2 = opendisplay(); + + /* Select for various events other than xname for the first client on the window. */ + kc = keycode(); + XSelectInput(display, w, KeyReleaseMask|ButtonPressMask|ButtonReleaseMask); + /* Select for xname events for the second client on the window. */ + XSelectInput(client2, w, EVENTMASK); + + /* Simulate a xname event on the window. */ + (void) warppointer(display, w, 0, 0); + XSync(display, True); + XSync(client2, True); + presskey(display, w, kc); + + XSync(client2, False); + + /* Verify that a xname event was generated for the second client. */ + if(XCheckWindowEvent(client2, w, EVENTMASK, &ev) == False) { + report("No %s event was generated.", eventname(EVENT)); + FAIL; + } else + CHECK; + + /* Verify that no events were generated for the first client. */ + count = XPending(display); + if (count != 0) { + report("Got %d unexpected events.", count); + FAIL; + } else + CHECK; + + keyrel(display, kc); + CHECKPASS(2); + +>>ASSERTION Good B 1 +When a xname event is generated +and no client has selected +.S KeyPressMask +on the source window, +then the event propagates, +with propagation stopping at the root window of the screen or +at the first window with +.S KeyPressMask +in its do-not-propagate mask, +from the source window to +the first ancestor window for which +some client has selected +for xname events. +>>STRATEGY +If extended testing is required: + Create a window. + Create a child of that window. + Create a grandchild of the window. + Select xname events on the root window of the screen. + Simulate a xname event on the grandchild. + Verify that a xname event was generated on the root. + Select xname events on the grandparent window. + Set the do_not_propagate mask on the child to xname events. + Simulate a xname event on the grandchild. + Verify no xname event was generated on the grandchild. + Verify no xname event was generated on the child. + Verify no xname event was generated on the parent. + Select xname events on the child window. + Set the do_not_propagate mask of the grandparent to xname events. + Set the do_not_propagate mask of the child to NoEventMask. + Simulate a xname event on the grandchild. + Verify that no xname event was generated on the grandchild. + Verify that no xname event was generated on the parent. + Verify that a xname event was generated on the child. +>>CODE +XEvent ev; +Window w; +Window w1; +Window w2; +XSetWindowAttributes atts; +int kc; + + + /* If extended testing is required: */ + if(noext(0)) + return; + + /* Create a window. */ + w = defwin(Dsp); + /* Create a child of that window. */ + w1 = crechild(Dsp, w, (struct area *) NULL); + /* Create a grandchild of the window. */ + w2 = crechild(Dsp, w1, (struct area *) NULL); + + /* Select xname events on the root window of the screen. */ + XSelectInput(Dsp, DRW(Dsp), EVENTMASK); + /* Simulate a xname event on the grandchild. */ + + (void) warppointer(Dsp, w2, 1,1); + kc = keycode(); + presskey(Dsp, w2, kc); + + /* Verify that a xname event was generated on the root. */ + if (XCheckWindowEvent(Dsp, DRW(Dsp), EVENTMASK, &ev) == False) { + report("Expected event (%s) not received.", eventname(KeyPress)); + FAIL; + } else + CHECK; + + keyrel(Dsp, kc); + XSelectInput(Dsp, DRW(Dsp), NoEventMask); + /* Select xname events on the grandparent window. */ + XSelectInput(Dsp, w, EVENTMASK); + + /* Set the do_not_propagate mask on the child to xname events. */ + atts.do_not_propagate_mask = EVENTMASK; + XChangeWindowAttributes(Dsp, w1, CWDontPropagate, &atts); + + /* Simulate a xname event on the grandchild. */ + presskey(Dsp, w2, kc); + + /* Verify no xname event was generated on the grandchild. */ + if (XCheckWindowEvent(Dsp, w2, EVENTMASK, &ev) != False) { + report("Unexpected event (%s) received.", eventname(KeyPress)); + FAIL; + } else + CHECK; + + /* Verify no xname event was generated on the child. */ + if (XCheckWindowEvent(Dsp, w1, EVENTMASK, &ev) != False) { + report("Unexpected event (%s) received.", eventname(KeyPress)); + FAIL; + } else + CHECK; + + /* Verify no xname event was generated on the parent. */ + if (XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) != False) { + report("Unexpected event (%s) received.", eventname(KeyPress)); + FAIL; + } else + CHECK; + + keyrel(Dsp, kc); + + /* Select xname events on the child window. */ + XSelectInput(Dsp, w1, EVENTMASK); + /* Set the do_not_propagate mask of the grandparent to xname events. */ + XChangeWindowAttributes(Dsp, w, CWDontPropagate, &atts); + + /* Set the do_not_propagate mask of the child to NoEventMask. */ + atts.do_not_propagate_mask = NoEventMask; + XChangeWindowAttributes(Dsp, w1, CWDontPropagate, &atts); + + /* Simulate a xname event on the grandchild. */ + presskey(Dsp, w2, kc); + + /* Verify that no xname event was generated on the grandchild. */ + if (XCheckWindowEvent(Dsp, w2, EVENTMASK, &ev) != False) { + report("Unexpected event (%s) received.", eventname(KeyPress)); + FAIL; + } else + CHECK; + + /* Verify that no xname event was generated on the parent. */ + if (XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) != False) { + report("Unexpected event (%s) received.", eventname(KeyPress)); + FAIL; + } else + CHECK; + + /* Verify that a xname event was generated on the child. */ + if (XCheckWindowEvent(Dsp, w1, EVENTMASK, &ev) == False) { + report("KeyPress event was not delivered to selecting child window."); + FAIL; + } else + CHECK; + + keyrel(Dsp, kc); + CHECKPASS(7); + +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE Global except for MappingNotify and KeymapNotify. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M window +>>#NOTEs is set to +>>#NOTEs the +>>#NOTEs ifdef(`WINDOWTYPE', WINDOWTYPE, event) +>>#NOTEs window. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M root +>>#NOTEs is set to the source window's root window. +>>ASSERTION Good B 1 +>># +>>#COMMENT +>># This assertion contains a tautology; a child is an inferior. +>># - Cal 12/2/92. +>># +When a xname event is delivered +and the source window is an inferior of the event window +and the source window is a child of the event window, +then +.M subwindow +is set to +the source window. +>>STRATEGY +If extended testing is required: + Create a window. + Create a child of the window + Select xname events on the parent. + Simulate a xname event on the child. + Verify that a xname event was generated on the parent. + Verify that the subwindow component was set to the child. +>>CODE +XEvent ev; +Window w; +Window w1; +int kc; + + if(noext(0)) + return; + + /* If extended testing is required: */ + + /* Create a window. */ + w = defwin(Dsp); + /* Create a child of the window */ + w1 = crechild(Dsp, w, (struct area *) NULL); + /* Select xname events on the parent. */ + XSelectInput(Dsp, w, EVENTMASK); + (void) warppointer(Dsp, w1, 1,1); + + /* Simulate a xname event on the child. */ + kc=keycode(); + presskey(Dsp, w1, kc); + + /* Verify that a xname event was generated on the parent. */ + if (XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) == False) { + report("Expected event (%s) not received.", eventname(EVENT)); + FAIL; + } else { + CHECK; + /* Verify that the subwindow component was set to the child. */ + if(ev.xkey.subwindow != w1) { + report("The subwindow component of the %s name was not set correctly.", eventname(EVENT)); + FAIL; + } else + CHECK; + } + + keyrel(Dsp, kc); + CHECKPASS(2); + +>>ASSERTION Good B 1 +When a xname event is delivered +and the source window is an inferior of the event window +and the source window is not a child of the event window, +then +.M subwindow +is set to +the child of the event window that is +an ancestor of the source window. +>>STRATEGY +If extended testing is required : + Create a window. + Create a child. + Create a grandchild. + Create a great-grandchild. + Select xname events on the great-grandparent. + Simulate a xname event on the great-grandchild. + Verify that a xname event was generated on the great-grandparent. + Verify that subwindow component of the event was the child. +>>CODE +Window w; +Window w1; +Window w2; +Window w3; +XEvent ev; +struct area area; +int kc; + + /* If extended testing is required : */ + if (noext(0)) + return; + + /* Create a window. */ + w = defwin(Dsp); + setarea(&area, 10, 10, 30, 30); + /* Create a child. */ + w1 = crechild(Dsp, w, &area); + /* Create a grandchild. */ + w2 = crechild(Dsp, w1, &area); + /* Create a great-grandchild. */ + w3 = crechild(Dsp, w2, &area); + (void) warppointer(Dsp, w3, 1,1); + + /* Select xname events on the great-grandparent. */ + XSelectInput(Dsp, w, EVENTMASK); + + /* Simulate a xname event on the great-grandchild. */ + kc = keycode(); + presskey(Dsp, w3, kc); + + /* Verify that a xname event was generated on the great-grandparent. */ + if (XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) == False) { + report("Expected event (%s) not received.", eventname(EVENT)); + FAIL; + } else { + CHECK; + /* Verify that subwindow component of the event was the child. */ + if(ev.xkey.subwindow != w1) { + report("The subwindow component of the %s event was not set correctly.", eventname(EVENT)); + FAIL; + } else + CHECK; + } + + keyrel(Dsp, kc); + CHECKPASS(2); + +>>ASSERTION Good B 1 +When a xname event is delivered +and the source window is not an inferior of the event window, +then +.M subwindow +is set to +.S None . +>>STRATEGY +If extended testing is required: + Create a window. + Select xname events on the window. + Simulate a xname event on the window. + Verify that a xname event was generated on the window. + Verify that the subwindow component was set to None. + Create a second window. + Grab the keyboard for the first window with owner_events set to False. + Simulate a xname event on the second window. + Verify that a xname event was generated on the grabbing window. + Verify that the subwindow component was set to None. +>>CODE +Window w; +Window w2; +XEvent ev; +int gr; +int kc; + + /* If extended testing is required: */ + if (noext(0)) + return; + + /* Create a window. */ + w = defwin(Dsp); + (void) warppointer(Dsp, w, 1,1); + + /* Select xname events on the window. */ + XSelectInput(Dsp, w, EVENTMASK); + + /* Simulate a xname event on the window. */ + kc=keycode(); + presskey(Dsp, w, kc); + + /* Verify that a xname event was generated on the window. */ + if (XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) == False) { + report("Expected event (%s) not received.", eventname(EVENT)); + FAIL; + } else { + CHECK; + /* Verify that the subwindow component was set to None. */ + if(ev.xkey.subwindow != None) { + report("The subwindow component of the %s event was not set correctly.", eventname(EVENT)); + FAIL; + } else + CHECK; + } + + keyrel(Dsp, kc); + + /* Create a second window. */ + w2 = defwin(Dsp); + + /* Grab the keyboard for the first window with owner_events set to False. */ + if( (gr=XGrabKeyboard(Dsp, w, False, GrabModeAsync, GrabModeAsync, CurrentTime)) != GrabSuccess) { + delete("XGrabKeyboard() returned %s instead of GrabSuccess.", grabreplyname(gr)); + return; + } else + CHECK; + + /* Simulate a xname event on the second window. */ + (void) warppointer(Dsp, w2, 1,1); + presskey(Dsp, w2, kc); + + /* Verify that a xname event was generated on the grabbing window. */ + if (XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) == False) { + report("Expected event (%s) not received.", eventname(EVENT)); + FAIL; + } else { + CHECK; + /* Verify that the subwindow component was set to None. */ + if(ev.xkey.subwindow != None) { + report("The subwindow component of the %s event was not set correctly.", eventname(EVENT)); + FAIL; + } else + CHECK; + } + + XUngrabKeyboard(Dsp, CurrentTime); + keyrel(Dsp, kc); + + CHECKPASS(5); + +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M time +>>#NOTEs is set to +>>#NOTEs the time in milliseconds at which the event was generated. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event window is on the same screen as the root window, +>>#NOTEs then +>>#NOTEs .M x +>>#NOTEs and +>>#NOTEs .M y +>>#NOTEs are set to +>>#NOTEs the coordinates of +>>#NOTEs the final pointer position relative to the event window's origin. +>>ASSERTION Good D 1 +If multiple screens are supported: +When a xname event is delivered +and the event and root windows are not on the same screen, +then +.M x +and +.M y +are set to +zero. +>>STRATEGY +If multiple screens are supported: + If extended testing is required: + Create a window on the default screen. + Select xname events on the window. + Create a window on the alternative screen. + Grab the keyboard for the first window. + Simulate a xname event on the alternate window. + Verify that a xname event was generated on the grabbing window. + Verify that the x and y components were set to zero. +>>CODE +Window w; +Window w2; +XEvent ev; +int gr; +int kc; + + /* If multiple screens are supported: */ + if (config.alt_screen == -1) { + unsupported("Multiple screens not supported."); + return; + } else + CHECK; + + /* If extended testing is required: */ + if(noext(0)) + return; + /* Create a window on the default screen. */ + w = defwin(Dsp); + + /* Select xname events on the window. */ + (void) warppointer(Dsp, w, 1,1); + XSelectInput(Dsp, w, EVENTMASK); + + /* Create a window on the alternative screen. */ + w2 = defdraw(Dsp, VI_ALT_WIN); + + /* Grab the keyboard for the first window. */ + if( (gr=XGrabKeyboard(Dsp, w, False, GrabModeAsync, GrabModeAsync, CurrentTime)) != GrabSuccess) { + delete("XGrabKeyboard() returned %s instead of GrabSuccess.", grabreplyname(gr)); + return; + } else + CHECK; + + kc=keycode(); + /* Simulate a xname event on the alternate window. */ + (void) warppointer(Dsp, w2, 1,1); + presskey(Dsp, w2, kc); + + /* Verify that a xname event was generated on the grabbing window. */ + if (XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) == False) { + report("Expected event (%s) not received.", eventname(EVENT)); + FAIL; + } else { + CHECK; + /* Verify that the x and y components were set to zero. */ + if(ev.xkey.x != 0 || ev.xkey.y != 0) { + report("The x (value %d) and y (value %d) components of the %s event were not set to zero.", ev.xkey.x, ev.xkey.y, eventname(EVENT)); + FAIL; + } else + CHECK; + } + + keyrel(Dsp, kc); + XUngrabKeyboard(Dsp, CurrentTime); + + CHECKPASS(4); + +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M x_root +>>#NOTEs and +>>#NOTEs .M y_root +>>#NOTEs are set to coordinates of the pointer +>>#NOTEs when the event was generated +>>#NOTEs relative to the root window's origin. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M state +>>#NOTEs is set to +>>#NOTEs indicate the logical state +>>#NOTEs of the pointer buttons, +>>#NOTEs which is the bitwise OR of one or more of +>>#NOTEs the button or modifier key masks +>>#NOTEs .S Button1Mask , +>>#NOTEs .S Button2Mask , +>>#NOTEs .S Button3Mask , +>>#NOTEs .S Button4Mask , +>>#NOTEs .S Button5Mask , +>>#NOTEs .S ShiftMask , +>>#NOTEs .S LockMask , +>>#NOTEs .S ControlMask , +>>#NOTEs .S Mod1Mask , +>>#NOTEs .S Mod2Mask , +>>#NOTEs .S Mod3Mask , +>>#NOTEs .S Mod4Mask , +>>#NOTEs and +>>#NOTEs .S Mod5Mask . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M keycode +>>#NOTEs is set to +>>#NOTEs a number that represents the physical key on the keyboard. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event and root windows are on the same screen, +>>#NOTEs then +>>#NOTEs .M same_screen +>>#NOTEs is set to +>>#NOTEs .S True . +>>ASSERTION Good D 1 +If multiple screens are supported: +When a xname event is delivered +and the event and root windows are not on the same screen, +then +.M same_screen +is set to +.S False . +>>STRATEGY +If multiple screens are supported: + If extended testing is required: + Create a window on the default screen. + Select xname events on the window. + Create a window on the alternative screen. + Grab the keyboard for the first window. + Simulate a xname event on the alternate window. + Verify that a xname event was generated on the grabbing window. + Verify that the same_screen component was False. +>>CODE +Window w; +Window w2; +XEvent ev; +int gr; +int kc; + + + /* If multiple screens are supported: */ + if (config.alt_screen == -1) { + unsupported("Multiple screens not supported."); + return; + } else + CHECK; + + /* If extended testing is required: */ + if(noext(0)) + return; + + /* Create a window on the default screen. */ + w = defwin(Dsp); + + /* Select xname events on the window. */ + (void) warppointer(Dsp, w, 1,1); + XSelectInput(Dsp, w, EVENTMASK); + + /* Create a window on the alternative screen. */ + w2 = defdraw(Dsp, VI_ALT_WIN); + + /* Grab the keyboard for the first window. */ + if( (gr=XGrabKeyboard(Dsp, w, False, GrabModeAsync, GrabModeAsync, CurrentTime)) != GrabSuccess) { + delete("XGrabKeyboard() returned %s instead of GrabSuccess.", grabreplyname(gr)); + return; + } else + CHECK; + + kc=keycode(); + /* Simulate a xname event on the alternate window. */ + (void) warppointer(Dsp, w2, 1,1); + presskey(Dsp, w2, kc); + + /* Verify that a xname event was generated on the grabbing window. */ + if (XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) == False) { + report("Expected event (%s) not received.", eventname(EVENT)); + FAIL; + } else { + CHECK; + /* Verify that the same_screen component was False. */ + if(ev.xkey.same_screen != False) { + report("The same_screen component of the %s event was not set to False.", eventname(EVENT)); + FAIL; + } else + CHECK; + } + + keyrel(Dsp, kc); + XUngrabKeyboard(Dsp, CurrentTime); + + CHECKPASS(4); + diff --git a/xts5/Xlib11/KeyRelease/KeyRelease.m b/xts5/Xlib11/KeyRelease/KeyRelease.m new file mode 100644 index 00000000..ef9a2e0e --- /dev/null +++ b/xts5/Xlib11/KeyRelease/KeyRelease.m @@ -0,0 +1,1059 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/KeyRelease/KeyRelease.m,v 1.2 2005-11-03 08:42:29 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/KeyRelease/KeyRelease.m +>># +>># Description: +>># Tests for KeyRelease() +>># +>># Modifications: +>># $Log: kyrls.m,v $ +>># Revision 1.2 2005-11-03 08:42:29 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:17 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:17 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:50:53 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:22:58 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:30 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:01:38 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:58:35 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE KeyRelease Xlib11 +>>EXTERN +#define EVENT KeyRelease +#define EVENTMASK KeyReleaseMask + +static void +presskey(Dpy, w, kc) +Display *Dpy; +Window w; +int kc; +{ + /* + * Note that we do not call XSetInputFocus() since 2 tests require + * the event window to be an ancestor of the source window. + */ + keypress(Dpy, kc); + XSync(Dsp, True); + keyrel(Dsp, kc); +} + +static int keyc = 0; + +static unsigned int +keycode() +{ +int tmp; + + if(keyc == 0) { + XDisplayKeycodes(Dsp, &keyc, &tmp); + if (keyc < 8) + keyc = 8; + } + return(keyc); +} + +static unsigned int +keystate(keyc) +int keyc; +{ +XModifierKeymap *map; +unsigned int state; +int i, j; + + map = XGetModifierMapping(Dsp); + if (!map) + return(0); + state = 0; + for (i = 0; i < 8; i++) { + for (j = 0; j < map->max_keypermod; j++) { + if (map->modifiermap[(i * map->max_keypermod) + j] == + keyc) + state |= (ShiftMask << i); + } + } + XFreeModifiermap(map); + return(state); +} +>>SET startup focusstartup +>>SET cleanup focuscleanup +>>ASSERTION Good B 1 +>>#NOTE The documentation not explicitly state the following anywhere, +>>#NOTE it merely states something relative to logical changes in +>>#NOTE key state. In addition, I don't expect for very many of these +>>#NOTE assertions to be testable. +When any key is released, +then a xname event is generated. +>>STRATEGY +If extended testing is enabled: + Create a window. + Select for xname events. + Simulate a xname event on the window. + Verify that a xname event was delivered. + Verify that event member fields are correctly set. +>>CODE +Display *display = Dsp; +Window w; +XEvent event_return; +XKeyEvent good; +PointerPlace *ptr; +int kc; + + + + /* If extended testing is enabled: */ + if(noext(0)) + return; + + /* Create a window. */ + w = defwin(display); + + /* Select for xname events. */ + XSelectInput(display, w, EVENTMASK); + + /* Simulate a xname event on the window. */ + ptr = warppointer(display, w, 0,0); + kc = keycode(); + presskey(display, w, kc); + + /* Verify that a xname event was delivered. */ + if (!XCheckTypedWindowEvent(display, w, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } else { + + CHECK; + + good = event_return.xkey; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.window = w; + good.root = DRW(display); + good.subwindow = None; + good.x = 0; + good.y = 0; + good.x_root = ptr->nx; + good.y_root = ptr->ny; + good.state = keystate(kc); + good.keycode = kc; + good.same_screen = True; + + /* Verify that event member fields are correctly set. */ + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } + + CHECKPASS(2); + +>>ASSERTION Good B 1 +When a xname event is generated, +then +all clients having set +.S KeyReleaseMask +event mask bits on the event window are delivered +a xname event. +>>STRATEGY +If extended testing is required: + Create a second client. + Create a third client. + Create a window. + Select for xname events on all clients. + Simulate a xname event on the window. + Verify that the event was delivered to all clients. + Verify that event member fields are correctly set. +Otherwise : + Create a window. + Select for xname events. + Verify no error was generated. +>>CODE +Display *display = Dsp; +Display *client2; +Display *client3; +Window w; +XEvent event_return; +XKeyReleasedEvent good; +PointerPlace *ptr; +int kc; + + /* If extended testing is required: */ + if(config.extensions) { + + if(noext(0)) + return; + + /* Create a second client. */ + client2 = opendisplay(); + /* Create a third client. */ + client3 = opendisplay(); + + /* Create a window. */ + w = defwin(display); + + /* Select for xname events on all clients. */ + XSelectInput(display, w, EVENTMASK); + XSelectInput(client2, w, EVENTMASK); + XSelectInput(client3, w, EVENTMASK); + + /* Simulate a xname event on the window. */ + ptr = warppointer(display, w, 0,0); + kc = keycode(); + + XSync(client2, True); + XSync(client3, True); + + presskey(display, w, kc); + + XSync(client2, False); + XSync(client3, False); + + good = event_return.xkey; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.window = w; + good.root = DRW(display); + good.subwindow = None; + good.x = 0; + good.y = 0; + good.x_root = ptr->nx; + good.y_root = ptr->ny; + good.state = keystate(kc); + good.keycode = kc; + good.same_screen = True; + + /* Verify that the event was delivered to all clients. */ + /* Verify that event member fields are correctly set. */ + if (!XCheckTypedWindowEvent(display, w, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } else { + CHECK; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } +/* client 2 */ + if (!XCheckTypedWindowEvent(client2, w, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } else { + CHECK; + + good.display = client2; + + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } +/* client 3 */ + + if (!XCheckTypedWindowEvent(client3, w, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } else { + CHECK; + + good.display = client3; + + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } + + CHECKPASS(6); + + } else { + + /* Otherwise : */ + /* Create a window. */ + w = mkwin(display, (XVisualInfo *) NULL, (struct area *) NULL, False); + /* Select for xname events. */ + XSelectInput(display, w, EVENTMASK); + XSync(display, True); + /* Verify no error was generated. */ + if (geterr() != Success) { + delete("Error setting up for test."); + return; + } + else + CHECK; + + CHECKUNTESTED(1); + } + +>>ASSERTION Good B 1 +>>#NOTE True for most events (except MappingNotify and selection stuff). +When a xname event is generated, +then +clients not having set +.S KeyReleaseMask +event mask bits on the event window are not delivered +a xname event. +>>STRATEGY +If extended testing is required: + Create a window. + Create a second client. + Select for various events other that xname for the first client on the window. + Select for xname events for the second client on the window. + Simulate a xname event on the window. + Verify that a xname event was generated for the second client. + Verify no events were generated for the first client. +>>CODE +Display *client2; +XEvent ev; +Window w; +int count; +int kc; + + /* If extended testing is required: */ + if(noext(0)) + return; + + /* Create a window. */ + w = defwin(Dsp); + + /* Create a second client. */ + client2 = opendisplay(); + + /* Select for various events other that xname for the first client on the window. */ + kc = keycode(); + XSelectInput(Dsp, w, KeyPressMask|ButtonPressMask|ButtonReleaseMask); + + /* Select for xname events for the second client on the window. */ + XSelectInput(client2, w, EVENTMASK); + + /* Simulate a xname event on the window. */ + (void) warppointer(Dsp, w, 0, 0); + XSync(Dsp, True); + XSync(client2, True); + + presskey(Dsp, w, kc); + + XSync(client2, False); + + /* Verify that a xname event was generated for the second client. */ + if(XCheckWindowEvent(client2, w, EVENTMASK, &ev) == False) { + report("No %s event was generated.", eventname(EVENT)); + FAIL; + } else + CHECK; + + /* Verify no events were generated for the first client. */ + count = XPending(Dsp); + if (count != 0) { + report("Got %d unexpected events.", count); + FAIL; + } else + CHECK; + + CHECKPASS(2); + +>>ASSERTION Good B 1 +When a xname event is generated +and no client has selected +.S KeyReleaseMask +on the source window, +then the event propagates, +with propagation stopping at the root window of the screen or +at the first window with +.S KeyReleaseMask +in its do-not-propagate mask, +from the source window to +the first ancestor window for which +some client has selected +for xname events. +>>STRATEGY +If extended testing is required: + Create a window. + Create a child of that window. + Create a grandchild of the window. + Select xname events on the root window of the screen. + Simulate a xname event on the grandchild. + Verify that a xname event was generated on the root. + Select xname events on the grandparent window. + Set the do_not_propagate mask on the child to xname events. + Simulate a xname event on the grandchild. + Verify no xname event was generated on the grandchild. + Verify no xname event was generated on the child. + Verify no xname event was generated on the parent. + Select xname events on the child window. + Set the do_not_propagate mask of the grandparent to xname events. + Set the do_not_propagate mask of the child to NoEventMask. + Simulate a xname event on the grandchild. + Verify that no xname event was generated on the grandchild. + Verify that no xname event was generated on the parent. + Verify that a xname event was generated on the child. +>>CODE +XEvent ev; +Window w; +Window w1; +Window w2; +XSetWindowAttributes atts; +int kc; + + + /* If extended testing is required: */ + if(noext(0)) + return; + + /* Create a window. */ + w = defwin(Dsp); + /* Create a child of that window. */ + w1 = crechild(Dsp, w, (struct area *) NULL); + /* Create a grandchild of the window. */ + w2 = crechild(Dsp, w1, (struct area *) NULL); + + /* Select xname events on the root window of the screen. */ + XSelectInput(Dsp, DRW(Dsp), EVENTMASK); + + /* Simulate a xname event on the grandchild. */ + (void) warppointer(Dsp, w2, 1,1); + kc = keycode(); + presskey(Dsp, w2, kc); + + /* Verify that a xname event was generated on the root. */ + if (XCheckWindowEvent(Dsp, DRW(Dsp), EVENTMASK, &ev) == False) { + report("Expected event (%s) not received.", eventname(EVENT)); + FAIL; + } else + CHECK; + + XSelectInput(Dsp, DRW(Dsp), NoEventMask); + /* Select xname events on the grandparent window. */ + XSelectInput(Dsp, w, EVENTMASK); + + /* Set the do_not_propagate mask on the child to xname events. */ + atts.do_not_propagate_mask = EVENTMASK; + XChangeWindowAttributes(Dsp, w1, CWDontPropagate, &atts); + + /* Simulate a xname event on the grandchild. */ + presskey(Dsp, w2, kc); + + /* Verify no xname event was generated on the grandchild. */ + if (XCheckWindowEvent(Dsp, w2, EVENTMASK, &ev) != False) { + report("Unexpected event (%s) received.", eventname(EVENT)); + FAIL; + } else + CHECK; + + /* Verify no xname event was generated on the child. */ + if (XCheckWindowEvent(Dsp, w1, EVENTMASK, &ev) != False) { + report("Unexpected event (%s) received.", eventname(EVENT)); + FAIL; + } else + CHECK; + + /* Verify no xname event was generated on the parent. */ + if (XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) != False) { + report("Unexpected event (%s) received.", eventname(EVENT)); + FAIL; + } else + CHECK; + + + /* Select xname events on the child window. */ + XSelectInput(Dsp, w1, EVENTMASK); + /* Set the do_not_propagate mask of the grandparent to xname events. */ + XChangeWindowAttributes(Dsp, w, CWDontPropagate, &atts); + + /* Set the do_not_propagate mask of the child to NoEventMask. */ + atts.do_not_propagate_mask = NoEventMask; + XChangeWindowAttributes(Dsp, w1, CWDontPropagate, &atts); + + /* Simulate a xname event on the grandchild. */ + presskey(Dsp, w2, kc); + + /* Verify that no xname event was generated on the grandchild. */ + if (XCheckWindowEvent(Dsp, w2, EVENTMASK, &ev) != False) { + report("Unexpected event (%s) received.", eventname(EVENT)); + FAIL; + } else + CHECK; + + /* Verify that no xname event was generated on the parent. */ + if (XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) != False) { + report("Unexpected event (%s) received.", eventname(EVENT)); + FAIL; + } else + CHECK; + + /* Verify that a xname event was generated on the child. */ + if (XCheckWindowEvent(Dsp, w1, EVENTMASK, &ev) == False) { + report("KeyRelease event was not delivered to selecting child window."); + FAIL; + } else + CHECK; + + CHECKPASS(7); + +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE Global except for MappingNotify and KeymapNotify. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M window +>>#NOTEs is set to +>>#NOTEs the +>>#NOTEs ifdef(`WINDOWTYPE', WINDOWTYPE, event) +>>#NOTEs window. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M root +>>#NOTEs is set to the source window's root window. +>>ASSERTION Good B 1 +>># +>>#COMMENT +>># This assertion contains a tautology; a child is an inferior. +>># Cal 12/2/92. +>># +When a xname event is delivered +and the source window is an inferior of the event window +and the source window is a child of the event window, +then +.M subwindow +is set to +the source window. +>>STRATEGY +If extended testing is required: + Create a window. + Create a child of the window + Select xname events on the parent. + Simulate an xname event on the child. + Verify that a xname event was generated on the parent. + Verify that the subwindow component was set to the child. +>>CODE +XEvent ev; +Window w; +Window w1; +int kc; + + + /* If extended testing is required: */ + if(noext(0)) + return; + + /* Create a window. */ + w = defwin(Dsp); + /* Create a child of the window */ + w1 = crechild(Dsp, w, (struct area *) NULL); + /* Select xname events on the parent. */ + XSelectInput(Dsp, w, EVENTMASK); + (void) warppointer(Dsp, w1, 1,1); + + /* Simulate a xname event on the child. */ + kc=keycode(); + presskey(Dsp, w1, kc); + + /* Verify that a xname event was generated on the parent. */ + if (XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) == False) { + report("Expected event (%s) not received.", eventname(EVENT)); + FAIL; + } else { + CHECK; + /* Verify that the subwindow component was set to the child. */ + if(ev.xkey.subwindow != w1) { + report("The subwindow component of the %s name was not set correctly.", eventname(EVENT)); + FAIL; + } else + CHECK; + } + + CHECKPASS(2); + +>>ASSERTION Good B 1 +When a xname event is delivered +and the source window is an inferior of the event window +and the source window is not a child of the event window, +then +.M subwindow +is set to +the child of the event window that is +an ancestor of the source window. +>>STRATEGY +If extended testing is required : + Create a window. + Create a child. + Create a grandchild. + Create a great-grandchild. + Select xname events on the great-grandparent. + Simulate a xname event on the great-grandchild. + Verify that a xname event was generated on the great-grandparent. + Verify that subwindow component of the event was the child. +>>CODE +Window w; +Window w1; +Window w2; +Window w3; +XEvent ev; +struct area area; +int kc; + + /* If extended testing is required : */ + if (noext(0)) + return; + + /* Create a window. */ + w = defwin(Dsp); + setarea(&area, 10, 10, 30, 30); + /* Create a child. */ + w1 = crechild(Dsp, w, &area); + /* Create a grandchild. */ + w2 = crechild(Dsp, w1, &area); + /* Create a great-grandchild. */ + w3 = crechild(Dsp, w2, &area); + (void) warppointer(Dsp, w3, 1,1); + + /* Select xname events on the great-grandparent. */ + XSelectInput(Dsp, w, EVENTMASK); + + /* Simulate a xname event on the great-grandchild. */ + kc = keycode(); + presskey(Dsp, w3, kc); + + /* Verify that a xname event was generated on the great-grandparent. */ + if (XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) == False) { + report("Expected event (%s) not received.", eventname(EVENT)); + FAIL; + } else { + CHECK; + /* Verify that subwindow component of the event was the child. */ + if(ev.xkey.subwindow != w1) { + report("The subwindow component of the %s event was not set correctly.", eventname(EVENT)); + FAIL; + } else + CHECK; + } + + CHECKPASS(2); + +>>ASSERTION Good B 1 +When a xname event is delivered +and the source window is not an inferior of the event window, +then +.M subwindow +is set to +.S None . +>>STRATEGY +If extended testing is required: + Create a window. + Select xname events on the window. + Simulate a xname event on the window. + Verify that a xname event was generated on the window. + Verify that the subwindow component was set to None. + Create a second window. + Grab the keyboard for the first window with owner_events set to False. + Simulate a xname event on the second window. + Verify that a xname event was generated on the grabbing window. + Verify that the subwindow component was set to None. +>>CODE +Window w; +Window w2; +XEvent ev; +int gr; +int kc; + + /* If extended testing is required: */ + if (noext(0)) + return; + + /* Create a window. */ + w = defwin(Dsp); + (void) warppointer(Dsp, w, 1,1); + + /* Select xname events on the window. */ + XSelectInput(Dsp, w, EVENTMASK); + + /* Simulate a xname event on the window. */ + kc=keycode(); + presskey(Dsp, w, kc); + + /* Verify that a xname event was generated on the window. */ + if (XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) == False) { + report("Expected event (%s) not received.", eventname(EVENT)); + FAIL; + } else { + CHECK; + /* Verify that the subwindow component was set to None. */ + if(ev.xkey.subwindow != None) { + report("The subwindow component of the %s event was not set correctly.", eventname(EVENT)); + FAIL; + } else + CHECK; + } + + /* Create a second window. */ + w2 = defwin(Dsp); + + /* Grab the keyboard for the first window with owner_events set to False. */ + if( (gr=XGrabKeyboard(Dsp, w, False, GrabModeAsync, GrabModeAsync, CurrentTime)) != GrabSuccess) { + delete("XGrabKeyboard() returned %s instead of GrabSuccess.", grabreplyname(gr)); + return; + } else + CHECK; + + /* Simulate a xname event on the second window. */ + (void) warppointer(Dsp, w2, 1,1); + presskey(Dsp, w2, kc); + + /* Verify that a xname event was generated on the grabbing window. */ + if (XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) == False) { + report("Expected event (%s) not received.", eventname(EVENT)); + FAIL; + } else { + CHECK; + /* Verify that the subwindow component was set to None. */ + if(ev.xkey.subwindow != None) { + report("The subwindow component of the %s event was not set correctly.", eventname(EVENT)); + FAIL; + } else + CHECK; + } + + XUngrabKeyboard(Dsp, CurrentTime); + + CHECKPASS(5); + +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M time +>>#NOTEs is set to +>>#NOTEs the time in milliseconds at which the event was generated. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event window is on the same screen as the root window, +>>#NOTEs then +>>#NOTEs .M x +>>#NOTEs and +>>#NOTEs .M y +>>#NOTEs are set to +>>#NOTEs the coordinates of +>>#NOTEs the final pointer position relative to the event window's origin. +>>ASSERTION Good D 1 +If multiple screens are supported: +When a xname event is delivered +and the event and root windows are not on the same screen, +then +.M x +and +.M y +are set to +zero. +>>STRATEGY +If multiple screens are supported: + If extended testing is required: + Create a window on the default screen. + Select xname events on the window. + Create a window on the alternative screen. + Grab the keyboard for the first window. + Simulate a xname event on the alternate window. + Verify that a xname event was generated on the grabbing window. + Verify that the x and y components were set to zero. +>>CODE +Window w; +Window w2; +XEvent ev; +int gr; +int kc; + + + /* If multiple screens are supported: */ + if (config.alt_screen == -1) { + unsupported("Multiple screens not supported."); + return; + } else + CHECK; + + /* If extended testing is required: */ + if(noext(0)) + return; + + /* Create a window on the default screen. */ + w = defwin(Dsp); + + /* Select xname events on the window. */ + (void) warppointer(Dsp, w, 1,1); + XSelectInput(Dsp, w, EVENTMASK); + + /* Create a window on the alternative screen. */ + w2 = defdraw(Dsp, VI_ALT_WIN); + + /* Grab the keyboard for the first window. */ + if( (gr=XGrabKeyboard(Dsp, w, False, GrabModeAsync, GrabModeAsync, CurrentTime)) != GrabSuccess) { + delete("XGrabKeyboard() returned %s instead of GrabSuccess.", grabreplyname(gr)); + return; + } else + CHECK; + + kc=keycode(); + /* Simulate a xname event on the alternate window. */ + (void) warppointer(Dsp, w2, 1,1); + presskey(Dsp, w2, kc); + + /* Verify that a xname event was generated on the grabbing window. */ + if (XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) == False) { + report("Expected event (%s) not received.", eventname(EVENT)); + FAIL; + } else { + CHECK; + /* Verify that the x and y components were set to zero. */ + if(ev.xkey.x != 0 || ev.xkey.y != 0) { + report("The x (value %d) and y (value %d) components of the %s event were not set to zero.", ev.xkey.x, ev.xkey.y, eventname(EVENT)); + FAIL; + } else + CHECK; + } + + XUngrabKeyboard(Dsp, CurrentTime); + + CHECKPASS(4); + +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M x_root +>>#NOTEs and +>>#NOTEs .M y_root +>>#NOTEs are set to coordinates of the pointer +>>#NOTEs when the event was generated +>>#NOTEs relative to the root window's origin. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M state +>>#NOTEs is set to +>>#NOTEs indicate the logical state +>>#NOTEs of the pointer buttons, +>>#NOTEs which is the bitwise OR of one or more of +>>#NOTEs the button or modifier key masks +>>#NOTEs .S Button1Mask , +>>#NOTEs .S Button2Mask , +>>#NOTEs .S Button3Mask , +>>#NOTEs .S Button4Mask , +>>#NOTEs .S Button5Mask , +>>#NOTEs .S ShiftMask , +>>#NOTEs .S LockMask , +>>#NOTEs .S ControlMask , +>>#NOTEs .S Mod1Mask , +>>#NOTEs .S Mod2Mask , +>>#NOTEs .S Mod3Mask , +>>#NOTEs .S Mod4Mask , +>>#NOTEs and +>>#NOTEs .S Mod5Mask . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M keycode +>>#NOTEs is set to +>>#NOTEs a number that represents the physical key on the keyboard. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event and root windows are on the same screen, +>>#NOTEs then +>>#NOTEs .M same_screen +>>#NOTEs is set to +>>#NOTEs .S True . +>>ASSERTION Good D 1 +If multiple screens are supported: +When a xname event is delivered +and the event and root windows are not on the same screen, +then +.M same_screen +is set to +.S False . +>>STRATEGY +If multiple screens are supported: + If extended testing is required: + Create a window on the default screen. + Select xname events on the window. + Create a window on the alternative screen. + Grab the keyboard for the first window. + Simulate a xname event on the alternate window. + Verify that a xname event was generated on the grabbing window. + Verify that the same_screen component was False. +>>CODE +Window w; +Window w2; +XEvent ev; +int gr; +int kc; + + /* If multiple screens are supported: */ + if (config.alt_screen == -1) { + unsupported("Multiple screens not supported."); + return; + } else + CHECK; + + /* If extended testing is required: */ + if(noext(0)) + return; + + /* Create a window on the default screen. */ + w = defwin(Dsp); + + (void) warppointer(Dsp, w, 1,1); + /* Select xname events on the window. */ + XSelectInput(Dsp, w, EVENTMASK); + + /* Create a window on the alternative screen. */ + w2 = defdraw(Dsp, VI_ALT_WIN); + + /* Grab the keyboard for the first window. */ + if( (gr=XGrabKeyboard(Dsp, w, False, GrabModeAsync, GrabModeAsync, CurrentTime)) != GrabSuccess) { + delete("XGrabKeyboard() returned %s instead of GrabSuccess.", grabreplyname(gr)); + return; + } else + CHECK; + + kc=keycode(); + /* Simulate a xname event on the alternate window. */ + (void) warppointer(Dsp, w2, 1,1); + presskey(Dsp, w2, kc); + + /* Verify that a xname event was generated on the grabbing window. */ + if (XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) == False) { + report("Expected event (%s) not received.", eventname(EVENT)); + FAIL; + } else { + CHECK; + /* Verify that the same_screen component was False. */ + if(ev.xkey.same_screen != False) { + report("The same_screen component of the %s event was not set to False.", eventname(EVENT)); + FAIL; + } else + CHECK; + } + + XUngrabKeyboard(Dsp, CurrentTime); + + CHECKPASS(4); diff --git a/xts5/Xlib11/KeymapNotify/KeymapNotify.m b/xts5/Xlib11/KeymapNotify/KeymapNotify.m new file mode 100644 index 00000000..f68f550a --- /dev/null +++ b/xts5/Xlib11/KeymapNotify/KeymapNotify.m @@ -0,0 +1,556 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/KeymapNotify/KeymapNotify.m,v 1.2 2005-11-03 08:42:28 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/KeymapNotify/KeymapNotify.m +>># +>># Description: +>># Tests for KeymapNotify() +>># +>># Modifications: +>># $Log: kympntfy.m,v $ +>># Revision 1.2 2005-11-03 08:42:28 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:17 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:16 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:50:50 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:22:57 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:29 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:01:34 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:58:27 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE KeymapNotify Xlib11 +>>EXTERN +#define EVENT KeymapNotify +#define MASK KeymapStateMask +>>ASSERTION Good A +When a +.S EnterNotify +event is generated, +then a xname event is generated immediately afterwards. +>>STRATEGY +Move pointer to known location. +Build and create window hierarchy. +Select for EnterNotify and KeymapNotify events on window hierarchy. +Move cursor into hierarchy window. +Get events from event queue. +Verify that EnterNotify events are delivered. +Verify that a KeymapNotify event follows each of these EnterNotify events. +Repeat. +>>CODE +int i; +Display *display = Dsp; +Winh *winhs[5]; + +#ifdef OTHERMASK +#undef OTHERMASK +#endif +#define OTHERMASK EnterWindowMask +#ifdef OTHEREVENT +#undef OTHEREVENT +#endif +#define OTHEREVENT EnterNotify +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Build and create window hierarchy. */ + if (winh(display, 3, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; + /* + * Initialize all members to null. Then check for null members + * in main for-loop as a sign of inconsistency between array + * size and the initialization of array members below. + */ + for (i=0; i<NELEM(winhs); i++) + winhs[i] = (Winh *) NULL; + winhs[0] = guardian->firstchild; + winhs[1] = winhs[0]->nextsibling; + winhs[2] = winhs[1]->nextsibling; + winhs[3] = winhs[0]->firstchild->firstchild; + winhs[4] = winhs[1]->firstchild->firstchild; +/* Select for EnterNotify and KeymapNotify events on window hierarchy. */ + if (winh_selectinput(display, (Winh *) NULL, MASK|OTHERMASK)) + return; + else + CHECK; + for (i=0; i<NELEM(winhs); i++) { + int once; + Winhe *ptr; + + if (winhs[i] == (Winh *) NULL) { + delete("Unexpected NULL window hierarchy member"); + return; + } + else + CHECK; +/* Move cursor into hierarchy window. */ + XSync(display, True); + XWarpPointer(display, None, winhs[i]->window, 0, 0, 0, 0, 2, 2); + XSync(display, False); +/* Get events from event queue. */ + if (winh_plant((Winh *) NULL, (XEvent *) NULL, NoEventMask, WINH_NOMASK)) { + /* already deleted */ + report("Could not initialize event data structures"); + return; + } + else + CHECK; + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; + ptr = winh_qdel; + if (ptr == (Winhe *) NULL) { + report("No events received."); + FAIL; + continue; + } + else + CHECK; +/* Verify that EnterNotify events are delivered. */ +/* Verify that a KeymapNotify event follows each of these EnterNotify events. */ + for (once=1; ptr != (Winhe *) NULL; ptr = ptr->next) { + if (once) { + CHECK; + once = 0; + } + if (ptr->event->type != OTHEREVENT) { + report("Got %s, expected %s", + eventname(ptr->event->type), + eventname(OTHEREVENT)); + FAIL; + break; + } + ptr = ptr->next; + if (ptr == (Winhe *) NULL) { + report("Missing %s event", EVENT); + FAIL; + break; + } + if (ptr->event->type != EVENT) { + report("Got %s, expected %s", + eventname(ptr->event->type), + eventname(EVENT)); + FAIL; + break; + } + } +/* Repeat. */ + } + CHECKPASS(3 + (NELEM(winhs)*5)); +>>ASSERTION Good A +When a +.S FocusIn +event is generated, +then a xname event is generated immediately afterwards. +>>STRATEGY +Move pointer to known location. +Build and create window hierarchy. +Select for FocusIn and KeymapNotify events on window hierarchy. +Generate FocusIn event. +Get events from event queue. +Verify that FocusIn events are delivered. +Verify that a KeymapNotify event follows each of these FocusIn events. +Repeat. +>>CODE +int i; +Display *display = Dsp; +Winh *winhs[5]; + +#ifdef OTHERMASK +#undef OTHERMASK +#endif +#define OTHERMASK FocusChangeMask +#ifdef OTHEREVENT +#undef OTHEREVENT +#endif +#define OTHEREVENT FocusIn +#ifdef IGNOREEVENT +#undef IGNOREEVENT +#endif +#define IGNOREEVENT FocusOut + +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Build and create window hierarchy. */ + if (winh(display, 3, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; + /* + * Initialize all members to null. Then check for null members + * in main for-loop as a sign of inconsistency between array + * size and the initialization of array members below. + */ + for (i=0; i<NELEM(winhs); i++) + winhs[i] = (Winh *) NULL; + winhs[0] = guardian->firstchild; + winhs[1] = winhs[0]->nextsibling; + winhs[2] = winhs[1]->nextsibling; + winhs[3] = winhs[0]->firstchild->firstchild; + winhs[4] = winhs[1]->firstchild->firstchild; +/* Select for FocusIn and KeymapNotify events on window hierarchy. */ + if (winh_selectinput(display, (Winh *) NULL, MASK|OTHERMASK)) + return; + else + CHECK; + for (i=0; i<NELEM(winhs); i++) { + int once; + Winhe *ptr; + + if (winhs[i] == (Winh *) NULL) { + delete("Unexpected NULL window hierarchy member"); + return; + } + else + CHECK; +/* Generate FocusIn event. */ + XSync(display, True); + XSetInputFocus(display, winhs[i]->window, RevertToNone, CurrentTime); + XSync(display, False); +/* Get events from event queue. */ + if (winh_plant((Winh *) NULL, (XEvent *) NULL, NoEventMask, WINH_NOMASK)) { + /* already deleted */ + report("Could not initialize event data structures"); + return; + } + else + CHECK; + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; + ptr = winh_qdel; + if (ptr == (Winhe *) NULL) { + report("No events received."); + FAIL; + continue; + } + else + CHECK; +/* Verify that FocusIn events are delivered. */ +/* Verify that a KeymapNotify event follows each of these FocusIn events. */ + for (once=1; ptr != (Winhe *) NULL; ptr = ptr->next) { + if (once) { + CHECK; + once = 0; + } + if (ptr->event->type == IGNOREEVENT) + continue; + if (ptr->event->type != OTHEREVENT) { + report("Got %s, expected %s", + eventname(ptr->event->type), + eventname(OTHEREVENT)); + FAIL; + break; + } + ptr = ptr->next; + if (ptr == (Winhe *) NULL) { + report("Missing %s event", EVENT); + FAIL; + break; + } + if (ptr->event->type != EVENT) { + report("Got %s, expected %s", + eventname(ptr->event->type), + eventname(EVENT)); + FAIL; + break; + } + } +/* Repeat. */ + } + CHECKPASS(3 + (NELEM(winhs)*5)); +>>ASSERTION Good A +When a xname event is generated, +then +all clients having set +.S KeymapStateMask +event mask bits on the event window are delivered +a xname event. +>>STRATEGY +Move pointer to known location. +Create clients client2 and client3. +Build and create window hierarchy. +Select for KeymapNotify and EnterNotify events on eventw. +Select for KeymapNotify and EnterNotify events on eventw with client2. +Select for no events on eventw with client3. +Generate KeymapNotify event. +Initialize for expected events. +Harvest events from each clients event queue. +Verify that KeymapNotify event was received. +Verify that KeymapNotify event was received by client2. +Verify that no event was received by client3. +>>CODE +Display *display = Dsp; +Display *client2, *client3; +Winh *eventw; +int status; +XEvent good; + +#ifdef OTHERMASK +#undef OTHERMASK +#endif +#define OTHERMASK EnterWindowMask +#ifdef OTHEREVENT +#undef OTHEREVENT +#endif +#define OTHEREVENT EnterNotify + +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; +/* Build and create window hierarchy. */ + if (winh(display, 1, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; + eventw = guardian->firstchild; +/* Select for KeymapNotify and EnterNotify events on eventw. */ + /* + * necessary so that winh routines know which window + * to associate the event with + */ + if (winh_selectinput(display, eventw, MASK|OTHERMASK)) + return; + else + CHECK; +/* Select for KeymapNotify and EnterNotify events on eventw with client2. */ + /* + * necessary so that winh routines know which window + * to associate the event with + */ + if (winh_selectinput(client2, eventw, MASK|OTHERMASK)) + return; + else + CHECK; +/* Select for no events on eventw with client3. */ + if (winh_selectinput(client3, eventw, NoEventMask)) + return; + else + CHECK; +/* Generate KeymapNotify event. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XWarpPointer(display, None, eventw->window, 0, 0, 0, 0, 2, 2); + XSync(display, False); + XSync(client2, False); + XSync(client3, False); +/* Initialize for expected events. */ + good.xany.type = EVENT; + good.xany.window = eventw->window; + good.xany.display = display; + if (winh_plant(eventw, &good, NoEventMask, WINH_NOMASK)) { + /* already deleted */ + report("Could not initialize event data structures (1)"); + return; + } + else + CHECK; +/* Harvest events from each clients event queue. */ + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; + if (winh_harvest(client2, (Winh *) NULL)) { + report("Could not harvest events for client2"); + return; + } + else + CHECK; + if (winh_harvest(client3, (Winh *) NULL)) { + report("Could not harvest events for client3"); + return; + } + else + CHECK; + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + report("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; +/* Verify that KeymapNotify event was received. */ +/* Verify that KeymapNotify event was received by client2. */ +/* Verify that no event was received by client3. */ + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + report("display: 0x%x, client2: 0x%x, client2: 0x%x", + display, client2, client3); + FAIL; + } + else + CHECK; + + CHECKPASS(13); +>>ASSERTION def +>>#NOTE True for most events (except MappingNotify and selection stuff). +>>#NOTE Tested for in previous assertion (i.e. client3). +When a xname event is generated, +then +clients not having set +.S KeymapStateMask +event mask bits on the event window are not delivered +a xname event. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEd >>ASSERTION +>>#NOTEd When ARTICLE xname is delivered, +>>#NOTEd then +>>#NOTEd .M key_vector +>>#NOTEd is set such that each bit set to one indicates that +>>#NOTEd the corresponding key is currently pressed. diff --git a/xts5/Xlib11/LeaveNotify/LeaveNotify.m b/xts5/Xlib11/LeaveNotify/LeaveNotify.m new file mode 100644 index 00000000..7c9aa6f9 --- /dev/null +++ b/xts5/Xlib11/LeaveNotify/LeaveNotify.m @@ -0,0 +1,1778 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/LeaveNotify/LeaveNotify.m,v 1.2 2005-11-03 08:42:29 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/LeaveNotify/LeaveNotify.m +>># +>># Description: +>># Tests for LeaveNotify() +>># +>># Modifications: +>># $Log: lvntfy.m,v $ +>># Revision 1.2 2005-11-03 08:42:29 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:17 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:18 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:50:54 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:22:59 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:31 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:01:41 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:58:39 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE LeaveNotify Xlib11 +>>EXTERN +#define EVENT LeaveNotify +#define OTHEREVENT EnterNotify +#define MASK LeaveWindowMask +#define OTHERMASK EnterWindowMask +#define BOTHMASKS (MASK|OTHERMASK) +#define EVENTMASK MASK + +static Display *_display_; +static int _detail_; +static long _event_mask_; +static XEvent good; + +static int +selectinput(start, stop, current, previous) +Winh *start, *stop, *current, *previous; +{ +#ifdef lint + winh_free(start); + winh_free(stop); + winh_free(previous); +#endif + return(winh_selectinput(_display_, current, _event_mask_)); +} + +static int +plant(start, stop, current, previous) +Winh *start, *stop, *current, *previous; +{ +#ifdef lint + winh_free(start); + winh_free(stop); + winh_free(previous); +#endif + good.xany.window = current->window; + return(winh_plant(current, &good, NoEventMask, WINH_NOMASK)); +} + +static Bool increasing; /* event sequence increases as we climb */ + +static int +checksequence(start, stop, current, previous) +Winh *start, *stop, *current, *previous; +{ + Winhe *d; + int current_sequence; + int status; + static int last_sequence; + +#ifdef lint + winh_free(start); + winh_free(stop); +#endif + /* look for desired event type */ + for (d = current->delivered; d != (Winhe *) NULL; d = d->next) { + if (d->event->type == good.type) { + current_sequence = d->sequence; + break; + } + } + if (d == (Winhe *) NULL) { + report("%s event not delivered", eventname(good.type)); + delete("Missing event"); + return(-1); + } + if (previous == (Winh *) NULL) + status = 0; /* first call, no previous sequence value */ + else { + /* assume sequence numbers are not the same */ + status = (current_sequence < last_sequence); + if (increasing) + status = (status ? 0 : 1); + if (status) + report("Ordering problem between 0x%x (%d) and 0x%x (%d)", + current->window, current_sequence, + previous->window, last_sequence); + } + last_sequence = current_sequence; + return(status); +} + +static int +checkdetail(start, stop, current, previous) +Winh *start, *stop, *current, *previous; +{ + Winhe *d; + +#ifdef lint + winh_free(start); + winh_free(stop); + winh_free(previous); +#endif + /* look for desired event type */ + for (d = current->delivered; d != (Winhe *) NULL; d = d->next) + if (d->event->type == good.type) + break; + if (d == (Winhe *) NULL) { + report("%s event not delivered to window 0x%x", + eventname(good.type), current->window); + delete("Missing event"); + return(-1); + } + /* check detail */ + if (_detail_ != d->event->xcrossing.detail) { + report("Expected detail of %d, got %d on window 0x%x", + _detail_, d->event->xcrossing.detail, current->window); + return(1); + } + return(0); +} +>>ASSERTION Good A +>>#NOTE +>>#NOTE Hierarchy events are: +>>#NOTE UnmapNotify, +>>#NOTE MapNotify, +>>#NOTE ConfigureNotify, +>>#NOTE GravityNotify, and +>>#NOTE CirculateNotify. +>>#NOTE +When a xname event is generated by a hierarchy change, +then the xname event is delivered after any hierarchy event. +>>STRATEGY +Create window1. +Create window2 on top of window1. +Select for xname and UnmapNotify events on window2. +Move pointer to window2. +Call XUnmapWindow on window2. +Verify that UnmapNotify event was received on window2. +Verify that xname event was received on window1. +Verify that pointer has remained where it was moved. +>>CODE +int i; +Display *display = Dsp; +Window w2; +XEvent event; +struct area area; +PointerPlace *warp; + +/* Create window1. */ + area.x = 0; + area.y = 0; + area.width = W_STDWIDTH; + area.height = W_STDHEIGHT; + (void) mkwin(display, (XVisualInfo *) NULL, &area, True); +/* Create window2 on top of window1. */ + w2 = mkwin(display, (XVisualInfo *) NULL, &area, True); +/* Select for xname and UnmapNotify events on window2. */ + XSelectInput(display, w2, MASK|StructureNotifyMask); +/* Move pointer to window2. */ + warp = warppointer(display, w2, 0, 0); + if (warp == (PointerPlace *) NULL) + return; + else + CHECK; + XSync(display, True); +/* Call XUnmapWindow on window2. */ + XUnmapWindow(display, w2); + XSync(display, False); +/* Verify that UnmapNotify event was received on window2. */ + if (XPending(display) < 1) { + report("Expected UnmapNotify event not delivered."); + FAIL; + return; + } + else + CHECK; + XNextEvent(display, &event); + if (event.type != UnmapNotify) { + report("Expected %s, got %s", eventname(UnmapNotify), eventname(event.type)); + FAIL; + } + else + CHECK; +/* Verify that xname event was received on window1. */ + if (XPending(display) < 1) { + report("Expected %s event not delivered.", TestName); + FAIL; + return; + } + else + CHECK; + XNextEvent(display, &event); + if (event.type != EVENT) { + report("Expected %s, got %s", eventname(EVENT), eventname(event.type)); + FAIL; + } + else + CHECK; + if ((i = XPending(display)) > 0) { + report("Expected 2 events, got %d", i+2); + FAIL; + } + else + CHECK; + + /* Additional possible testing: */ + /* Select for no events on window1. */ + /* Select for MapNotify events on window2. */ + /* Select for xname events on window2. */ + /* Select for xname events on window2 with client2. */ + /* Call XMapWindow on window2. */ + /* Verify that MapNotify event was received on window2. */ + /* Verify that xname event was received on window2. */ + /* Verify that xname event was received on window2 by client2. */ + /* Verify that pointer has remained where it was moved. */ + /* Select for xname events on window1. */ + /* Select for xname events on window1 with client2. */ + /* Select for ConfigureNotify events on window2. */ + /* Call XLowerWindow on window2. */ + /* Verify that ConfigureNotify event was received on window2. */ + /* Verify that xname event was received on window1. */ + /* Verify that xname event was received on window1 by client2. */ + /* Verify that pointer has remained where it was moved. */ + + /* Others: GravityNotify, CirculateNotify. */ + +/* Verify that pointer has remained where it was moved. */ + if (pointermoved(display, warp)) { + delete("Pointer moved unexpectedly"); + return; + } + else + CHECK; + CHECKPASS(7); +>>ASSERTION Good A +When a xname event is generated, +then +all clients having set +.S LeaveWindowMask +event mask bits on the event window are delivered +a xname event. +>>STRATEGY +Create clients client2 and client3. +Create window. +Move pointer inside of window. +Select for xname events on window. +Select for xname events on window with client2. +Select for no events on window with client3. +Warp pointer outside window. +Verify that a single xname event was received. +Verify that a single xname event was received by client2. +Verify that no events were received by client2. +>>CODE +int i; +Display *display = Dsp; +Display *client2, *client3; +Window w; +XEvent event; +XLeaveWindowEvent good; +struct area area; + +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; +/* Create window. */ + area.x = 10; + area.y = 10; + area.width = W_STDWIDTH; + area.height = W_STDHEIGHT; + w = mkwin(display, (XVisualInfo *) NULL, &area, True); +/* Move pointer inside of window. */ + if (warppointer(display, w, 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Select for xname events on window. */ + XSelectInput(display, w, MASK); +/* Select for xname events on window with client2. */ + XSelectInput(client2, w, MASK); +/* Select for no events on window with client3. */ + XSelectInput(client3, w, NoEventMask); +/* Warp pointer outside window. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XWarpPointer(display, None, DRW(display), 0, 0, 0, 0, 0, 0); + XSync(display, False); + XSync(client2, False); + XSync(client3, False); +/* Verify that a single xname event was received. */ + if (XPending(display) < 1) { + report("Expected %s event not delivered.", TestName); + FAIL; + return; + } + else + CHECK; + XNextEvent(display, &event); + good = event.xcrossing; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.window = w; + good.root = DRW(display); + good.subwindow = None; + rootcoordset(display, DRW(display), w, 0, 0, &(good.x), &(good.y)); + good.x_root = 0; + good.y_root = 0; + good.mode = NotifyNormal; + /* under virtual root windows detail gets set to NotifyNonlinear */ + good.detail = NotifyAncestor; + good.same_screen = True; + good.focus = True; /* assumes focus follows pointer */ + good.state = 0; + if (checkevent((XEvent*)&good, &event)) { + FAIL; + } + else + CHECK; + if ((i = XPending(display)) > 0) { + report("Expected 1 event, got %d", i+1); + FAIL; + } + else + CHECK; +/* Verify that a single xname event was received by client2. */ + if (XPending(client2) < 1) { + report("Expected %s event not delivered to client2.", TestName); + FAIL; + return; + } + else + CHECK; + XNextEvent(client2, &event); + good = event.xcrossing; + good.type = EVENT; + good.send_event = False; + good.display = client2; + good.window = w; + good.root = DRW(client2); + good.subwindow = None; + rootcoordset(client2, DRW(client2), w, 0, 0, &(good.x), &(good.y)); + good.x_root = 0; + good.y_root = 0; + good.mode = NotifyNormal; + /* under virtual root windows detail gets set to NotifyNonlinear */ + good.detail = NotifyAncestor; + good.same_screen = True; + good.focus = True; /* assumes focus follows pointer */ + good.state = 0; + if (checkevent((XEvent*)&good, &event)) { + report("Unexpected structure member values for client2"); + FAIL; + } + else + CHECK; + if ((i = XPending(client2)) > 0) { + report("Expected 1 event, got %d for client2", i+1); + FAIL; + } + else + CHECK; +/* Verify that no events were received by client2. */ + if ((i = XPending(client2)) > 0) { + report("For client2: Expected 0 events, got %d", i); + FAIL; + } + else + CHECK; + CHECKPASS(10); +>>ASSERTION def +>>#NOTE Tested for in previous assertion. +When a xname event is generated, +then +clients not having set +.S LeaveWindowMask +event mask bits on the event window are not delivered +a xname event. +>>#NOTEd >>ASSERTION +>>#NOTEd When the window which contains the pointer changes, +>>#NOTEd then ARTICLE xname event is generated. +>>#NOTEm >>ASSERTION +>>#NOTEm When a client calls +>>#NOTEm .F XGrabPointer +>>#NOTEm or +>>#NOTEm .F XUngrabPointer , +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE Global except for MappingNotify and KeymapNotify. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M window +>>#NOTEs is set to +>>#NOTEs the +>>#NOTEs ifdef(`WINDOWTYPE', WINDOWTYPE, event) +>>#NOTEs window. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M root +>>#NOTEs is set to the source window's root window. +>>ASSERTION Good A +When a xname event is delivered +and the child of the event window contains the initial pointer position, +then +.M subwindow +is set to +that child. +>>STRATEGY +Build window hierarchy. +Create the hierarchy. +Move pointer to inside of child window. +Set LeaveWindowMask event mask bits on the eventw. +Move pointer to outside of windows. +Verify that a xname event was received. +Verify that subwindow is set to the source window. +>>CODE +int status; +Display *display = Dsp; +Winh *eventw; +Winh *child; +XEvent good; +Winhg winhg; + +/* Build window hierarchy. */ + winhg.area.x = 10; + winhg.area.y = 10; + winhg.area.width = W_STDWIDTH; + winhg.area.height = W_STDHEIGHT; + winhg.border_width = 1; + eventw = winh_adopt(display, (Winh *) NULL, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (eventw == (Winh *) NULL) { + report("Could not create eventw"); + return; + } + else + CHECK; + winhg.area.width /= 2; + winhg.area.height /= 2; + child = winh_adopt(display, eventw, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (child == (Winh *) NULL) { + report("Could not create child"); + return; + } + else + CHECK; +/* Create the hierarchy. */ + if (winh_create(display, (Winh *) NULL, WINH_MAP)) + return; + else + CHECK; +/* Move pointer to inside of child window. */ + if (warppointer(display, child->window, 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set LeaveWindowMask event mask bits on the eventw. */ + if (winh_selectinput(display, eventw, MASK)) + return; + else + CHECK; +/* Move pointer to outside of windows. */ + XSync(display, True); + XWarpPointer(display, None, DRW(display), 0, 0, 0, 0, 0, 0); + XSync(display, False); +/* Verify that a xname event was received. */ + good.type = EVENT; + good.xany.display = display; + good.xany.window = eventw->window; + if (winh_plant(eventw, &good, NoEventMask, WINH_NOMASK)) + return; + else + CHECK; + if (winh_harvest(display, (Winh *) NULL)) + return; + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that subwindow is set to the source window. */ + /* since only one event was expected, it must be first in list */ + if (eventw->delivered->event->xcrossing.subwindow != child->window) { + report("Subwindow set to 0x%x, expected 0x%x", + eventw->delivered->event->xcrossing.subwindow, child->window); + FAIL; + } + else + CHECK; + } + + CHECKPASS(8); +>>ASSERTION Good A +When a xname event is delivered +and the child of the event window does not contain the initial pointer position, +then +.M subwindow +is set to +.S None . +>>STRATEGY +Build window hierarchy. +Create the hierarchy. +Move pointer to inside of window. +Set LeaveWindowMask event mask bits on the eventw. +Move pointer to outside of windows. +Verify that a xname event was received. +Verify that subwindow is set to None. + since only one event was expected, it must be first in list +>>CODE +int status; +Display *display = Dsp; +Winh *eventw; +XEvent good; +Winhg winhg; + +/* Build window hierarchy. */ + winhg.area.x = 10; + winhg.area.y = 10; + winhg.area.width = W_STDWIDTH; + winhg.area.height = W_STDHEIGHT; + winhg.border_width = 1; + eventw = winh_adopt(display, (Winh *) NULL, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (eventw == (Winh *) NULL) { + report("Could not create eventw"); + return; + } + else + CHECK; +/* Create the hierarchy. */ + if (winh_create(display, (Winh *) NULL, WINH_MAP)) + return; + else + CHECK; +/* Move pointer to inside of window. */ + if (warppointer(display, eventw->window, 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set LeaveWindowMask event mask bits on the eventw. */ + if (winh_selectinput(display, eventw, MASK)) + return; + else + CHECK; +/* Move pointer to outside of windows. */ + XSync(display, True); + XWarpPointer(display, None, DRW(display), 0, 0, 0, 0, 0, 0); + XSync(display, False); +/* Verify that a xname event was received. */ + good.type = EVENT; + good.xany.display = display; + good.xany.window = eventw->window; + if (winh_plant(eventw, &good, NoEventMask, WINH_NOMASK)) + return; + else + CHECK; + if (winh_harvest(display, (Winh *) NULL)) + return; + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that subwindow is set to None. */ + /* since only one event was expected, it must be first in list */ + if (eventw->delivered->event->xcrossing.subwindow != None) { + report("Subwindow set to 0x%x, expected 0x%x", + eventw->delivered->event->xcrossing.subwindow, None); + FAIL; + } + else + CHECK; + } + + CHECKPASS(7); +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M time +>>#NOTEs is set to +>>#NOTEs the time in milliseconds at which the event was generated. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event window is on the same screen as the root window, +>>#NOTEs then +>>#NOTEs .M x +>>#NOTEs and +>>#NOTEs .M y +>>#NOTEs are set to +>>#NOTEs the coordinates of +>>#NOTEs the final pointer position relative to the event window's origin. +>>ASSERTION Good C +>>#COMMENT: +>># Assertion category changed March 1992 since it was found not to require +>># device events. +>># - Cal. +If multiple screens are supported: +When a xname event is delivered +and the event and root windows are not on the same screen, +then +.M x +and +.M y +are set to +zero. +>>STRATEGY +If multiple screens are supported: + Create a window on the default screen. + Create a window on the alternate screen. + Warp the pointer into the first window. + Grab the pointer for the first window. + Warp the pointer to the alternate window. + Verify that an xname event was generated relative to the grab window. + Verify that the x and y components of the event were set to zero. +>>CODE +Window w; +Window w2; +XEvent ev; +int gr; + + + /* If multiple screens are supported: */ + if (config.alt_screen == -1) { + unsupported("Multiple screens not supported."); + return; + } else + CHECK; + + /* Create a window on the default screen. */ + w = defwin(Dsp); + + /* Create a window on the alternate screen. */ + w2 = defdraw(Dsp, VI_ALT_WIN); + + /* Warp the pointer into the first window. */ + (void) warppointer(Dsp, w, 2,3); + + /* Grab the pointer for the first window. */ + if((gr=XGrabPointer(Dsp, w, False, EVENTMASK, GrabModeAsync, GrabModeAsync, None, None, CurrentTime)) != GrabSuccess) { + delete("XGrabPointer() returned %s instead of GrabSuccess.", grabreplyname(gr)); + return; + } else + CHECK; + + /* Warp the pointer to the alternate window. */ + XSync(Dsp, True); + (void) warppointer(Dsp, w2, 1,1); + XSync(Dsp, False); + + /* Verify that an xname event was generated relative to the grab window. */ + if (XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) == False) { + report("Expected %s event was not received.", eventname(EVENT)); + FAIL; + } else { + CHECK; + + /* Verify that the x and y components of the event were set to zero. */ + if(ev.xcrossing.x != 0 || ev.xcrossing.y != 0) { + report("The x (value %d) and y (value %d) components of the %s event were not set to zero.", + ev.xcrossing.x, ev.xcrossing.y, eventname(EVENT)); + FAIL; + } else + CHECK; + } + + XUngrabPointer(Dsp, CurrentTime); + CHECKPASS(4); + +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M x_root +>>#NOTEs and +>>#NOTEs .M y_root +>>#NOTEs are set to coordinates of the pointer +>>#NOTEs when the event was generated +>>#NOTEs relative to the root window's origin. +>>#NOTEm >>ASSERTION +>>#NOTEm >>#NOTE +>>#NOTEm >>#NOTE The spec does not actually state this. What the spec states is that +>>#NOTEm >>#NOTE things behave as if the pointer moved from the confine-to window to +>>#NOTEm >>#NOTE the grab window, the opposite of what one might expect. +>>#NOTEm >>#NOTE +>>#NOTEm When ARTICLE xname event is generated as the result of a grab activation, +>>#NOTEm then xname event generation occurs as if the pointer moved from +>>#NOTEm the grab window to the confine-to window with +>>#NOTEm .M mode +>>#NOTEm set to +>>#NOTEm .S NotifyGrab . +>>#NOTEm >>ASSERTION +>>#NOTEm >>#NOTE +>>#NOTEm >>#NOTE The spec does not actually state this. What the spec states is that +>>#NOTEm >>#NOTE things behave as if the pointer moved from the grab window to +>>#NOTEm >>#NOTE the confine-to window, the opposite of what one might expect. +>>#NOTEm >>#NOTE +>>#NOTEm When ARTICLE xname event is generated as the result of a grab deactivation, +>>#NOTEm then xname event generation occurs as if the pointer moved from +>>#NOTEm the confine-to window to the grab window with +>>#NOTEm .M mode +>>#NOTEm set to +>>#NOTEm .S NotifyUngrab . +>>ASSERTION def +All xname events are delivered before +any related +.S EnterNotify +events are delivered. +>>#NOTE +>>#NOTE It would not surprise me in the least if these assertions could +>>#NOTE be simplified and/or reduced in number. +>>#NOTE +>>ASSERTION Good A +When the pointer moves from window A to window B +and A is an inferior of B, +then a xname event is generated on window A with +.M detail +set to +.S NotifyAncestor +and then on each window +between window A and window B, exclusive, with +.M detail +set to +.S NotifyVirtual . +>>STRATEGY +Build window hierarchy. +Move pointer to known location. +Set window B. +Set window A to child of window B. +Select for EnterNotify and xname events on windows A and B. +Move pointer from window A to window B. +Verify that the expected events were delivered. +Verify that event delivered to window A with detail set to NotifyAncestor. +Verify events delivered, between window A and window B, exclusive, +in proper order. +Verify that detail is set to NotifyVirtual. +Verify that all xname events are delivered before all +EnterNotify events. +>>CODE +Display *display = Dsp; +int depth = 4; +Winh *A, *B; +int status; + +/* Build window hierarchy. */ + if (winh(display, depth, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set window B. */ + B = guardian->firstchild; +/* Set window A to child of window B. */ + A = B->firstchild->firstchild->firstchild; +/* Select for EnterNotify and xname events on windows A and B. */ + _event_mask_ = BOTHMASKS; + _display_ = display; + if (winh_climb(A, B, selectinput)) { + report("Could not select for events"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(A, B->firstchild, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; +/* Move pointer from window A to window B. */ + XWarpPointer(display, None, A->window, 0, 0, 0, 0, 0, 0); + XSync(display, True); + XWarpPointer(display, None, B->window, 0, 0, 0, 0, 0, 0); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that the expected events were delivered. */ + if (winh_ignore_event(B, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered to window A with detail set to NotifyAncestor. */ + _detail_ = NotifyAncestor; + if (winh_climb(A, A, checkdetail)) + FAIL; + else + CHECK; +/* Verify events delivered, between window A and window B, exclusive, */ +/* in proper order. */ + increasing = False; + if (winh_climb(A, B->firstchild, checksequence)) + FAIL; + else + CHECK; +/* Verify that detail is set to NotifyVirtual. */ + _detail_ = NotifyVirtual; + if (winh_climb(A->parent, B->firstchild, checkdetail)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered before all */ +/* EnterNotify events. */ + status = winh_ordercheck(EVENT, OTHEREVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(10); +>>ASSERTION Good A +When the pointer moves from window A to window B +and B is an inferior of A, +then a xname event is generated on window A with +.M detail +set to +.S NotifyInferior . +>>STRATEGY +Build window hierarchy. +Move pointer to known location. +Set window A. +Set window B to child of window A. +Select for xname and EnterNotify events on windows A and B. +Move pointer from window A to window B. +Verify xname event received on window A. +Verify that detail is set to NotifyInferior. +Verify that all xname events are delivered before all +EnterNotify events. +>>CODE +Display *display = Dsp; +int depth = 3; +Winh *A, *B; +int status; +XEvent *event; + +/* Build window hierarchy. */ + if (winh(display, depth, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set window A. */ + A = guardian->firstchild; +/* Set window B to child of window A. */ + B = A->firstchild; +/* Select for xname and EnterNotify events on windows A and B. */ + if (winh_selectinput(display, A, BOTHMASKS)) { + report("Error selecting for events."); + return; + } + else + CHECK; + if (winh_selectinput(display, B, BOTHMASKS)) { + report("Error selecting for events."); + return; + } + else + CHECK; + +/* Move pointer from window A to window B. */ + XWarpPointer(display, None, A->window, 0, 0, 0, 0, 0, 0); + XSync(display, True); + XWarpPointer(display, None, B->window, 0, 0, 0, 0, 0, 0); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify xname event received on window A. */ + if (A->delivered == (Winhe *) NULL || (event = A->delivered->event)->type != EVENT) { + report("Expected event not generated"); + FAIL; + } + else + { +/* Verify that detail is set to NotifyInferior. */ + if (event->xcrossing.detail != NotifyInferior) { + report("Got detail %d, expected %d", event->xcrossing.detail, NotifyInferior); + FAIL; + } + else + CHECK; +/* Verify that all xname events are delivered before all */ +/* EnterNotify events. */ + status = winh_ordercheck(EVENT, OTHEREVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + } + CHECKPASS(7); +>>ASSERTION Good A +>>#NOTE +>>#NOTE The approved form of this assertion was in error. +>>#NOTE The offending line is listed below: +>>#NOTE +>>#NOTE between window B and window C, exclusive, with +>>#NOTE +When the pointer moves from window A to window B +and there exists a window C that is their least common ancestor, +then a xname event is generated on window A with +.M detail +set to +.S NotifyNonlinear +and then on each window +between window A and window C, exclusive, with +.M detail +set to +.S NotifyNonlinearVirtual . +>>STRATEGY +Build window hierarchy. +Move pointer to known location. +Set windows A, B, and C. +Select for xname and EnterNotify events on window A and +between windows A and C, exclusive. +Select for xname and EnterNotify events between windows B and C. +Move pointer from window A to window B. +Verify that event delivered to window A with detail set to NotifyNonlinear. +Verify events delivered in proper order. +Verify that detail is set to NotifyNonlinearVirtual on events delivered on +each window between window A and window C, exclusive. +Verify that all xname events are delivered before all +EnterNotify events. +>>CODE +Display *display = Dsp; +int depth = 5; +Winh *A, *B, *C; +int status; + +/* Build window hierarchy. */ + if (winh(display, depth, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Move pointer to known location. */ + if (warppointer(display, DRW(display), 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set windows A, B, and C. */ + C = guardian->firstchild; + A = C->firstchild->nextsibling->firstchild->firstchild; + B = C->firstchild-> firstchild->firstchild; +/* Select for xname and EnterNotify events on window A and */ +/* between windows A and C, exclusive. */ + _event_mask_ = BOTHMASKS; + _display_ = display; + if (winh_climb(A, C->firstchild->nextsibling, selectinput)) { + report("Could not select for events"); + return; + } + else + CHECK; +/* Select for xname and EnterNotify events between windows B and C. */ + _display_ = display; + if (winh_climb(B, C, selectinput)) { + report("Could not select for events between C and B"); + return; + } + else + CHECK; + good.type = EVENT; + good.xany.display = display; + if (winh_climb(A, C->firstchild->nextsibling, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; +/* Move pointer from window A to window B. */ + XWarpPointer(display, None, A->window, 0, 0, 0, 0, 0, 0); + XSync(display, True); + XWarpPointer(display, None, B->window, 0, 0, 0, 0, 0, 0); + XSync(display, False); + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + delete("Could not ignore %s events", eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that event delivered to window A with detail set to NotifyNonlinear. */ + _detail_ = NotifyNonlinear; + if (winh_climb(A, A, checkdetail)) + FAIL; + else + CHECK; +/* Verify events delivered in proper order. */ + increasing = False; + if (winh_climb(A, C->firstchild->nextsibling, checksequence)) + FAIL; + else + CHECK; +/* Verify that detail is set to NotifyNonlinearVirtual on events delivered on */ +/* each window between window A and window C, exclusive. */ + _detail_ = NotifyNonlinearVirtual; + if (winh_climb(A->parent, C->firstchild->nextsibling, checkdetail)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered before all */ +/* EnterNotify events. */ + status = winh_ordercheck(EVENT, OTHEREVENT); + if (status == -1) + return; + else if (status) { + report("Incorrect event ordering."); + FAIL; + } + else + CHECK; + } + CHECKPASS(11); +>>ASSERTION Good C +If the implementation supports multiple screens: +When the pointer moves from window A to window B +and window A and window B are on different screens, +then a xname event is generated on window A with +.M detail +set to +.S NotifyNonlinear . +>>STRATEGY +Check to see if multiple screens are supported. +Build window hierarchy. +Move pointer to window A. +Select for xname and EnterNotify events on windows A and B. +Move pointer from window A to window B. +Verify that the expected events were received. +Verify that detail is set to NotifyNonlinear. +Verify that all xname events are delivered before all +EnterNotify events. +>>CODE +Display *display = Dsp; +int depth = 1; +Winh *A, *B, *Broot; +int status; + +/* Check to see if multiple screens are supported. */ + if (config.alt_screen == -1) { + unsupported("Multiple screens not supported."); + return; + } + else + CHECK; +/* Build window hierarchy. */ + if (winh(display, depth, WINH_MAP|WINH_BOTH_SCREENS)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Set windows A and B. */ + A = guardian->firstchild; + Broot = guardian->nextsibling; + B = Broot->firstchild; +/* Move pointer to window A. */ + if (warppointer(display, A->window, 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Select for xname and EnterNotify events on windows A and B. */ + if (winh_selectinput(display, A, BOTHMASKS)) { + report("Could not select for events on A"); + return; + } + else + CHECK; + if (winh_selectinput(display, B, BOTHMASKS)) { + report("Could not select for events on B"); + return; + } + else + CHECK; +/* Move pointer from window A to window B. */ + XSync(display, True); + XWarpPointer(display, None, B->window, 0, 0, 0, 0, 0, 0); + XSync(display, False); +/* Verify that the expected events were received. */ + good.type = EVENT; + good.xany.display = display; + good.xany.window = A->window; + if (winh_plant(A, &good, NoEventMask, WINH_NOMASK)) { + report("Could not plant events"); + return; + } + else + CHECK; + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; + if (winh_ignore_event(B, OTHEREVENT, WINH_NOMASK)) { + report("Could not ignore %s events on B", + eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that detail is set to NotifyNonlinear. */ + if (A->delivered->event->xcrossing.detail != NotifyNonlinear) { + report("Got detail %d, expected %d", + A->delivered->event->xcrossing.detail, + NotifyNonlinear); + FAIL; + } + else + CHECK; +/* Verify that all xname events are delivered before all */ +/* EnterNotify events. */ + status = winh_ordercheck(EVENT, OTHEREVENT); + if (status == -1) + return; + else if (status) { + report("Incorrect event ordering."); + FAIL; + } + else + CHECK; + } + CHECKPASS(10); +>>ASSERTION Good C +If the implementation supports multiple screens: +When the pointer moves from window A to window B +and window A and window B are on different screens +and window A is not a root window, +then, after the related xname event is generated +with +.M detail +set to +.S NotifyNonlinear , +a xname event is generated on +each window above A up to and including its root, with +.M detail +set to +.S NotifyNonlinearVirtual . +>>STRATEGY +Check to see if multiple screens are supported. +Create client. +Build window hierarchy. +Move pointer to window A. +Select for xname and EnterNotify events on windows A and B. +Move pointer from window A to window B. +Verify that the expected events were received. +Verify that detail is set to NotifyNonlinear for event delivered to A. +Verify events delivered on each window above A up to and +including its root, with detail set to NotifyNonlinearVirtual. +Verify that all xname events are delivered before all +EnterNotify events. +>>CODE +Display *display; +int depth = 4; +Winh *A, *B, *Aroot; +int status; + +/* Check to see if multiple screens are supported. */ + if (config.alt_screen == -1) { + unsupported("Multiple screens not supported."); + return; + } + else + CHECK; +/* Create client. */ + if ((display = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client."); + return; + } + else + CHECK; +/* Build window hierarchy. */ + if (winh(display, depth, WINH_MAP|WINH_BOTH_SCREENS)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Set windows A and B. */ + Aroot = guardian; + A = guardian->firstchild->firstchild->firstchild; + B = guardian->nextsibling->firstchild; +/* Move pointer to window A. */ + if (warppointer(display, A->window, 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Select for xname and EnterNotify events on windows A and B. */ + _event_mask_ = BOTHMASKS; + _display_ = display; + if (winh_climb(A, Aroot, selectinput)) { + report("Could not select for events"); + return; + } + else + CHECK; + if (winh_selectinput(display, B, BOTHMASKS)) { + report("Could not select for events on B"); + return; + } + else + CHECK; +/* Move pointer from window A to window B. */ + XSync(display, True); + XWarpPointer(display, None, B->window, 0, 0, 0, 0, 0, 0); + XSync(display, False); +/* Verify that the expected events were received. */ + good.type = EVENT; + good.xany.display = display; + if (winh_climb(A, Aroot, plant)) { + report("Could not plant events"); + return; + } + else + CHECK; + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; + if (winh_ignore_event(B, OTHEREVENT, WINH_NOMASK)) { + report("Could not ignore %s events on B", + eventname(OTHEREVENT)); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that detail is set to NotifyNonlinear for event delivered to A. */ + if (A->delivered->event->xcrossing.detail != NotifyNonlinear) { + report("Got detail %d, expected %d on A", + A->delivered->event->xcrossing.detail, + NotifyNonlinear); + FAIL; + } + else + CHECK; +/* Verify events delivered on each window above A up to and */ +/* including its root, with detail set to NotifyNonlinearVirtual. */ + increasing = False; + if (winh_climb(A, Aroot, checksequence)) + FAIL; + else + CHECK; + _detail_ = NotifyNonlinearVirtual; + if (winh_climb(A->parent, Aroot, checkdetail)) + FAIL; + else + CHECK; +/* Verify that all xname events are delivered before all */ +/* EnterNotify events. */ + status = winh_ordercheck(EVENT, OTHEREVENT); + if (status == -1) + return; + else if (status) { + report("Incorrect event ordering."); + FAIL; + } + else + CHECK; + } + CHECKPASS(13); + +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event and root windows are on the same screen, +>>#NOTEs then +>>#NOTEs .M same_screen +>>#NOTEs is set to +>>#NOTEs .S True . +>>ASSERTION Good C +>>#COMMENT: +>># Assertion category changed March 1992 since it was found not to require +>># device events. +>># - Cal. +If multiple screens are supported: +When a xname event is delivered +and the event and root windows are not on the same screen, +then +.M same_screen +is set to +.S False . +>>STRATEGY +If multiple screens are supported: + Create a window on the default screen. + Create a window on the alternate screen. + Warp the pointer into the first window. + Grab the pointer for the first window. + Warp the pointer to the alternate window. + Verify that an xname event was generated relative to the grab window. + Verify that the same_screen component of the event was False. +>>CODE +Window w; +Window w2; +XEvent ev; +int gr; + + /* If multiple screens are supported: */ + if(config.alt_screen == -1) { + unsupported("Multiple screens not supported."); + return; + } else + CHECK; + + /* Create a window on the default screen. */ + w = defwin(Dsp); + + /* Create a window on the alternate screen. */ + w2 = defdraw(Dsp, VI_ALT_WIN); + + /* Warp the pointer into the first window. */ + (void) warppointer(Dsp, w, 2,3); + + /* Grab the pointer for the first window. */ + if((gr=XGrabPointer(Dsp, w, False, EVENTMASK, GrabModeAsync, GrabModeAsync, None, None, CurrentTime)) != GrabSuccess) { + delete("XGrabPointer() returned %s instead of GrabSuccess.", grabreplyname(gr)); + return; + } else + CHECK; + + /* Warp the pointer to the alternate window. */ + XSync(Dsp, True); + (void) warppointer(Dsp, w2, 1,1); + XSync(Dsp, False); + + /* Verify that an xname event was generated relative to the grab window. */ + if (XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) == False) { + report("Expected %s event was not received.", eventname(EVENT)); + FAIL; + } else { + CHECK; + + /* Verify that the same_screen component of the event was False. */ + if(ev.xcrossing.same_screen != False) { + report("The same_screen component of the %s event was not set to False.", eventname(EVENT)); + FAIL; + } else + CHECK; + } + + XUngrabPointer(Dsp, CurrentTime); + CHECKPASS(4); + +>>ASSERTION Good A +When a xname event is delivered +and the event window is the focus window, +then +.M focus +is set to +.S True . +>>STRATEGY +Build window hierarchy. +Set input focus to eventw. +Move pointer to window. +Select xname events on the eventw. +Call XWarpPointer to move the pointer to outside of window. +Verify event was delivered with focus set to True. +Move pointer back to window. +Set input focus to known window. +Call XWarpPointer to move the pointer to eventw. +Verify event was delivered with focus set to False. +>>CODE +Display *display = Dsp; +Winh *eventw; +int status; + +/* Build window hierarchy. */ + if (winh(display, 1, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; + eventw = guardian->firstchild; +/* Set input focus to eventw. */ + XSetInputFocus(display, eventw->window, RevertToPointerRoot, CurrentTime); +/* Move pointer to window. */ + if (warppointer(display, eventw->window, 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Select xname events on the eventw. */ + if (winh_selectinput(display, eventw, MASK)) + return; + else + CHECK; +/* Call XWarpPointer to move the pointer to outside of window. */ + XSync(display, True); + XWarpPointer(display, None, DRW(display), 0, 0, 0, 0, 0, 0); + XSync(display, False); +/* Verify event was delivered with focus set to True. */ + good.type = EVENT; + good.xany.display = display; + good.xany.window = eventw->window; + if (winh_plant(eventw, &good, NoEventMask, WINH_NOMASK)) { + report("Could not initialize for event delivery"); + return; + } + else + CHECK; + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { + if (eventw->delivered->event->xcrossing.focus != True) { + report("Focus set to %d, expected %d", + eventw->delivered->event->xcrossing.focus,True); + FAIL; + } + else + CHECK; + } +/* Move pointer back to window. */ + XWarpPointer(display, None, eventw->window, 0, 0, 0, 0, 0, 0); +/* Set input focus to known window. */ + XSetInputFocus(display, eventw->nextsibling->window, RevertToPointerRoot, CurrentTime); +/* Call XWarpPointer to move the pointer to eventw. */ + XSync(display, True); + XWarpPointer(display, None, DRW(display), 0, 0, 0, 0, 0, 0); + XSync(display, False); +/* Verify event was delivered with focus set to False. */ + if (winh_plant(eventw, &good, NoEventMask, WINH_NOMASK)) { + report("Could not initialize for event delivery"); + return; + } + else + CHECK; + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { + if (eventw->delivered->event->xcrossing.focus != False) { + report("Focus set to %d, expected %d", + eventw->delivered->event->xcrossing.focus, False); + FAIL; + } + else + CHECK; + } + CHECKPASS(9); +>>ASSERTION Good A +When a xname event is delivered +and the event window is an inferior of the focus window, +then +.M focus +is set to +.S True . +>>STRATEGY +Build window hierarchy. +Set input focus to ancestor of window eventw. +Move pointer to event window. +Select xname events on the eventw. +Call XWarpPointer to move the pointer outside event window. +Verify event was delivered with focus set to True. +>>CODE +Display *display = Dsp; +Winh *eventw, *focusw; +int status; + +/* Build window hierarchy. */ + if (winh(display, 2, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; + focusw = guardian->firstchild; + eventw = guardian->firstchild->firstchild; +/* Set input focus to ancestor of window eventw. */ + XSetInputFocus(display, focusw->window, RevertToPointerRoot, CurrentTime); +/* Move pointer to event window. */ + if (warppointer(display, eventw->window, 0, 0) == (PointerPlace *) NULL) + return; + else + CHECK; +/* Select xname events on the eventw. */ + if (winh_selectinput(display, eventw, MASK)) + return; + else + CHECK; +/* Call XWarpPointer to move the pointer outside event window. */ + XSync(display, True); + XWarpPointer(display, None, DRW(display), 0, 0, 0, 0, 0, 0); + XSync(display, False); +/* Verify event was delivered with focus set to True. */ + good.type = EVENT; + good.xany.display = display; + good.xany.window = eventw->window; + if (winh_plant(eventw, &good, NoEventMask, WINH_NOMASK)) { + report("Could not initialize for event delivery"); + return; + } + else + CHECK; + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { + if (eventw->delivered->event->xcrossing.focus != True) { + report("Focus set to %d, expected %d", + eventw->delivered->event->xcrossing.focus, True); + FAIL; + } + else + CHECK; + } + CHECKPASS(6); +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event window is not the focus window or +>>#NOTEs an inferior of the focus window, +>>#NOTEs then +>>#NOTEs .M focus +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M state +>>#NOTEs is set to +>>#NOTEs indicate the logical state +>>#NOTEs of the pointer buttons, +>>#NOTEs which is the bitwise OR of one or more of +>>#NOTEs the button or modifier key masks +>>#NOTEs .S Button1Mask , +>>#NOTEs .S Button2Mask , +>>#NOTEs .S Button3Mask , +>>#NOTEs .S Button4Mask , +>>#NOTEs .S Button5Mask , +>>#NOTEs .S ShiftMask , +>>#NOTEs .S LockMask , +>>#NOTEs .S ControlMask , +>>#NOTEs .S Mod1Mask , +>>#NOTEs .S Mod2Mask , +>>#NOTEs .S Mod3Mask , +>>#NOTEs .S Mod4Mask , +>>#NOTEs and +>>#NOTEs .S Mod5Mask . diff --git a/xts5/Xlib11/Makefile.am b/xts5/Xlib11/Makefile.am new file mode 100644 index 00000000..b0168c6a --- /dev/null +++ b/xts5/Xlib11/Makefile.am @@ -0,0 +1,44 @@ +include ../../common.mk +AUTOMAKE_OPTIONS = subdir-objects + +AM_CFLAGS = $(XTS_LCFLAGS) $(XTS_CFLAGS) +LDADD = $(TCM) $(XTS_LLIBS) $(XTS_LIBS) + +libexec_PROGRAMS = $(tprogs) +BUILT_SOURCES = $(tprogs:$(EXEEXT)=.c) +CLEANFILES = $(BUILT_SOURCES) + +tprogs = \ + ButtonPress/ButtonPress \ + ButtonRelease/ButtonRelease \ + ClientMessage/ClientMessage \ + ColormapNotify/ColormapNotify \ + ConfigureNotify/ConfigureNotify \ + ConfigureRequest/ConfigureRequest \ + CirculateNotify/CirculateNotify \ + CirculateRequest/CirculateRequest \ + CreateNotify/CreateNotify \ + DestroyNotify/DestroyNotify \ + EnterNotify/EnterNotify \ + Expose/Expose \ + FocusIn/FocusIn \ + FocusOut/FocusOut \ + GraphicsExpose/GraphicsExpose \ + GravityNotify/GravityNotify \ + KeymapNotify/KeymapNotify \ + KeyPress/KeyPress \ + KeyRelease/KeyRelease \ + LeaveNotify/LeaveNotify \ + MapNotify/MapNotify \ + MappingNotify/MappingNotify \ + MapRequest/MapRequest \ + MotionNotify/MotionNotify \ + NoExpose/NoExpose \ + PropertyNotify/PropertyNotify \ + ReparentNotify/ReparentNotify \ + ResizeRequest/ResizeRequest \ + SelectionClear/SelectionClear \ + SelectionNotify/SelectionNotify \ + SelectionRequest/SelectionRequest \ + UnmapNotify/UnmapNotify \ + VisibilityNotify/VisibilityNotify diff --git a/xts5/Xlib11/MapNotify/MapNotify.m b/xts5/Xlib11/MapNotify/MapNotify.m new file mode 100644 index 00000000..660bc738 --- /dev/null +++ b/xts5/Xlib11/MapNotify/MapNotify.m @@ -0,0 +1,490 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/MapNotify/MapNotify.m,v 1.2 2005-11-03 08:42:29 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/MapNotify/MapNotify.m +>># +>># Description: +>># Tests for MapNotify() +>># +>># Modifications: +>># $Log: mpntfy.m,v $ +>># Revision 1.2 2005-11-03 08:42:29 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:17 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:18 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:50:55 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:22:59 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:31 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:01:44 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:58:43 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE MapNotify Xlib11 +>>EXTERN +#define EVENT MapNotify +#define MASK StructureNotifyMask +#define MASKP SubstructureNotifyMask +>>ASSERTION Good A +When a window's state changes from unmapped to mapped +as a result of save-set processing, +then a xname event is generated. +>>STRATEGY +Create client2. +Create parent window with client2. +Create child window as inferior to parent. +Add child window to client2's save-set. +Set client2's shut down mode to DestroyAll. +Select for MapNotify events on child. +Call XCloseDisplay with client2. +Verify that a MapNotify event was delivered. +Verify that event member fields are correctly set. +>>CODE +Display *display = Dsp; +Display *client2; +Window child; +Window parent; +XEvent event_return; +XMapEvent good; +struct area area; + +/* Create client2. */ + if (config.display == (char *) NULL) { + delete("config.display not set"); + return; + } + else + CHECK; + client2 = XOpenDisplay(config.display); + if (client2 == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; +/* Create parent window with client2. */ + /* must avoid resource registration! */ + parent = XCreateSimpleWindow(display, DRW(display), 1, 1, W_STDWIDTH, W_STDHEIGHT, 1, 0L, 0L); + XSync(client2, True); +/* Create child window as inferior to parent. */ + area.x = 1; + area.y = 1; + area.width = W_STDWIDTH/2; + area.height = W_STDHEIGHT/2; + child = mkwinchild(display, (XVisualInfo *) NULL, &area, False, parent, 1); + XSync(display, True); +/* Add child window to client2's save-set. */ + XAddToSaveSet(client2, child); +/* Set client2's shut down mode to DestroyAll. */ + XSetCloseDownMode(client2, DestroyAll); +/* Select for MapNotify events on child. */ + XSelectInput(display, child, MASK); +/* Call XCloseDisplay with client2. */ + XSync(display, True); + XSync(client2, True); + XCloseDisplay(client2); + sleep(config.speedfactor); + XSync(display, False); +/* Verify that a MapNotify event was delivered. */ + if (!XCheckTypedWindowEvent(display, child, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } + else + CHECK; +/* Verify that event member fields are correctly set. */ + good = event_return.xmap; + good.type = EVENT; + good.event = child; + good.window = child; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; + + CHECKPASS(4); +>>#NOTEm >>ASSERTION +>>#NOTEm When a window's state changes from unmapped to mapped +>>#NOTEm as a result of a call to +>>#NOTEm .F XMapWindow , +>>#NOTEm .F XMapRaised , +>>#NOTEm .F XMapSubwindows , +>>#NOTEm or +>>#NOTEm .F XReparentWindow , +>>#NOTEm then ARTICLE xname event is generated. +>>ASSERTION Good A +When a xname event is generated, +then all clients having set +.S StructureNotifyMask +event mask bits on the mapped window are delivered +a xname event. +>>STRATEGY +Create clients client2 and client3. +Create window. +Select for MapNotify events using StructureNotifyMask. +Select for MapNotify events using StructureNotifyMask with client2. +Select for no events with client3. +Generate MapNotify event. +Verify that a MapNotify event was delivered. +Verify that event member fields are correctly set. +Verify that a MapNotify event was delivered to client2. +Verify that event member fields are correctly set. +Verify that no events were delivered to client3. +>>CODE +Display *display = Dsp; +Display *client2; +Display *client3; +Window w; +int count; +XEvent event_return; +XMapEvent good; + +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; +/* Create window. */ + w = mkwin(display, (XVisualInfo *) NULL, (struct area *) NULL, False); +/* Select for MapNotify events using StructureNotifyMask. */ + XSelectInput(display, w, MASK); +/* Select for MapNotify events using StructureNotifyMask with client2. */ + XSelectInput(client2, w, MASK); +/* Select for no events with client3. */ + XSelectInput(client3, w, NoEventMask); +/* Generate MapNotify event. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XMapWindow(display, w); + XSync(display, False); + XSync(client2, False); + XSync(client3, False); +/* Verify that a MapNotify event was delivered. */ +/* Verify that event member fields are correctly set. */ + if (!XCheckTypedWindowEvent(display, w, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } + else + CHECK; + good = event_return.xmap; + good.type = EVENT; + good.event = w; + good.window = w; + good.override_redirect = config.debug_override_redirect; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; +/* Verify that a MapNotify event was delivered to client2. */ +/* Verify that event member fields are correctly set. */ + if (!XCheckTypedWindowEvent(client2, w, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } + else + CHECK; + good = event_return.xmap; + good.type = EVENT; + good.event = w; + good.window = w; + good.override_redirect = config.debug_override_redirect; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event for client2"); + FAIL; + } + else + CHECK; +/* Verify that no events were delivered to client3. */ + count = XPending(client3); + if (count != 0) { + report("Got %d events, expected %d for client3", count, 0); + FAIL; + return; + } + else + CHECK; + + CHECKPASS(7); +>>ASSERTION Good A +When a xname event is generated, +then all clients having set +.S SubstructureNotifyMask +event mask bits on the parent of the mapped window are delivered +a xname event. +>>STRATEGY +Create clients client2 and client3. +Create window. +Select for MapNotify events using SubstructureNotifyMask. +Select for MapNotify events using SubstructureNotifyMask with client2. +Select for no events with client3. +Generate MapNotify event. +Verify that a MapNotify event was delivered. +Verify that event member fields are correctly set. +Verify that a MapNotify event was delivered to client2. +Verify that event member fields are correctly set. +Verify that no events were delivered to client3. +>>CODE +Display *display = Dsp; +Display *client2; +Display *client3; +Window w; +int count; +XEvent event_return; +XMapEvent good; + +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; +/* Create window. */ + w = mkwin(display, (XVisualInfo *) NULL, (struct area *) NULL, False); +/* Select for MapNotify events using SubstructureNotifyMask. */ + XSelectInput(display, DRW(display), MASKP); +/* Select for MapNotify events using SubstructureNotifyMask with client2. */ + XSelectInput(client2, DRW(display), MASKP); +/* Select for no events with client3. */ + XSelectInput(client3, DRW(display), NoEventMask); +/* Generate MapNotify event. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XMapWindow(display, w); + XSync(display, False); + XSync(client2, False); + XSync(client3, False); +/* Verify that a MapNotify event was delivered. */ +/* Verify that event member fields are correctly set. */ + if (!XCheckTypedWindowEvent(display, DRW(display), EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } + else + CHECK; + good = event_return.xmap; + good.type = EVENT; + good.event = DRW(display); + good.window = w; + good.override_redirect = config.debug_override_redirect; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; +/* Verify that a MapNotify event was delivered to client2. */ +/* Verify that event member fields are correctly set. */ + if (!XCheckTypedWindowEvent(client2, DRW(display), EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } + else + CHECK; + good = event_return.xmap; + good.type = EVENT; + good.event = DRW(display); + good.window = w; + good.override_redirect = config.debug_override_redirect; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event for client2"); + FAIL; + } + else + CHECK; +/* Verify that no events were delivered to client3. */ + count = XPending(client3); + if (count != 0) { + report("Got %d events, expected %d for client3", count, 0); + FAIL; + return; + } + else + CHECK; + + CHECKPASS(7); +>>ASSERTION def +>>#NOTE Tested for in previous two assertions. +When a xname event is generated, +then +clients not having set +.S StructureNotifyMask +event mask bits on the +mapped window +and also not having set +.S SubstructureNotifyMask +event mask bits on the +parent of the mapped window +are not delivered +a xname event. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and +>>#NOTEs .S StructureNotify +>>#NOTEs was selected, +>>#NOTEs then +>>#NOTEs .M event +>>#NOTEs is set to +>>#NOTEs the WINDOWTYPE window. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and +>>#NOTEs .S SubstructureNotify +>>#NOTEs was selected, +>>#NOTEs then +>>#NOTEs .M event +>>#NOTEs is set to +>>#NOTEs the WINDOWTYPE window's parent. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE Global except for MappingNotify and KeymapNotify. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M window +>>#NOTEs is set to +>>#NOTEs the +>>#NOTEs ifdef(`WINDOWTYPE', WINDOWTYPE, event) +>>#NOTEs window. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M override_redirect +>>#NOTEs is set to the override-redirect attribute of +>>#NOTEs .M window . diff --git a/xts5/Xlib11/MapRequest/MapRequest.m b/xts5/Xlib11/MapRequest/MapRequest.m new file mode 100644 index 00000000..303d74e8 --- /dev/null +++ b/xts5/Xlib11/MapRequest/MapRequest.m @@ -0,0 +1,401 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/MapRequest/MapRequest.m,v 1.2 2005-11-03 08:42:30 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/MapRequest/MapRequest.m +>># +>># Description: +>># Tests for MapRequest() +>># +>># Modifications: +>># $Log: mprqst.m,v $ +>># Revision 1.2 2005-11-03 08:42:30 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:18 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:19 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:50:57 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:23:00 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:32 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:01:47 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:58:47 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE MapRequest Xlib11 +>>EXTERN +#define EVENT MapRequest +#define MASK SubstructureRedirectMask +>>ASSERTION Good A +When a xname event is generated, +then +all clients having set +.S SubstructureRedirectMask +event mask bits on the parent of the window +for which the map request was issued are delivered +a xname event. +>>STRATEGY +Create clients client2 and client3. +Build and create window hierarchy. +Create inferiors with override-redirect set to True. +Select for ConfigureRequest events using SubstructureRedirectMask. +Select for no events with client3. +Map window. +Verify that no events were delivered. +Verify that no events were delivered to client3. +Unmap window. +Set the override-redirect flag on inferiors to False. +Attempt to map window. +Initialize for expected events. +Verify that a ConfigureRequest event is delivered. +Verify that no events are delivered to client3. +Verify members of event structure. +Verify that no events were delivered to client3. +>>CODE +Display *display = Dsp; +Display *client2, *client3; +Winh *parent, *child, *lastw, *winh; +Winhg winhg; +XEvent event; +int i; +int status; +int numchildren = 2; +int count; +XSetWindowAttributes attrs; +unsigned long valuemask; + +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; +/* Build and create window hierarchy. */ + /* can't use winh() because the windows need to overlap */ + winhg.border_width = 1; + winhg.area.x = 1; + winhg.area.y = 1; + winhg.area.width = 100; + winhg.area.height = 100; + parent = winh_adopt(display, (Winh *) NULL, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (parent == (Winh *) NULL) { + report("Could not create parent"); + return; + } + else + CHECK; + winhg.area.x = 1; + winhg.area.y = 1; + winhg.area.width = 30; + winhg.area.height = 30; +/* Create inferiors with override-redirect set to True. */ + attrs.override_redirect = True; + attrs.border_pixel = W_FG; + attrs.background_pixel = W_BG; + valuemask = CWOverrideRedirect | CWBorderPixel | CWBackPixel; + for (i=0; i<numchildren; i++) { + if (!i) + CHECK; + lastw = winh_adopt(display, parent, valuemask, &attrs, &winhg, WINH_NOMASK); + if (lastw == (Winh *) NULL) { + report("Could not create child %d", i); + return; + } + winhg.area.x += 10; + winhg.area.y += 10; + } + child = parent->firstchild; + if (winh_create(display, (Winh *) NULL, WINH_MAP)) + return; + else + CHECK; +/* Select for ConfigureRequest events using SubstructureRedirectMask. */ + /* + * Selection with a single client because only one can select + * for this event at a time. + */ + if (winh_selectinput(display, parent, MASK)) { + report("Selection failed."); + return; + } + else + CHECK; +/* Select for no events with client3. */ + if (winh_selectinput(client3, (Winh *) NULL, NoEventMask)) { + report("Selection with client3 failed."); + return; + } + else + CHECK; +/* Map window. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XMapWindow(client2, child->window); + XSync(client2, False); + XSync(display, False); + XSync(client3, False); +/* Verify that no events were delivered. */ + count = XPending(display); + if (count != 0) { + report("Got %d events, expected %d (with override-redirect set)", count, 0); + FAIL; + } + else + CHECK; +/* Verify that no events were delivered to client3. */ + count = XPending(client3); + if (count != 0) { + report("Got %d events, expected %d for client3 (with override-redirect set)", count, 0); + FAIL; + } + else + CHECK; +/* Unmap window. */ + /* + * this assumes that it was mapped in the first place + * which is not the case where the override-redirect flag is ignored + */ + XUnmapWindow(client2, child->window); + XSync(client2, True); +/* Set the override-redirect flag on inferiors to False. */ + attrs.override_redirect = False; + valuemask = CWOverrideRedirect; + for (winh = parent->firstchild, i=0; i<numchildren; winh = winh->nextsibling, i++) { + if (!i) + CHECK; + if (winh_changewindowattributes(display, winh, valuemask, &attrs)) { + report("Failed to change attributes for subwindow %d", i); + return; + } + } +/* Attempt to map window. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XMapWindow(client2, child->window); + XSync(client2, False); + XSync(display, False); + XSync(client3, False); +/* Initialize for expected events. */ + event.xany.type = EVENT; + event.xany.window = parent->window; + if (winh_plant(parent, &event, MASK, WINH_NOMASK)) { + report("Could not plant events for parent"); + return; + } + else + CHECK; +/* Verify that a ConfigureRequest event is delivered. */ +/* Verify that no events are delivered to client3. */ + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; + if (winh_harvest(client3, (Winh *) NULL)) { + report("Could not harvest events for client3"); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status == -1) + return; + else if (status) { + report("Event delivery not as expected"); + FAIL; + } + else { + XEvent *event_return; + XMapRequestEvent good; + +/* Verify members of event structure. */ + event_return = winh_qdel->event; + good = event_return->xmaprequest; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.parent = parent->window; + good.window = child->window; + if (checkevent((XEvent *) &good, event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; + } +/* Verify that no events were delivered to client3. */ + count = XPending(client3); + if (count != 0) { + report("Got %d events, expected %d for client3", count, 0); + FAIL; + return; + } + else + CHECK; + + CHECKPASS(15); +>>ASSERTION def +>>#NOTE Tested for in previous assertion. +When a xname event is generated, +then +clients not having set +.S SubstructureRedirectMask +event mask bits on the +parent of the window for which the map request was issued +are not delivered +a xname event. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is generated +>>#NOTEm and a client has selected xname events on the child's parent +>>#NOTEm and the override-redirect attribute of the child window is set to +>>#NOTEm .S False , +>>#NOTEm then +>>#NOTEm .M window +>>#NOTEm is not WINDOWTYPE. +>>#NOTEm >>ASSERTION +>>#NOTEm When a +>>#NOTEm .S MapWindow +>>#NOTEm protocol request is issued on an unmapped child window by another client +>>#NOTEm and the unmapped child window's +>>#NOTEm .M override_redirect +>>#NOTEm member is set to +>>#NOTEm .S False , +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M parent +>>#NOTEs is set to +>>#NOTEs the parent window of +>>#NOTEs .M window . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M window +>>#NOTEs is set to +>>#NOTEs the child window to be WINDOWTYPE. diff --git a/xts5/Xlib11/MappingNotify/MappingNotify.m b/xts5/Xlib11/MappingNotify/MappingNotify.m new file mode 100644 index 00000000..e8c58ba4 --- /dev/null +++ b/xts5/Xlib11/MappingNotify/MappingNotify.m @@ -0,0 +1,284 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/MappingNotify/MappingNotify.m,v 1.2 2005-11-03 08:42:29 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/MappingNotify/MappingNotify.m +>># +>># Description: +>># Tests for MappingNotify() +>># +>># Modifications: +>># $Log: mppngntfy.m,v $ +>># Revision 1.2 2005-11-03 08:42:29 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:18 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:19 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:50:56 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:22:59 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:32 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:01:46 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:58:45 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE MappingNotify Xlib11 +>>EXTERN +#define EVENT MappingNotify +>>ASSERTION Good A +When a xname event is generated, +a xname event is delivered to all clients. +>>STRATEGY +Create client2. +Generate MappingNotify event. +Verify that MappingNotify event was delivered. +Verify members in delivered event structure. +Verify that MappingNotify event was delivered to client2. +Verify members in delivered event structure. +>>CODE +Display *display = Dsp; +Display *client2; +XEvent event_return; +int nmap; +int count; +unsigned char *map; +unsigned char buf[2]; + +/* Create client2. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; +/* Generate MappingNotify event. */ + nmap = XGetPointerMapping(display, buf, sizeof(buf)); + if (nmap < 1) { + report("XGetPointerMapping returned %d, expected greater than 0", nmap); + delete("Can't determine size of pointer mapping buffer"); + return; + } + else + CHECK; + map = (unsigned char *) malloc((unsigned int) (nmap * sizeof(*map))); + if (map == (unsigned char *) NULL) { + report("Couldn't allocate %d bytes", nmap * sizeof(*map)); + delete("Memory allocation error"); + return; + } + else + CHECK; + count = XGetPointerMapping(display, map, nmap); + if (count < nmap) { + report("XGetPointerMapping returned %d, expected %d", + count, nmap); + delete("XGetPointerMapping inconsistencies"); + free(map); + return; + } + else + CHECK; + XSync(display, True); + XSync(client2, True); + count = XSetPointerMapping(display, map, nmap); + if (count != Success) { + report("XSetPointerMapping returned %d, expected %d", + count, Success); + delete("XSetPointerMapping failed"); + free(map); + return; + } + else + CHECK; + XSync(display, False); + XSync(client2, False); +/* Verify that MappingNotify event was delivered. */ + if (!XCheckTypedEvent(display, EVENT, &event_return)) { + report("No events generated, expected %s event", + eventname(EVENT)); + FAIL; + } + else { + XMappingEvent good; + +/* Verify members in delivered event structure. */ + good = event_return.xmapping; + good.type = EVENT; + good.request = MappingPointer; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; + } +/* Verify that MappingNotify event was delivered to client2. */ + if (!XCheckTypedEvent(client2, EVENT, &event_return)) { + report("No events generated, expected %s event with client2", + eventname(EVENT)); + FAIL; + } + else { + XMappingEvent good; + +/* Verify members in delivered event structure. */ + good = event_return.xmapping; + good.type = EVENT; + good.request = MappingPointer; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event with client2"); + FAIL; + } + else + CHECK; + } + free(map); + + CHECKPASS(7); +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEm >>ASSERTION +>>#NOTEm When a call is made to +>>#NOTEm .F XSetModifierMapping , +>>#NOTEm then ARTICLE xname event is generated with +>>#NOTEm .M request +>>#NOTEm set to +>>#NOTEm .S MappingModifier . +>>#NOTEm >>ASSERTION +>>#NOTEm When a call is made to +>>#NOTEm .F XChangeKeyboardMapping , +>>#NOTEm then ARTICLE xname event is generated with +>>#NOTEm .M request +>>#NOTEm set to +>>#NOTEm .S MappingKeyboard . +>>#NOTEm >>ASSERTION +>>#NOTEm When a call is made to +>>#NOTEm .F XSetPointerMapping , +>>#NOTEm then ARTICLE xname event is generated with +>>#NOTEm .M request +>>#NOTEm set to +>>#NOTEm .S MappingPointer . +>>#NOTEs >>ASSERTION +>>#NOTEs When +>>#NOTEs .M request +>>#NOTEs is set to +>>#NOTEs .S MappingKeyboard , +>>#NOTEs then +>>#NOTEs .M first_keycode +>>#NOTEs is set to the first number in the range of the altered mapping +>>#NOTEs and +>>#NOTEs .M count +>>#NOTEs is set to the number of keycodes altered. diff --git a/xts5/Xlib11/MotionNotify/MotionNotify.m b/xts5/Xlib11/MotionNotify/MotionNotify.m new file mode 100644 index 00000000..e4f5c553 --- /dev/null +++ b/xts5/Xlib11/MotionNotify/MotionNotify.m @@ -0,0 +1,2257 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/MotionNotify/MotionNotify.m,v 1.2 2005-11-03 08:42:30 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/MotionNotify/MotionNotify.m +>># +>># Description: +>># Tests for MotionNotify() +>># +>># Modifications: +>># $Log: mtnntfy.m,v $ +>># Revision 1.2 2005-11-03 08:42:30 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:18 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:20 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:50:58 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:23:01 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:33 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:01:49 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:58:51 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE MotionNotify Xlib11 +>>EXTERN +#define MASK PointerMotionMask +#define HINTMASK PointerMotionHintMask +#define EVENT MotionNotify +#define EVENTMASK MASK +>>ASSERTION Good A +When the pointer is moved +and the pointer motion begins and ends in the same window, +then a xname event is generated. +>>STRATEGY +Create client2. +Create window. +Move pointer to inside of window. +Set PointerMotionMask event mask bits on window. +Set PointerMotionMask event mask bits on window with client2. +Synthesize expected event. +Call XWarpPointer to move the pointer with motion beginning and +ending in window. +Verify that a MotionNotify event was received. +Verify event members. +Verify that only one MotionNotify event was received. +Verify that no other events were received. +Verify that a MotionNotify event was received by client2. +Verify event members for client2. +Verify that only one MotionNotify event was received. +Verify that no other events were received. +Call XWarpPointer to move the pointer multiple times with +motion beginning and ending in window. +Verify that multiple MotionNotify events were received. +Verify that no other events were received. +>>CODE +int i; +int nummoves; +Display *display = Dsp; +Display *client2; +Window w; +int x, y; +XEvent event_return; +XMotionEvent good; +PointerPlace *warp; + +/* Create client2. */ + client2 = opendisplay(); + if (client2 == (Display *) NULL) { + delete("Can't open display"); + return; + } + else + CHECK; +/* Create window. */ + w = mkwin(display, (XVisualInfo *) NULL, (struct area *) NULL, True); +/* Move pointer to inside of window. */ + warp = warppointer(display, w, 0, 0); + if (warp == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set PointerMotionMask event mask bits on window. */ + XSelectInput(display, w, MASK); + XSync(display, True); +/* Set PointerMotionMask event mask bits on window with client2. */ + XSelectInput(client2, w, MASK); + XSync(client2, True); +/* Synthesize expected event. */ + x = 2; + y = 2; + good.type = MotionNotify; + /* ignore serial */ + good.send_event = False; + good.display = display; + good.window = w; + good.root = DRW(display); + good.subwindow = None; + /* ignore time */ + good.x = x; + good.y = y; + ROOTCOORDSET(display, &good); /* x_root and y_root */ + good.state = 0; + good.is_hint = NotifyNormal; + good.same_screen = True; +/* Call XWarpPointer to move the pointer with motion beginning and */ +/* ending in window. */ + XWarpPointer(display, None, w, 0, 0, 0, 0, x, y); +/* Verify that a MotionNotify event was received. */ + XSync(display, False); + if (!XCheckTypedWindowEvent(display, w, MotionNotify, &event_return)) { + report("No events delivered."); + FAIL; + } + else + CHECK; +/* Verify event members. */ + /* ignore serial */ + good.serial = ((XMotionEvent *) &event_return)->serial = 0; + /* ignore time */ + good.time = ((XMotionEvent *) &event_return)->time = 0; + CHECKEVENT((XEvent *) &good, &event_return); +/* Verify that only one MotionNotify event was received. */ + if (XCheckTypedWindowEvent(display, w, MotionNotify, &event_return)) { + report("Excess events generated."); + FAIL; + } + else + CHECK; +/* Verify that no other events were received. */ + if (XPending(display) > 0) { + delete("Unexpected events generated."); + return; + } + else + CHECK; +/* Verify that a MotionNotify event was received by client2. */ + XSync(client2, False); + if (!XCheckTypedWindowEvent(client2, w, MotionNotify, &event_return)) { + report("No events delivered to client2."); + FAIL; + } + else + CHECK; +/* Verify event members for client2. */ + good.display = client2; + /* ignore serial */ + good.serial = ((XMotionEvent *) &event_return)->serial = 0; + /* ignore time */ + good.time = ((XMotionEvent *) &event_return)->time = 0; + CHECKEVENT((XEvent *) &good, &event_return); +/* Verify that only one MotionNotify event was received. */ + if (XCheckTypedWindowEvent(client2, w, MotionNotify, &event_return)) { + report("Excess events generated for client2."); + FAIL; + } + else + CHECK; +/* Verify that no other events were received. */ + if (XPending(client2) > 0) { + delete("Unexpected events generated for client2."); + return; + } + else + CHECK; +/* Call XWarpPointer to move the pointer multiple times with */ +/* motion beginning and ending in window. */ + XSync(display, True); + nummoves = 5; + for (i=0; i<nummoves; i++) { + if (!i) + CHECK; + XWarpPointer(display, None, w, 0, 0, 0, 0, ++x, ++y); + /* + * Some servers may only generate the expected multiple + * MotionNotify events when this call to XWarpPointer is + * followed by an XSync (or probably any other protocol + * request). + */ + } +/* Verify that multiple MotionNotify events were received. */ + XSync(display, False); + for (i=0; i<nummoves; i++) { + if (!XCheckTypedWindowEvent(display, w, MotionNotify, &event_return)) { + report("Missing %d events.", nummoves - i); + FAIL; + break; + } + else + CHECK; + } +/* Verify that no other events were received. */ + if (XPending(display) > 0) { + delete("Unexpected events generated."); + return; + } + else + CHECK; + + CHECKPASS(12 + nummoves); +>>ASSERTION def +When a xname event is generated, +then all clients having set +.S PointerMotionMask +event mask bits on the event window are delivered +a xname event. +>>ASSERTION Good B 1 +When a xname event is generated while pointer button 1 was pressed, +then all clients having set +.S Button1MotionMask +event mask bits on the event window are delivered +a xname event. +>>STRATEGY +If extended testing is required: + Verify that at least one button is supported. + Create a second client. + Create a third client. + Create a window. + Select Button1MotionMask as the event mask for all clients. + Simulate a Motion event with Button1 depressed on the window. + Verify a xname event was generated for the first client. + Verify that event member fields were correctly set. + Verify a xname event was generated for the second client. + Verify that event member fields were correctly set. + Verify a xname event was generated for the third client. + Verify that event member fields were correctly set. +>>CODE +Display *client2; +Display *client3; +Window w; +XEvent ev; +XPointerMovedEvent good; +PointerPlace *ptr; + + if(noext(1)) + return; + + /* If extended testing is required: */ + + /* Verify that at least one button is supported. */ + if(nbuttons() < 1) { + delete("No buttons are supported."); + return; + } else + CHECK; + + /* Create a second client. */ + client2 = opendisplay(); + /* Create a third client. */ + client3 = opendisplay(); + + /* Create a window. */ + w = defwin(Dsp); + + /* Select Button1MotionMask as the event mask for all clients. */ + XSelectInput(Dsp, w, Button1MotionMask); + XSelectInput(client2, w, Button1MotionMask); + XSelectInput(client3, w, Button1MotionMask); + + (void) warppointer(Dsp, w, 0,0); + XSync(Dsp, True); + XSync(client2, True); + XSync(client3, True); + + /* Simulate a Motion event with Button1 depressed on the window. */ + buttonpress(Dsp, Button1); + ptr = warppointer(Dsp, w, 10,10); + XSync(Dsp, False); + XSync(client2, False); + XSync(client3, False); + buttonrel(Dsp, Button1); + + good = ev.xmotion; + good.type = EVENT; + good.send_event = False; + good.display = Dsp; + good.window = w; + good.root = DRW(Dsp); + good.subwindow = None; + + good.x = 10; + good.y = 10; + good.x_root = ptr->nx; + good.y_root = ptr->ny; + good.state = Button1Mask; + good.is_hint = NotifyNormal; + good.same_screen = True; + + /* Verify a xname event was generated for the first client. */ + if(XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) == False) { + report("Expected %s event was not generated.", eventname(EVENT)); + FAIL; + } else { + CHECK; + + /* Verify that event member fields were correctly set. */ + if (checkevent((XEvent *) &good, &ev)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } + + /* Verify a xname event was generated for the second client. */ + if(XCheckWindowEvent(client2, w, EVENTMASK, &ev) == False) { + report("Expected %s event was not generated.", eventname(EVENT)); + FAIL; + } else { + CHECK; + + /* Verify that event member fields were correctly set. */ + good.display = client2; + if (checkevent((XEvent *) &good, &ev)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } + + /* Verify a xname event was generated for the third client. */ + if(XCheckWindowEvent(client3, w, EVENTMASK, &ev) == False) { + report("Expected %s event was not generated.", eventname(EVENT)); + FAIL; + } else { + CHECK; + + /* Verify that event member fields were correctly set. */ + good.display = client3; + if (checkevent((XEvent *) &good, &ev)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } + + CHECKPASS(7); + +>>ASSERTION Good D 1 +When a xname event is generated while pointer button 2 was pressed, +then all clients having set +.S Button2MotionMask +event mask bits on the event window are delivered +a xname event. +>>STRATEGY +If extended testing is required: + Verify that the server supports at least 2 buttons. + Create a second client. + Create a third client. + Create a window. + Select Button2MotionMask as the event mask for all clients. + Simulate a Motion event with Button2 depressed on the window. + Verify a xname event was generated for the first client. + Verify that event member fields were correctly set. + Verify a xname event was generated for the second client. + Verify that event member fields were correctly set. + Verify a xname event was generated for the third client. + Verify that event member fields were correctly set. +>>CODE +Display *client2; +Display *client3; +Window w; +int b; +XEvent ev; +XPointerMovedEvent good; +PointerPlace *ptr; + + /* If extended testing is required: */ + if(noext(1)) + return; + + /* Verify that the server supports at least 2 buttons. */ + if((b = nbuttons()) < 2) { + unsupported("Server supports only %d buttons.", b); + return; + } else + CHECK; + + /* Create a second client. */ + client2 = opendisplay(); + /* Create a third client. */ + client3 = opendisplay(); + + /* Create a window. */ + w = defwin(Dsp); + + /* Select Button2MotionMask as the event mask for all clients. */ + XSelectInput(Dsp, w, Button2MotionMask); + XSelectInput(client2, w, Button2MotionMask); + XSelectInput(client3, w, Button2MotionMask); + + (void) warppointer(Dsp, w, 0,0); + XSync(Dsp, True); + XSync(client2, True); + XSync(client3, True); + + /* Simulate a Motion event with Button2 depressed on the window. */ + buttonpress(Dsp, Button2); + ptr = warppointer(Dsp, w, 10,10); + XSync(Dsp, False); + XSync(client2, False); + XSync(client3, False); + buttonrel(Dsp, Button2); + + good = ev.xmotion; + good.type = EVENT; + good.send_event = False; + good.display = Dsp; + good.window = w; + good.root = DRW(Dsp); + good.subwindow = None; + + good.x = 10; + good.y = 10; + good.x_root = ptr->nx; + good.y_root = ptr->ny; + good.state = Button2Mask; + good.is_hint = NotifyNormal; + good.same_screen = True; + + /* Verify a xname event was generated for the first client. */ + if(XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) == False) { + report("Expected %s event was not generated.", eventname(EVENT)); + FAIL; + } else { + CHECK; + + /* Verify that event member fields were correctly set. */ + if (checkevent((XEvent *) &good, &ev)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } + + /* Verify a xname event was generated for the second client. */ + if(XCheckWindowEvent(client2, w, EVENTMASK, &ev) == False) { + report("Expected %s event was not generated.", eventname(EVENT)); + FAIL; + } else { + CHECK; + + /* Verify that event member fields were correctly set. */ + good.display = client2; + if (checkevent((XEvent *) &good, &ev)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } + + /* Verify a xname event was generated for the third client. */ + if(XCheckWindowEvent(client3, w, EVENTMASK, &ev) == False) { + report("Expected %s event was not generated.", eventname(EVENT)); + FAIL; + } else { + CHECK; + + /* Verify that event member fields were correctly set. */ + good.display = client3; + if (checkevent((XEvent *) &good, &ev)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } + + CHECKPASS(7); + +>>ASSERTION Good D 1 +When a xname event is generated while pointer button 3 was pressed, +then all clients having set +.S Button3MotionMask +event mask bits on the event window are delivered +a xname event. +>>STRATEGY +If extended testing is required: + Verify that the server supports at least 3 buttons. + Create a second client. + Create a third client. + Create a window. + Select Button3MotionMask as the event mask for all clients. + Simulate a Motion event with Button3 depressed on the window. + Verify a xname event was generated for the first client. + Verify that event member fields were correctly set. + Verify a xname event was generated for the second client. + Verify that event member fields were correctly set. + Verify a xname event was generated for the third client. + Verify that event member fields were correctly set. +>>CODE +Display *client2; +Display *client3; +Window w; +int b; +XEvent ev; +XPointerMovedEvent good; +PointerPlace *ptr; + + /* If extended testing is required: */ + if(noext(1)) + return; + + /* Verify that the server supports at least 3 buttons. */ + if((b = nbuttons()) < 3) { + unsupported("Server supports only %d buttons.", b); + return; + } else + CHECK; + + /* Create a second client. */ + client2 = opendisplay(); + /* Create a third client. */ + client3 = opendisplay(); + + /* Create a window. */ + w = defwin(Dsp); + + /* Select Button3MotionMask as the event mask for all clients. */ + XSelectInput(Dsp, w, Button3MotionMask); + XSelectInput(client2, w, Button3MotionMask); + XSelectInput(client3, w, Button3MotionMask); + + (void) warppointer(Dsp, w, 0,0); + XSync(Dsp, True); + XSync(client2, True); + XSync(client3, True); + + /* Simulate a Motion event with Button3 depressed on the window. */ + buttonpress(Dsp, Button3); + ptr = warppointer(Dsp, w, 10,10); + XSync(Dsp, False); + XSync(client2, False); + XSync(client3, False); + buttonrel(Dsp, Button3); + + good = ev.xmotion; + good.type = EVENT; + good.send_event = False; + good.display = Dsp; + good.window = w; + good.root = DRW(Dsp); + good.subwindow = None; + + good.x = 10; + good.y = 10; + good.x_root = ptr->nx; + good.y_root = ptr->ny; + good.state = Button3Mask; + good.is_hint = NotifyNormal; + good.same_screen = True; + + /* Verify a xname event was generated for the first client. */ + if(XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) == False) { + report("Expected %s event was not generated.", eventname(EVENT)); + FAIL; + } else { + CHECK; + + /* Verify that event member fields were correctly set. */ + if (checkevent((XEvent *) &good, &ev)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } + + /* Verify a xname event was generated for the second client. */ + if(XCheckWindowEvent(client2, w, EVENTMASK, &ev) == False) { + report("Expected %s event was not generated.", eventname(EVENT)); + FAIL; + } else { + CHECK; + + /* Verify that event member fields were correctly set. */ + good.display = client2; + if (checkevent((XEvent *) &good, &ev)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } + + /* Verify a xname event was generated for the third client. */ + if(XCheckWindowEvent(client3, w, EVENTMASK, &ev) == False) { + report("Expected %s event was not generated.", eventname(EVENT)); + FAIL; + } else { + CHECK; + + /* Verify that event member fields were correctly set. */ + good.display = client3; + if (checkevent((XEvent *) &good, &ev)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } + + CHECKPASS(7); + +>>ASSERTION Good D 1 +When a xname event is generated while pointer button 4 was pressed, +then all clients having set +.S Button4MotionMask +event mask bits on the event window are delivered +a xname event. +>>STRATEGY +If extended testing is required: + Verify that the server supports at least 4 buttons. + Create a second client. + Create a third client. + Create a window. + Select Button4MotionMask as the event mask for all clients. + Simulate a Motion event with Button4 depressed on the window. + Verify a xname event was generated for the first client. + Verify that event member fields were correctly set. + Verify a xname event was generated for the second client. + Verify that event member fields were correctly set. + Verify a xname event was generated for the third client. + Verify that event member fields were correctly set. +>>CODE +Display *client2; +Display *client3; +Window w; +int b; +XEvent ev; +XPointerMovedEvent good; +PointerPlace *ptr; + + /* If extended testing is required: */ + if(noext(1)) + return; + + /* Verify that the server supports at least 4 buttons. */ + if((b = nbuttons()) < 4) { + unsupported("Server supports only %d buttons.", b); + return; + } else + CHECK; + + /* Create a second client. */ + client2 = opendisplay(); + /* Create a third client. */ + client3 = opendisplay(); + + /* Create a window. */ + w = defwin(Dsp); + + /* Select Button4MotionMask as the event mask for all clients. */ + XSelectInput(Dsp, w, Button4MotionMask); + XSelectInput(client2, w, Button4MotionMask); + XSelectInput(client3, w, Button4MotionMask); + + (void) warppointer(Dsp, w, 0,0); + XSync(Dsp, True); + XSync(client2, True); + XSync(client3, True); + + /* Simulate a Motion event with Button4 depressed on the window. */ + buttonpress(Dsp, Button4); + ptr = warppointer(Dsp, w, 10,10); + XSync(Dsp, False); + XSync(client2, False); + XSync(client3, False); + buttonrel(Dsp, Button4); + + good = ev.xmotion; + good.type = EVENT; + good.send_event = False; + good.display = Dsp; + good.window = w; + good.root = DRW(Dsp); + good.subwindow = None; + + good.x = 10; + good.y = 10; + good.x_root = ptr->nx; + good.y_root = ptr->ny; + good.state = Button4Mask; + good.is_hint = NotifyNormal; + good.same_screen = True; + + /* Verify a xname event was generated for the first client. */ + if(XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) == False) { + report("Expected %s event was not generated.", eventname(EVENT)); + FAIL; + } else { + CHECK; + + /* Verify that event member fields were correctly set. */ + if (checkevent((XEvent *) &good, &ev)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } + + /* Verify a xname event was generated for the second client. */ + if(XCheckWindowEvent(client2, w, EVENTMASK, &ev) == False) { + report("Expected %s event was not generated.", eventname(EVENT)); + FAIL; + } else { + CHECK; + + /* Verify that event member fields were correctly set. */ + good.display = client2; + if (checkevent((XEvent *) &good, &ev)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } + + /* Verify a xname event was generated for the third client. */ + if(XCheckWindowEvent(client3, w, EVENTMASK, &ev) == False) { + report("Expected %s event was not generated.", eventname(EVENT)); + FAIL; + } else { + CHECK; + + /* Verify that event member fields were correctly set. */ + good.display = client3; + if (checkevent((XEvent *) &good, &ev)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } + + CHECKPASS(7); + +>>ASSERTION Good D 1 +When a xname event is generated while pointer button 5 was pressed, +then all clients having set +.S Button5MotionMask +event mask bits on the event window are delivered +a xname event. +>>STRATEGY +If extended testing is required: + Verify that the server supports 5 buttons. + Create a second client. + Create a third client. + Create a window. + Select Button5MotionMask as the event mask for all clients. + Simulate a Motion event with Button5 depressed on the window. + Verify a xname event was generated for the first client. + Verify that event member fields were correctly set. + Verify a xname event was generated for the second client. + Verify that event member fields were correctly set. + Verify a xname event was generated for the third client. + Verify that event member fields were correctly set. +>>CODE +Display *client2; +Display *client3; +Window w; +int b; +XEvent ev; +XPointerMovedEvent good; +PointerPlace *ptr; + + /* If extended testing is required: */ + if(noext(1)) + return; + + /* Verify that the server supports 5 buttons. */ + if((b = nbuttons()) < 5) { + unsupported("Server supports only %d buttons.", b); + return; + } else + CHECK; + + /* Create a second client. */ + client2 = opendisplay(); + /* Create a third client. */ + client3 = opendisplay(); + + /* Create a window. */ + w = defwin(Dsp); + + /* Select Button5MotionMask as the event mask for all clients. */ + XSelectInput(Dsp, w, Button5MotionMask); + XSelectInput(client2, w, Button5MotionMask); + XSelectInput(client3, w, Button5MotionMask); + + (void) warppointer(Dsp, w, 0,0); + XSync(Dsp, True); + XSync(client2, True); + XSync(client3, True); + + /* Simulate a Motion event with Button5 depressed on the window. */ + buttonpress(Dsp, Button5); + ptr = warppointer(Dsp, w, 10,10); + XSync(Dsp, False); + XSync(client2, False); + XSync(client3, False); + buttonrel(Dsp, Button5); + + good = ev.xmotion; + good.type = EVENT; + good.send_event = False; + good.display = Dsp; + good.window = w; + good.root = DRW(Dsp); + good.subwindow = None; + + good.x = 10; + good.y = 10; + good.x_root = ptr->nx; + good.y_root = ptr->ny; + good.state = Button5Mask; + good.is_hint = NotifyNormal; + good.same_screen = True; + + /* Verify a xname event was generated for the first client. */ + if(XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) == False) { + report("Expected %s event was not generated.", eventname(EVENT)); + FAIL; + } else { + CHECK; + + /* Verify that event member fields were correctly set. */ + if (checkevent((XEvent *) &good, &ev)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } + + /* Verify a xname event was generated for the second client. */ + if(XCheckWindowEvent(client2, w, EVENTMASK, &ev) == False) { + report("Expected %s event was not generated.", eventname(EVENT)); + FAIL; + } else { + CHECK; + + /* Verify that event member fields were correctly set. */ + good.display = client2; + if (checkevent((XEvent *) &good, &ev)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } + + /* Verify a xname event was generated for the third client. */ + if(XCheckWindowEvent(client3, w, EVENTMASK, &ev) == False) { + report("Expected %s event was not generated.", eventname(EVENT)); + FAIL; + } else { + CHECK; + + /* Verify that event member fields were correctly set. */ + good.display = client3; + if (checkevent((XEvent *) &good, &ev)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } + + CHECKPASS(7); + +>>ASSERTION Good B 1 +When a xname event is generated while at least one +pointer button was pressed, +then all clients having set +.S ButtonMotionMask +event mask bits on the event window are delivered +a xname event. +>>STRATEGY +If extended testing is required: + Verify that at least one button is supported. + Create a second client. + Create a third client. + Create a window. + Select ButtonMotionMask as the event mask for all clients. + Simulate a Motion event with Button1 depressed on the window. + Verify a xname event was generated for the first client. + Verify that event member fields were correctly set. + Verify a xname event was generated for the second client. + Verify that event member fields were correctly set. + Verify a xname event was generated for the third client. + Verify that event member fields were correctly set. +>>CODE +Display *client2; +Display *client3; +Window w; +XEvent ev; +XPointerMovedEvent good; +PointerPlace *ptr; + + /* If extended testing is required: */ + if(noext(1)) + return; + + /* Verify that at least one button is supported. */ + if(nbuttons() < 1) { + delete("No buttons are supported."); + return; + } else + CHECK; + + /* Create a second client. */ + client2 = opendisplay(); + /* Create a third client. */ + client3 = opendisplay(); + + /* Create a window. */ + w = defwin(Dsp); + + /* Select ButtonMotionMask as the event mask for all clients. */ + XSelectInput(Dsp, w, ButtonMotionMask); + XSelectInput(client2, w, ButtonMotionMask); + XSelectInput(client3, w, ButtonMotionMask); + + (void) warppointer(Dsp, w, 0,0); + XSync(Dsp, True); + XSync(client2, True); + XSync(client3, True); + + /* Simulate a Motion event with Button1 depressed on the window. */ + buttonpress(Dsp, Button1); + ptr = warppointer(Dsp, w, 10,10); + XSync(Dsp, False); + XSync(client2, False); + XSync(client3, False); + buttonrel(Dsp, Button1); + + good = ev.xmotion; + good.type = EVENT; + good.send_event = False; + good.display = Dsp; + good.window = w; + good.root = DRW(Dsp); + good.subwindow = None; + + good.x = 10; + good.y = 10; + good.x_root = ptr->nx; + good.y_root = ptr->ny; + good.state = Button1Mask; + good.is_hint = NotifyNormal; + good.same_screen = True; + + /* Verify a xname event was generated for the first client. */ + if(XCheckWindowEvent(Dsp, w, EVENTMASK, &ev) == False) { + report("Expected %s event was not generated.", eventname(EVENT)); + FAIL; + } else { + CHECK; + + /* Verify that event member fields were correctly set. */ + if (checkevent((XEvent *) &good, &ev)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } + + /* Verify a xname event was generated for the second client. */ + if(XCheckWindowEvent(client2, w, EVENTMASK, &ev) == False) { + report("Expected %s event was not generated.", eventname(EVENT)); + FAIL; + } else { + CHECK; + + /* Verify that event member fields were correctly set. */ + good.display = client2; + if (checkevent((XEvent *) &good, &ev)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } + + /* Verify a xname event was generated for the third client. */ + if(XCheckWindowEvent(client3, w, EVENTMASK, &ev) == False) { + report("Expected %s event was not generated.", eventname(EVENT)); + FAIL; + } else { + CHECK; + + /* Verify that event member fields were correctly set. */ + good.display = client3; + if (checkevent((XEvent *) &good, &ev)) { + report("Unexpected values in delivered event"); + FAIL; + } else + CHECK; + } + + CHECKPASS(7); + +>>ASSERTION Good B 1 +When a xname event is generated +and a client has selected one or more of +.S Button1MotionMask , +.S Button2MotionMask , +.S Button3MotionMask , +.S Button4MotionMask , +.S Button5MotionMask , +.S ButtonMotionMask , +or +.S PointerMotionMask +event mask bits on the event window, +then only one xname event is delivered to that client. +>>EXTERN +unsigned long motionmasks[7] = { Button1MotionMask, Button2MotionMask, + Button3MotionMask, Button4MotionMask, Button5MotionMask, + ButtonMotionMask, PointerMotionMask }; + +#define MOTIONMASK Button1MotionMask | Button2MotionMask | \ + Button3MotionMask | Button4MotionMask | Button5MotionMask | \ + ButtonMotionMask | PointerMotionMask +>>STRATEGY +If extended testing is required: + Verify that at least one button is supported. + Create a window. + Select all the motion masks on the window. + Simulate a Motion event with Button1 depressed on the window. + Check that only one of the possible events was generated. + Simulate a Motion event with all buttons pressed. + Check that only one of the possible events was generated. +>>CODE +int i; +int b; +int nevents = 0; +Window w; +XEvent ev; + + /* If extended testing is required: */ + if(noext(1)) + return; + + /* Verify that at least one button is supported. */ + if((b = nbuttons()) < 1) { + delete("No buttons are supported."); + return; + } else + CHECK; + + /* Create a window. */ + w = defwin(Dsp); + + /* Select all the motion masks on the window. */ + XSelectInput(Dsp, w, MOTIONMASK); + + /* Simulate a Motion event with Button1 depressed on the window. */ + (void) warppointer(Dsp, w, 0,0); + XSync(Dsp, True); + buttonpress(Dsp, Button1); + (void) warppointer(Dsp, w, 10, 10); + XSync(Dsp, False); + buttonrel(Dsp, Button1); + + for(i=0; i < NELEM(motionmasks); i++) { + + if(XCheckWindowEvent(Dsp, w, motionmasks[i], &ev) == False) { + trace("%s event was not generated.", eventmaskname(motionmasks[i])); + } else { + nevents++; + trace("%s event was generated.", eventmaskname(motionmasks[i])); + } + + } + + /* Check that only one of the possible events was generated. */ + if(nevents != 1) { + report("More than one of the selected motion events was generated."); + FAIL; + } else + CHECK; + + nevents = 0; + /* Simulate a Motion event with all buttons pressed. */ + buttonpress(Dsp, Button1); + if(b>=2) + buttonpress(Dsp, Button2); + + if(b>=3) + buttonpress(Dsp, Button3); + + if(b>=4) + buttonpress(Dsp, Button4); + + if(b>=5) + buttonpress(Dsp, Button5); + + + (void) warppointer(Dsp, w, 0,0); + XSync(Dsp, True); + (void) warppointer(Dsp, w, 10, 10); + XSync(Dsp, False); + + for(i=0; i < NELEM(motionmasks); i++) { + + if(XCheckWindowEvent(Dsp, w, motionmasks[i], &ev) == False) { + trace("Event selected by %s was not generated.", eventmaskname(motionmasks[i])); + } else { + nevents++; + trace("Event selected by %s event was generated.", eventmaskname(motionmasks[i])); + } + + } + + if(b>=2) + buttonrel(Dsp, Button2); + + if(b>=3) + buttonrel(Dsp, Button3); + + if(b>=4) + buttonrel(Dsp, Button4); + + if(b>=5) + buttonrel(Dsp, Button5); + + + /* Check that only one of the possible events was generated. */ + if(nevents != 1) { + report("More than one of the selected motion events was generated."); + FAIL; + } else + CHECK; + + CHECKPASS(3); + +>>EXTERN +unsigned long buttonmask[7] = { Button5MotionMask,Button4MotionMask,Button3MotionMask, + Button2MotionMask,Button1MotionMask,ButtonMotionMask,PointerMotionMask}; + +unsigned int buttons[7] = { Button5, Button4, Button3, Button2, Button1, Button1, Button1 }; + +>>ASSERTION Good B 1 +When a xname event is generated, +then +clients not having set +.S Button1MotionMask , +.S Button2MotionMask , +.S Button3MotionMask , +.S Button4MotionMask , +.S Button5MotionMask , +.S ButtonMotionMask , +or +.S PointerMotionMask +event mask bits on the event window, +are not delivered +a xname event. +>>STRATEGY +If extended testing is required: + Verify that at least one button is supported. + Create a second client. + Create a window. + Select for something on the second client. + For each supported type of motion event : + Select the mask as the event mask for the first client. + Simulate the motion event. + Verify that the first client received the appropriate event. + Verify that the second client did not receive that event. +>>CODE +Display *client2; +Window w; +XEvent ev; +int i; + + + /* If extended testing is required: */ + if(noext(1)) + return; + + /* Verify that at least one button is supported. */ + if(nbuttons() < 1) { + delete("No buttons are supported."); + return; + } else + CHECK; + + /* Create a second client. */ + client2 = opendisplay(); + + /* Create a window. */ + w = defwin(Dsp); + + /* Select for something on the second client. */ + XSelectInput(client2, w, EnterWindowMask); + + /* For each supported type of motion event : */ + for(i = 5-nbuttons(); i<NELEM(buttonmask); i++) { + + trace("Iteration : %d Event mask : %s Button : %s", i, eventmaskname(buttonmask[i]), buttonname((int)buttons[i])); + + /* Select the mask as the event mask for the first client. */ + XSelectInput(Dsp, w, buttonmask[i]); + + /* Simulate the motion event. */ + (void) warppointer(Dsp, w, 0,0); + XSync(Dsp, False); + XSync(client2, False); + if(buttonmask[i] != PointerMotionMask) + buttonpress(Dsp, buttons[i]); + (void) warppointer(Dsp, w, 10,10); + XSync(Dsp, False); + XSync(client2, False); + + /* Verify that the first client received the appropriate event. */ + if(XCheckWindowEvent(Dsp, w, buttonmask[i], &ev) == False) { + report("Expected %s event was not generated.", eventmaskname(buttonmask[i])); + FAIL; + } else { + CHECK; + + /* Verify that the second client did not receive that event. */ + if(XCheckWindowEvent(client2, w, buttonmask[i], &ev) != False) { + report("Unexpected %s event was generated.", eventmaskname(buttonmask[i])); + FAIL; + } else + CHECK; + } + if(buttonmask[i] != PointerMotionMask) + buttonrel(Dsp, buttons[i]); + + } + + CHECKPASS(1 + 2 * (nbuttons()+2)); + +>>ASSERTION Good B 1 +When a xname event is delivered with +.M is_hint +set to +.S NotifyHint , +then clients which have set +.S PointerMotionHintMask +and one or more of +.S Button1MotionMask , +.S Button2MotionMask , +.S Button3MotionMask , +.S Button4MotionMask , +.S Button5MotionMask , +.S ButtonMotionMask , +or +.S PointerMotionMask +event mask bits on the event window may not be +delivered another xname event until either the key or button +state changes, the pointer leaves the event window or the client +calls +.S XQueryPointer +or +.S XGetMotionEvents . + +>>ASSERTION def +When a xname event is generated, then all clients which have not set +.S PointerMotionHintMask +and have set one or more of +.S Button1MotionMask , +.S Button2MotionMask , +.S Button3MotionMask , +.S Button4MotionMask , +.S Button5MotionMask , +.S ButtonMotionMask , +or +.S PointerMotionMask +event mask bits on the event window are delivered a +xname event with +.M is_hint +set to +.S NotifyNormal . + +>>ASSERTION Good A +When a xname event is generated, then all clients which +have set +.S PointerMotionHintMask +and one or more of +.S Button1MotionMask , +.S Button2MotionMask , +.S Button3MotionMask , +.S Button4MotionMask , +.S Button5MotionMask , +.S ButtonMotionMask , +or +.S PointerMotionMask event mask bits on the event window are +delivered a xname event with +.M is_hint +set to +.S NotifyHint +or +.S NotifyNormal . +>>STRATEGY +Create client2. +Create window. +Move pointer to inside of window. +Set PointerMotionMask and PointerMotionHintMask event mask bits on window. +Set PointerMotionMask and PointerMotionHintMask event mask bits on window +with client2. +Synthesize expected event. +Call XWarpPointer to move the pointer with motion beginning and +ending in window. +Verify that a MotionNotify event was received. +Verify event members. +Verify that only one MotionNotify event was received. +Verify that no other events were received. +Verify that a MotionNotify event was received by client2. +Verify event members for client2. +Verify that only one MotionNotify event was received. +Verify that no other events were received. +>>CODE +Display *display = Dsp; +Display *client2; +Window w; +int x, y; +XEvent event_return; +XMotionEvent good; +PointerPlace *warp; + +/* Create client2. */ + client2 = opendisplay(); + if (client2 == (Display *) NULL) { + delete("Can't open display"); + return; + } + else + CHECK; +/* Create window. */ + w = mkwin(display, (XVisualInfo *) NULL, (struct area *) NULL, True); +/* Move pointer to inside of window. */ + warp = warppointer(display, w, 0, 0); + if (warp == (PointerPlace *) NULL) + return; + else + CHECK; +/* Set PointerMotionMask and PointerMotionHintMask event mask bits on window. */ + XSelectInput(display, w, HINTMASK|MASK); + XSync(display, True); +/* Set PointerMotionMask and PointerMotionHintMask event mask bits on window */ +/* with client2. */ + XSelectInput(client2, w, HINTMASK|MASK); + XSync(client2, True); +/* Synthesize expected event. */ + x = 2; + y = 2; + good.type = MotionNotify; + /* ignore serial */ + good.send_event = False; + good.display = display; + good.window = w; + good.root = DRW(display); + good.subwindow = None; + /* ignore time */ + good.x = x; + good.y = y; + ROOTCOORDSET(display, &good); /* x_root and y_root */ + good.state = 0; + good.is_hint = NotifyNormal; + good.same_screen = True; +/* Call XWarpPointer to move the pointer with motion beginning and */ +/* ending in window. */ + XWarpPointer(display, None, w, 0, 0, 0, 0, x, y); +/* Verify that a MotionNotify event was received. */ + XSync(display, False); + if (!XCheckTypedWindowEvent(display, w, MotionNotify, &event_return)) { + report("No events delivered."); + FAIL; + } + else + CHECK; +/* Verify is_hint is set to NotifyNormal or Notify Hint */ + if(((XMotionEvent *) &event_return)->is_hint != NotifyNormal && + ((XMotionEvent *) &event_return)->is_hint != NotifyHint) { + report("is_hint was set to 0x%x, expected 0x%x or 0x%x", + ((XMotionEvent *) &event_return)->is_hint, + NotifyNormal, NotifyHint); + FAIL; + } + else + CHECK; + + /* is_hint has been checked so don't bother reporting again */ + good.is_hint = event_return.xmotion.is_hint; + +/* Verify event members. */ + /* ignore serial */ + good.serial = ((XMotionEvent *) &event_return)->serial = 0; + /* ignore time */ + good.time = ((XMotionEvent *) &event_return)->time = 0; + if (checkevent((XEvent *) &good, &event_return)) { + report("Delivered event did not match expected event"); + FAIL; + } + else + CHECK; +/* Verify that only one MotionNotify event was received. */ + if (XCheckTypedWindowEvent(display, w, MotionNotify, &event_return)) { + report("Excess events generated."); + FAIL; + } + else + CHECK; +/* Verify that no other events were received. */ + if (XPending(display) > 0) { + delete("Unexpected events generated."); + return; + } + else + CHECK; +/* Verify that a MotionNotify event was received by client2. */ + XSync(client2, False); + if (!XCheckTypedWindowEvent(client2, w, MotionNotify, &event_return)) { + report("No events delivered to client2."); + FAIL; + } + else + CHECK; +/* Verify is_hint is set to NotifyNormal or Notify Hint */ + if(((XMotionEvent *) &event_return)->is_hint != NotifyNormal && + ((XMotionEvent *) &event_return)->is_hint != NotifyHint) { + report("is_hint was set to 0x%x, expected 0x%x or 0x%x", + ((XMotionEvent *) &event_return)->is_hint, + NotifyNormal, NotifyHint); + FAIL; + } + else + CHECK; + + /* is_hint has been checked so don't bother reporting again */ + good.is_hint = event_return.xmotion.is_hint; + +/* Verify event members for client2. */ + good.display = client2; + /* ignore serial */ + good.serial = ((XMotionEvent *) &event_return)->serial = 0; + /* ignore time */ + good.time = ((XMotionEvent *) &event_return)->time = 0; + if (checkevent((XEvent *) &good, &event_return)) { + report("Delivered event did not match expected event"); + FAIL; + } + else + CHECK; +/* Verify that only one MotionNotify event was received. */ + if (XCheckTypedWindowEvent(client2, w, MotionNotify, &event_return)) { + report("Excess events generated for client2."); + FAIL; + } + else + CHECK; +/* Verify that no other events were received. */ + if (XPending(client2) > 0) { + delete("Unexpected events generated for client2."); + return; + } + else + CHECK; + + CHECKPASS(12); + +>>ASSERTION Good B 1 +When a xname event is generated +and no client has selected +.S Button1MotionMask , +.S Button2MotionMask , +.S Button3MotionMask , +.S Button4MotionMask , +.S Button5MotionMask , +.S ButtonMotionMask , +or +.S PointerMotionMask +event mask bits +on the source window, +then the event propagates, +with propagation stopping at the root window of the screen or +at the first window with +.S Button1MotionMask , +.S Button2MotionMask , +.S Button3MotionMask , +.S Button4MotionMask , +.S Button5MotionMask , +.S ButtonMotionMask , +or +.S PointerMotionMask +event mask bits +in its do-not-propagate mask, +from the source window to +the first ancestor window for which +some client has selected for xname events. +>>STRATEGY +If extended is required: + Verify that at least one button is supported. + For each supported type of motion event : + Create a window. + Create a child of that window. + Create a grandchild of the window. + Select xname events on the root window of the screen. + Simulate a xname event on the grandchild. + Verify that a xname event was generated on the root. + Select xname events on the grandparent window. + Set the do_not_propagate mask on the child to xname events. + Simulate a xname event on the grandchild. + Verify no xname event was generated on the grandchild. + Verify no xname event was generated on the child. + Verify no xname event was generated on the parent. + Select xname events on the child window. + Set the do_not_propagate mask of the child to NoEventMask. + Simulate a xname event on the grandchild. + Verify that no xname event was generated on the grandchild. + Verify that no xname event was generated on the parent. + Verify that a xname event was generated on the child. +>>CODE +XEvent ev; +Window w; +Window w1; +Window w2; +XSetWindowAttributes atts; +int i; + +/* If extended is required: */ + if(noext(0)) + return; + +/* Verify that at least one button is supported. */ + if(nbuttons() < 1) { + delete("No buttons are supported."); + return; + } else + CHECK; + +/* For each supported type of motion event : */ + for(i = 5-nbuttons(); i<NELEM(buttonmask); i++) { + trace("Iteration : %d Event mask : %s Button : %s", i, eventmaskname(buttonmask[i]), buttonname((int)buttons[i])); + +/* Create a window. */ + w = defwin(Dsp); +/* Create a child of that window. */ + w1 = crechild(Dsp, w, (struct area *) NULL); +/* Create a grandchild of the window. */ + w2 = crechild(Dsp, w1, (struct area *) NULL); + +/* Select xname events on the root window of the screen. */ + XSelectInput(Dsp, DRW(Dsp), buttonmask[i]); + +/* Simulate a xname event on the grandchild. */ + (void) warppointer(Dsp, w2, 0,0); + XSync(Dsp, False); + if(buttonmask[i] != PointerMotionMask) + buttonpress(Dsp, buttons[i]); + (void) warppointer(Dsp, w2, 1,1); + if(buttonmask[i] != PointerMotionMask) + buttonrel(Dsp, buttons[i]); + XSync(Dsp, False); + +/* Verify that a xname event was generated on the root. */ + if (XCheckWindowEvent(Dsp, DRW(Dsp), buttonmask[i], &ev) == False) { + report("Expected event (%s) not received.", eventmaskname(buttonmask[i])); + FAIL; + } else + CHECK; + + XSelectInput(Dsp, DRW(Dsp), NoEventMask); + +/* Select xname events on the grandparent window. */ + XSelectInput(Dsp, w, buttonmask[i]); + +/* Set the do_not_propagate mask on the child to xname events. */ + atts.do_not_propagate_mask = buttonmask[i]; + XChangeWindowAttributes(Dsp, w1, CWDontPropagate, &atts); + +/* Simulate a xname event on the grandchild. */ + (void) warppointer(Dsp, w2, 0,0); + XSync(Dsp, False); + if(buttonmask[i] != PointerMotionMask) + buttonpress(Dsp, buttons[i]); + (void) warppointer(Dsp, w2, 1,1); + if(buttonmask[i] != PointerMotionMask) + buttonrel(Dsp, buttons[i]); + XSync(Dsp, False); + +/* Verify no xname event was generated on the grandchild. */ + if (XCheckWindowEvent(Dsp, w2, buttonmask[i], &ev) != False) { + report("Unexpected event (%s) received.", eventmaskname(buttonmask[i])); + FAIL; + } else + CHECK; + +/* Verify no xname event was generated on the child. */ + if (XCheckWindowEvent(Dsp, w1, buttonmask[i], &ev) != False) { + report("Unexpected event (%s) received.", eventmaskname(buttonmask[i])); + FAIL; + } else + CHECK; + +/* Verify no xname event was generated on the parent. */ + if (XCheckWindowEvent(Dsp, w, buttonmask[i], &ev) != False) { + report("Unexpected event (%s) received.", eventmaskname(buttonmask[i])); + FAIL; + } else + CHECK; + +/* Select xname events on the child window. */ + XSelectInput(Dsp, w1, buttonmask[i]); + +/* Set the do_not_propagate mask of the child to NoEventMask. */ + atts.do_not_propagate_mask = NoEventMask; + XChangeWindowAttributes(Dsp, w1, CWDontPropagate, &atts); + +/* Simulate a xname event on the grandchild. */ + (void) warppointer(Dsp, w2, 0,0); + XSync(Dsp, False); + if(buttonmask[i] != PointerMotionMask) + buttonpress(Dsp, buttons[i]); + (void) warppointer(Dsp, w2, 1,1); + if(buttonmask[i] != PointerMotionMask) + buttonrel(Dsp, buttons[i]); + XSync(Dsp, False); + +/* Verify that no xname event was generated on the grandchild. */ + if (XCheckWindowEvent(Dsp, w2, buttonmask[i], &ev) != False) { + report("Unexpected event (%s) received.", eventmaskname(buttonmask[i])); + FAIL; + } else + CHECK; + +/* Verify that no xname event was generated on the parent. */ + if (XCheckWindowEvent(Dsp, w, buttonmask[i], &ev) != False) { + report("Unexpected event (%s) received.", eventmaskname(buttonmask[i])); + FAIL; + } else + CHECK; + +/* Verify that a xname event was generated on the child. */ + if (XCheckWindowEvent(Dsp, w1, buttonmask[i], &ev) == False) { + report("%s event was not delivered to selecting child window.", eventmaskname(buttonmask[i])); + FAIL; + } else + CHECK; + + } /* for */ + + + CHECKPASS(1 + (nbuttons()+2)*7); + +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE Global except for MappingNotify and KeymapNotify. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M window +>>#NOTEs is set to +>>#NOTEs the +>>#NOTEs ifdef(`WINDOWTYPE', WINDOWTYPE, event) +>>#NOTEs window. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M root +>>#NOTEs is set to the source window's root window. +>>ASSERTION Good A +When a xname event is delivered +and the source window is an inferior of the event window +and the source window is a child of the event window, +then +.M subwindow +is set to +the source window. +>>STRATEGY +Create window hierarchy. +Create the hierarchy. +Move pointer to inside of window. +Select no events on the sourcew. +Set PointerMotionMask event mask bits on the eventw. +Call XWarpPointer to move the pointer with motion beginning and +ending in window. +Verify that a MotionNotify event was received. +Verify that subwindow is set to the source window. +>>CODE +int status; +Display *display = Dsp; +Winh *eventw; +Winh *sourcew; +XEvent good; +Winhg winhg; +PointerPlace *warp; + +/* Create window hierarchy. */ + winhg.area.x = 0; + winhg.area.y = 0; + winhg.area.width = W_STDWIDTH; + winhg.area.height = W_STDHEIGHT; + winhg.border_width = 1; + eventw = winh_adopt(display, (Winh *) NULL, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (eventw == (Winh *) NULL) { + delete("Could not create eventw"); + return; + } + else + CHECK; + winhg.area.width /= 2; + winhg.area.height /= 2; + sourcew = winh_adopt(display, eventw, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (sourcew == (Winh *) NULL) { + delete("Could not create sourcew"); + return; + } + else + CHECK; +/* Create the hierarchy. */ + if (winh_create(display, (Winh *) NULL, WINH_MAP)) + return; + else + CHECK; +/* Move pointer to inside of window. */ + warp = warppointer(display, sourcew->window, 0, 0); + if (warp == (PointerPlace *) NULL) + return; + else + CHECK; +/* Select no events on the sourcew. */ + if (winh_selectinput(display, sourcew, NoEventMask)) + return; + else + CHECK; +/* Set PointerMotionMask event mask bits on the eventw. */ + if (winh_selectinput(display, eventw, MASK)) + return; + else + CHECK; + XSync(display, True); + good.type = MotionNotify; + good.xmotion.display = display; + good.xmotion.window = eventw->window; + good.xmotion.subwindow = sourcew->window; +/* Call XWarpPointer to move the pointer with motion beginning and */ +/* ending in window. */ + XWarpPointer(display, None, sourcew->window, 0, 0, 0, 0, 2, 2); +/* Verify that a MotionNotify event was received. */ + XSync(display, False); + if (winh_plant(sourcew, &good, NoEventMask, WINH_NOMASK)) + return; + else + CHECK; + if (winh_harvest(display, (Winh *) NULL)) + return; + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else + CHECK; + if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that subwindow is set to the source window. */ + /* since only one event was expected, it must be first in list */ + if (eventw->delivered->event->xmotion.subwindow != sourcew->window) { + report("Subwindow set to 0x%x, expected 0x%x", + eventw->delivered->event->xmotion.subwindow, sourcew->window); + FAIL; + } + else + CHECK; + } + + CHECKPASS(10); +>>ASSERTION Good A +When a xname event is delivered +and the source window is an inferior of the event window +and the source window is not a child of the event window, +then +.M subwindow +is set to +the child of the event window that is +an ancestor of the source window. +>>STRATEGY +Create window hierarchy. +Create the hierarchy. +Move pointer to inside of window. +Select no events on the sourcew. +Set PointerMotionMask event mask bits on the eventw. +Call XWarpPointer to move the pointer with motion beginning and +ending in window. +Verify that a MotionNotify event was received. +Verify that subwindow is set to the source window. +>>CODE +int status; +Display *display = Dsp; +Winh *eventw; +Winh *ancestorw; +Winh *sourcew; +XEvent good; +Winhg winhg; +PointerPlace *warp; + +/* Create window hierarchy. */ + winhg.area.x = 0; + winhg.area.y = 0; + winhg.area.width = W_STDWIDTH; + winhg.area.height = W_STDHEIGHT; + winhg.border_width = 1; + eventw = winh_adopt(display, (Winh *) NULL, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (eventw == (Winh *) NULL) { + delete("Could not create eventw"); + return; + } + else + CHECK; + winhg.area.width /= 2; + winhg.area.height /= 2; + ancestorw = winh_adopt(display, eventw, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (ancestorw == (Winh *) NULL) { + delete("Could not create ancestorw"); + return; + } + else + CHECK; + winhg.area.width /= 2; + winhg.area.height /= 2; + sourcew = winh_adopt(display, ancestorw, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (sourcew == (Winh *) NULL) { + delete("Could not create sourcew"); + return; + } + else + CHECK; +/* Create the hierarchy. */ + if (winh_create(display, (Winh *) NULL, WINH_MAP)) + return; + else + CHECK; +/* Move pointer to inside of window. */ + warp = warppointer(display, sourcew->window, 0, 0); + if (warp == (PointerPlace *) NULL) + return; + else + CHECK; +/* Select no events on the sourcew. */ + if (winh_selectinput(display, sourcew, NoEventMask)) + return; + else + CHECK; +/* Set PointerMotionMask event mask bits on the eventw. */ + if (winh_selectinput(display, eventw, MASK)) + return; + else + CHECK; + XSync(display, True); + good.type = MotionNotify; + good.xmotion.display = display; + good.xmotion.window = eventw->window; + good.xmotion.subwindow = ancestorw->window; +/* Call XWarpPointer to move the pointer with motion beginning and */ +/* ending in window. */ + XWarpPointer(display, None, sourcew->window, 0, 0, 0, 0, 2, 2); +/* Verify that a MotionNotify event was received. */ + XSync(display, False); + if (winh_plant(sourcew, &good, NoEventMask, WINH_NOMASK)) + return; + else + CHECK; + if (winh_harvest(display, (Winh *) NULL)) + return; + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else + CHECK; + if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else { +/* Verify that subwindow is set to the source window. */ + /* since only one event was expected, it must be first in list */ + if (eventw->delivered->event->xmotion.subwindow != ancestorw->window) { + report("Subwindow set to 0x%x, expected 0x%x", + eventw->delivered->event->xmotion.subwindow, ancestorw->window); + FAIL; + } + else + CHECK; + } + + CHECKPASS(11); + +>>ASSERTION def +When a xname event is delivered +and the source window is not an inferior of the event window, +then +.M subwindow +is set to +.S None . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M time +>>#NOTEs is set to +>>#NOTEs the time in milliseconds at which the event was generated. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event window is on the same screen as the root window, +>>#NOTEs then +>>#NOTEs .M x +>>#NOTEs and +>>#NOTEs .M y +>>#NOTEs are set to +>>#NOTEs the coordinates of +>>#NOTEs the final pointer position relative to the event window's origin. +>>ASSERTION Good D 1 +If multiple screens are supported: +When a xname event is delivered +and the event and root windows are not on the same screen, +then +.M x +and +.M y +are set to +zero. +>>STRATEGY +If multiple screens are supported: + If extended testing is required: + Create a window on the default screen. + Create a window on the alternate screen. + Grab the pointer asynchronously for the first window selecting PointerMotion and ButtonMotion events. + Generate a PointerMotion event on the alternate window. + Verify that a PointerMotion event was generated with respect to the grabbing window. + Verify that the x and y event components were zero. + Generate a ButtonMotion mask on the alternate window. + Verify that a ButtonMotion event was generated with respect to the grabbing window. + Verify that the x and y event components were zero. +>>CODE +Window w; +Window w2; +XEvent ev; + +/* If multiple screens are supported: */ + if (config.alt_screen == -1) { + unsupported("Multiple screens not supported."); + return; + } else + CHECK; + +/* If extended testing is required: */ + if(noext(1)) + return; + +/* Create a window on the default screen. */ + w = defwin(Dsp); +/* Create a window on the alternate screen. */ + w2 = defdraw(Dsp, VI_ALT_WIN); + +/* Grab the pointer asynchronously for the first window selecting PointerMotion and ButtonMotion events. */ + if( XGrabPointer(Dsp, w, False, PointerMotionMask | ButtonMotionMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime) != GrabSuccess) { + delete("XGrabPointer() did not return GrabSuccess."); + return; + } else + CHECK; + +/* Generate a PointerMotion event on the alternate window. */ + (void) warppointer(Dsp, w2, 0,0); + XSync(Dsp, True); + (void) warppointer(Dsp, w2, 10, 10); + XSync(Dsp, False); + +/* Verify that a PointerMotion event was generated with respect to the grabbing window. */ + if (XCheckWindowEvent(Dsp, w, PointerMotionMask, &ev) == False) { + report("Expected event (%s) not received.", eventname(MotionNotify)); + FAIL; + } else { + CHECK; +/* Verify that the x and y event components were zero. */ + if(ev.xmotion.x != 0 || ev.xmotion.y != 0) { + report("The x (value %d) and y (value %d) components of the %s event were not set to zero.", + ev.xmotion.x, ev.xmotion.y, eventname(EVENT)); + FAIL; + } else + CHECK; + } + +/* Generate a ButtonMotion mask on the alternate window. */ + (void) warppointer(Dsp, w2, 0,0); + XSync(Dsp, True); + buttonpress(Dsp, Button1); + (void) warppointer(Dsp, w2, 10, 10); + XSync(Dsp, False); + buttonrel(Dsp, Button1); + +/* Verify that a ButtonMotion event was generated with respect to the grabbing window. */ + if (XCheckWindowEvent(Dsp, w, ButtonMotionMask, &ev) == False) { + report("Expected event (%s) not received.", eventname(MotionNotify)); + FAIL; + } else { + CHECK; +/* Verify that the x and y event components were zero. */ + if(ev.xmotion.x != 0 || ev.xmotion.y != 0) { + report("The x (value %d) and y (value %d) components of the %s event were not set to zero.", + ev.xmotion.x, ev.xmotion.y, eventname(EVENT)); + FAIL; + } else + CHECK; + } + + XUngrabPointer(Dsp, CurrentTime); + + CHECKPASS(6); + +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M x_root +>>#NOTEs and +>>#NOTEs .M y_root +>>#NOTEs are set to coordinates of the pointer +>>#NOTEs when the event was generated +>>#NOTEs relative to the root window's origin. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M state +>>#NOTEs is set to +>>#NOTEs indicate the logical state +>>#NOTEs of the pointer buttons, +>>#NOTEs which is the bitwise OR of one or more of +>>#NOTEs the button or modifier key masks +>>#NOTEs .S Button1Mask , +>>#NOTEs .S Button2Mask , +>>#NOTEs .S Button3Mask , +>>#NOTEs .S Button4Mask , +>>#NOTEs .S Button5Mask , +>>#NOTEs .S ShiftMask , +>>#NOTEs .S LockMask , +>>#NOTEs .S ControlMask , +>>#NOTEs .S Mod1Mask , +>>#NOTEs .S Mod2Mask , +>>#NOTEs .S Mod3Mask , +>>#NOTEs .S Mod4Mask , +>>#NOTEs and +>>#NOTEs .S Mod5Mask . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M keycode +>>#NOTEs is set to +>>#NOTEs a number that represents the physical key on the keyboard. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event and root windows are on the same screen, +>>#NOTEs then +>>#NOTEs .M same_screen +>>#NOTEs is set to +>>#NOTEs .S True . +>>ASSERTION Good D 1 +If multiple screens are supported: +When a xname event is delivered +and the event and root windows are not on the same screen, +then +.M same_screen +is set to +.S False . +>>STRATEGY +If multiple screens are supported: + If extended testing is required: + Create a window on the default screen. + Create a window on the alternate screen. + Grab the pointer asynchronously for the first window selecting PointerMotion and ButtonMotion events. + Generate a PointerMotion event on the alternate window. + Verify that a PointerMotion event was generated with respect to the grabbing window. + Verify that same_screen event component was False. + Generate a ButtonMotion event on the alternate window. + Verify that a ButtonMotion event was generated with respect to the grabbing window. + Verify that same_screen event component was False. +>>CODE +Window w; +Window w2; +XEvent ev; + +/* If multiple screens are supported: */ + if (config.alt_screen == -1) { + unsupported("Multiple screens not supported."); + return; + } else + CHECK; + +/* If extended testing is required: */ + if(noext(1)) + return; + +/* Create a window on the default screen. */ + w = defwin(Dsp); +/* Create a window on the alternate screen. */ + w2 = defdraw(Dsp, VI_ALT_WIN); + +/* Grab the pointer asynchronously for the first window selecting PointerMotion and ButtonMotion events. */ + if( XGrabPointer(Dsp, w, False, PointerMotionMask | ButtonMotionMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime) != GrabSuccess) { + delete("XGrabPointer() did not return GrabSuccess."); + return; + } else + CHECK; + +/* Generate a PointerMotion event on the alternate window. */ + (void) warppointer(Dsp, w2, 0,0); + XSync(Dsp, True); + (void) warppointer(Dsp, w2, 10, 10); + XSync(Dsp, False); + +/* Verify that a PointerMotion event was generated with respect to the grabbing window. */ + if (XCheckWindowEvent(Dsp, w, PointerMotionMask, &ev) == False) { + report("Expected event (%s) not received.", eventname(MotionNotify)); + FAIL; + } else { + CHECK; +/* Verify that same_screen event component was False. */ + if(ev.xmotion.same_screen != False ) { + report("The same_screen component of the %s event was not set correctly.", eventname(ButtonPress)); + FAIL; + } else + CHECK; + } + +/* Generate a ButtonMotion event on the alternate window. */ + (void) warppointer(Dsp, w2, 0,0); + XSync(Dsp, True); + buttonpress(Dsp, Button1); + (void) warppointer(Dsp, w2, 10, 10); + XSync(Dsp, False); + buttonrel(Dsp, Button1); + +/* Verify that a ButtonMotion event was generated with respect to the grabbing window. */ + if (XCheckWindowEvent(Dsp, w, ButtonMotionMask, &ev) == False) { + report("Expected event (%s) not received.", eventname(MotionNotify)); + FAIL; + } else { + CHECK; +/* Verify that same_screen event component was False. */ + if(ev.xmotion.same_screen != False ) { + report("The same_screen component of the %s event was not set correctly.", eventname(ButtonPress)); + FAIL; + } else + CHECK; + } + + XUngrabPointer(Dsp, CurrentTime); + + CHECKPASS(6); diff --git a/xts5/Xlib11/NoExpose/NoExpose.m b/xts5/Xlib11/NoExpose/NoExpose.m new file mode 100644 index 00000000..231de02c --- /dev/null +++ b/xts5/Xlib11/NoExpose/NoExpose.m @@ -0,0 +1,188 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/NoExpose/NoExpose.m,v 1.2 2005-11-03 08:42:30 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/NoExpose/NoExpose.m +>># +>># Description: +>># Tests for NoExpose() +>># +>># Modifications: +>># $Log: nexps.m,v $ +>># Revision 1.2 2005-11-03 08:42:30 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:18 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:21 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:50:59 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:23:01 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:34 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:01:53 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:58:57 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE NoExpose Xlib11 +>>ASSERTION Good A +There are no assertions in sections 8.1-8.4 for xname events. +There are already assertions for +.F XCopyArea +and +.F XCopyPlane +covering xname events. +>>STRATEGY +Put out a message explaining that there are no specific assertions for +xname events in sections 8.1-8.4, and that delivery of xname events is +covered in XCopyPlane and XCopyArea. +>>CODE + + report("There are no specific assertions for %s events in sections 8.1-8.4.", TestName); + report("Delivery of %s events is covered in XCopyPlane and XCopyArea.", TestName); + tet_result(TET_NOTINUSE); + +>>#NOTEm >>ASSERTION +>>#NOTEm When a call to +>>#NOTEm .F XCopyArea +>>#NOTEm or +>>#NOTEm .F XCopyPlane +>>#NOTEm is made +>>#NOTEm and a +>>#NOTEm .S GraphicsExpose +>>#NOTEm event is not generated +>>#NOTEm and the graphics-expose attribute +>>#NOTEm of the graphics context is set to +>>#NOTEm .S True , +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M drawable +>>#NOTEs is set to +>>#NOTEs the drawable of the destination region on +>>#NOTEs which the graphics request was performed. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M major_code +>>#NOTEs is set to either +>>#NOTEs .S X_CopyArea +>>#NOTEs or +>>#NOTEs .S X_CopyPlane +>>#NOTEs and +>>#NOTEs .M minor_code +>>#NOTEs is set to zero. diff --git a/xts5/Xlib11/PropertyNotify/PropertyNotify.m b/xts5/Xlib11/PropertyNotify/PropertyNotify.m new file mode 100644 index 00000000..a817e822 --- /dev/null +++ b/xts5/Xlib11/PropertyNotify/PropertyNotify.m @@ -0,0 +1,337 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/PropertyNotify/PropertyNotify.m,v 1.3 2005-11-03 08:42:30 jmichael Exp $ + +Copyright (c) 2001 The Open Group +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/PropertyNotify/PropertyNotify.m +>># +>># Description: +>># Tests for PropertyNotify() +>># +>># Modifications: +>># $Log: prprtyntfy.m,v $ +>># Revision 1.3 2005-11-03 08:42:30 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.2 2005/04/21 09:40:42 ajosey +>># resync to VSW5.1.5 +>># +>># Revision 8.2 2005/01/21 10:36:58 gwc +>># Updated copyright notice +>># +>># Revision 8.1 2001/11/27 16:27:19 vsx +>># TSD4W.00172: tp1 - pass 32 bit data to XChangeProperty as a long (not int) +>># +>># Revision 8.0 1998/12/23 23:31:21 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:51:00 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:23:02 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:34 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:31:29 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:01:54 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:58:59 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE PropertyNotify Xlib11 +>>EXTERN +#include "X11/Xatom.h" +#define EVENT PropertyNotify +#define MASK PropertyChangeMask +>>ASSERTION Good A +When a xname event is generated, +then +all clients having set +.S PropertyChangeMask +event mask bits on the event window are delivered +a xname event. +>>STRATEGY +Create clients client2 and client3. +Create window. +Select for PropertyNotify events using PropertyChangeMask. +Select for PropertyNotify events using PropertyChangeMask with client2. +Select for no events with client3. +Create atom for property. +Generate PropertyNotify event. +Verify that a PropertyNotify event was delivered. +Verify that event member fields are correctly set. +Verify that a PropertyNotify event was delivered to client2. +Verify that event member fields are correctly set. +Verify that no events were delivered to client3. +>>CODE +Display *display = Dsp; +Display *client2; +Display *client3; +Window w; +int count; +XEvent event_return; +XPropertyEvent good; +Atom atom; +long data = 42; + +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; +/* Create window. */ + w = mkwin(display, (XVisualInfo *) NULL, (struct area *) NULL, False); +/* Select for PropertyNotify events using PropertyChangeMask. */ + XSelectInput(display, w, MASK); +/* Select for PropertyNotify events using PropertyChangeMask with client2. */ + XSelectInput(client2, w, MASK); +/* Select for no events with client3. */ + XSelectInput(client3, w, NoEventMask); +/* Create atom for property. */ + atom = XInternAtom(display, XT_TIMESTAMP, False); + if (atom == None) { + delete("XInternAtom of '%s' failed.", XT_TIMESTAMP); + return; + } + else + CHECK; +/* Generate PropertyNotify event. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XChangeProperty(display, w, atom, XA_INTEGER, 32, PropModeReplace, (unsigned char *)&data, 1); + XSync(display, False); + XSync(client2, False); + XSync(client3, False); +/* Verify that a PropertyNotify event was delivered. */ +/* Verify that event member fields are correctly set. */ + if (!XCheckTypedWindowEvent(display, w, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } + else + CHECK; + good = event_return.xproperty; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.window = w; + good.atom = atom; + good.state = PropertyNewValue; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; +/* Verify that a PropertyNotify event was delivered to client2. */ +/* Verify that event member fields are correctly set. */ + if (!XCheckTypedWindowEvent(client2, w, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } + else + CHECK; + good = event_return.xproperty; + good.type = EVENT; + good.send_event = False; + good.display = client2; + good.window = w; + good.atom = atom; + good.state = PropertyNewValue; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event for client2"); + FAIL; + } + else + CHECK; +/* Verify that no events were delivered to client3. */ + count = XPending(client3); + if (count != 0) { + report("Got %d events, expected %d for client3", count, 0); + FAIL; + return; + } + else + CHECK; + + CHECKPASS(8); +>>ASSERTION def +>>#NOTE Tested for in previous assertion. +When a xname event is generated, +then +clients not having set +.S PropertyChangeMask +event mask bits on the event window are not delivered +a xname event. +>>#NOTEm >>ASSERTION +>>#NOTEm When a window's property changes, +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE Global except for MappingNotify and KeymapNotify. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M window +>>#NOTEs is set to +>>#NOTEs the +>>#NOTEs ifdef(`WINDOWTYPE', WINDOWTYPE, event) +>>#NOTEs window. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M atom +>>#NOTEs is set to the property's atom. +>>#NOTEm >>ASSERTION +>>#NOTEm >>#NOTE +>>#NOTEm >>#NOTE ``Changed'' includes adding zero-length data or replacing all or part of +>>#NOTEm >>#NOTE a property with identical data. +>>#NOTEm >>#NOTE +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the property was changed by a call to +>>#NOTEm .F XChangeProperty , +>>#NOTEm .F XRotateWindowProperties , +>>#NOTEm .F XChangeProperty , +>>#NOTEm or +>>#NOTEm .F XRotateWindowProperties , +>>#NOTEm then +>>#NOTEm .M state +>>#NOTEm is set to +>>#NOTEm .S PropertyNewValue . +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the property was deleted by a call to +>>#NOTEm .F XDeleteProperty +>>#NOTEm or by a call to +>>#NOTEm .F XGetWindowProperty +>>#NOTEm with a delete argument of +>>#NOTEm .S True , +>>#NOTEm then +>>#NOTEm .M state +>>#NOTEm is set to +>>#NOTEm .S PropertyDelete . +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE +>>#NOTEs >>#NOTE Untestable? +>>#NOTEs >>#NOTE +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M time +>>#NOTEs is set to +>>#NOTEs the server time when the property was changed. diff --git a/xts5/Xlib11/ReparentNotify/ReparentNotify.m b/xts5/Xlib11/ReparentNotify/ReparentNotify.m new file mode 100644 index 00000000..4aa90aeb --- /dev/null +++ b/xts5/Xlib11/ReparentNotify/ReparentNotify.m @@ -0,0 +1,519 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/ReparentNotify/ReparentNotify.m,v 1.2 2005-11-03 08:42:30 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/ReparentNotify/ReparentNotify.m +>># +>># Description: +>># Tests for ReparentNotify() +>># +>># Modifications: +>># $Log: rprntntfy.m,v $ +>># Revision 1.2 2005-11-03 08:42:30 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:18 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:22 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:51:01 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:23:02 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:34 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:01:56 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:59:01 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE ReparentNotify Xlib11 +>>EXTERN +#define EVENT ReparentNotify +#define MASK StructureNotifyMask +#define MASKP SubstructureNotifyMask +>>ASSERTION Good A +When a xname event is generated, +then all clients having set +.S StructureNotifyMask +event mask bits on the reparented window are delivered +a xname event. +>>STRATEGY +Create clients client2 and client3. +Create parent window. +Create window. +Select for ReparentNotify events using StructureNotifyMask. +Select for ReparentNotify events using StructureNotifyMask with client2. +Select for no events with client3. +Generate ReparentNotify event. +Verify that a ReparentNotify event was delivered. +Verify that event member fields are correctly set. +Verify that a ReparentNotify event was delivered to client2. +Verify that event member fields are correctly set. +Verify that no events were delivered to client3. +>>CODE +Display *display = Dsp; +Display *client2; +Display *client3; +Window parent, w; +int count; +XEvent event_return; +XReparentEvent good; + +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; + /* + * The order in which these windows are created is critical. + * If the order were reversed, a BadWindow error would result + * when the resource registration routines destroyed these windows. + */ +/* Create parent window. */ + parent = mkwin(display, (XVisualInfo *) NULL, (struct area *) NULL, False); +/* Create window. */ + w = mkwin(display, (XVisualInfo *) NULL, (struct area *) NULL, False); +/* Select for ReparentNotify events using StructureNotifyMask. */ + XSelectInput(display, w, MASK); +/* Select for ReparentNotify events using StructureNotifyMask with client2. */ + XSelectInput(client2, w, MASK); +/* Select for no events with client3. */ + XSelectInput(client3, w, NoEventMask); +/* Generate ReparentNotify event. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XReparentWindow(display, w, parent, 1, 1); + XSync(display, False); + XSync(client2, False); + XSync(client3, False); +/* Verify that a ReparentNotify event was delivered. */ +/* Verify that event member fields are correctly set. */ + if (!XCheckTypedWindowEvent(display, w, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } + else + CHECK; + good = event_return.xreparent; + good.type = EVENT; + good.event = w; + good.window = w; + good.parent = parent; + good.x = 1; + good.y = 1; + good.override_redirect = config.debug_override_redirect; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; +/* Verify that a ReparentNotify event was delivered to client2. */ +/* Verify that event member fields are correctly set. */ + if (!XCheckTypedWindowEvent(client2, w, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } + else + CHECK; + good = event_return.xreparent; + good.type = EVENT; + good.event = w; + good.window = w; + good.parent = parent; + good.x = 1; + good.y = 1; + good.override_redirect = config.debug_override_redirect; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event for client2"); + FAIL; + } + else + CHECK; +/* Verify that no events were delivered to client3. */ + count = XPending(client3); + if (count != 0) { + report("Got %d events, expected %d for client3", count, 0); + FAIL; + return; + } + else + CHECK; + + CHECKPASS(7); +>>ASSERTION Good A +When a xname event is generated, +then all clients having set +.S SubstructureNotifyMask +event mask bits on the parent of the reparented window are delivered +a xname event. +>>STRATEGY +Create clients client2 and client3. +Create parent window. +Create window. +Select for ReparentNotify events on new parent using SubstructureNotifyMask. +Select for ReparentNotify events on old parent using SubstructureNotifyMask. +Select for ReparentNotify events on new parent using SubstructureNotifyMask with client2. +Select for ReparentNotify events on old parent using SubstructureNotifyMask with client2. +Select for no events on new parent with client3. +Select for no events on old parent with client3. +Generate ReparentNotify event. +Verify that a ReparentNotify event was delivered. +Verify that event member fields are correctly set. +Verify that a ReparentNotify event was delivered for oldparent. +Verify that event member fields are correctly set. +Verify that a ReparentNotify event was delivered to client2. +Verify that event member fields are correctly set. +Verify that a ReparentNotify event was delivered to client2 for old parent. +Verify that event member fields are correctly set. +Verify that no events were delivered to client3. +>>CODE +Display *display = Dsp; +Display *client2; +Display *client3; +Window oldparent, parent, w; +int count; +XEvent event_return; +XReparentEvent good; + +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; + oldparent = DRW(display); + /* + * The order in which these windows are created is critical. + * If the order were reversed, a BadWindow error would result + * when the resource registration routines destroyed these windows. + */ +/* Create parent window. */ + parent = mkwin(display, (XVisualInfo *) NULL, (struct area *) NULL, False); +/* Create window. */ + w = mkwin(display, (XVisualInfo *) NULL, (struct area *) NULL, False); +/* Select for ReparentNotify events on new parent using SubstructureNotifyMask. */ + XSelectInput(display, parent, MASKP); +/* Select for ReparentNotify events on old parent using SubstructureNotifyMask. */ + XSelectInput(display, oldparent, MASKP); +/* Select for ReparentNotify events on new parent using SubstructureNotifyMask with client2. */ + XSelectInput(client2, parent, MASKP); +/* Select for ReparentNotify events on old parent using SubstructureNotifyMask with client2. */ + XSelectInput(client2, oldparent, MASKP); +/* Select for no events on new parent with client3. */ + XSelectInput(client3, parent, NoEventMask); +/* Select for no events on old parent with client3. */ + XSelectInput(client3, oldparent, NoEventMask); +/* Generate ReparentNotify event. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XReparentWindow(display, w, parent, 1, 1); + XSync(display, False); + XSync(client2, False); + XSync(client3, False); +/* Verify that a ReparentNotify event was delivered. */ +/* Verify that event member fields are correctly set. */ + if (!XCheckTypedWindowEvent(display, parent, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } + else + CHECK; + good = event_return.xreparent; + good.type = EVENT; + good.event = parent; + good.window = w; + good.parent = parent; + good.x = 1; + good.y = 1; + good.override_redirect = config.debug_override_redirect; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; +/* Verify that a ReparentNotify event was delivered for oldparent. */ +/* Verify that event member fields are correctly set. */ + if (!XCheckTypedWindowEvent(display, oldparent, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } + else + CHECK; + good = event_return.xreparent; + good.type = EVENT; + good.event = oldparent; + good.window = w; + good.parent = parent; + good.x = 1; + good.y = 1; + good.override_redirect = config.debug_override_redirect; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; +/* Verify that a ReparentNotify event was delivered to client2. */ +/* Verify that event member fields are correctly set. */ + if (!XCheckTypedWindowEvent(client2, parent, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } + else + CHECK; + good = event_return.xreparent; + good.type = EVENT; + good.event = parent; + good.window = w; + good.parent = parent; + good.x = 1; + good.y = 1; + good.override_redirect = config.debug_override_redirect; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event for client2"); + FAIL; + } + else + CHECK; +/* Verify that a ReparentNotify event was delivered to client2 for old parent. */ +/* Verify that event member fields are correctly set. */ + if (!XCheckTypedWindowEvent(client2, oldparent, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } + else + CHECK; + good = event_return.xreparent; + good.type = EVENT; + good.event = oldparent; + good.window = w; + good.parent = parent; + good.x = 1; + good.y = 1; + good.override_redirect = config.debug_override_redirect; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event for client2"); + FAIL; + } + else + CHECK; +/* Verify that no events were delivered to client3. */ + count = XPending(client3); + if (count != 0) { + report("Got %d events, expected %d for client3", count, 0); + FAIL; + return; + } + else + CHECK; + + CHECKPASS(11); +>>ASSERTION def +>>#NOTE Tested for in previous assertion. +When a xname event is generated, +then all clients having set +.S SubstructureNotifyMask +event mask bits on either the old or new parent of +the reparented window are delivered +a xname event. +>>ASSERTION def +>>#NOTE Tested for in preceeding assertions. +When a xname event is generated, +then +clients not having set +.S StructureNotifyMask +event mask bits on the +reparented window +and also not having set +.S SubstructureNotifyMask +event mask bits on either the +old or new parent of the reparented window +are not delivered +a xname event. +>>#NOTEm >>ASSERTION +>>#NOTEm When a window's parent changes +>>#NOTEm as a result of a call to +>>#NOTEm .F XReparentWindow , +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and +>>#NOTEs .S StructureNotify +>>#NOTEs was selected, +>>#NOTEs then +>>#NOTEs .M event +>>#NOTEs is set to +>>#NOTEs the WINDOWTYPE window. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and +>>#NOTEs .S SubstructureNotify +>>#NOTEs was selected, +>>#NOTEs then +>>#NOTEs .M event +>>#NOTEs is set to +>>#NOTEs the WINDOWTYPE window's parent. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE Global except for MappingNotify and KeymapNotify. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M window +>>#NOTEs is set to +>>#NOTEs the +>>#NOTEs ifdef(`WINDOWTYPE', WINDOWTYPE, event) +>>#NOTEs window. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M parent +>>#NOTEs is set to +>>#NOTEs the parent window of +>>#NOTEs .M window . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M x +>>#NOTEs and +>>#NOTEs .M y +>>#NOTEs are set to +>>#NOTEs the coordinates of +>>#NOTEs .M window +>>#NOTEs relative to parent window's origin +>>#NOTEs and indicate the position of the upper-left outside corner of +>>#NOTEs .M window . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M override_redirect +>>#NOTEs is set to the override-redirect attribute of +>>#NOTEs .M window . diff --git a/xts5/Xlib11/ResizeRequest/ResizeRequest.m b/xts5/Xlib11/ResizeRequest/ResizeRequest.m new file mode 100644 index 00000000..db1d690d --- /dev/null +++ b/xts5/Xlib11/ResizeRequest/ResizeRequest.m @@ -0,0 +1,450 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/ResizeRequest/ResizeRequest.m,v 1.2 2005-11-03 08:42:30 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/ResizeRequest/ResizeRequest.m +>># +>># Description: +>># Tests for ResizeRequest() +>># +>># Modifications: +>># $Log: rszrqst.m,v $ +>># Revision 1.2 2005-11-03 08:42:30 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:18 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:22 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:51:02 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:23:02 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:35 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:01:57 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:59:04 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE ResizeRequest Xlib11 +>>EXTERN +#define EVENT ResizeRequest +#define MASK ResizeRedirectMask +>>ASSERTION Good A +When a xname event is generated, +then +all clients having set +.S ResizeRedirectMask +event mask bits on the event window are delivered +a xname event. +>>STRATEGY +Create clients client2 and client3. +Build and create window hierarchy. +Create inferiors with override-redirect set to True. +Change one inferior's override-redirect attribute to False. +Select for CirculateRequest events using SubstructureRedirectMask. +Select for no events with client3. +Attempt to resize a window. +Initialize for expected events. +Verify that a CirculateRequest event is delivered. +Verify that no events are delivered to client3. +Verify members of event structure. +Verify that no events were delivered to client3. +Attempt to resize another window. +Initialize for expected events. +Verify that a CirculateRequest event is delivered. +Verify that no events are delivered to client3. +Verify members of event structure. +Verify that no events were delivered to client3. +>>CODE +Display *display = Dsp; +Display *client2, *client3; +Winh *parent, *lastw, *child; +Winhg winhg; +XEvent event; +int i; +int status; +int numchildren = 4; +int count; +XSetWindowAttributes attrs; +unsigned long valuemask; + +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; +/* Build and create window hierarchy. */ + /* can't use winh() because the windows need to overlap */ + winhg.border_width = 1; + winhg.area.x = 1; + winhg.area.y = 1; + winhg.area.width = 100; + winhg.area.height = 100; + parent = winh_adopt(display, (Winh *) NULL, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (parent == (Winh *) NULL) { + report("Could not create parent"); + return; + } + else + CHECK; + winhg.area.x = 1; + winhg.area.y = 1; + winhg.area.width = 30; + winhg.area.height = 30; +/* Create inferiors with override-redirect set to True. */ + attrs.override_redirect = True; + attrs.border_pixel = W_FG; + attrs.background_pixel = W_BG; + valuemask = CWOverrideRedirect | CWBorderPixel | CWBackPixel; + for (i=0; i<numchildren; i++) { + if (!i) + CHECK; + lastw = winh_adopt(display, parent, valuemask, &attrs, &winhg, WINH_NOMASK); + if (lastw == (Winh *) NULL) { + report("Could not create child %d", i); + return; + } + winhg.area.x += 10; + winhg.area.y += 10; + } + child = parent->firstchild; + if (winh_create(display, (Winh *) NULL, WINH_MAP)) + return; + else + CHECK; +/* Change one inferior's override-redirect attribute to False. */ + attrs.override_redirect = False; + valuemask = CWOverrideRedirect; + if (winh_changewindowattributes(display, lastw, valuemask, &attrs)) { + report("Failed to change attribute for subwindow"); + return; + } +/* Select for CirculateRequest events using SubstructureRedirectMask. */ + /* + * Selection with a single client because only one can select + * for this event at a time. + */ + if (winh_selectinput(display, child, MASK)) { + report("Selection failed on child."); + return; + } + else + CHECK; + if (winh_selectinput(display, lastw, MASK)) { + report("Selection failed on lastw."); + return; + } + else + CHECK; +/* Select for no events with client3. */ + if (winh_selectinput(client3, (Winh *) NULL, NoEventMask)) { + report("Selection with client3 failed."); + return; + } + else + CHECK; +/* Attempt to resize a window. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + child->winhg.area.width += 2; + child->winhg.area.height += 2; + XResizeWindow(client2, child->window, child->winhg.area.width, child->winhg.area.height); + XSync(client2, False); + XSync(display, False); + XSync(client3, False); +/* Initialize for expected events. */ + event.xany.type = EVENT; + event.xany.window = child->window; + if (winh_plant(child, &event, MASK, WINH_NOMASK)) { + report("Could not plant events for child"); + return; + } + else + CHECK; +/* Verify that a CirculateRequest event is delivered. */ +/* Verify that no events are delivered to client3. */ + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; + if (winh_harvest(client3, (Winh *) NULL)) { + report("Could not harvest events for client3"); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status == -1) + return; + else if (status) { + report("Event delivery not as expected"); + FAIL; + } + else { + XEvent *event_return; + XResizeRequestEvent good; + +/* Verify members of event structure. */ + event_return = winh_qdel->event; + good = event_return->xresizerequest; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.window = child->window; + good.width = child->winhg.area.width; + good.height = child->winhg.area.height; + if (checkevent((XEvent *) &good, event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; + } +/* Verify that no events were delivered to client3. */ + count = XPending(client3); + if (count != 0) { + report("Got %d events, expected %d for client3", count, 0); + FAIL; + } + else + CHECK; +/* Attempt to resize another window. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + lastw->winhg.area.width += 2; + lastw->winhg.area.height += 2; + XResizeWindow(client2, lastw->window, lastw->winhg.area.width, lastw->winhg.area.height); + XSync(client2, False); + XSync(display, False); + XSync(client3, False); +/* Initialize for expected events. */ + event.xany.type = EVENT; + event.xany.window = lastw->window; + if (winh_plant(lastw, &event, MASK, WINH_NOMASK)) { + report("Could not plant events for lastw"); + return; + } + else + CHECK; +/* Verify that a CirculateRequest event is delivered. */ +/* Verify that no events are delivered to client3. */ + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; + if (winh_harvest(client3, (Winh *) NULL)) { + report("Could not harvest events for client3"); + return; + } + else + CHECK; + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status == -1) + return; + else if (status) { + report("Event delivery not as expected"); + FAIL; + } + else { + XEvent *event_return; + XResizeRequestEvent good; + +/* Verify members of event structure. */ + event_return = winh_qdel->event; + good = event_return->xresizerequest; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.window = lastw->window; + good.width = child->winhg.area.width; + good.height = child->winhg.area.height; + if (checkevent((XEvent *) &good, event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; + } +/* Verify that no events were delivered to client3. */ + count = XPending(client3); + if (count != 0) { + report("Got %d events, expected %d for client3", count, 0); + FAIL; + return; + } + else + CHECK; + + CHECKPASS(18); +>>ASSERTION def +>>#NOTE Tested for in previous assertion. +When a xname event is generated, +then +clients not having set +.S ResizeRedirectMask +event mask bits on the event window are not delivered +a xname event. +>>#NOTEm >>ASSERTION +>>#NOTEm >>#NOTE +>>#NOTEm >>#NOTE Only one client at a time can select this event. +>>#NOTEm >>#NOTE +>>#NOTEm When a client attempts to change the size of a window by calling +>>#NOTEm .F XConfigureWindow , +>>#NOTEm .F XResizeWindow , +>>#NOTEm or +>>#NOTEm .F XMoveResizeWindow , +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEm >>ASSERTION +>>#NOTEm >>#NOTE +>>#NOTEm >>#NOTE This is somewhat unusual in that the override-redirect attribute's +>>#NOTEm >>#NOTE value is not relevant. See notsomething.m4. +>>#NOTEm >>#NOTE +>>#NOTEm When ARTICLE xname event is generated +>>#NOTEm and a client has selected xname events on the child's parent, +>>#NOTEm then +>>#NOTEm .M window +>>#NOTEm is not WINDOWTYPE. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M window +>>#NOTEs is set to +>>#NOTEs the child window to be WINDOWTYPE. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M width +>>#NOTEs and +>>#NOTEs .M height +>>#NOTEs are set to +>>#NOTEs the +>>#NOTEs ifdef(`REQUESTED', REQUESTED,) +>>#NOTEs inside size of +>>#NOTEs .M window , +>>#NOTEs not including the border. diff --git a/xts5/Xlib11/SelectionClear/SelectionClear.m b/xts5/Xlib11/SelectionClear/SelectionClear.m new file mode 100644 index 00000000..8b13cc2a --- /dev/null +++ b/xts5/Xlib11/SelectionClear/SelectionClear.m @@ -0,0 +1,179 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/SelectionClear/SelectionClear.m,v 1.2 2005-11-03 08:42:30 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/SelectionClear/SelectionClear.m +>># +>># Description: +>># Tests for SelectionClear() +>># +>># Modifications: +>># $Log: slctnclr.m,v $ +>># Revision 1.2 2005-11-03 08:42:30 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:18 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:23 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:51:02 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:23:03 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:35 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:01:59 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:59:06 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE SelectionClear Xlib11 +>>ASSERTION Good A +There are no assertions in sections 8.1-8.4 for xname events. +Assertions will be submitted from section 4 which will cover +xname event assertions. +>>STRATEGY +Put out a message explaining that there are no specific assertions for +xname events in sections 8.1-8.4, and that delivery of xname events will +be covered in section 4. +>>CODE + + report("There are no specific assertions for %s events in sections 8.1-8.4.", TestName); + report("Delivery of %s events will be covered in section 4.", TestName); + tet_result(TET_NOTINUSE); + +>>#NOTEm >>ASSERTION +>>#NOTEm When the ownership of a selection changes +>>#NOTEm and the previous owner was not +>>#NOTEm .S None , +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M window +>>#NOTEs is set to +>>#NOTEs the window that was specified by the current owner in its +>>#NOTEs .F XSetSelectionOwner +>>#NOTEs call. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M selection +>>#NOTEs is set to +>>#NOTEs the selection atom. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M time +>>#NOTEs is set to +>>#NOTEs the last change time recorded for the selection. diff --git a/xts5/Xlib11/SelectionNotify/SelectionNotify.m b/xts5/Xlib11/SelectionNotify/SelectionNotify.m new file mode 100644 index 00000000..86ad090e --- /dev/null +++ b/xts5/Xlib11/SelectionNotify/SelectionNotify.m @@ -0,0 +1,210 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/SelectionNotify/SelectionNotify.m,v 1.2 2005-11-03 08:42:31 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/SelectionNotify/SelectionNotify.m +>># +>># Description: +>># Tests for SelectionNotify() +>># +>># Modifications: +>># $Log: slctnntfy.m,v $ +>># Revision 1.2 2005-11-03 08:42:31 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:18 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:23 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:51:03 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:23:03 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:36 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:02:00 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:59:08 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE SelectionNotify Xlib11 +>>ASSERTION Good A +There are no assertions in sections 8.1-8.4 for xname events. +Assertions will be submitted from section 4 which will cover +xname event assertions. +>>STRATEGY +Put out a message explaining that there are no specific assertions for +xname events in sections 8.1-8.4, and that delivery of xname events will +be covered in section 4. +>>CODE + + report("There are no specific assertions for %s events in sections 8.1-8.4.", TestName); + report("Delivery of %s events will be covered in section 4.", TestName); + tet_result(TET_NOTINUSE); + +>>#NOTEm >>ASSERTION +>>#NOTEm When a +>>#NOTEm .S ConvertSelection +>>#NOTEm protocol request is generated +>>#NOTEm and there is no owner for the selection, +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE +>>#NOTEs >>#NOTE These members should correspond the values specified +>>#NOTEs >>#NOTE in the call to XConvertSelection. +>>#NOTEs >>#NOTE +>>#NOTEs When a +>>#NOTEs .S ConvertSelection +>>#NOTEs protocol request is generated +>>#NOTEs and there is no owner for the selection, +>>#NOTEs then +>>#NOTEs .M requestor +>>#NOTEs is set to +>>#NOTEs the window associated with the requestor of the selection. +>>#NOTEs >>ASSERTION +>>#NOTEs When a +>>#NOTEs .S ConvertSelection +>>#NOTEs protocol request is generated +>>#NOTEs and there is no owner for the selection, +>>#NOTEs then +>>#NOTEs .M selection +>>#NOTEs is set to +>>#NOTEs the atom that indicates the selection. +>>#NOTEs >>ASSERTION +>>#NOTEs When a +>>#NOTEs .S ConvertSelection +>>#NOTEs protocol request is generated +>>#NOTEs and there is no owner for the selection, +>>#NOTEs then +>>#NOTEs .M target +>>#NOTEs is set to +>>#NOTEs the atom that indicates the converted type. +>>#NOTEs >>ASSERTION +>>#NOTEs When a +>>#NOTEs .S ConvertSelection +>>#NOTEs protocol request is generated +>>#NOTEs and there is no owner for the selection, +>>#NOTEs then +>>#NOTEs .M property +>>#NOTEs is set to +>>#NOTEs .S None . +>>#NOTEs >>ASSERTION +>>#NOTEs When a +>>#NOTEs .S ConvertSelection +>>#NOTEs protocol request is generated +>>#NOTEs and there is no owner for the selection, +>>#NOTEs then +>>#NOTEs .M time +>>#NOTEs is set to +>>#NOTEs the time the conversion took place and can be a timestamp or +>>#NOTEs .S CurrentTime . diff --git a/xts5/Xlib11/SelectionRequest/SelectionRequest.m b/xts5/Xlib11/SelectionRequest/SelectionRequest.m new file mode 100644 index 00000000..fcc4f0fd --- /dev/null +++ b/xts5/Xlib11/SelectionRequest/SelectionRequest.m @@ -0,0 +1,210 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/SelectionRequest/SelectionRequest.m,v 1.2 2005-11-03 08:42:31 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/SelectionRequest/SelectionRequest.m +>># +>># Description: +>># Tests for SelectionRequest() +>># +>># Modifications: +>># $Log: slctnrqst.m,v $ +>># Revision 1.2 2005-11-03 08:42:31 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:18 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:24 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:51:04 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:23:04 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:36 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:02:02 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:59:09 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE SelectionRequest Xlib11 +>>ASSERTION Good A +There are no assertions in sections 8.1-8.4 for xname events. +Assertions will be submitted from section 4 which will cover +xname event assertions. +>>STRATEGY +Put out a message explaining that there are no specific assertions for +xname events in sections 8.1-8.4, and that delivery of xname events will +be covered in section 4. +>>CODE + + report("There are no specific assertions for %s events in sections 8.1-8.4.", TestName); + report("Delivery of %s events will be covered in section 4.", TestName); + tet_result(TET_NOTINUSE); + +>>#NOTEm >>ASSERTION +>>#NOTEm When a client requests a selection conversion by calling +>>#NOTEm .F XConvertSelection +>>#NOTEm and the specified selection owner is not +>>#NOTEm .S None , +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M owner +>>#NOTEs is set to +>>#NOTEs the window owning the selection. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M requestor +>>#NOTEs is set to +>>#NOTEs the window requesting the selection. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M selection +>>#NOTEs is set to +>>#NOTEs the atom that names the selection. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE +>>#NOTEs >>#NOTE What is meant by ``the type the selection is desired in''? +>>#NOTEs >>#NOTE +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M target +>>#NOTEs is set to +>>#NOTEs the atom that indicates the type +>>#NOTEs the selection is desired in. +>>#NOTEs >>#NOTE +>>#NOTEs >>#NOTE Testing strategy? +>>#NOTEs >>#NOTE +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M property +>>#NOTEs is set to +>>#NOTEs the atom that names a property name or +>>#NOTEs .S None . +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE +>>#NOTEs >>#NOTE This assertion might be incorrect. It mimics the spec, +>>#NOTEs >>#NOTE but the result is rather ambiguous. +>>#NOTEs >>#NOTE Testing strategy? +>>#NOTEs >>#NOTE +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M time +>>#NOTEs is set to +>>#NOTEs the time or +>>#NOTEs .S CurrentTime . diff --git a/xts5/Xlib11/UnmapNotify/UnmapNotify.m b/xts5/Xlib11/UnmapNotify/UnmapNotify.m new file mode 100644 index 00000000..e3e38082 --- /dev/null +++ b/xts5/Xlib11/UnmapNotify/UnmapNotify.m @@ -0,0 +1,428 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/UnmapNotify/UnmapNotify.m,v 1.2 2005-11-03 08:42:31 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/UnmapNotify/UnmapNotify.m +>># +>># Description: +>># Tests for UnmapNotify() +>># +>># Modifications: +>># $Log: unmpntfy.m,v $ +>># Revision 1.2 2005-11-03 08:42:31 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:18 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:24 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:51:05 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:23:04 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:37 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:02:03 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:59:12 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE UnmapNotify Xlib11 +>>EXTERN +#define EVENT UnmapNotify +#define MASK StructureNotifyMask +#define MASKP SubstructureNotifyMask +>>ASSERTION Good A +When an xname event is generated, +then all clients having set +.S StructureNotifyMask +event mask bits on the unmapped window are delivered +an xname event. +>>STRATEGY +Create clients client2 and client3. +Create window. +Select for UnmapNotify events using StructureNotifyMask. +Select for UnmapNotify events using StructureNotifyMask with client2. +Select for no events with client3. +Generate UnmapNotify event. +Verify that a UnmapNotify event was delivered. +Verify that event member fields are correctly set. +Verify that a UnmapNotify event was delivered to client2. +Verify that event member fields are correctly set. +Verify that no events were delivered to client3. +>>CODE +Display *display = Dsp; +Display *client2; +Display *client3; +Window w; +int count; +XEvent event_return; +XUnmapEvent good; + +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; +/* Create window. */ + w = mkwin(display, (XVisualInfo *) NULL, (struct area *) NULL, True); +/* Select for UnmapNotify events using StructureNotifyMask. */ + XSelectInput(display, w, MASK); +/* Select for UnmapNotify events using StructureNotifyMask with client2. */ + XSelectInput(client2, w, MASK); +/* Select for no events with client3. */ + XSelectInput(client3, w, NoEventMask); +/* Generate UnmapNotify event. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XUnmapWindow(display, w); + XSync(display, False); + XSync(client2, False); + XSync(client3, False); +/* Verify that a UnmapNotify event was delivered. */ +/* Verify that event member fields are correctly set. */ + if (!XCheckTypedWindowEvent(display, w, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } + else + CHECK; + good = event_return.xunmap; + good.type = EVENT; + good.event = w; + good.window = w; + good.from_configure = False; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; +/* Verify that a UnmapNotify event was delivered to client2. */ +/* Verify that event member fields are correctly set. */ + if (!XCheckTypedWindowEvent(client2, w, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } + else + CHECK; + good = event_return.xunmap; + good.type = EVENT; + good.event = w; + good.window = w; + good.from_configure = False; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event for client2"); + FAIL; + } + else + CHECK; +/* Verify that no events were delivered to client3. */ + count = XPending(client3); + if (count != 0) { + report("Got %d events, expected %d for client3", count, 0); + FAIL; + return; + } + else + CHECK; + + CHECKPASS(7); +>>ASSERTION Good A +When an xname event is generated, +then all clients having set +.S SubstructureNotifyMask +event mask bits on the parent of the unmapped window are delivered +an xname event. +>>STRATEGY +Create clients client2 and client3. +Create window. +Select for UnmapNotify events using SubstructureNotifyMask. +Select for UnmapNotify events using SubstructureNotifyMask with client2. +Select for no events with client3. +Generate UnmapNotify event. +Verify that a UnmapNotify event was delivered. +Verify that event member fields are correctly set. +Verify that a UnmapNotify event was delivered to client2. +Verify that event member fields are correctly set. +Verify that no events were delivered to client3. +>>CODE +Display *display = Dsp; +Display *client2; +Display *client3; +Window parent, w; +int count; +XEvent event_return; +XUnmapEvent good; + +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; + parent = DRW(display); +/* Create window. */ + w = mkwin(display, (XVisualInfo *) NULL, (struct area *) NULL, True); +/* Select for UnmapNotify events using SubstructureNotifyMask. */ + XSelectInput(display, parent, MASKP); +/* Select for UnmapNotify events using SubstructureNotifyMask with client2. */ + XSelectInput(client2, parent, MASKP); +/* Select for no events with client3. */ + XSelectInput(client3, parent, NoEventMask); +/* Generate UnmapNotify event. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XUnmapWindow(display, w); + XSync(display, False); + XSync(client2, False); + XSync(client3, False); +/* Verify that a UnmapNotify event was delivered. */ +/* Verify that event member fields are correctly set. */ + if (!XCheckTypedWindowEvent(display, parent, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } + else + CHECK; + good = event_return.xunmap; + good.type = EVENT; + good.event = parent; + good.window = w; + good.from_configure = False; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; +/* Verify that a UnmapNotify event was delivered to client2. */ +/* Verify that event member fields are correctly set. */ + if (!XCheckTypedWindowEvent(client2, parent, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } + else + CHECK; + good = event_return.xunmap; + good.type = EVENT; + good.event = parent; + good.window = w; + good.from_configure = False; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event for client2"); + FAIL; + } + else + CHECK; +/* Verify that no events were delivered to client3. */ + count = XPending(client3); + if (count != 0) { + report("Got %d events, expected %d for client3", count, 0); + FAIL; + return; + } + else + CHECK; + + CHECKPASS(7); +>>ASSERTION def +>>#NOTE Tested for in previous two assertions. +When an xname event is generated, +then +clients not having set +.S StructureNotifyMask +event mask bits on the +unmapped window +and also not having set +.S SubstructureNotifyMask +event mask bits on the +parent of the unmapped window +are not delivered +an xname event. +>>#NOTEm >>ASSERTION +>>#NOTEm When a window's state changes +>>#NOTEm from mapped to unmapped, +>>#NOTEm then ARTICLE xname event is generated. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and +>>#NOTEs .S StructureNotify +>>#NOTEs was selected, +>>#NOTEs then +>>#NOTEs .M event +>>#NOTEs is set to +>>#NOTEs the WINDOWTYPE window. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and +>>#NOTEs .S SubstructureNotify +>>#NOTEs was selected, +>>#NOTEs then +>>#NOTEs .M event +>>#NOTEs is set to +>>#NOTEs the WINDOWTYPE window's parent. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE Global except for MappingNotify and KeymapNotify. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M window +>>#NOTEs is set to +>>#NOTEs the +>>#NOTEs ifdef(`WINDOWTYPE', WINDOWTYPE, event) +>>#NOTEs window. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname +>>#NOTEm event is delivered +>>#NOTEm and +>>#NOTEm .M window +>>#NOTEm was unmapped as a result of a resizing of the window's parent when +>>#NOTEm the window's +>>#NOTEm .M win_gravity +>>#NOTEm attribute is set to +>>#NOTEm .S UnmapGravity , +>>#NOTEm then +>>#NOTEm .M from_configure +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname +>>#NOTEm event is delivered +>>#NOTEm and +>>#NOTEm .M window +>>#NOTEm was not unmapped as a result of a resizing of the window's parent when +>>#NOTEm the window's +>>#NOTEm .M win_gravity +>>#NOTEm attribute is set to +>>#NOTEm .S UnmapGravity , +>>#NOTEm then +>>#NOTEm .M from_configure +>>#NOTEm is set to +>>#NOTEm .S False . diff --git a/xts5/Xlib11/VisibilityNotify/VisibilityNotify.m b/xts5/Xlib11/VisibilityNotify/VisibilityNotify.m new file mode 100644 index 00000000..f4863c9b --- /dev/null +++ b/xts5/Xlib11/VisibilityNotify/VisibilityNotify.m @@ -0,0 +1,1016 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib11/VisibilityNotify/VisibilityNotify.m,v 1.2 2005-11-03 08:42:31 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib11/VisibilityNotify/VisibilityNotify.m +>># +>># Description: +>># Tests for VisibilityNotify() +>># +>># Modifications: +>># $Log: vsbltyntfy.m,v $ +>># Revision 1.2 2005-11-03 08:42:31 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:18 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:31:25 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:51:06 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:23:05 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:19:37 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:02:05 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:59:15 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE VisibilityNotify Xlib11 +>>EXTERN +#define EVENT VisibilityNotify +#define MASK VisibilityChangeMask +>>ASSERTION Good A +The server does not generate xname events on windows +whose class is specified as +.S InputOnly . +>>STRATEGY +Create class InputOnly window. +Select for VisibilityNotify events. +Attempt to generate VisibilityNotify event on this window. +Verify that no events were delivered. +>>CODE +Display *display = Dsp; +Window w; +int count; + +/* Create class InputOnly window. */ + w = iponlywin(display); +/* Select for VisibilityNotify events. */ + XSelectInput(display, w, MASK); +/* Attempt to generate VisibilityNotify event on this window. */ + XSync(display, True); + XMapWindow(display, w); + XSync(display, False); +/* Verify that no events were delivered. */ + count = XPending(display); + if (count > 0) { + report("Received %d events, expected %d", count, 0); + FAIL; + } + else + CHECK; + CHECKPASS(1); +>>#NOTEd >>ASSERTION +>>#NOTEd When a window's visibility state changes, +>>#NOTEd then ARTICLE xname event is generated. +>>ASSERTION Good A +>>#NOTE +>>#NOTE Possible hierarchy event types: UnmapNotify, MapNotify, ConfigureNotify, +>>#NOTE GravityNotify, and CirculateNotify. +>>#NOTE +When a xname event is generated by a hierarchy change, +then the xname event is delivered after +any hierarchy event. +>>STRATEGY +Create client. +Build and create window hierarchy. +Create window large enough to be obscure each top-level +window in a \"standard\" window hierarchy. +Select for VisibilityNotify events on all hierarchy windows. +Select for UnmapNotify events on event window. +Generate VisibilityNotify and UnmapNotify events. +Initialize for expected events. +Harvest events from event queue. +Verify that expected events were delivered. +Verify that all VisibilityNotify events are delivered after all +UnmapNotify events. +>>CODE +Display *display; +Winh *eventw; +XEvent event; +Winhg winhg; +int status; + +#ifdef OTHERMASK +#undef OTHERMASK +#endif +#define OTHERMASK StructureNotifyMask +#ifdef OTHEREVENT +#undef OTHEREVENT +#endif +#define OTHEREVENT UnmapNotify + +/* Create client. */ + /* + * Can not use Dsp because we are selecting on root window. + * We could instead de-select on root window prior to returning, + * but this is actually easier. + */ + display = opendisplay(); + if (display == (Display *) NULL) { + delete("Could not open display."); + return; + } + else + CHECK; +/* Build and create window hierarchy. */ + if (winh(display, 2, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Create window large enough to obscure each top-level */ +/* window in a "standard" window hierarchy. */ + winhg.area.x = 0; + winhg.area.y = 0; + winhg.area.width = DisplayWidth(display, DefaultScreen(display)); + winhg.area.height = DisplayHeight(display, DefaultScreen(display)); + winhg.border_width = 0; + eventw = winh_adopt(display, (Winh *) NULL, 0L, (XSetWindowAttributes *) NULL, &winhg, WINH_NOMASK); + if (eventw == (Winh *) NULL) { + report("Could not create event window"); + return; + } + else + CHECK; + if (winh_create(display, eventw, WINH_MAP)) + return; + else + CHECK; +/* Select for VisibilityNotify events on all hierarchy windows. */ + if (winh_selectinput(display, (Winh *)NULL, MASK)) + return; + else + CHECK; +/* Select for UnmapNotify events on event window. */ + if (winh_selectinput(display, eventw, OTHERMASK)) + return; + else + CHECK; +/* Select for no events on root windows. */ + if (winh_selectinput(display, guardian, NoEventMask)) + return; + else + CHECK; + if (guardian->nextsibling && + winh_selectinput(display, guardian->nextsibling, NoEventMask)) + return; + else + CHECK; +/* Generate VisibilityNotify and UnmapNotify events. */ + XSync(display, True); + XUnmapWindow(display, eventw->window); + XSync(display, False); +/* Initialize for expected events. */ + event.xany.type = OTHEREVENT; + event.xany.window = eventw->window; + if (winh_plant(eventw, &event, OTHERMASK, WINH_NOMASK)) + return; + else + CHECK; + event.xany.type = EVENT; + event.xany.window = WINH_BAD; + if (winh_plant((Winh *)NULL, &event, MASK, WINH_NOMASK)) + return; + else + CHECK; +/* Harvest events from event queue. */ + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Verify that expected events were delivered. */ + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else + CHECK; +/* Verify that all VisibilityNotify events are delivered after all */ +/* UnmapNotify events. */ + status = winh_ordercheck(OTHEREVENT, EVENT); + if (status == -1) + return; + else if (status) + FAIL; + else + CHECK; + + CHECKPASS(13); +>>ASSERTION Good A +When a xname event is generated, +then the xname event is delivered before any +.S Expose +events on that window. +>>STRATEGY +Create client. +Build and create window hierarchy. +Select for VisibilityNotify and Expose events on all windows. +Generate VisibilityNotify and Expose events. +Initialize for expected events. +Harvest events from event queue. +Ignore Expose events. +Verify that expected events were delivered. +Verify that VisibilityNotify events are delivered before +Expose events. +>>CODE +Display *display; +Winh *eventw; +XEvent event; +int status; +Winhe *winhe, *winhe2; + +#ifdef OTHERMASK +#undef OTHERMASK +#endif +#define OTHERMASK ExposureMask +#ifdef OTHEREVENT +#undef OTHEREVENT +#endif +#define OTHEREVENT Expose + +/* Create client. */ + /* + * Can not use Dsp because we are selecting on root window. + * We could instead de-select on root window prior to returning, + * but this is actually easier. + */ + display = opendisplay(); + if (display == (Display *) NULL) { + delete("Could not open display."); + return; + } + else + CHECK; +/* Build and create window hierarchy. */ + if (winh(display, 2, WINH_MAP)) { + report("Could not build window hierarchy"); + return; + } + else + CHECK; +/* Select for VisibilityNotify and Expose events on all windows. */ + if (winh_selectinput(display, (Winh *)NULL, MASK|OTHERMASK)) + return; + else + CHECK; +/* Select for no events on root windows. */ + if (winh_selectinput(display, guardian, NoEventMask)) + return; + else + CHECK; + if (guardian->nextsibling && + winh_selectinput(display, guardian->nextsibling, NoEventMask)) + return; + else + CHECK; +/* Generate VisibilityNotify and Expose events. */ + for (eventw = guardian->firstchild; eventw; eventw = eventw->nextsibling) + XUnmapWindow(display, eventw->window); + XSync(display, True); + for (eventw = guardian->firstchild; eventw; eventw = eventw->nextsibling) + XMapWindow(display, eventw->window); + XSync(display, False); +/* Initialize for expected events. */ + event.xany.type = EVENT; + event.xany.window = WINH_BAD; + if (winh_plant((Winh *)NULL, &event, MASK, WINH_NOMASK)) + return; + else + CHECK; +/* Harvest events from event queue. */ + if (winh_harvest(display, (Winh *) NULL)) { + report("Could not harvest events"); + return; + } + else + CHECK; +/* Ignore Expose events. */ + if (winh_ignore_event((Winh *) NULL, OTHEREVENT, WINH_NOMASK)) { + report("Could not mark %s events to be ignored", + eventname(OTHEREVENT)); + return; + } + else + CHECK; +/* Verify that expected events were delivered. */ + status = winh_weed((Winh *) NULL, -1, WINH_WEED_IDENTITY); + if (status < 0) + return; + else if (status > 0) { + report("Event delivery was not as expected"); + FAIL; + } + else + CHECK; +/* Verify that VisibilityNotify events are delivered before */ +/* Expose events. */ + status = 0; + for (winhe = winh_qdel; winhe; winhe = winhe->next) { + if (winhe->event->type == VisibilityNotify) { + for (winhe2 = winh_qdel; winhe2 != winhe; winhe2 = winhe2->next) { + if (winhe2->event->type == Expose && + winhe2->event->xexpose.window == + winhe->event->xvisibility.window) { + report("Expose event delivered before Visibility event on window 0x%x", winhe->event->xvisibility.window); + FAIL; + } + } + if (!status) { + CHECK; + status = 1; + } + for (winhe2 = winhe->next; winhe2; winhe2 = winhe2->next) { + if (winhe2->event->type == Expose && + winhe2->event->xexpose.window == + winhe->event->xvisibility.window) + break; + } + if (!winhe2) { + report("Expose event not delivered on window 0x%x", winhe->event->xvisibility.window); + FAIL; + } + } + } + CHECKPASS(10); +>>ASSERTION Good A +When a xname event is generated, +then +all clients having set +.S VisibilityChangeMask +event mask bits on the event window are delivered +a xname event. +>>STRATEGY +Create clients client2 and client3. +Create window. +Select for VisibilityNotify events using VisibilityChangeMask. +Select for VisibilityNotify events using VisibilityChangeMask with client2. +Select for no events with client3. +Generate VisibilityNotify event. +Verify that a VisibilityNotify event was delivered. +Verify that event member fields are correctly set. +Verify that a VisibilityNotify event was delivered to client2. +Verify that event member fields are correctly set. +Verify that no events were delivered to client3. +>>CODE +Display *display = Dsp; +Display *client2; +Display *client3; +Window w; +int count; +XEvent event_return; +XVisibilityEvent good; + +/* Create clients client2 and client3. */ + if ((client2 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client2."); + return; + } + else + CHECK; + if ((client3 = opendisplay()) == (Display *) NULL) { + delete("Couldn't create client3."); + return; + } + else + CHECK; +/* Create window. */ + w = mkwin(display, (XVisualInfo *) NULL, (struct area *) NULL, False); +/* Select for VisibilityNotify events using VisibilityChangeMask. */ + XSelectInput(display, w, MASK); +/* Select for VisibilityNotify events using VisibilityChangeMask with client2. */ + XSelectInput(client2, w, MASK); +/* Select for no events with client3. */ + XSelectInput(client3, w, NoEventMask); +/* Generate VisibilityNotify event. */ + XSync(display, True); + XSync(client2, True); + XSync(client3, True); + XMapWindow(display, w); + XSync(display, False); + XSync(client2, False); + XSync(client3, False); +/* Verify that a VisibilityNotify event was delivered. */ + if (!XCheckTypedWindowEvent(display, w, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } + else + CHECK; +/* Verify that event member fields are correctly set. */ + good = event_return.xvisibility; + good.type = EVENT; + good.window = w; + good.state = VisibilityUnobscured; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event"); + FAIL; + } + else + CHECK; +/* Verify that a VisibilityNotify event was delivered to client2. */ + if (!XCheckTypedWindowEvent(client2, w, EVENT, &event_return)) { + report("Expected %s event, got none", eventname(EVENT)); + FAIL; + } + else + CHECK; +/* Verify that event member fields are correctly set. */ + good = event_return.xvisibility; + good.type = EVENT; + good.window = w; + good.state = VisibilityUnobscured; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event for client2"); + FAIL; + } + else + CHECK; +/* Verify that no events were delivered to client3. */ + count = XPending(client3); + if (count != 0) { + report("Got %d events, expected %d for client3", count, 0); + FAIL; + return; + } + else + CHECK; + + CHECKPASS(7); +>>ASSERTION def +>>#NOTE Tested for in previous assertion. +When a xname event is generated, +then +clients not having set +.S VisibilityChangeMask +event mask bits on the event window are not delivered +a xname event. +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M type +>>#NOTEs is set to +>>#NOTEs xname. +>>#NOTEs >>ASSERTION +>>#NOTEs >>#NOTE The method of expansion is not clear. +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M serial +>>#NOTEs is set +>>#NOTEs from the serial number reported in the protocol +>>#NOTEs but expanded from the 16-bit least-significant bits +>>#NOTEs to a full 32-bit value. +>>#NOTEm >>ASSERTION +>>#NOTEm When ARTICLE xname event is delivered +>>#NOTEm and the event came from a +>>#NOTEm .S SendEvent +>>#NOTEm protocol request, +>>#NOTEm then +>>#NOTEm .M send_event +>>#NOTEm is set to +>>#NOTEm .S True . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered +>>#NOTEs and the event was not generated by a +>>#NOTEs .S SendEvent +>>#NOTEs protocol request, +>>#NOTEs then +>>#NOTEs .M send_event +>>#NOTEs is set to +>>#NOTEs .S False . +>>#NOTEs >>ASSERTION +>>#NOTEs When ARTICLE xname event is delivered, +>>#NOTEs then +>>#NOTEs .M display +>>#NOTEs is set to +>>#NOTEs a pointer to the display on which the event was read. +>>ASSERTION def +>>#NOTE Tested for in previous assertions. +When a xname event is delivered, +then +.M window +is set to the window +whose visibility state changes. +>>ASSERTION Good A +When a xname event is delivered +and +.M window +changes state from +partially obscured, +fully obscured, +or not viewable to viewable and completely unobscured, +then +.M state +is set to +.S VisibilityUnobscured . +>>STRATEGY +Create window. +Select for VisibilityNotify events on window. +Generate VisibilityNotify event. +Verify that a VisibilityNotify event was delivered. +Verify that event member fields are correctly set. +Verify that no other events were delivered. +Fully obscure window. +Generate VisibilityNotify event. +Verify that a VisibilityNotify event was delivered. +Verify that event member fields are correctly set. +Verify that no other events were delivered. +Partially obscure window. +Generate VisibilityNotify event. +Verify that a VisibilityNotify event was delivered. +Verify that event member fields are correctly set. +Verify that no other events were delivered. +>>CODE +Display *display = Dsp; +Window w, w2; +struct area area; +XEvent event_return; +XVisibilityEvent good; +int count; + + /* + * test ordering: + * + * not viewable -> viewable and completely unobscured + * fully obscured -> viewable and completely unobscured + * partially obscured -> viewable and completely unobscured + */ +/* Create window. */ + area.x = 1; + area.y = 1; + area.width = W_STDWIDTH; + area.height = W_STDHEIGHT; + w = mkwin(display, (XVisualInfo *) NULL, &area, False); +/* Select for VisibilityNotify events on window. */ + XSelectInput(display, w, MASK); +/* Generate VisibilityNotify event. */ + XSync(display, True); + XMapWindow(display, w); + XSync(display, False); +/* Verify that a VisibilityNotify event was delivered. */ + if (!XCheckTypedWindowEvent(display, w, EVENT, &event_return)) { + report("Expected %s event, got none (not viewable test)", eventname(EVENT)); + FAIL; + } + else + CHECK; +/* Verify that event member fields are correctly set. */ + good = event_return.xvisibility; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.window = w; + good.state = VisibilityUnobscured; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event (not viewable test)"); + FAIL; + } + else + CHECK; +/* Verify that no other events were delivered. */ + count = XPending(display); + if (count > 0) { + report("Received %d events, expected %d (not viewable test)", count+1, 1); + FAIL; + } + else + CHECK; +/* Fully obscure window. */ + w2 = mkwin(display, (XVisualInfo *) NULL, &area, True); +/* Generate VisibilityNotify event. */ + XSync(display, True); + XUnmapWindow(display, w2); + XSync(display, False); +/* Verify that a VisibilityNotify event was delivered. */ + if (!XCheckTypedWindowEvent(display, w, EVENT, &event_return)) { + report("Expected %s event, got none (fully obscured test)", eventname(EVENT)); + FAIL; + } + else + CHECK; +/* Verify that event member fields are correctly set. */ + good = event_return.xvisibility; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.window = w; + good.state = VisibilityUnobscured; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event (fully obscured test)"); + FAIL; + } + else + CHECK; +/* Verify that no other events were delivered. */ + count = XPending(display); + if (count > 0) { + report("Received %d events, expected %d (fully obscured test)", count+1, 1); + FAIL; + } + else + CHECK; +/* Partially obscure window. */ + area.x = 1; + area.y = 1; + area.width = W_STDWIDTH/2; + area.height = W_STDHEIGHT/2; + w2 = mkwin(display, (XVisualInfo *) NULL, &area, True); +/* Generate VisibilityNotify event. */ + XSync(display, True); + XUnmapWindow(display, w2); + XSync(display, False); +/* Verify that a VisibilityNotify event was delivered. */ + if (!XCheckTypedWindowEvent(display, w, EVENT, &event_return)) { + report("Expected %s event, got none (partially obscured test)", eventname(EVENT)); + FAIL; + } + else + CHECK; +/* Verify that event member fields are correctly set. */ + good = event_return.xvisibility; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.window = w; + good.state = VisibilityUnobscured; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event (partially obscured test)"); + FAIL; + } + else + CHECK; +/* Verify that no other events were delivered. */ + count = XPending(display); + if (count > 0) { + report("Received %d events, expected %d (partially obscured test)", count+1, 1); + FAIL; + } + else + CHECK; + + CHECKPASS(9); +>>ASSERTION Good A +When a xname event is delivered +and +.M window +changes state from +viewable and completely unobscured or +not viewable to viewable and partially obscured, +then +.M state +is set to +.S VisibilityPartiallyObscured . +>>STRATEGY +Create window. +Create partially obscuring window. +Select for VisibilityNotify events on window. +Generate VisibilityNotify event. +Verify that a VisibilityNotify event was delivered. +Verify that event member fields are correctly set. +Verify that no other events were delivered. +Unobscure window. +Generate VisibilityNotify event. +Verify that a VisibilityNotify event was delivered. +Verify that event member fields are correctly set. +Verify that no other events were delivered. +>>CODE +Display *display = Dsp; +Window w, wpo; +struct area area; +XEvent event_return; +XVisibilityEvent good; +int count; + + /* + * test ordering: + * + * not viewable + * -> viewable and partially obscured + * viewable & completely unobscured + * -> viewable & partially unobscured + */ +/* Create window. */ + area.x = 1; + area.y = 1; + area.width = W_STDWIDTH; + area.height = W_STDHEIGHT; + w = mkwin(display, (XVisualInfo *) NULL, &area, False); +/* Create partially obscuring window. */ + area.x += W_STDWIDTH/2; + area.y += W_STDHEIGHT/2; + wpo = mkwin(display, (XVisualInfo *) NULL, &area, True); +/* Select for VisibilityNotify events on window. */ + XSelectInput(display, w, MASK); +/* Generate VisibilityNotify event. */ + XSync(display, True); + XMapWindow(display, w); + XSync(display, False); +/* Verify that a VisibilityNotify event was delivered. */ + if (!XCheckTypedWindowEvent(display, w, EVENT, &event_return)) { + report("Expected %s event, got none (not viewable test)", eventname(EVENT)); + FAIL; + } + else + CHECK; +/* Verify that event member fields are correctly set. */ + good = event_return.xvisibility; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.window = w; + good.state = VisibilityPartiallyObscured; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event (not viewable test)"); + FAIL; + } + else + CHECK; +/* Verify that no other events were delivered. */ + count = XPending(display); + if (count > 0) { + report("Received %d events, expected %d (not viewable test)", count+1, 1); + FAIL; + } + else + CHECK; +/* Unobscure window. */ + XUnmapWindow(display, wpo); +/* Generate VisibilityNotify event. */ + XSync(display, True); + XMapWindow(display, wpo); + XSync(display, False); +/* Verify that a VisibilityNotify event was delivered. */ + if (!XCheckTypedWindowEvent(display, w, EVENT, &event_return)) { + report("Expected %s event, got none (viewable & completely unobscured test)", eventname(EVENT)); + FAIL; + } + else + CHECK; +/* Verify that event member fields are correctly set. */ + good = event_return.xvisibility; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.window = w; + good.state = VisibilityPartiallyObscured; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event (viewable & completely unobscured test)"); + FAIL; + } + else + CHECK; +/* Verify that no other events were delivered. */ + count = XPending(display); + if (count > 0) { + report("Received %d events, expected %d (viewable & completely unobscured test)", count+1, 1); + FAIL; + } + else + CHECK; + + CHECKPASS(6); +>>ASSERTION Good A +When a xname event is delivered +and +.M window +changes state from +viewable and completely unobscured, +viewable and partially obscured, +or not viewable to viewable and fully obscured, +then +.M state +is set to +.S VisibilityFullyObscured . +>>STRATEGY +Create window. +Create completely obscuring window. +Create partially obscuring window. +Select for VisibilityNotify events on window. +Generate VisibilityNotify event. +Verify that a VisibilityNotify event was delivered. +Verify that event member fields are correctly set. +Verify that no other events were delivered. +Unobscure window. +Generate VisibilityNotify event. +Verify that a VisibilityNotify event was delivered. +Verify that event member fields are correctly set. +Verify that no other events were delivered. +Partially obscure window. +Generate VisibilityNotify event. +Verify that a VisibilityNotify event was delivered. +Verify that event member fields are correctly set. +Verify that no other events were delivered. +>>CODE +Display *display = Dsp; +Window w, wfo, wpo; +struct area area; +XEvent event_return; +XVisibilityEvent good; +int count; + + /* + * test ordering: + * + * not viewable -> + * -> viewable and fully obscured + * viewable and completely unobscured + * -> viewable and fully obscured + * viewable and partially obscured + * -> viewable and fully obscured + */ +/* Create window. */ + area.x = 1; + area.y = 1; + area.width = W_STDWIDTH; + area.height = W_STDHEIGHT; + w = mkwin(display, (XVisualInfo *) NULL, &area, False); +/* Create completely obscuring window. */ + wfo = mkwin(display, (XVisualInfo *) NULL, &area, True); +/* Create partially obscuring window. */ + area.x += W_STDWIDTH/2; + area.y += W_STDHEIGHT/2; + wpo = mkwin(display, (XVisualInfo *) NULL, &area, False); +/* Select for VisibilityNotify events on window. */ + XSelectInput(display, w, MASK); +/* Generate VisibilityNotify event. */ + XSync(display, True); + XMapWindow(display, w); + XSync(display, False); +/* Verify that a VisibilityNotify event was delivered. */ + if (!XCheckTypedWindowEvent(display, w, EVENT, &event_return)) { + report("Expected %s event, got none (not viewable test)", eventname(EVENT)); + FAIL; + } + else + CHECK; +/* Verify that event member fields are correctly set. */ + good = event_return.xvisibility; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.window = w; + good.state = VisibilityFullyObscured; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event (not viewable test)"); + FAIL; + } + else + CHECK; +/* Verify that no other events were delivered. */ + count = XPending(display); + if (count > 0) { + report("Received %d events, expected %d (not viewable test)", count+1, 1); + FAIL; + } + else + CHECK; +/* Unobscure window. */ + XUnmapWindow(display, wfo); +/* Generate VisibilityNotify event. */ + XSync(display, True); + XMapWindow(display, wfo); + XSync(display, False); +/* Verify that a VisibilityNotify event was delivered. */ + if (!XCheckTypedWindowEvent(display, w, EVENT, &event_return)) { + report("Expected %s event, got none (viewable and completely unobscured test)", eventname(EVENT)); + FAIL; + } + else + CHECK; +/* Verify that event member fields are correctly set. */ + good = event_return.xvisibility; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.window = w; + good.state = VisibilityFullyObscured; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event (viewable and completely unobscured test)"); + FAIL; + } + else + CHECK; +/* Verify that no other events were delivered. */ + count = XPending(display); + if (count > 0) { + report("Received %d events, expected %d (viewable and completely unobscured test)", count+1, 1); + FAIL; + } + else + CHECK; +/* Partially obscure window. */ + XUnmapWindow(display, wfo); + XMapWindow(display, wpo); +/* Generate VisibilityNotify event. */ + XSync(display, True); + XMapWindow(display, wfo); + XSync(display, False); +/* Verify that a VisibilityNotify event was delivered. */ + if (!XCheckTypedWindowEvent(display, w, EVENT, &event_return)) { + report("Expected %s event, got none (viewable and partially obscured test)", eventname(EVENT)); + FAIL; + } + else + CHECK; +/* Verify that event member fields are correctly set. */ + good = event_return.xvisibility; + good.type = EVENT; + good.send_event = False; + good.display = display; + good.window = w; + good.state = VisibilityFullyObscured; + if (checkevent((XEvent *) &good, &event_return)) { + report("Unexpected values in delivered event (viewable and partially obscured test)"); + FAIL; + } + else + CHECK; +/* Verify that no other events were delivered. */ + count = XPending(display); + if (count > 0) { + report("Received %d events, expected %d (viewable and partially obscured test)", count+1, 1); + FAIL; + } + else + CHECK; + + CHECKPASS(9); |