>># 
>># 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: cpyar.m,v 1.7 92/06/11 16:20:58 rws Exp $
>># 
>>#      SCCS:  @(#)  function.mc Rel 1.11	    (1/23/92)
>>#      SCCS:  @(#)  plane-mas.mc Rel 1.9	    (6/10/91)
>>#      SCCS:  @(#)  subwindow.mc Rel 1.11	    (6/15/92)
>>#      SCCS:  @(#)  graphics-.mc Rel 1.1	    (7/1/91)
>>#      SCCS:  @(#)  clip-x-or.mc Rel 1.10	    (4/29/92)
>>#      SCCS:  @(#)  clip-y-or.mc Rel 1.1	    (7/1/91)
>>#      SCCS:  @(#)  clip-mask.mc Rel 1.11	    (12/20/91)
>>#      SCCS:  @(#)  EMat1.mc Rel 1.5	    (10/25/91)
>>#      SCCS:  @(#)  EMat2.mc Rel 1.4	    (10/25/91)
>>#      SCCS:  @(#)  EMat3.mc Rel 1.5	    (10/25/91)
>>#      SCCS:  @(#)  EDra.mc Rel 1.5	    (10/25/91)
>>#      SCCS:  @(#)  EGC.mc Rel 1.5	    (10/25/91)
>>#
>>TITLE XCopyArea CH06
>>ASSERTION A XCopyArea-1
A call to XCopyArea combines the specified rectangle of src
with the specified rectangle of dest, according to the
function in the argument gc.
>>STRATEGY
Create window pair.
Tile background of first window
Copy to other window.
Verify copy on other window.
>>ASSERTION A XCopyArea-2
When regions of the source rectangle are obscured and have
not been retained in backing store or regions outside the
boundaries of the source drawable are specified and the
destination is a pixmap, then those regions are not copied.
>>STRATEGY
For all pixmaps
	make src and draw into it (background of 0)
	make dest
	copy region that extends off the edge of the source drawable
	verify that it is not copied.
>>ASSERTION A XCopyArea-3
When regions of the source rectangle are obscured and have
not been retained in backing store or regions outside the
boundaries of the source drawable are specified and the
destination is a window with a background other than None,
then all corresponding destination regions that are either
visible or are retained in backing store are tiled with that
background with plane-mask of all ones and the GXcopy
function.
>>STRATEGY
For all visuals
	make src window and draw into it (background of 0)
	make dest window with background of 1 and draw into it
	copy region that extends off the edge of the source drawable
	verify that it is not copied.
	verify that the background is tiled in parts corresponding to uncopied area.
>>ASSERTION A XCopyArea-4
When graphics-exposures is True, then GraphicsExpose
events for all corresponding destination regions are
generated.
>>STRATEGY
For all visuals
	Set graphics-exposures to True.
	Copy area that extends beyond the boundries of the source window.
	Enable All Events.
	Check events received, and x,y,width,height in each.
>>ASSERTION A XCopyArea-5
When graphics-exposures is True and no GraphicsExpose
events are generated, then a NoExpose event is generated.
>>STRATEGY
For each visual
  Enable graphics-exposures.
  Enable all events.
  Copy area that is fully within the window.
  Verify that one event is received and that it is a NoExpose event.
>>ASSERTION A XCopyArea-6
When a graphics operation is performed and the source pixel
is src and the destination pixel is dst and function is
GXclear, then the destination becomes (dst AND (NOT
plane_mask)).
>>STRATEGY
Find a point (f_pix_x, f_pix_y) that is drawn by the graphics operation.

Set function component of GC to GXclear.
For destination pixel values dst = 0, 1, 2, 3
    For source pixel values of src = 0, 1
	Set all points in drawable to destination pixel value.
	Set foreground component of GC to source pixel value.
	  (or fill source drawable/image with source pixel value in the cases
	   of XCopyArea or XPutImage, while XCopyPlane always has it ~0 to
	   force a foreground fill).
	Do graphics operation.
	Verify that pixel value at f_pix_x, f_pix_y is 0.
>>ASSERTION A XCopyArea-7
When a graphics operation is performed and the source pixel
is src and the destination pixel is dst and function is
GXand, then the destination becomes ((src AND dst) AND
plane_mask) OR (dst AND (NOT plane_mask)).
>>STRATEGY
Find a point (f_pix_x, f_pix_y) that is drawn by the graphics operation.

