>># 
>># 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: crtwdw.m,v 1.10 92/06/29 18:47:14 rws Exp $
>># 
>>#      SCCS:  @(#)  EWin.mc Rel 1.4	    (7/19/91)
>>#      SCCS:  @(#)  EVal.mc Rel 1.5	    (10/10/91)
>>#      SCCS:  @(#)  EAll.mc Rel 1.5	    (3/12/92)
>>#
>>TITLE XCreateWindow CH03
>>ASSERTION A XCreateWindow-1
A call to XCreateWindow creates an unmapped subwindow for a
specified parent window and returns the window ID of the
created window.
>>STRATEGY
Call XCreateWindow.
Do simple checks on returned id.
>>ASSERTION A XCreateWindow-2
The window attributes specified in valuemask are set to the
values in the attributes structure.
>>STRATEGY
Create window with all attributes set to non-default values.
Get the window attributes with XGetWindowAttributes.
Verify that they are the same as the ones set.
The attributes that can't be checked in this way are the subject of other
  assertions.
>>ASSERTION A XCreateWindow-3
Window attributes that are not specified in valuemask are
set to their default values.
>>STRATEGY
Create window.
Check default values:
bit-gravity: Forget
win-gravity: NorthWest
backing-store: NotUseful
backing-planes: all ones
backing-pixel: zero
save-under: False
event-mask: empty set
do-not-propagate-mask: empty set
override-redirect: False
colormap: CopyFromParent
>>ASSERTION A XCreateWindow-4
On a call to XCreateWindow a CreateNotify event is
generated on the parent window.
>>STRATEGY
Create parent window.
Select SubstructureNotifyMask on parent window.
Create window.
Select NoEventMask on parent window.
Verify that a single CreateNotify event was generated.
Verify that the returned event structure was correct.
>>ASSERTION A XCreateWindow-5
The created window is placed on top in the stacking order
with respect to siblings.
>>STRATEGY
Create a parent window.
Create two overlapping sibling windows.
Verify that second window is at top of stacking order.
Verify that first sibling is next in the stacking order.
>>ASSERTION A XCreateWindow-6
The created window is not displayed.
>>STRATEGY
Create window to use as parent.
Set background to other than W_BG.
Create window with XCreateWindow.
Verify that parent window is still clear.
>>ASSERTION A XCreateWindow-7
When class is CopyFromParent, then the class is taken from
the parent window.
>>STRATEGY
Create InputOutput window to use as parent.
Create window with class CopyFromParent.
Verify that class of created window is InputOutput.
Create InputOnly window to use as parent.
Create window with class CopyFromParent.
Verify that class of created window is InputOnly.
>>ASSERTION A XCreateWindow-8
When depth is CopyFromParent and class is InputOutput,
then the depth is taken from the parent window.
>>STRATEGY
Create InputOutput window to use as parent.
Create window with depth CopyFromParent.
Verify that depth of created window is same as the parent.
>>ASSERTION A XCreateWindow-9
When visual is CopyFromParent, then the visual is taken
from the parent window.
>>STRATEGY
Create window to use as parent.
Create window with visual CopyFromParent.
Verify that visual of created window is same as the parent.
>>ASSERTION A XCreateWindow-10
The window is located such that the upper left outer corner
is at the co-ordinate specified by x and y relative to the
inside of the border of the parent window.
>>STRATEGY
Create window with border and background pixel W_FG.
Map created window.
Verify position by direct check with checkarea.
>>ASSERTION A XCreateWindow-11
When the background-pixmap attribute is set to None and the
background_pixel attribute is not being set at the same
time, then the window has no defined background.
>>STRATEGY
Set background-pixmap attribute to None.
Map window over a patterned background.
Verify that contents of the window are the same as the parent's.
>>ASSERTION A XCreateWindow-12
When the background-pixmap attribute is set to
ParentRelative, then each time the background pixmap is
required it is taken from the parent window at the time that
it is required, with the background tile origin aligned with
the origin of the parent window.
>>STRATEGY
Set background-pixmap to ParentRelative.
For a variety of parent backgrounds
  Clear child window.
  Verify that background changes to that set for the parent.
