>># 
>># 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: gtsbimg.m,v 1.16 92/06/11 17:07:13 rws Exp $
>># 
>>#      SCCS:  @(#)  EDra.mc Rel 1.5	    (10/25/91)
>>#      SCCS:  @(#)  EVal.mc Rel 1.5	    (10/10/91)
>>#
>>TITLE XGetSubImage CH06
>>ASSERTION A XGetSubImage-1
A call to XGetSubImage returns a pointer to an XImage
structure containing the contents of the rectangle with
upper left corner at [ x, y] relative to the origin of the
drawable d and with width width and height height and in the
format specified by the format argument.
>>STRATEGY
Create image in XYPixmap format with all pixels set to W_BG.
Create drawable with all pixels set to W_FG.
Call XGetSubImage with XYPixmap format and
width and height equal to size of image.
Verify XGetSubImage return value is not null.
Verify depth, width, height, and format
values in gotten image structure.
Verify gotten image for known pattern.
Repeat call to XGetSubImage getting a subset of the entire drawable.
Repeat for ZPixmap format.
Repeat for each visual.
>>ASSERTION A XGetSubImage-2
A call to XGetSubImage returns a pointer to the same XImage
structure specified by dest_image.
>>STRATEGY
Create image.
Create drawable.
Call XGetSubImage to get subimage from drawable.
Verify XGetSubImage returned pointer to same XImage structure.
>>ASSERTION A XGetSubImage-3
When the format is XYPixmap, then the image contains only
the bit planes specified in plane_mask.
>>STRATEGY
Create image in XYPixmap format.
Create drawable.
Clear all pixels in image.
Set only bits in drawable corresponding to planes specified by planemask.
Call XGetSubImage with XYPixmap format.
Verify XGetSubImage 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.
Repeat for each planemask.
Repeat for each visual.
>>ASSERTION A XGetSubImage-4
When the format is ZPixmap, then a call to XGetSubImage
returns as zero the bits in all planes not specified in
plane_mask.
>>STRATEGY
Create image in ZPixmap format.
Create drawable.
Clear all pixels in image.
Set only bits in drawable corresponding to planes specified by planemask.
Call XGetSubImage with ZPixmap format.
Verify XGetSubImage 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.
Repeat for each planemask.
Repeat for each visual.
>>ASSERTION - XGetSubImage-5
The value for plane_mask is truncated to the depth of the
drawable.
>>ASSERTION A XGetSubImage-6
When the specified subimage does not fit at the specified
location ( dest_x, dest_y) on the destination image, then
the right and bottom edges are clipped.
>>STRATEGY
Create image.
Create drawable.
Call XGetSubImage to get subimage from drawable.
Verify XGetSubImage returned non-null.
Verify depth, width, height, and format
values in gotten image structure.
>>ASSERTION A XGetSubImage-7
When the specified rectangle includes the window border,
then the contents of the window border are obtained in the
XImage structure.
>>STRATEGY
Create image in ZPixmap format.
Create drawable.
Set window border to W_FG.
Call XGetSubImage with ZPixmap format to get image of border pixel.
Verify XGetSubImage 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.
Repeat for each type-window visual.
>>ASSERTION D XGetSubImage-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
XGetSubImage.
>>STRATEGY
Report UNTESTED
>>ASSERTION D XGetSubImage-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 D XGetSubImage-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 XGetSubImage-11
The pointer cursor image is not included in the returned
contents.
>>STRATEGY
Create 2 images.
Create drawable.
Grab server.
Enable synchronization.
Save initial pointer location.
Warp pointer to drawable.
Get new pointer location.
Call XGetSubImage with pointer inside drawable.
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 XGetSubImage with pointer outside drawable.
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.
>>ASSERTION A XGetSubImage-12
When XGetSubImage fails, then it returns NULL.
>>STRATEGY
Create image.
Create bad drawable.
Call XGetSubImage with bad drawable.
Verify XGetSubImage return value is null.
>>ASSERTION A XGetSubImage-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 image.
Create pixmap.
Call XGetSubImage.
Verify XGetSubImage return value is null.
Verify that BadMatch error occurred.
>>ASSERTION A XGetSubImage-14
When the drawable is a window and the window is not
viewable, then a BadMatch error occurs.
>>STRATEGY
Create window.
Create image.
Call XUnmapWindow to make the window non-viewable.
Call XSubGetImage on window which is not viewable.
Verify XSubGetImage return value is null.
Verify that BadMatch error occurred.
>>ASSERTION A XGetSubImage-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 image.
Create window which is not fully visible on the screen.
Call XMapWindow to make sure the window is viewable.
Call XGetSubImage with rectangle extending beyond edge of screen.
Verify XGetSubImage 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 XGetSubImage with rectangle extending beyond edge of window.
Verify XGetSubImage return value is null.
Verify that BadMatch error occurred.
>>ASSERTION A XGetSubImage-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 XGetSubImage-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.