Set function component of GC to GXand.
For destination pixel values dst = 0, 1, 2, 3
    For source pixel values of src = 0, 1
	Set all points in drawable to destination pixel value.
	Set foreground component of GC to source pixel value.
	  (or fill source drawable/image with source pixel value in the cases
	   of XCopyArea or XPutImage, while XCopyPlane always has it ~0 to
	   force a foreground fill).
	Do graphics operation.
	Verify that pixel value at f_pix_x, f_pix_y is src&dest.
>>ASSERTION A XCopyArea-8
When a graphics operation is performed and the source pixel
is src and the destination pixel is dst and function is
GXandReverse, then the destination becomes ((src AND (NOT
dst)) AND plane_mask) OR (dst AND (NOT plane_mask)).
>>STRATEGY
Find a point (f_pix_x, f_pix_y) that is drawn by the graphics operation.

Set function component of GC to GXandReverse.
For destination pixel values dst = 0, 1, 2, 3
    For source pixel values of src = 0, 1
	Set all points in drawable to destination pixel value.
	Set foreground component of GC to source pixel value.
	  (or fill source drawable/image with source pixel value in the cases
	   of XCopyArea or XPutImage, while XCopyPlane always has it ~0 to
	   force a foreground fill).
	Do graphics operation.
	Verify that pixel value at f_pix_x, f_pix_y is src&~dest.
>>ASSERTION A XCopyArea-9
When a graphics operation is performed and the source pixel
is src and the destination pixel is dst and function is
GXcopy, then the destination becomes (src AND plane_mask)
OR (dst AND (NOT plane_mask)).
>>STRATEGY
Find a point (f_pix_x, f_pix_y) that is drawn by the graphics operation.

Set function component of GC to GXcopy.
For destination pixel values dst = 0, 1, 2, 3
    For source pixel values of src = 0, 1
	Set all points in drawable to destination pixel value.
	Set foreground component of GC to source pixel value.
	  (or fill source drawable/image with source pixel value in the cases
	   of XCopyArea or XPutImage, while XCopyPlane always has it ~0 to
	   force a foreground fill).
	Do graphics operation.
	Verify that pixel value at f_pix_x, f_pix_y is src.
>>ASSERTION A XCopyArea-10
When a graphics operation is performed and the source pixel
is src and the destination pixel is dst and function is
GXandInverted, then the destination becomes (((NOT src) AND
dst) AND plane_mask) OR (dst AND (NOT plane_mask)).
>>STRATEGY
Find a point (f_pix_x, f_pix_y) that is drawn by the graphics operation.

Set function component of GC to GXandInverted.
For destination pixel values dst = 0, 1, 2, 3
    For source pixel values of src = 0, 1
	Set all points in drawable to destination pixel value.
	Set foreground component of GC to source pixel value.
	  (or fill source drawable/image with source pixel value in the cases
	   of XCopyArea or XPutImage, while XCopyPlane always has it ~0 to
	   force a foreground fill).
	Do graphics operation.
	Verify that pixel value at f_pix_x, f_pix_y is ~src&dest.
>>ASSERTION A XCopyArea-11
When a graphics operation is performed and the source pixel
is src and the destination pixel is dst and function is
GXnoop, then the destination becomes (dst AND plane_mask)
OR (dst AND (NOT plane_mask)).
>>STRATEGY
Find a point (f_pix_x, f_pix_y) that is drawn by the graphics operation.

Set function component of GC to GXnoop.
For destination pixel values dst = 0, 1, 2, 3
    For source pixel values of src = 0, 1
	Set all points in drawable to destination pixel value.
	Set foreground component of GC to source pixel value.
	  (or fill source drawable/image with source pixel value in the cases
	   of XCopyArea or XPutImage, while XCopyPlane always has it ~0 to
	   force a foreground fill).
	Do graphics operation.
	Verify that pixel value at f_pix_x, f_pix_y is dest.
>>ASSERTION A XCopyArea-12
When a graphics operation is performed and the source pixel
is src and the destination pixel is dst and function is
GXxor, then the destination becomes ((src XOR dst) AND
plane_mask) OR (dst AND (NOT plane_mask)).
>>STRATEGY
Find a point (f_pix_x, f_pix_y) that is drawn by the graphics operation.