>>ASSERTION A XCreateWindow-13
When both background_pixel and background_pixmap are
specified, then background_pixel overrides background_pixmap.
>>STRATEGY
Set both the background-pixel attribute and the background-pixmap attribute.
Map and clear window to ensure background is refreshed.
Verify that background is set to the pixel value.
>>ASSERTION A XCreateWindow-14
When background_pixel is specified, then it is truncated to
the depth of the window.
>>STRATEGY
For each visual
  Try variety of background pixel values.
  Verify that they are truncated to depth using checkarea.
>>ASSERTION A XCreateWindow-15
When border_pixmap is CopyFromParent, then the
border-pixmap attribute is copied from the parent window.
>>STRATEGY
Create parent window.
Set parent border-pixmap attribute.
Set child window border-pixmap to CopyFromParent.
Ensure that window is mapped.
Pixmap verify to check that border is correct.
>>ASSERTION A XCreateWindow-16
When border_pixel is specified, then the value is truncated
to the depth of the window.
>>STRATEGY
For each visual
  Set border-pixel to various values.
  Read one pixel back from the border.
  Verify that this pixel has been truncated to depth of window.
>>ASSERTION A XCreateWindow-17
When colormap is CopyFromParent, then the colormap
attribute is copied from the parent window.
>>STRATEGY
Set colormap attribute to CopyFromParent.
Get attribute values.
Verify that colormap is same as for parent.
>>ASSERTION B XCreateWindow-18
When the cursor attribute is set to None, then the cursor
of the parent window is used for the window and any change
in the parent window's cursor will cause an immediate change
in the window's cursor.
>>STRATEGY
If extended testing is required:
  Create a parent window.
  Set the parent's cursor to a non-default cursor.
  Verify that the parent's cursor was set correctly.
  If XCreateWindow:
    Create a child window using XCreateWindow.
  Otherwise:
    Create and map a child window.
    Change the cursor attribute of the window to None using XCreateWindow.
  Warp the pointer to the child window.
  Verify that the current cursor is that of the parent.
  Verify that the child's cursor was set correctly.
  Set the parent's cursor to a different cursor.
  Verify that the parent's cursor was set correctly.
  Verify that the current cursor has changed to that of the parent.
>>ASSERTION A XCreateWindow-19
When a window argument does not name a valid Window, then a
BadWindow error occurs.
>>STRATEGY
Create a bad window by creating and destroying a window.
Call test function using bad window as the window argument.
Verify that a BadWindow error occurs.
>>ASSERTION A XCreateWindow-20
When background_pixmap is not a valid pixmap, None, or
ParentRelative, then a BadPixmap error occurs.
>>STRATEGY
Call XCreateWindow with background_pixmap set to an invalid value.
Verify that a BadPixmap error occurs.
>>ASSERTION A XCreateWindow-21
When border_pixmap is not a valid pixmap or CopyFromParent,
then a BadPixmap error occurs.
>>STRATEGY
Call XCreateWindow with border_pixmap set to an invalid value.
Verify that a BadPixmap error occurs.
>>ASSERTION A XCreateWindow-22
When colormap is not a valid Colormap resource or
CopyFromParent, then a BadColor error occurs.
>>STRATEGY
Call XCreateWindow with colormap set to an invalid value.
Verify that a BadColor error occurs.
>>ASSERTION A XCreateWindow-23
When cursor is not a valid Cursor resource or None, then a
BadCursor error occurs.
>>STRATEGY
Call XCreateWindow with cursor set to an invalid value.
Verify that a BadCursor error occurs.
>>ASSERTION A XCreateWindow-24
When the window has class InputOnly and valuemask contains
a bit set other than CWWinGravity, CWEventMask,
CWDontPropagate, CWOverrideRedirect and CWCursor, then a
BadMatch error occurs.
>>STRATEGY
Set value mask to contain invalid bits.
Verify in each case, that a BadMatch error occurs.
>>ASSERTION C XCreateWindow-25
If windows with depth other than one are supported: When
background_pixmap and the window do not have the same depth,
then a BadMatch error occurs.
>>STRATEGY
Use depth of 1 for the pixmap.
Find a visual not of depth 1.
If not such a visual
  UNSUPPORTED
else
  Attempt to set background_pixmap to the depth 1 pixmap.
  Verify that a BadMatch error occurs.
