>># 
>># 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: drwimgst16.m,v 1.10 92/06/11 16:30:19 rws Exp $
>># 
>>#      SCCS:  @(#)  plane-mas.mc Rel 1.9	    (6/10/91)
>>#      SCCS:  @(#)  font.mc Rel 1.1	    (7/1/91)
>>#      SCCS:  @(#)  subwindow.mc Rel 1.11	    (6/15/92)
>>#      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:  @(#)  foregroun.mc Rel 1.15	    (10/4/91)
>>#      SCCS:  @(#)  backgroun.mc Rel 1.15	    (1/3/92)
>>#      SCCS:  @(#)  EDra.mc Rel 1.5	    (10/25/91)
>>#      SCCS:  @(#)  EGC.mc Rel 1.5	    (10/25/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)
>>#
>>TITLE XDrawImageString16 CH06
>>ASSERTION A XDrawImageString16-1
A call to XDrawImageString16 first fills the destination
rectangle with the background pixel value and next draws a
string of 2-byte or 16-bit characters, selected from the gc
's font, using the foreground pixel value.
>>STRATEGY
Reverse foreground and background.
Draw string
Pixmap verify
>>ASSERTION - XDrawImageString16-2
The upper-left corner of the filled rectangle is at [ x, y
- max-ascent], with width equal to the sum of the
per-character widths, and with height font-ascent+
font-descent, where font-ascent and font-descent are the
logical ascent and descent of the font.
>>ASSERTION A XDrawImageString16-3
The origin of the string is at [ x, y].
>>STRATEGY
Vary x and y
Call XDrawImageString16 to draw string.
Pixmap verify.
>>ASSERTION A XDrawImageString16-4
The effective function is GXcopy, and the effective
fill_style is FillSolid.
>>STRATEGY
Set gc function to GXxor
Set fill-style to FillTiled
Set Tile.
Verify that these settings have no effect.
>>ASSERTION B XDrawImageString16-5
When fonts are defined with linear indexing rather than
2-byte matrix indexing, then each XChar2b structure is
interpreted as a 16-bit number with byte1 as the
most-significant byte.
>>STRATEGY
Report UNTESTED
>>ASSERTION A XDrawImageString16-6
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 XDrawImageString16-7
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 XDrawImageString16-8
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 XDrawImageString16-9
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 XDrawImageString16-10
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 XDrawImageString16-11
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 XDrawImageString16-12
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 XDrawImageString16-13
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 XDrawImageString16-14
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 XDrawImageString16-15
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 XDrawImageString16-16
The foregound component of the gc is used to determine the
foreground pixel value.
>>STRATEGY
Set foreground to various values.
Pixmap verify the results.
>>ASSERTION A XDrawImageString16-17
The value for foreground is truncated to the depth of the
GC.
>>STRATEGY
Set foreground to value with all bits set.
Find a non background pixel.
Check that this is truncated to the depth.
>>ASSERTION A XDrawImageString16-18
The background component of the gc is used to determine the
background pixel value.
>>STRATEGY
Set GC component background to various values.
Pixmap verify the results.
>>ASSERTION A XDrawImageString16-19
The value for background is truncated to the depth of the
GC.
>>STRATEGY
Set GC component background to value with all bits set.
If not (XDrawImageString  || XCopyPlane || XPutImage || XCopyArea)
  Set GC component stipple to all zeros
  Set GC component FillStyle to FillOpaqueStippled.
else if (XCopyPlane || XPutImage)
  Fill source drawable/image-bitmap with 0's to ensure we draw with background
else if XCopyArea
  Fill source drawable/image-bitmap with all 1's
Draw item.
Find a pixel with a value other than W_BG.
Check that this is truncated to the depth.
>>ASSERTION A XDrawImageString16-20
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 XDrawImageString16-21
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.
>>ASSERTION A XDrawImageString16-22
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 XDrawImageString16-23
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 XDrawImageString16-24
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
