>># 
>># Copyright 1990, 1991 by the Massachusetts Institute of Technology and
>># UniSoft Group Limited.
>># 
>># Permission to use, copy, modify, distribute, and sell this software and
>># its documentation for any purpose is hereby granted without fee,
>># provided that the above copyright notice appear in all copies and that
>># both that copyright notice and this permission notice appear in
>># supporting documentation, and that the names of MIT and UniSoft not be
>># used in advertising or publicity pertaining to distribution of the
>># software without specific, written prior permission.  MIT and UniSoft
>># make no representations about the suitability of this software for any
>># purpose.  It is provided "as is" without express or implied warranty.
>># 
>># $XConsortium: gtimg.m,v 1.15 92/06/11 17:07:03 rws Exp $
>># 
>>#      SCCS:  @(#)  EDra.mc Rel 1.5	    (10/25/91)
>>#      SCCS:  @(#)  EVal.mc Rel 1.5	    (10/10/91)
>>#
>>TITLE XGetImage CH06
>>ASSERTION A XGetImage-1
A call to XGetImage returns a pointer to an XImage
structure containing the contents of the specified rectangle
with upper left corner at [ x, y] relative to the origin
of the drawable d and with width width and height height in
the format specified by the format argument.
>>STRATEGY
Create drawable.
Write known pattern to drawable.
Call XGetImage with XYPixmap format.
Verify XGetImage return value is not null.
Verify depth, width, height, and format values in gotten image structure.
Verify gotten image for known pattern.
Repeat for ZPixmap format.
Destroy images using XDestroyImage.
Repeat for each visual.
>>ASSERTION A XGetImage-2
When the format is XYPixmap, then the image contains only
the bit planes specified in plane_mask.
>>STRATEGY
Create drawable.
Set only bits in drawable corresponding to planes specified by planemask.
Call XGetImage with XYPixmap format.
Verify XGetImage return value is not null.
Verify depth, width, height, and format values in gotten image structure.
Verify gotten image for known pattern.
Repeat with only bits set not in planes specified by planemask.
Destroy images using XDestroyImage.
Repeat for each planemask.
Repeat for each visual.
>>ASSERTION - XGetImage-3
When the format is XYPixmap and the plane_mask only
requests a subset of the planes of the display, then the
depth of the returned image will be the number of planes
requested.
>>ASSERTION A XGetImage-4
When the format is ZPixmap, then a call to XGetImage
returns as zero the bits in all planes not specified in
plane_mask.
>>STRATEGY
Create drawable.
Set only bits in drawable corresponding to planes specified by planemask.
Call XGetImage with ZPixmap format.
Verify XGetImage return value is not null.
Verify depth, width, height, and format values in gotten image structure.
Verify gotten image for zero-bits in
all planes not specified in plane_mask.
Repeat with only bits set not in planes specified by planemask.
Destroy images using XDestroyImage.
Repeat for each planemask.
Repeat for each visual.
>>ASSERTION - XGetImage-5
When the format is ZPixmap, then the depth of the returned
image is as specified on drawable creation.
>>ASSERTION - XGetImage-6
The value for plane_mask is truncated to the depth of the
drawable.
>>ASSERTION A XGetImage-7
When the specified rectangle includes the window border,
then the contents of the window border are obtained in the
XImage structure returned by a call to XGetImage.
>>STRATEGY
Create drawable.
Set window border to W_FG.
Call XGetImage with ZPixmap format to get image of border pixel.
Verify XGetImage return value is not null.
Verify depth, width, height, and format values in gotten image structure.
Verify gotten image for known pattern.
Repeat with window border set to W_BG.
Destroy images using XDestroyImage.
Repeat for each type-window visual.
>>ASSERTION D XGetImage-8
When the drawable is a window and the window has
backing-store and has regions obscured by noninferior
windows, then backing store contents are returned for those
regions in the XImage structure returned by a call to
XGetImage.
>>STRATEGY
Report UNTESTED
>>ASSERTION D XGetImage-9
When the drawable is a window and the window does not have
backing-store and regions of the window are obscured by
noninferior windows, then undefined values are returned for
those regions.
>>STRATEGY
Report UNTESTED
>>ASSERTION B XGetImage-10
When the drawable is a window and visible regions of the
window are obscured by inferior windows of different depth
to the specified window, then undefined values are returned
for those regions.
>>STRATEGY
Report UNTESTED
>>ASSERTION A XGetImage-11
The pointer cursor image is not included in the returned
contents.
>>STRATEGY
Create drawable.
Grab server.
Enable synchronization.
Save initial pointer location.
Warp pointer to drawable.
Get new pointer location.
Call XGetImage with pointer inside drawable.
Verify XGetImage returned success.
Verify depth, width, height, and format values in gotten image structure.
Get current pointer location.
Check to see if pointer moved.
Warp pointer outside of drawable.
Get new pointer location.
Call XGetImage with pointer outside drawable.
Verify XGetImage returned success.
Verify depth, width, height, and format values in gotten image structure.
Get current pointer location.
Check to see if pointer moved.
Warp pointer back to where it started.
Disable synchronization.
Ungrab server.
Verify that two images are identical.
Destroy gotten images.
>>ASSERTION A XGetImage-12
When XGetImage fails, then it returns NULL.
>>STRATEGY
Create bad drawable.
Call XGetImage with bad drawable.
Verify XGetImage return value is null.
>>ASSERTION A XGetImage-13
When the drawable is a pixmap and the given rectangle is
not wholly contained within the pixmap, then a BadMatch
error occurs.
>>STRATEGY
Create pixmap.
Call XGetImage with rectangle not wholly contained within the pixmap.
Verify XGetImage return value is null.
Verify that BadMatch error occurred.
>>ASSERTION A XGetImage-14
When the drawable is a window and the window is not
viewable, then a BadMatch error occurs.
>>STRATEGY
Create window.
Call XUnmapWindow to make the window non-viewable.
Call XGetImage on window which is not viewable.
Verify XGetImage return value is null.
Verify that BadMatch error occurred.
>>ASSERTION A XGetImage-15
When the drawable is a window and the window is viewable
and it is not the case that given there were no inferiors or
overlapping windows the specified rectangle of the window
would be fully visible on the screen and wholly contained
within the outside edges of the window, then a BadMatch
error occurs.
>>STRATEGY
Create window which is not fully visible on the screen.
Call XMapWindow to make sure the window is viewable.
Call XGetImage with rectangle extending beyond edge of screen.
Verify XGetImage return value is null.
Verify that BadMatch error occurred.
Create window which is fully visible on the screen.
Call XMapWindow to make sure the window is viewable.
Call XGetImage with rectangle extending beyond edge of window.
Verify XGetImage return value is null.
Verify that BadMatch error occurred.
>>ASSERTION A XGetImage-16
When a drawable argument does not name a valid Drawable,
then a BadDrawable error occurs.
>>STRATEGY
Create a bad drawable by creating and destroying a window.
Call test function using bad drawable as the drawable argument.
Verify that a BadDrawable error occurs.
>>ASSERTION A XGetImage-17
When the value of format is other than XYPixmap or ZPixmap,
then a BadValue error occurs.
>>STRATEGY
Obtain a sequence of values which are not in the list specified by VALUE_LIST.
For each value:
  Call test function with this value in the VALUE_ARG argument.
  Verify that a BadValue error occurs.