>>ASSERTION C XCreateWindow-26
If multiple screens are supported: When background_pixmap
and the window are not created for the same screen, then a
BadMatch error occurs.
>>STRATEGY
If there is a pixmap depth on the alternate screen that has the same
depth as a visual on the test screen then
  Create pixmap on alternate screen.
  Attempt to set background-pixmap with the pixmap
  Verify that a BadMatch error occurs.
else
  UNSUPPORTED
>>ASSERTION C XCreateWindow-27
If multiple window depths are supported: When
background_pixmap is ParentRelative and the window and the
parent window do not have the same depth, then a BadMatch
error occurs.
>>STRATEGY
If two different depth windows are supported.
  Create window with different depth to parent.
  Attempt to set background_pixmap to ParentRelative.
  Verify that a BadMatch error occurs.
else
  UNSUPPORTED.
>>ASSERTION A XCreateWindow-28
When colormap and the window are not created for the same
screen, then a BadMatch error occurs.
>>STRATEGY
If multiple screens are supported:
  Obtain visual information about the alternate screen.
  Determine a visual type shared between the main and alternate screen.
  Create a colormap on the alternate screen.
  Attempt to set the colormap.
  Verify that a BadMatch error occurs.
else
  UNSUPPORTED
>>ASSERTION A XCreateWindow-29
When colormap and the window do not have the same visual
type, then a BadMatch error occurs.
>>STRATEGY
If two different visual types are supported:
  Create colour map of different visual to window.
  Attempt to set colourmap to created colour map.
  Verify that a BadMatch error occurs.
else
  UNSUPPORTED.
>>ASSERTION A XCreateWindow-30
When colormap is CopyFromParent and the parent window has a
colormap of None, then a BadMatch error occurs.
>>STRATEGY
Create a window with a colormap.
Free the colormap the window.
Call function with colormap of CopyFromParent.
Verify BadMatch error occurred.
>>ASSERTION A XCreateWindow-31
When the window has class InputOnly and border_width is not
zero, then a BadMatch error occurs.
>>STRATEGY
Set border_width to contain non zero.
Verify that a BadMatch error occurs.
>>ASSERTION A XCreateWindow-32
When bit_gravity is other than ForgetGravity,
NorthWestGravity, NorthGravity, NorthEastGravity,
WestGravity, CenterGravity, EastGravity, SouthWestGravity,
SouthGravity, SouthEastGravityor StaticGravity, then a
BadValue error occurs.
>>STRATEGY
Set bit_gravity to a bad value.
Verify that BadValue is generated.
>>ASSERTION A XCreateWindow-33
When win_gravity is other than UnmapGravity,
NorthWestGravity, NorthGravity, NorthEastGravity,
WestGravity, CenterGravity, EastGravity, SouthWestGravity,
SouthGravity, SouthEastGravityor StaticGravity, then a
BadValue error occurs.
>>STRATEGY
Set win_gravity to a bad value.
Verify that BadValue is generated.
>>ASSERTION A XCreateWindow-34
When backing_store is other than NotUseful, WhenMapped or
Always, then a BadValue error occurs.
>>STRATEGY
Set backing_store to a bad value.
Verify that BadValue is generated.
>>ASSERTION A XCreateWindow-35
When save_under is other than True or False, then a
BadValue error occurs.
>>STRATEGY
Set save_under to a bad value.
Verify that BadValue is generated.
>>ASSERTION A XCreateWindow-36
When event_mask is other than a bitwise OR of any of
NoEventMask, KeyPressMask, KeyReleaseMask,
ButtonPressMask, ButtonReleaseMask, EnterWindowMask,
LeaveWindowMask, PointerMotionMask, PointerMotionHintMask,
Button1MotionMask, Button2MotionMask, Button3MotionMask,
Button4MotionMask, Button5MotionMask, ButtonMotionMask,
KeymapStateMask, ExposureMask, VisibilityChangeMask,
StructureNotifyMask, ResizeRedirectMask,
SubstructureNotifyMask, SubstructureRedirectMask,
FocusChangeMask, PropertyChangeMask, ColormapChangeMask or
OwnerGrabButtonMask, then a BadValue error occurs.
>>STRATEGY
Set event_mask to a bad value.
Verify that BadValue is generated.
>>ASSERTION A XCreateWindow-37
When do_not_propagate_mask is other than a bitwise OR of
any of NoEventMask, KeyPressMask, KeyReleaseMask,
ButtonPressMask, ButtonReleaseMask, EnterWindowMask,
LeaveWindowMask, PointerMotionMask, PointerMotionHintMask,
Button1MotionMask, Button2MotionMask, Button3MotionMask,
Button4MotionMask, Button5MotionMask, ButtonMotionMask,
KeymapStateMask, ExposureMask, VisibilityChangeMask,
StructureNotifyMask, ResizeRedirectMask,
SubstructureNotifyMask, SubstructureRedirectMask,
FocusChangeMask, PropertyChangeMask, ColormapChangeMask or
OwnerGrabButtonMask, then a BadValue error occurs.
>>STRATEGY
Set do_not_propagate_mask to a bad value.
Verify that BadValue is generated.
>>ASSERTION A XCreateWindow-38
When override_redirect is other than True or False, then a
BadValue error occurs.
>>STRATEGY
Set override_redirect to a bad value.
Verify that BadValue is generated.
>>ASSERTION C XCreateWindow-39
If windows with depth other than one are supported: When
border_pixmap and the window do not have the same depth,
then a BadMatch error occurs.
>>STRATEGY
If a window with depth other than one is supported:
  Attempt to set border_pixmap with depth one.
  Verify that a BadMatch error occurs with a window depth other than one.