Set function component of GC to GXxor.
For destination pixel values dst = 0, 1, 2, 3
    For source pixel values of src = 0, 1
	Set all points in drawable to destination pixel value.
	Set foreground component of GC to source pixel value.
	  (or fill source drawable/image with source pixel value in the cases
	   of XCopyArea or XPutImage, while XCopyPlane always has it ~0 to
	   force a foreground fill).
	Do graphics operation.
	Verify that pixel value at f_pix_x, f_pix_y is src^dest.
>>ASSERTION A XCopyArea-13
When a graphics operation is performed and the source pixel
is src and the destination pixel is dst and function is GXor,
then the destination becomes ((src OR dst) AND plane_mask)
OR (dst AND (NOT plane_mask)).
>>STRATEGY
Find a point (f_pix_x, f_pix_y) that is drawn by the graphics operation.

Set function component of GC to GXor.
For destination pixel values dst = 0, 1, 2, 3
    For source pixel values of src = 0, 1
	Set all points in drawable to destination pixel value.
	Set foreground component of GC to source pixel value.
	  (or fill source drawable/image with source pixel value in the cases
	   of XCopyArea or XPutImage, while XCopyPlane always has it ~0 to
	   force a foreground fill).
	Do graphics operation.
	Verify that pixel value at f_pix_x, f_pix_y is src|dest.
>>ASSERTION A XCopyArea-14
When a graphics operation is performed and the source pixel
is src and the destination pixel is dst and function is
GXnor, then the destination becomes (((NOT src) AND (NOT
dst)) AND plane_mask) OR (dst AND (NOT plane_mask)).
>>STRATEGY
Find a point (f_pix_x, f_pix_y) that is drawn by the graphics operation.

Set function component of GC to GXnor.
For destination pixel values dst = 0, 1, 2, 3
    For source pixel values of src = 0, 1
	Set all points in drawable to destination pixel value.
	Set foreground component of GC to source pixel value.
	  (or fill source drawable/image with source pixel value in the cases
	   of XCopyArea or XPutImage, while XCopyPlane always has it ~0 to
	   force a foreground fill).
	Do graphics operation.
	Verify that pixel value at f_pix_x, f_pix_y is ~src&~dest.
>>ASSERTION A XCopyArea-15
When a graphics operation is performed and the source pixel
is src and the destination pixel is dst and function is
GXequiv, then the destination becomes (((NOT src) XOR dst)
AND plane_mask) OR (dst AND (NOT plane_mask)).
>>STRATEGY
Find a point (f_pix_x, f_pix_y) that is drawn by the graphics operation.

Set function component of GC to GXequiv.
For destination pixel values dst = 0, 1, 2, 3
    For source pixel values of src = 0, 1
	Set all points in drawable to destination pixel value.
	Set foreground component of GC to source pixel value.
	  (or fill source drawable/image with source pixel value in the cases
	   of XCopyArea or XPutImage, while XCopyPlane always has it ~0 to
	   force a foreground fill).
	Do graphics operation.
	Verify that pixel value at f_pix_x, f_pix_y is ~src^dest.
>>ASSERTION A XCopyArea-16
When a graphics operation is performed and the source pixel
is src and the destination pixel is dst and function is
GXinvert, then the destination becomes ((NOT dst) AND
plane_mask) OR (dst AND (NOT plane_mask)).
>>STRATEGY
Find a point (f_pix_x, f_pix_y) that is drawn by the graphics operation.

Set function component of GC to GXinvert.
For destination pixel values dst = 0, 1, 2, 3
    For source pixel values of src = 0, 1
	Set all points in drawable to destination pixel value.
	Set foreground component of GC to source pixel value.
	  (or fill source drawable/image with source pixel value in the cases
	   of XCopyArea or XPutImage, while XCopyPlane always has it ~0 to
	   force a foreground fill).
	Do graphics operation.
	Verify that pixel value at f_pix_x, f_pix_y is ~dest.
>>ASSERTION A XCopyArea-17
When a graphics operation is performed and the source pixel
is src and the destination pixel is dst and function is
GXorReverse, then the destination becomes ((src OR (NOT
dst)) AND plane_mask) OR (dst AND (NOT plane_mask)).
>>STRATEGY
Find a point (f_pix_x, f_pix_y) that is drawn by the graphics operation.

