>># 
>># 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: frclrs.m,v 1.13 92/06/11 16:16:00 rws Exp $
>># 
>>#      SCCS:  @(#)  EAcc2.mc Rel 1.5	    (10/2/91)
>>#      SCCS:  @(#)  ECol.mc Rel 1.4	    (7/31/91)
>>#
>>TITLE XFreeColors CH05
>>ASSERTION C XFreeColors-1
If any of the visual classes DirectColor, PseudoColor or
GrayScale is supported: A call to XFreeColors function frees
the colourmap entries obtained by ORing the npixels pixel
values specified in the pixels argument with zero or more of
the planes specified in the planes argument that have been
allocated by the client using XAllocColor, XAllocNamedColor,
XAllocColorCells or XAllocColorPlanes.
>>STRATEGY
For each visual class DirectColor, PseudoColor and GrayScale:
  Create a colormap with XCreateColormap.
  Allocate 1 colormap cell with XAllocNamedColor.
  Allocate the remaining colourmap cells with XAllocColorCells.
  Free the cell allocated by XAllocNamedColor with XFreeColors.
  Allocate 1 colourmap cell with XAllocColorCells.
  Verify that the call did not return False.

For each visual class DirectColor, PseudoColor and GrayScale:
  Create a colormap with XCreateColormap.
  Allocate 1 colormap cell with XAllocColor.
  Allocate the remaining colourmap cells with XAllocColorCells.
  Free the cell allocated by XAllocColor with XFreeColors.
  Allocate 1 colourmap cell with XAllocColorCells.
  Verify that the call did not return False.

For each visual class DirectColor, PseudoColor and GrayScale:
  Create a colormap with XCreateColormap.
  Allocate the entire colourmap with XAllocColorCells.
  Free a cell allocated by XAllocColorCells with XFreeColors.
  Allocate 1 colourmap cell with XAllocColorCells.
  Verify that the call did not return False.

>>ASSERTION C XFreeColors-2
If any of the visual classes DirectColor, PseudoColor or
GrayScale is supported: When a read-only colourmap entry has
been allocated by another client, then the colourmap entry
is not freed on a call to XFreeColors.
>>STRATEGY
For each of the visual classes DirectColor, PseudoColor and GrayScale:
  Create a colormap with alloc set to AllocNone.
  Create a second client with XOpenDisplay().
  Allocate a r/o cell with XAllocColor for the first client.
  Allocate a r/o cell using the returned rgb values with XAllocColor for the second client.
  Allocate the rest of the colormap with XAllocColorCells.
  Free the cell for the first client with XFreeColors.
  Verify that the colormap is full with XAllocColorCell.
  Free the cell for the second client with XFreeColors.
  Verify that the cell was freed with XAllocColorCell.
>>ASSERTION A XFreeColors-3
If the visual class DirectColor, PseudoColor or GrayScale
is supported: When a read-only colourmap entry has been
allocated more than once by the client, and XFreeColors has
been called one less time than the colormap entry was
allocated, then a call to XFreeColors frees the colormap
entry.
>>STRATEGY
For each of the visual classes DirectColor, PseudoColor and GrayScale:
  Create a colormap with alloc set to AllocNone.
  Allocate a cell maxsize(vp) times with XAllocColor.
  Allocate the rest of the colourmap with XAllocColorCells.
  Repeat maxsize(vp)-1 times:
    Deallocate the colourcell with XFreeColours.
    Verify that the cell is not deallocated with XAllocColorCells.
  Deallocate the colourcell with XFreeColours.
  Verify that the colourcell was deallocated with XAllocColors.
>>ASSERTION A XFreeColors-4
If any of the visual classes DirectColor, PseudoColor or
GrayScale is supported: When one or more pixels cannot be
freed, and one or more pixels can be freed, then the pixels
that are allocated by the client in the colourmap that can
be freed are freed.
>>STRATEGY
For each visual class DirectColor, PseudoColor and GrayScale:
  Create a colormap with alloc set to AllocNone.
  Create a new client with XOpenDisplay.
  Allocate a r/o cell for the new client with XAllocColor.
  Allocate the rest of the colormap for the first client with XAllocColorCells.
  Free the entire colormap with the second client with XFreeColors.
  Verify that only one cell was freed with XAllocColorCells.
>>ASSERTION A XFreeColors-5
If the visual class DirectColor is supported: When all
related colormap entries are already freed, then a call to
XFreeColors with a particular pixel value allows that pixel
value to be allocated by a subsequent call to
XAllocColorPlanes.
>>STRATEGY
For the visual class DirectColor:
  Create a colourmap with XCreateColormap.
  Allocate the entire colormap with 2 pixels and red_mask-1, green_mask-1
    and blue_mask-1 red, green and blue planes with XAllocColorPlanes.
  Verify that further allocation does not succeed with XAllocColorPlanes.
  Free pixel2 and red|green|blue planes.
  Allocate 1 pixel with red_mask-1, green_mask-1 and blue_mask-1 planes.
  Verify that the call did not return False.
>>ASSERTION A XFreeColors-6
When a specified pixel is not a valid entry in the colormap
argument, then a BadValue error occurs.
>>STRATEGY
For all supported visual types:
  Create a colormap with alloc set to AllocNone.
  Free a pixel with pixel value of 2power(longbits)-1 with XFreeColors.
  Verify that a BadValue error occurred.

  Create a colormap using XCreateColormap with alloc set to AllocNone.
  Allocate one readonly cell in the colormap with XAllocColor.
  Construct an array with the same pixel in both elements.
  Deallocate the colormap cells indicated by the array with XFreeColors.
  Verify that a BadValue error occurred.
>>ASSERTION A XFreeColors-7
When an attempt to free a colormap entry not allocated by
the client is made, then a BadAccess error occurs.
>>STRATEGY
  Create a colormap with alloc set to AllocNone.
  Free a pixel with pixel value = 0 with XFreeColors.
  Verify that a BadValue error occurred.
>>ASSERTION A XFreeColors-8
When a colourmap argument does not name a valid colourmap,
then a BadColor error occurs.
>>STRATEGY
Create a bad colourmap by creating and freeing a colourmap.
Call test function using bad colourmap as the colourmap argument.
Verify that a BadColor error occurs.
>>ASSERTION A XFreeColors-9
When more than one pixel value is not a valid entry in the
colormap argument, then a BadValue error occurs which will
report any one of the invalid pixel values.
>>STRATEGY
For each supported visual class:
  Create a colormap using XCreateColormap with alloc set to AllocNone.
  Allocate one readonly cell in the colormap with XAllocColor.
  Construct an array with two invalid pixel values and one valid pixel value.
  Deallocate the colormap cells indicated by the array with XFreeColors.
  Verify that a BadValue error occurred.
  Verify that the bad value reported was one of the invalid pixel array elements.