else
  UNSUPPORTED.
>>ASSERTION C XCreateWindow-40
If multiple window depths are supported: When border_pixmap
is CopyFromParent, and the window does not have the same
depth as the parent window, then a BadMatch error occurs.
>>STRATEGY
If two different depth windows are supported.
  Create window with different depth to parent.
  Attempt to set border_pixmap to CopyFromParent.
  Verify that a BadMatch error occurs.
else
  UNSUPPORTED.
>>ASSERTION A XCreateWindow-41
When colormap is CopyFromParent and the window does not
have the same visual type as the parent window, then a
BadMatch error occurs.
>>STRATEGY
If two different visual types are supported:
  Create a parent of one visual type
  Attempt to set colourmap to CopyFromParent on window of different visual type.
  Verify that a BadMatch error occurs.
else
  UNSUPPORTED.
>>ASSERTION A XCreateWindow-42
When class is InputOutput and the specified visual type and
depth are not supported for the screen, then a BadMatch
error occurs.
>>STRATEGY
Find depth not supported by screen.
Set depth to the unsupported depth.
Set visual to a supported type
(doesn't seem possible to test unsupported visual portably)
Set class to InputOutput.
Attempt to create window.
Verify that BadMatch error occurs.
>>ASSERTION A XCreateWindow-43
When class is InputOutput and the parent window has class
InputOnly, then a BadMatch error occurs.
>>STRATEGY
Create input only window with iponlywin().
Set class to InputOutput.
Create window with the input only window as parent.
Verify that a BadMatch error occurs.
>>ASSERTION A XCreateWindow-44
When class is InputOnly and the depth is not zero, then a
BadMatch error occurs.
>>STRATEGY
Set class to InputOnly.
Set depth to 1.
Set border_width to 0 to avoid BadMatch error due to border width.
Call XCreateWindow.
Verify that BadMatch error occurs.
>>ASSERTION B XCreateWindow-45
When class is InputOnly and the specified visual type is
not supported by the screen, then a BadMatch error occurs.
>>STRATEGY
Report UNTESTED
>>ASSERTION A XCreateWindow-46
When the width or height is zero, then a BadValue error
occurs.
>>STRATEGY
Set width and height in turn to be zero.
Call XCreateWindow.
Verify that a BadValue error occurs.
>>ASSERTION B XCreateWindow-47
When the specified visual type is invalid, then a BadValue
error occurs.
>>STRATEGY
Report UNTESTED
>>ASSERTION A XCreateWindow-48
When the value of class is other than InputOutput,
InputOnly or CopyFromParent, 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.
>>ASSERTION B XCreateWindow-49
When the server fails to allocate a required resource, then
a BadAlloc error occurs.
>>STRATEGY
Report UNTESTED