Set function component of GC to GXorReverse.
For destination pixel values dst = 0, 1, 2, 3
    For source pixel values of src = 0, 1
	Set all points in drawable to destination pixel value.
	Set foreground component of GC to source pixel value.
	  (or fill source drawable/image with source pixel value in the cases
	   of XCopyArea or XPutImage, while XCopyPlane always has it ~0 to
	   force a foreground fill).
	Do graphics operation.
	Verify that pixel value at f_pix_x, f_pix_y is src|~dest.
>>ASSERTION A XCopyArea-18
When a graphics operation is performed and the source pixel
is src and the destination pixel is dst and function is
GXcopyInverted, then the destination becomes ((NOT src) AND
plane_mask) OR (dst AND (NOT plane_mask)).
>>STRATEGY
Find a point (f_pix_x, f_pix_y) that is drawn by the graphics operation.

Set function component of GC to GXcopyInverted.
For destination pixel values dst = 0, 1, 2, 3
    For source pixel values of src = 0, 1
	Set all points in drawable to destination pixel value.
	Set foreground component of GC to source pixel value.
	  (or fill source drawable/image with source pixel value in the cases
	   of XCopyArea or XPutImage, while XCopyPlane always has it ~0 to
	   force a foreground fill).
	Do graphics operation.
	Verify that pixel value at f_pix_x, f_pix_y is ~src.
>>ASSERTION A XCopyArea-19
When a graphics operation is performed and the source pixel
is src and the destination pixel is dst and function is
GXorInverted, then the destination becomes (((NOT src) OR
dst) AND plane_mask) OR (dst AND (NOT plane_mask)).
>>STRATEGY
Find a point (f_pix_x, f_pix_y) that is drawn by the graphics operation.

Set function component of GC to GXorInverted.
For destination pixel values dst = 0, 1, 2, 3
    For source pixel values of src = 0, 1
	Set all points in drawable to destination pixel value.
	Set foreground component of GC to source pixel value.
	  (or fill source drawable/image with source pixel value in the cases
	   of XCopyArea or XPutImage, while XCopyPlane always has it ~0 to
	   force a foreground fill).
	Do graphics operation.
	Verify that pixel value at f_pix_x, f_pix_y is ~src|dest.
>>ASSERTION A XCopyArea-20
When a graphics operation is performed and the source pixel
is src and the destination pixel is dst and function is
GXnand, then the destination becomes (((NOT src) OR (NOT
dst)) AND plane_mask) OR (dst AND (NOT plane_mask)).
>>STRATEGY
Find a point (f_pix_x, f_pix_y) that is drawn by the graphics operation.

Set function component of GC to GXnand.
For destination pixel values dst = 0, 1, 2, 3
    For source pixel values of src = 0, 1
	Set all points in drawable to destination pixel value.
	Set foreground component of GC to source pixel value.
	  (or fill source drawable/image with source pixel value in the cases
	   of XCopyArea or XPutImage, while XCopyPlane always has it ~0 to
	   force a foreground fill).
	Do graphics operation.
	Verify that pixel value at f_pix_x, f_pix_y is ~src|~dest.
>>ASSERTION A XCopyArea-21
When a graphics operation is performed and the source pixel
is src and the destination pixel is dst and function is
GXset, then the destination becomes ( plane_mask) OR (dst
AND (NOT plane_mask)).
>>STRATEGY
Find a point (f_pix_x, f_pix_y) that is drawn by the graphics operation.

Set function component of GC to GXset.
For destination pixel values dst = 0, 1, 2, 3
    For source pixel values of src = 0, 1
	Set all points in drawable to destination pixel value.
	Set foreground component of GC to source pixel value.
	  (or fill source drawable/image with source pixel value in the cases
	   of XCopyArea or XPutImage, while XCopyPlane always has it ~0 to
	   force a foreground fill).
	Do graphics operation.
	Verify that pixel value at f_pix_x, f_pix_y is ~0.
>>ASSERTION A XCopyArea-22
The value for plane_mask is truncated to the depth of the
GC.
>>STRATEGY
Set foreground to pattern of 1's and 0's
Set plane-mask to values larger than the depth.
Verify that result is what would be expected if the extra bits
 were masked off.
>>ASSERTION A XCopyArea-23
The plane_mask specifies which planes of the destination
are to be modified, one bit per plane, with bits being
assigned to planes from the least significant bit of the
word to the most significant bit.
>>STRATEGY
Set foreground to pattern of 1's and 0's
Select a variety of plane masks.
Verify that the expected pixels are drawn.
>>ASSERTION A XCopyArea-24
When subwindow_mode is ClipByChildren, then the
destination window and source (if it is a window) are
clipped by all viewable InputOutput children.
>>STRATEGY
Set subwindow-mode to be ClipByChildren
Cover window with many strip sub-windows.
Do drawing operation
Verify that all subwindows are clear.
>>ASSERTION A XCopyArea-25
When subwindow_mode is IncludeInferiors, then neither the
destination window nor source (if it is a window) is clipped
by inferiors.
>>STRATEGY
Place subwindows over parts of the main window
Create subwindows over these windows as well.
Do graphics operation.
Verify that the operation was not affected.
>>ASSERTION A XCopyArea-26
When subwindow_mode is IncludeInferiors on a window of one
depth with mapped inferiors of differing depth, then no
errors occur.
>>STRATEGY
If only one depth window supported
  Result is UNSUPPORTED

Find two visuals with different depths.
Use one of these visuals to create a window.
Use the other to create a subwindow.
Verify that no errors occur.
For information purposes only see if graphics operation is rendered properly.
>>ASSERTION A XCopyArea-27
The clip origin coordinates clip-x-origin and clip-y-origin
are interpreted relative to the origin of the destination
drawable specified in the graphics operation.
>>STRATEGY
Create Pixmap and set clip-mask with it.
Vary clip origin
Verify nothing is drawn outside the clip_mask based on the origin.
Pixmap verify results inside the cliparea.
>>ASSERTION A XCopyArea-28
When the clip_mask is set to None, then the pixels are
always drawn regardless of the clip origin.
>>STRATEGY
Set clip mask to None
Verify that things are still drawn.
>>ASSERTION A XCopyArea-29
When pixels are outside the area covered by the clip_mask,
then they are not drawn.
>>STRATEGY
Create a pixmap depth 1.
Fill it with all ones.
Set this pixmap as the clip_mask.
Verify that nothing is drawn outside the clip-mask area.
Use a pixmap size of 5x5 to ensure that all tests have some part of the
drawing outside the clip-mask.
>>ASSERTION A XCopyArea-30
When pixels have a clip_mask bit set to 1, and they would
be drawn, then they are drawn.
>>STRATEGY
Do graphics operation.
Save the image on the drawable.
Clear drawable.
Create a pixmap depth 1 that is the same size as the window.
Set all bits in pixmap to 1.
Set GC component clip-mask to pixmap using XSetClipMask.
Do graphics operation.
Verify that the images drawn were the same.

Set pixmap to a pattern.
Do graphics operation.
Pixmap verify the result.
>>ASSERTION A XCopyArea-31
When pixels have a clip_mask bit set to 0, then they are
not drawn.
>>STRATEGY
Create a pixmap depth 1 that is the same size as the window.
Set all bits in pixmap to 0.
Set GC component clip_mask to pixmap using XSetClipMask.
Do graphics operation.
Verify that nothing is drawn.
>>ASSERTION A XCopyArea-32
When a drawable argument is an InputOnly window then a
BadMatch error occurs.
>>STRATEGY
Create an InputOnly window.
Call test function using InputOnly window as the drawable argument.
Verify that a BadMatch error occurs.
>>ASSERTION A XCopyArea-33
When the graphics context and the drawable do not have the
same depth, then a BadMatch error occurs.
>>STRATEGY
If only one depth supported
  report UNSUPPORTED
Create pixmap of depth 1.
Create gc of different depth.
Call test function with this pixmap and gc.
Verify that a BadMatch error occurs.
>>ASSERTION A XCopyArea-34
When the graphics context and the drawable were not created
for the same root, then a BadMatch error occurs.
>>STRATEGY
If multiple screens are supported
  Create pixmap of depth 1.
  Create gc on alternate screen.
  Call test function with this pixmap and gc.
  Verify that a BadMatch error occurs.
else
  report UNSUPPORTED
>>ASSERTION A XCopyArea-35
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 XCopyArea-36
When the GC argument does not name a defined GC, then a
BadGC error occurs.
>>STRATEGY
Create a GC.
Set GC id to -1 using XTestSetGContextOfGC.
Call test function using bad GC as the GC argument.
Verify that a BadGC error occurs.
