diff options
Diffstat (limited to 'xts5/Xlib7')
60 files changed, 24909 insertions, 0 deletions
diff --git a/xts5/Xlib7/.gitignore b/xts5/Xlib7/.gitignore new file mode 100644 index 00000000..de55143c --- /dev/null +++ b/xts5/Xlib7/.gitignore @@ -0,0 +1,58 @@ +XAllocColor/XAllocColor +XAllocColorCells/XAllocColorCells +XAllocColorPlanes/XAllocColorPlanes +XAllocNamedColor/XAllocNamedColor +XcmsAllocColor/XcmsAllocColor +XcmsAddColorSpace/XcmsAddColorSpace +XcmsAddFunctionSet/XcmsAddFunctionSet +XcmsAllocNamedColor/XcmsAllocNamedColor +XcmsCCCOfColormap/XcmsCCCOfColormap +XcmsConvertColors/XcmsConvertColors +XcmsCIELabQueryMaxLC/XcmsCIELabQueryMaxLC +XcmsCIELabQueryMaxC/XcmsCIELabQueryMaxC +XcmsCIELabQueryMaxL/XcmsCIELabQueryMaxL +XcmsConversionProc/XcmsConversionProc +XcmsConversionProc/XcmsConversionProc +XcmsCreateCCC/XcmsCreateCCC +XcmsDefaultCCC/XcmsDefaultCCC +XcmsDisplayOfCCC/XcmsDisplayOfCCC +XcmsFreeCCC/XcmsFreeCCC +XcmsFormatOfPrefix/XcmsFormatOfPrefix +XcmsLookupColor/XcmsLookupColor +XcmsCIELabQueryMinL/XcmsCIELabQueryMinL +XcmsPrefixOfFormat/XcmsPrefixOfFormat +XcmsQueryBlack/XcmsQueryBlack +XcmsQueryBlue/XcmsQueryBlue +XcmsQueryColor/XcmsQueryColor +XcmsQueryColors/XcmsQueryColors +XcmsQueryGreen/XcmsQueryGreen +XcmsCIELuvQueryMaxC/XcmsCIELuvQueryMaxC +XcmsCIELuvQueryMinL/XcmsCIELuvQueryMinL +XcmsCIELuvQueryMaxL/XcmsCIELuvQueryMaxL +XcmsCIELuvQueryMaxLC/XcmsCIELuvQueryMaxLC +XcmsQueryRed/XcmsQueryRed +XcmsQueryWhite/XcmsQueryWhite +XcmsScreenNumberOfCCC/XcmsScreenNumberOfCCC +XcmsStoreColor/XcmsStoreColor +XcmsStoreColors/XcmsStoreColors +XcmsTekHVCQueryMaxC/XcmsTekHVCQueryMaxC +XcmsTekHVCQueryMinV/XcmsTekHVCQueryMinV +XcmsTekHVCQueryMaxV/XcmsTekHVCQueryMaxV +XcmsTekHVCQueryMaxVC/XcmsTekHVCQueryMaxVC +XcmsTekHVCQueryMaxVSamples/XcmsTekHVCQueryMaxVSamples +XcmsVisualOfCCC/XcmsVisualOfCCC +XcmsSetWhiteAdjustProc/XcmsSetWhiteAdjustProc +XcmsScreenWhitePointOfCCC/XcmsScreenWhitePointOfCCC +XcmsClientWhitePointOfCCC/XcmsClientWhitePointOfCCC +XcmsSetWhitePoint/XcmsSetWhitePoint +XCopyColormapAndFree/XCopyColormapAndFree +XCreateColormap/XCreateColormap +XFreeColormap/XFreeColormap +XFreeColors/XFreeColors +XLookupColor/XLookupColor +XParseColor/XParseColor +XQueryColor/XQueryColor +XQueryColors/XQueryColors +XStoreColor/XStoreColor +XStoreColors/XStoreColors +XStoreNamedColor/XStoreNamedColor diff --git a/xts5/Xlib7/Makefile.am b/xts5/Xlib7/Makefile.am new file mode 100644 index 00000000..57351e27 --- /dev/null +++ b/xts5/Xlib7/Makefile.am @@ -0,0 +1,70 @@ +include ../../common.mk +AUTOMAKE_OPTIONS = subdir-objects + +AM_CFLAGS = $(XTS_LCFLAGS) $(XTS_CFLAGS) +LDADD = $(TCM) $(XTS_LLIBS) $(XTS_LIBS) \ + $(top_builddir)/xts5/src/libXR5/libXR5.a + +libexec_PROGRAMS = $(tprogs) +BUILT_SOURCES = $(tprogs:$(EXEEXT)=.c) +CLEANFILES = $(BUILT_SOURCES) + +tprogs = \ + XAllocColor/XAllocColor \ + XAllocColorCells/XAllocColorCells \ + XAllocColorPlanes/XAllocColorPlanes \ + XAllocNamedColor/XAllocNamedColor \ + XcmsAllocColor/XcmsAllocColor \ + XcmsAddColorSpace/XcmsAddColorSpace \ + XcmsAddFunctionSet/XcmsAddFunctionSet \ + XcmsAllocNamedColor/XcmsAllocNamedColor \ + XcmsCCCOfColormap/XcmsCCCOfColormap \ + XcmsConvertColors/XcmsConvertColors \ + XcmsCIELabQueryMaxLC/XcmsCIELabQueryMaxLC \ + XcmsCIELabQueryMaxC/XcmsCIELabQueryMaxC \ + XcmsCIELabQueryMaxL/XcmsCIELabQueryMaxL \ + XcmsConversionProc/XcmsConversionProc \ + XcmsConversionProc/XcmsConversionProc \ + XcmsCreateCCC/XcmsCreateCCC \ + XcmsDefaultCCC/XcmsDefaultCCC \ + XcmsDisplayOfCCC/XcmsDisplayOfCCC \ + XcmsFreeCCC/XcmsFreeCCC \ + XcmsFormatOfPrefix/XcmsFormatOfPrefix \ + XcmsLookupColor/XcmsLookupColor \ + XcmsCIELabQueryMinL/XcmsCIELabQueryMinL \ + XcmsPrefixOfFormat/XcmsPrefixOfFormat \ + XcmsQueryBlack/XcmsQueryBlack \ + XcmsQueryBlue/XcmsQueryBlue \ + XcmsQueryColor/XcmsQueryColor \ + XcmsQueryColors/XcmsQueryColors \ + XcmsQueryGreen/XcmsQueryGreen \ + XcmsCIELuvQueryMaxC/XcmsCIELuvQueryMaxC \ + XcmsCIELuvQueryMinL/XcmsCIELuvQueryMinL \ + XcmsCIELuvQueryMaxL/XcmsCIELuvQueryMaxL \ + XcmsCIELuvQueryMaxLC/XcmsCIELuvQueryMaxLC \ + XcmsQueryRed/XcmsQueryRed \ + XcmsQueryWhite/XcmsQueryWhite \ + XcmsScreenNumberOfCCC/XcmsScreenNumberOfCCC \ + XcmsStoreColor/XcmsStoreColor \ + XcmsStoreColors/XcmsStoreColors \ + XcmsTekHVCQueryMaxC/XcmsTekHVCQueryMaxC \ + XcmsTekHVCQueryMinV/XcmsTekHVCQueryMinV \ + XcmsTekHVCQueryMaxV/XcmsTekHVCQueryMaxV \ + XcmsTekHVCQueryMaxVC/XcmsTekHVCQueryMaxVC \ + XcmsTekHVCQueryMaxVSamples/XcmsTekHVCQueryMaxVSamples \ + XcmsVisualOfCCC/XcmsVisualOfCCC \ + XcmsSetWhiteAdjustProc/XcmsSetWhiteAdjustProc \ + XcmsScreenWhitePointOfCCC/XcmsScreenWhitePointOfCCC \ + XcmsClientWhitePointOfCCC/XcmsClientWhitePointOfCCC \ + XcmsSetWhitePoint/XcmsSetWhitePoint \ + XCopyColormapAndFree/XCopyColormapAndFree \ + XCreateColormap/XCreateColormap \ + XFreeColormap/XFreeColormap \ + XFreeColors/XFreeColors \ + XLookupColor/XLookupColor \ + XParseColor/XParseColor \ + XQueryColor/XQueryColor \ + XQueryColors/XQueryColors \ + XStoreColor/XStoreColor \ + XStoreColors/XStoreColors \ + XStoreNamedColor/XStoreNamedColor diff --git a/xts5/Xlib7/XAllocColor/XAllocColor.m b/xts5/Xlib7/XAllocColor/XAllocColor.m new file mode 100644 index 00000000..107b8ab6 --- /dev/null +++ b/xts5/Xlib7/XAllocColor/XAllocColor.m @@ -0,0 +1,403 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XAllocColor/XAllocColor.m,v 1.2 2005-11-03 08:43:42 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib7/XAllocColor/XAllocColor.m +>># +>># Description: +>># Tests for XAllocColor() +>># +>># Modifications: +>># $Log: allcclr.m,v $ +>># Revision 1.2 2005-11-03 08:43:42 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:29 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:26:54 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:12 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:07 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:39 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:05 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:48:11 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE XAllocColor Xlib7 +Status +XAllocColor(display, colormap, screen_in_out) +Display *display = Dsp; +Colormap colormap = DefaultColormap(display, DefaultScreen(display)); +XColor *screen_in_out = &dummy; +>>EXTERN +XColor dummy; +>>ASSERTION Good A +A call to xname +allocates a read-only entry in the +.A colormap +argument +corresponding to the closest RGB value that is supported by the hardware to the +value specified by the +.M red , +.M green , +and +.M blue +components in the +.S XColor +structure named by the +.A screen_in_out +argument, returns that value in the +.M red , +.M green , +and +.M blue +components in the +.S XColor +structure named by the +.A screen_in_out +argument +and returns the colourmap entry in the +.M pixel +component in the +.S XColor +structure named by the +.A screen_in_out +argument. +>>STRATEGY +For each supported visual class: + Create a colormap with XCreateColormap. + Create a new client with XOpenDisplay. + Allocate one read-only colorcell with XAllocColor with the second client. + Reallocate a cell with the returned RGB values with the original client. + Verify that the returned pixel is identical to the first and that the r, g and b value argee. + Verify the cell is read only with the failure of XStoreColor. +>>CODE +Display *disp2; +XVisualInfo *vp; +Status status; +XColor screencol, testcol; +unsigned long vmask; + + if( (vmask = visualsupported(display, 0L)) == 0L) { + delete("No visuals reported as valid."); + return; + } + + if( (disp2 = opendisplay()) == (Display *) 0) { + delete("Could not open display"); + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + trace("Attempting AllocColor() for class %s", displayclassname(vp->class)); + colormap = makecolmap(display, vp -> visual, AllocNone); + + testcol.red = 0xf3f3; + testcol.green = 0xe4e4; + testcol.blue = 0xd5d5; + + trace("Source colour : r %u g %u b %u", testcol.red, testcol.green, testcol.blue); + screen_in_out = &testcol; + display = disp2; + status = XCALL; + + if( status == (Status) 0) { + report("XAllocColor() failed to return non-zero."); + FAIL; + continue; + } + + screencol = testcol; + trace("Screen: pixel %lu, r %u g %u b %u", screencol.pixel , screencol.red, screencol.green, screencol.blue); + trace("Test : pixel %lu, r %u g %u b %u", testcol.pixel, testcol.red, testcol.green, testcol.blue); + + screen_in_out = &testcol; + display = Dsp; + status = XCALL; + + if(status == (Status) 0) { + report("XAllocColor() failed to return non-zero."); + FAIL; + continue; + } + + if( screencol.pixel != testcol.pixel ) { + report("XAllocColor() return pixel value %lu instead of %lu.", testcol.pixel, screencol.pixel); + FAIL; + } else + CHECK; + + if( (screencol.red != testcol.red) || (screencol.green != testcol.green) || (screencol.blue != testcol.blue) ) { + report("XAllocColor() return RGB values r %u g %u b %u instead of r %u g %u b %u.", + testcol.red, testcol.green, testcol.blue, screencol.red, screencol.green, screencol.blue); + FAIL; + } else + CHECK; + + startcall(display); + XStoreColor(display, colormap, &testcol); + endcall(display); + + if (geterr() == Success) { + report("Got success writing to a read-only cell"); + tet_result(TET_FAIL); + } else + CHECK; + + } + + CHECKPASS(3 * nsupvis()); + + +>>ASSERTION Good A +A call to xname does not use or affect the +.S flags +component of the +.S XColor +structure named by the +.A screen_in_out +argument. +>>STRATEGY +For each supported visual class: + Create a colormap with XCreateColormap. + Allocate a colourcell with an XColor structure flags component of DoGreen, + and red, green and blue components of 255<<8, 63<<8 and 31 <<8. + Verify that the returned flags component is DoGreen. + Allocate a colourcell with an XColor structure flags component of DoRed | DoBlue + and red, green and blue components of 255<<8, 63<<8 and 31 <<8. + Verify that the returned flags component is DoRed | DoBlue. + Verify that the returned pixel and red, green and blue values are identical to + those initially returned. +>>CODE +XVisualInfo *vp; +Status status; +XColor screencol, testcol; +unsigned long vmask; + + if( (vmask = visualsupported(display, 0L)) == 0L) { + delete("No visuals reported as valid."); + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + trace("Attempting AllocColor() for class %s", displayclassname(vp->class)); + colormap = makecolmap(display, vp -> visual, AllocNone); + + testcol.red = 255 << 8; + testcol.green = 63 << 8; + testcol.blue = 31 << 8; + testcol.flags = DoGreen; + + screen_in_out = &testcol; + status = XCALL; + + if( status == (Status) 0) { + report("XAllocColor() failed to return non-zero."); + FAIL; + continue; + } + + if( DoGreen != testcol.flags ) { + report("XAllocColor() altered flags value %lu to %lu.", + DoGreen, testcol.flags); + FAIL; + } else + CHECK; + + screencol = testcol; + trace("Screen: pixel %lu, r %u g %u b %u", screencol.pixel , screencol.red, screencol.green, screencol.blue); + trace("Test : pixel %lu, r %u g %u b %u", testcol.pixel, testcol.red, testcol.green, testcol.blue); + + testcol.red = 255 << 8; + testcol.green = 63 << 8; + testcol.blue = 31 << 8; + testcol.flags = DoRed | DoBlue; + + screen_in_out = &testcol; + status = XCALL; + + if(status == (Status) 0) { + report("XAllocColor() failed to return non-zero."); + FAIL; + continue; + } + + if( (DoRed | DoBlue) != testcol.flags ) { + report("XAllocColor() altered flags value %lu to %lu.", + (DoRed | DoBlue), testcol.flags); + FAIL; + } else + CHECK; + + if( screencol.pixel != testcol.pixel ) { + report("XAllocColor() return pixel value %lu instead of %lu.", testcol.pixel, screencol.pixel); + FAIL; + } else + CHECK; + + if( (screencol.red != testcol.red) || (screencol.green != testcol.green) || (screencol.blue != testcol.blue) ) { + report("XAllocColor() return RGB values r %u g %u b %u instead of r %u g %u b %u.", + testcol.red, testcol.green, testcol.blue, screencol.red, screencol.green, screencol.blue); + FAIL; + } else + CHECK; + } + + CHECKPASS(4 * nsupvis()); + + + +>>ASSERTION Good A +When a call to xname has allocated a read-only entry in a colourmap, +then a subsequent call to xname with identical +.M red , +.M green +and +.M blue +components in the +.S XColor +structure named by the +.A screen_in_out +argument returns an identical pixel component in the +.S XColor +structure. +>>STRATEGY +For each supported visual class: + Create a colormap with XCreateColormap. + Allocate a colourcell with an XColor structure with + red, green and blue components of 255<<8, 127<<8 and 63 <<8. + Allocate a colourcell with an XColor structure having the + the previously returned rgb values. + Verify that the returned pixel is the same as that initially returned. +>>CODE +XVisualInfo *vp; +Status status; +XColor screencol, testcol; +unsigned long vmask; + + if( (vmask = visualsupported(display, 0L)) == 0L) { + delete("No visuals reported as valid."); + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + trace("Attempting AllocColor() for class %s", displayclassname(vp->class)); + colormap = makecolmap(display, vp -> visual, AllocNone); + + testcol.red = 255 << 8; + testcol.green = 127 << 8; + testcol.blue = 63 << 8; + + screen_in_out = &testcol; + status = XCALL; + + if( status == (Status) 0) { + report("XAllocColor() failed to return non-zero."); + FAIL; + continue; + } + + screencol = testcol; + trace("Screen: pixel %lu, r %u g %u b %u", screencol.pixel , screencol.red, screencol.green, screencol.blue); + trace("Test : pixel %lu, r %u g %u b %u", testcol.pixel, testcol.red, testcol.green, testcol.blue); + + screen_in_out = &testcol; + status = XCALL; + + if(status == (Status) 0) { + report("XAllocColor() failed to return non-zero."); + FAIL; + continue; + } + + if( screencol.pixel != testcol.pixel ) { + report("XAllocColor() return pixel value %lu instead of %lu.", testcol.pixel, screencol.pixel); + FAIL; + } else + CHECK; + } + + CHECKPASS(nsupvis()); + +>>ASSERTION Bad A +.ER BadColor +>>ASSERTION Bad A +.ER Alloc +>>#HISTORY Cal Completed Written in new format and style. 4/12/90 +>>#HISTORY Kieron Completed <Have a look> +>>#HISTORY Cal Action Writting code. diff --git a/xts5/Xlib7/XAllocColorCells/XAllocColorCells.m b/xts5/Xlib7/XAllocColorCells/XAllocColorCells.m new file mode 100644 index 00000000..4c0af61f --- /dev/null +++ b/xts5/Xlib7/XAllocColorCells/XAllocColorCells.m @@ -0,0 +1,819 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XAllocColorCells/XAllocColorCells.m,v 1.2 2005-11-03 08:43:42 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib7/XAllocColorCells/XAllocColorCells.m +>># +>># Description: +>># Tests for XAllocColorCells() +>># +>># Modifications: +>># $Log: allcclrcll.m,v $ +>># Revision 1.2 2005-11-03 08:43:42 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:29 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:26:55 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:13 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:08 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:39 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:07 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:48:15 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE XAllocColorCells Xlib7 +Status +XAllocColorCells(display, colormap, contig, plane_masks_return, nplanes, pixels_return, npixels) +Display *display = Dsp; +Colormap colormap; +Bool contig; +unsigned long *plane_masks_return; +unsigned int nplanes; +unsigned long *pixels_return; +unsigned int npixels; +>>EXTERN +#define lowbit(x) ((x) & (~(x) + 1)) +#define bitcontig(x) ((((x) + lowbit(x)) & (x)) == 0) +#define bitsubset(a,b) (((a) & (b)) == (a)) + +>>ASSERTION Good C +If any of the visual classes +.S DirectColor , +.S PseudoColor , +or +.S GrayScale +is supported: +A call to xname allocates +.A npixels*2pow(nplanes) +read/write colourmap entries whose indices in the colourmap are +obtained by ORing each pixel value returned in the +.A pixels_return +argument +with zero or more of the planes returned in the +.A plane_mask +argument. +>>STRATEGY +For each visual class DirectColor, PseudoColor and GrayScale: + Create a colormap. + Allocate all colors and no planemasks with XAllocColorCells. + Verify the correct number of cells have been allocated by initialising + them with XStoreColors, and reading them with XQueryColors. + Allocate planes and masks such that lg(colors) + planes = lg(colormap_size) + Verify the correct number of cells have been allocated by initialising + them with XStoreColors, and reading them with XQueryColors. +>>CODE +XVisualInfo *vp; +XColor color, qcolor; +Visual *visual; +Status status; +Colormap cmap; +unsigned long vmask, pmask, mask, planemask; +int i, j, k, cells; +int pathcnt; + +#define RW_COLORMAP_MASK ((1L<<DirectColor) | (1L<<PseudoColor) | (1L<<GrayScale)) + + if( (vmask = visualsupported(display, RW_COLORMAP_MASK)) == 0L) { + unsupported("DirectColor, PseudoColor and GrayScale are not supported"); + return; + } + + contig = False; + color.red = 1<<8; + color.green = 2<<8; + color.blue = 3<<8; + color.flags = DoRed | DoGreen | DoBlue; + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + trace("Attempting XAllocColorCells() for class %s", displayclassname(vp->class)); + + /* Test that we can allocate the entire colormap, nplanes = 0 */ + + colormap = makecolmap(display, vp -> visual, AllocNone); + nplanes = 0; + npixels = maxsize(vp); + plane_masks_return = (unsigned long *) 0; + pixels_return = (unsigned long *) malloc( npixels * sizeof(unsigned long)); + trace("Testing XAllocColorCells with %u colors and %u planes", npixels, nplanes); + if(pixels_return == (unsigned long *) 0) { + delete("Malloc failed to allocate memory for pixels return value."); + return; + } + + for(j=0; j<npixels; j++) + pixels_return[j] = npixels+1; + + status = XCALL; + if(status == (Status) 0) { + report("%s failed to return non-zero", TestName); + report("allocating all %d cells with visual class %s.", + npixels, displayclassname(vp->class)); + FAIL; + continue; + } else + CHECK; + + for(pathcnt = 0, j=0; j < npixels; j++) { + color.pixel = pixels_return[j]; + startcall(display); + XStoreColor(display, colormap, &color); + endcall(display); + if(geterr() != Success) { + report("XStoreColor() failed (%s) to store pixel value %lu in colormap of class %s", errorname(geterr()), color.pixel, displayclassname(vp->class)); + FAIL; + } else { + qcolor.pixel = pixels_return[j]; + startcall(display); + XQueryColor(display, colormap, &qcolor); + endcall(display); + if(geterr() != Success) { + report("XQueryColor() failed (%s) to return pixel value %lu in colormap of class %s", errorname(geterr()), qcolor.pixel, displayclassname(vp->class)); + FAIL; + } else + pathcnt++; + } + } + + if(pathcnt == npixels) + CHECK; + + free( (char *) pixels_return); + + /* Test that we can allocate planes and cells of size floor(log2(colormapsize)). */ + + colormap = makecolmap(display, vp -> visual, AllocNone); + cells = 1<<lg(maxsize(vp)); + npixels = (unsigned int) 1<<(lg(maxsize(vp))/2); + nplanes = (unsigned int) lg(maxsize(vp)) - lg(npixels); + plane_masks_return = (unsigned long *) malloc(nplanes * sizeof(unsigned long)); + pixels_return = (unsigned long *) malloc(npixels * sizeof(unsigned long)); + + if(plane_masks_return == (unsigned long*) 0 || pixels_return == (unsigned long*) 0) { + delete("Malloc() failed to allocate memory for return values."); + return; + } else + CHECK; + + for(j=0; j<npixels; j++) + pixels_return[j] = cells+1; + + for(j=0; j<nplanes; j++) + plane_masks_return[j] = cells+1; + + trace("Testing XAllocColorCells() with nplanes = %u, npixels = %u, cells = %d, pixels * 2 pow planes = %u", nplanes, npixels, cells, npixels * (1<<nplanes)); + + status = XCALL; + if(status == (Status) 0) { + report("%s failed to return non-zero", TestName); + report("allocating %lu pixels and %lu planes with visual class %s.", + npixels, nplanes, displayclassname(vp->class)); + FAIL; + continue; + } else + CHECK; + + for(pathcnt = 0, j=0; j < npixels; j++) + for(i=0; i < (1<<nplanes); i++) { + planemask = 0L; + for(k=0, mask=1; k < nplanes; k++, mask <<= 1) /* */ + if((unsigned long) i & mask) /* Select the i th subset of plane masks. */ + mask |= plane_masks_return[k]; /* */ + + color.pixel = pixels_return[j] | planemask; + startcall(display); + XStoreColor(display, colormap, &color); + endcall(display); + + if(geterr() != Success) { + report("XStoreColor() failed (%s) to store pixel value %lu in colormap of class %s", errorname(geterr()), color.pixel, displayclassname(vp->class)); + FAIL; + } else { + qcolor.pixel = pixels_return[j] | planemask; + startcall(display); + XQueryColor(display, colormap, &qcolor); + endcall(display); + if(geterr() != Success) { + report("XQueryColor() failed (%s) to return pixel value %lu in colormap of class %s", errorname(geterr()), qcolor.pixel, displayclassname(vp->class)); + FAIL; + } else + pathcnt++; + } + } + + if(pathcnt == npixels*(1<<nplanes)) + CHECK; + + free( (char *) pixels_return); + free( (char *) plane_masks_return); + } + + CHECKPASS(5 * nsupvis()); + +>>ASSERTION Good C +If any of the visual classes +.S DirectColor , +.S PseudoColor , +or +.S GrayScale +is supported: +A call to xname returns +.A nplanes +plane masks in the +.A plane_mask_return +argument +and +.A npixels +pixel values in the +.A pixels_return +argument +such that no plane mask has a bit set in common with +any other plane mask or with any of the pixels. +>>STRATEGY +For each supported visual with r/w colour cells: + Create a colourmap with alloc set to AllocNone. + Allocate planes and masks such that lg(colors) + planes = lg(colormap_size) + Form the bitwise OR of all the pixels. + For each planemask: + Verify that the bitwise AND of every other planemask is 0. + Verify that the bitwise AND of the planemask and the OR of the colours is 0. +>>CODE +XVisualInfo *vp; +Visual *visual; +Status status; +Colormap cmap; +unsigned long vmask, planemask, pixelmask; +int i, j, cells, pathcnt = 0; + + + if( (vmask = visualsupported(display, RW_COLORMAP_MASK)) == 0L) { + unsupported("DirectColor, PseudoColor and GrayScale are not supported"); + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + trace("Attempting XAllocColorCells() for class %s", displayclassname(vp->class)); + + contig = False; + colormap = makecolmap(display, vp -> visual, AllocNone); + cells = 1<<lg(maxsize(vp)); + npixels = (unsigned int) 1<<(lg(maxsize(vp))/2); + nplanes = (unsigned int) lg(maxsize(vp)) - lg(npixels); + plane_masks_return = (unsigned long *) malloc(nplanes * sizeof(unsigned long)); + pixels_return = (unsigned long *) malloc(npixels * sizeof(unsigned long)); + if(plane_masks_return == (unsigned long*) 0 || + pixels_return == (unsigned long*) 0) { + delete("Malloc() failed to allocate memory for return values."); + return; + } else + CHECK; + + pathcnt += nplanes*(nplanes+1); + + for(j=0; j<npixels; j++) + pixels_return[j] = cells+1; + + for(j=0; j<nplanes; j++) + plane_masks_return[j] = cells+1; + + trace("Testing XAllocColorCells() with nplanes = %u, npixels = %u, cells = %d, pixels * 2 pow planes = %u", + nplanes, npixels, cells, npixels * (1<<nplanes)); + + status = XCALL; + + if(status == (Status) 0) { + report("%s failed to return non-zero", TestName); + report("for visual class %s.", + displayclassname(vp->class)); + FAIL; + } else { + pixelmask = 0L; + for(j=0; j < npixels; j++) + pixelmask |= pixels_return[j]; + + for(j=0; j < nplanes; j++) { + planemask = plane_masks_return[j]; + for(i=0; i < nplanes; i++) + if(((planemask & plane_masks_return[i]) != 0) && (i != j)) { + report("Plane mask %d(%lu) has a bit in common with mask %d(%ln).", j, planemask, i, plane_masks_return[i]); + FAIL; + } else + CHECK; + + if( (pixelmask & planemask) != 0L) { + report("Plane mask %d(%lu) has a bit in common with a pixel value.", j, planemask); + FAIL; + } else + CHECK; + } + } + + free( (char *) plane_masks_return); + free( (char *) pixels_return); + } + + CHECKPASS(pathcnt+nsupvis()); + +>>ASSERTION Good A +If either of the visual classes +.S PseudoColor +or +.S GrayScale +are supported: +When the visual type of the +.A colormap +argument is +.S PseudoColor +or +.S GrayScale , +then a call to xname sets exactly one bit in each plane mask in +.A plane_mask_return . +>>STRATEGY +For the visuals PseudoColor and GrayScale: + Create a colourmap with alloc set to AllocNone. + Allocate 1 color and all planemasks with XAllocColorCells. + Verify that the number of bits set in each planemask is exactly 1. +>>CODE +XVisualInfo *vp; +Visual *visual; +Status status; +Colormap cmap; +unsigned long vmask; +int j, cells, pathcnt = 0; + + + if( (vmask = visualsupported(display, (1<<PseudoColor) | (1<<GrayScale)) ) == 0L) { + unsupported("PseudoColor and GrayScale are not supported"); + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + trace("Attempting XAllocColorCells() for class %s", displayclassname(vp->class)); + + contig = False; + colormap = makecolmap(display, vp -> visual, AllocNone); + cells = 1<<lg(maxsize(vp)); + npixels = 1; + nplanes = (unsigned int) lg(maxsize(vp)); + plane_masks_return = (unsigned long *) malloc(nplanes * sizeof(unsigned long)); + pixels_return = (unsigned long *) malloc(npixels * sizeof(unsigned long)); + if(plane_masks_return == (unsigned long*) 0 || pixels_return == (unsigned long*) 0) { + delete("Malloc() failed to allocate memory for return values."); + return; + } else + CHECK; + + pathcnt += nplanes; + + for(j=0; j<npixels; j++) + pixels_return[j] = cells+1; + + for(j=0; j<nplanes; j++) + plane_masks_return[j] = cells+1; + + trace("Testing XAllocColorCells() with nplanes = %u, npixels = %u, cells = %d, pixels * 2 pow planes = %u", nplanes, npixels, cells, npixels * (1<<nplanes)); + + status = XCALL; + + if(status == (Status) 0) { + report("%s failed to return non-zero", TestName); + report("for visual class %s.", + displayclassname(vp->class)); + FAIL; + } else { + int bits; + for(j=0; j < nplanes; j++) + if( (bits = bitcount(plane_masks_return[j])) != 1 ) { + report("Plane_mask %d had %d bits set instead of 1", j, bits); + FAIL; + } + else + CHECK; + } + } + + CHECKPASS(pathcnt + nsupvis()); + +>>ASSERTION Good A +If the visual class +.S DirectColor +is supported: +When the visual type of the +.A colormap +argument is +.S DirectColor , +then a call to xname sets exactly three bits in each plane mask in +.A plane_mask_return . +>>STRATEGY +For the visual class DirectColor: + Create a colormap. + Allocate 1 color and all planemasks with XAllocColorCells. + Verify that for each planemask exactly three bits are set. +>>CODE +XVisualInfo *vp; +Visual *visual; +Status status; +Colormap cmap; +unsigned long vmask; +int j, cells; + + + if( (vmask = visualsupported(display, 1<<DirectColor)) == 0L) { + unsupported("DirectColor is not supported"); + return; + } + + resetsupvis(vmask); + nextsupvis(&vp); + trace("Attempting XAllocColorCells() for class %s", displayclassname(vp->class)); + contig = False; + colormap = XCreateColormap(display, DRW(display), vp -> visual, AllocNone); + cells = 1<<lg(maxsize(vp)); + npixels = 1; + nplanes = (unsigned int) lg(maxsize(vp)); + plane_masks_return = (unsigned long *) malloc(nplanes * sizeof(unsigned long)); + pixels_return = (unsigned long *) malloc(npixels * sizeof(unsigned long)); + if(plane_masks_return == (unsigned long*) 0 || pixels_return == (unsigned long*) 0) { + delete("Malloc() failed to allocate memory for return values."); + return; + } else + CHECK; + + for(j=0; j<npixels; j++) + pixels_return[j] = cells+1; + + for(j=0; j<nplanes; j++) + plane_masks_return[j] = cells+1; + + trace("Testing XAllocColorCells() with nplanes = %u, npixels = %u, cells = %d, pixels * 2 pow planes = %u", nplanes, npixels, cells, npixels * (1<<nplanes)); + + status = XCALL; + + if(status == (Status) 0) { + report("%s failed to return non-zero", TestName); + report("for visual class %s.", + displayclassname(vp->class)); + FAIL; + } else { + int bits; + for(j=0; j < nplanes; j++) + if( (bits = bitcount(plane_masks_return[j])) != 3 ) { + report("Plane_mask %d had %d bits set instead of 3", j, bits); + FAIL; + } + else + CHECK; + } + + CHECKPASS(nplanes+nsupvis()); + + +>>ASSERTION Good A +If either of the visual classes +.S PseudoColor +or +.S GrayScale +are supported: +When the +.A contig +argument is +.S True , +and the visual type of the +.A colormap +argument is +.S GrayScale +or +.S PseudoColor , +then the mask formed by ORing the +plane masks in +.A plane_mask_return +contains one set of contiguous bits. +>>STRATEGY +For the visual types PseudoColor and GreyScale: + Create a colourmap. + Allocate 1 color and some planemasks using XAllocColorCells and contig = True. + Form the bitwise OR of all the planemasks. + Verify that the returned planemasks were contiguous. +>>CODE +XVisualInfo *vp; +Visual *visual; +Status status; +Colormap cmap; +unsigned long vmask; +unsigned long planeor; +int j, cells; + + + if( (vmask = visualsupported(display, (1<<PseudoColor) | (1<<GrayScale)) ) == 0L) { + unsupported("PseudoColor and GrayScale are not supported"); + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + trace("Attempting XAllocColorCells() for class %s", displayclassname(vp->class)); + + contig = True; + colormap = makecolmap(display, vp -> visual, AllocNone); + cells = 1<<lg(maxsize(vp)); + npixels = 1; + nplanes = (unsigned int) lg(maxsize(vp)); + /* + * Just ask for a small number of planes if more was possible. + * Originally this test requested all planes - but of course this + * gave little scope for contig to make any difference. + */ + if(nplanes > 2) + nplanes = 2; + plane_masks_return = (unsigned long *) malloc(nplanes * sizeof(unsigned long)); + pixels_return = (unsigned long *) malloc(npixels * sizeof(unsigned long)); + if(plane_masks_return == (unsigned long*) 0 || pixels_return == (unsigned long*) 0) { + delete("Malloc() failed to allocate memory for return values."); + return; + } else + CHECK; + + for(j=0; j<npixels; j++) + pixels_return[j] = cells+1; + + for(j=0; j<nplanes; j++) + plane_masks_return[j] = cells+1; + + trace("Testing XAllocColorCells() with contig = True, nplanes = %u, npixels = %u, cells = %d, pixels * 2 pow planes = %u", nplanes, npixels, cells, npixels * (1<<nplanes)); + + status = XCALL; + + if(status == (Status) 0) { + report("%s failed to return non-zero", TestName); + report("for visual class %s.", + displayclassname(vp->class)); + FAIL; + } else { + planeor = 0L; + for(j=0; j < nplanes; j++) + planeor |= plane_masks_return[j]; + + if(bitcontig(planeor) == 0) { + report("The allocated planemask bits were not contiguous."); + FAIL; + } else + CHECK; + } + } + + CHECKPASS(2*nsupvis()); + +>>ASSERTION Good A +If the visual class +.S DirectColor +is supported: +When the +.A contig +argument is +.S True , +and the visual type of the +.A colormap +argument is +.S DirectColor , +then the mask formed by ORing the +plane masks in +.A plane_mask_return +contains three sets of contiguous bits set to one, one lying in each of +the red, green and blue pixel subfields. +>>STRATEGY +For the visual class DirectColor: + Create a colormap. + Allocate 1 color and some planemasks using XAllocColorCells and contig = True. + Form the bitwise OR of all the planemasks per bit set. + Verify that the returned planemasks in the red, green and blue subfields + were contiguous and distinct. +>>CODE +XVisualInfo *vp; +Visual *visual; +Status status; +Colormap cmap; +unsigned long vmask; +unsigned long planeor; +int j, cells; + + + if( (vmask = visualsupported(display, 1<<DirectColor)) == 0L) { + unsupported("DirectColor is not supported"); + return; + } + + resetsupvis(vmask); + nextsupvis(&vp); + trace("Attempting XAllocColorCells() for class %s", displayclassname(vp->class)); + contig = True; + colormap = makecolmap(display, vp -> visual, AllocNone); + cells = 1<<lg(maxsize(vp)); + npixels = 1; + nplanes = (unsigned int) lg(maxsize(vp)); + trace("nplanes %d", nplanes); + /* + * Just ask for a small number of planes if more was possible. + * Originally this test requested all planes - but of course this + * gave little scope for contig to make any difference. + */ + if(nplanes > 2) + nplanes = 2; + trace("nplanes %d", nplanes); + plane_masks_return = (unsigned long *) malloc(nplanes * sizeof(unsigned long)); + pixels_return = (unsigned long *) malloc(npixels * sizeof(unsigned long)); + if(plane_masks_return == (unsigned long*) 0 || pixels_return == (unsigned long*) 0) { + delete("Malloc() failed to allocate memory for return values."); + return; + } else + CHECK; + + + for(j=0; j<npixels; j++) + pixels_return[j] = cells+1; + + for(j=0; j<nplanes; j++) + plane_masks_return[j] = cells+1; + + for(j=0; j < nplanes; j++) + { + trace("plane_mask_return is initially %x", plane_masks_return[j]); + } + + trace("Testing XAllocColorCells() with nplanes = %u, npixels = %u, cells = %d, pixels * 2 pow planes = %u", nplanes, npixels, cells, npixels * (1<<nplanes)); + + status = XCALL; + + if(status == (Status) 0) { + report("XAllocColorCells() failed to return non-zero for visual class %s.", displayclassname(vp->class)); + FAIL; + } else { + unsigned long planeor1 = 0L, planeor2 = 0L, planeor3 = 0L, pln; + + for(j=0; j < nplanes; j++) + { + trace("plane_mask_return is %x", plane_masks_return[j]); + pln = plane_masks_return[j]; + if (bitcount(pln) != 3) { + report("Planemask %d did not have 3 bits set (0x%lx)", j, pln); + FAIL; + } else + CHECK; + planeor1 |= lowbit(pln); + pln &= ~lowbit(pln); + planeor2 |= lowbit(pln); + pln &= ~lowbit(pln); + planeor3 |= lowbit(pln); + pln &= ~lowbit(pln); + } + + trace("red_mask is %x", vp->red_mask); + trace("green_mask is %x", vp->green_mask); + trace("blue_mask is %x", vp->blue_mask); + if(!((bitsubset(planeor1, vp->red_mask) && + bitsubset(planeor2, vp->green_mask) && + bitsubset(planeor3, vp->blue_mask)) || + (bitsubset(planeor1, vp->red_mask) && + bitsubset(planeor3, vp->green_mask) && + bitsubset(planeor2, vp->blue_mask)) || + (bitsubset(planeor2, vp->red_mask) && + bitsubset(planeor1, vp->green_mask) && + bitsubset(planeor3, vp->blue_mask)) || + (bitsubset(planeor2, vp->red_mask) && + bitsubset(planeor3, vp->green_mask) && + bitsubset(planeor1, vp->blue_mask)) || + (bitsubset(planeor3, vp->red_mask) && + bitsubset(planeor1, vp->green_mask) && + bitsubset(planeor2, vp->blue_mask)) || + (bitsubset(planeor3, vp->red_mask) && + bitsubset(planeor2, vp->green_mask) && + bitsubset(planeor1, vp->blue_mask)))) { + report("Planemasks (0x%lx, 0x%lx, 0x%lx) are not subsets of RGB masks (0x%lx, 0x%lx, 0x%lx)", planeor1, planeor2, planeor3, vp->red_mask, vp->green_mask, vp->blue_mask); + FAIL; + } else + CHECK; + if (bitcount(planeor1) != nplanes || + bitcount(planeor2) != nplanes || + bitcount(planeor3) != nplanes) { + report("Planemasks not all distinct (0x%lx, 0x%lx, 0x%lx)", planeor1, planeor2, planeor3); + FAIL; + } else + CHECK; + if (!bitcontig(planeor1) || + !bitcontig(planeor2) || + !bitcontig(planeor3)) { + report("Planemasks not all contiguous (0x%lx, 0x%lx, 0x%lx)", planeor1, planeor2, planeor3); + FAIL; + } else + CHECK; + + } + + CHECKPASS(4+nplanes); + +>>ASSERTION Bad A +.ER BadColor +>>ASSERTION Bad A +When the +.A npixels +argument is zero, then a +.S BadValue +error occurs. +>>STRATEGY +Verify that with npixels = 0, nplanes = 0, with the DefaultColormap, + XAllocColorCells generates a BadValue error. +>>CODE BadValue + + colormap = DefaultColormap(display, DefaultScreen(display)); + npixels = 0; + nplanes = 0; + plane_masks_return = (unsigned long *) 0; + pixels_return = (unsigned long *) 0; + contig = False; + XCALL; + if(geterr() != BadValue) + FAIL; + else + CHECK; + + CHECKPASS(1); +>>ASSERTION Bad A +.ER BadValue contig True False +>>#HISTORY Cal Completed Written in new format and style 4/12/90. +>>#HISTORY Kieron Completed <Have a look> +>>#HISTORY Cal Completed Writting code. +>>#HISTORY Kieron Completed Bug fixes. diff --git a/xts5/Xlib7/XAllocColorPlanes/XAllocColorPlanes.m b/xts5/Xlib7/XAllocColorPlanes/XAllocColorPlanes.m new file mode 100644 index 00000000..45064a84 --- /dev/null +++ b/xts5/Xlib7/XAllocColorPlanes/XAllocColorPlanes.m @@ -0,0 +1,660 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XAllocColorPlanes/XAllocColorPlanes.m,v 1.2 2005-11-03 08:43:42 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib7/XAllocColorPlanes/XAllocColorPlanes.m +>># +>># Description: +>># Tests for XAllocColorPlanes() +>># +>># Modifications: +>># $Log: allcclrpln.m,v $ +>># Revision 1.2 2005-11-03 08:43:42 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:29 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:26:55 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:13 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:08 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:40 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:09 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:48:19 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE XAllocColorPlanes Xlib7 +Status +XAllocColorPlanes(display, colormap, contig, pixels_return, ncolors, nreds, ngreens, nblues, rmask_return, gmask_return, bmask_return) +Display *display = Dsp; +Colormap colormap = DefaultColormap(display, DefaultScreen(display)); +Bool contig; +unsigned long *pixels_return = &dummy; +int ncolors = 1; +int nreds; +int ngreens; +int nblues; +unsigned long *rmask_return = &dummy; +unsigned long *gmask_return = &dummy; +unsigned long *bmask_return = &dummy; +>>EXTERN +static unsigned long dummy; + +static int contiguous(mask) +unsigned long mask; +{ + if(!mask) + return(0L); + + while((mask&1) == 0L) + mask>>=1; + mask++; + return( bitcount(mask) == 1); +} + +static int maskshift(mask) +unsigned long mask; +{ + int i = 0; + + if(!mask) + return(0); + + while((mask&1) == 0L) { + mask>>=1; + i++; + } + return(i); +} + +>>ASSERTION Good A +A call to xname allocates +.A ncolors*2pow(nreds+ngreens+nblues) +read/write colourmap entries whose indices in the colourmap are +obtained by ORing each pixel value returned in the +.A pixels_return +argument +with zero or more of the planes obtained by ORing the masks +returned in the +.A rmask_return , +.A gmask_return +and +.A bmask_return +arguments. +>>STRATEGY +For visual class DirectColor: + Create a colormap with alloc set to AllocNone. + Allocate one colour and all planes with XAllocColorPlanes. + Verify that the function did not return zero. + Verify the correct number of cells have been allocated by initialising + them with XStoreColors, and reading them with XQueryColors. +>>CODE +XVisualInfo *vp; +unsigned long vmask = (1<<DirectColor); +unsigned long *pixm, *rr, *gr, *br; +unsigned long rm, gm, bm, pm, rgbmask, pixel, r, g, b; +XColor color, qcolor; +Status status; +int cells; +int rshift, gshift, bshift; + + if( (vmask = visualsupported(display, vmask)) == 0L) { + tet_result(TET_UNSUPPORTED); + return; + } + + resetsupvis(vmask); + nextsupvis(&vp); + + colormap = makecolmap(display, vp->visual, AllocNone); + ncolors = 1; + nreds = bitcount(vp->red_mask); + ngreens = bitcount(vp->green_mask); + nblues = bitcount(vp->blue_mask); + cells = ncolors * (1 << (nreds+ngreens+nblues)); + contig = False; + pixels_return = ± + rmask_return = &rm; + gmask_return = &gm; + bmask_return = &bm; + + status = XCALL; + if(status == (Status) 0) { + report("%s failed to return non-zero", TestName); + FAIL; + } else { + trace("%d cells allocated in the colormap", cells); + CHECK; + } + + rgbmask = rm | gm | bm ; + rshift = maskshift(rm); + gshift = maskshift(gm); + bshift = maskshift(bm); + trace("rgbmask is %x", rgbmask); + trace("red shift is %d", rshift); + trace("green shift is %d", gshift); + trace("blue shift is %d", bshift); + + /* + * The following code works on the assumption that for each subfield, + * all planes in the subfield mask are allocated (so are contiguous). + * + * (It does not assume the subfields are adjacent) + */ + + for(r = 0; r<(1<<nreds); r++) { + pixel = (r<<rshift) | pm; + debug(1, "pixel value %x", pixel); + color.pixel = pixel; + color.flags =DoRed; + color.red = 0xffff; + + startcall(display); + XStoreColor(display, colormap, &color); + endcall(display); + + if(geterr() != Success) { + report("XStoreColor() failed with pixel value %lu", pixel); + FAIL; + } else { + qcolor.pixel = pixel; + startcall(display); + XQueryColor(display, colormap, &qcolor); + endcall(display); + if(geterr() != Success) { + report("XQueryColor() failed with pixel value %lu", pixel); + FAIL; + } else + CHECK; + } + } + + for(g = 0; g<(1<<ngreens); g++) { + pixel = (g<<gshift) | pm; + debug(1, "pixel value %x", pixel); + color.pixel = pixel; + color.flags =DoGreen; + color.green = 0xffff; + + startcall(display); + XStoreColor(display, colormap, &color); + endcall(display); + + if(geterr() != Success) { + report("XStoreColor() failed with pixel value %lu", pixel); + FAIL; + } else { + qcolor.pixel = pixel; + startcall(display); + XQueryColor(display, colormap, &qcolor); + endcall(display); + if(geterr() != Success) { + report("XQueryColor() failed with pixel value %lu", pixel); + FAIL; + } else + CHECK; + } + } + + for(b = 0; b<(1<<nblues); b++) { + pixel = (b<<bshift) | pm; + debug(1, "pixel value %x", pixel); + color.pixel = pixel; + color.flags =DoBlue; + color.blue = 0xffff; + + startcall(display); + XStoreColor(display, colormap, &color); + endcall(display); + + if(geterr() != Success) { + report("XStoreColor() failed with pixel value %lu", pixel); + FAIL; + } else { + qcolor.pixel = pixel; + startcall(display); + XQueryColor(display, colormap, &qcolor); + endcall(display); + if(geterr() != Success) { + report("XQueryColor() failed with pixel value %lu", pixel); + FAIL; + } else + CHECK; + } + } + + CHECKPASS(1 + (1<<nreds) + (1<<ngreens) + (1<<nblues)); +>>ASSERTION Good A +A call to xname sets +.A nreds +bits to one in the mask named by +.A rmask_return , +.A ngreens +bits to one in the mask named by +.A gmask_return , +and +.A nblues +bits to one in the mask named by +.A bmask_return +and returns +.A ncolors +pixels values in the +.A pixels_return +argument +such that no mask has a bit set in common with +any other mask or with any of the pixels. +>>STRATEGY +For the visual class DirectColor: + Create a colormap with alloc set to AllocNone. + Allocate one colour and all planes with XAllocColorPlanes. + Verify the bitcount of the OR of the colourplane masks equals the + sum of the individual bitcounts. + Verify that the AND of the pixel and the OR of the colourplane masks is zero. + Create a colormap with alloc set to AllocNone. + Allocate 3 colours and 3 planes with XAllocColorPlanes. + Verify the bitcount of the OR of the colourplane masks equals the + sum of the individual bitcounts. + Verify that the AND of each pixel and the OR of the colourplane masks is zero. +>>CODE +XVisualInfo *vp; +unsigned long vmask = (1<<DirectColor); +unsigned long *pixm, *rr, *gr, *br; +unsigned long rm, gm, bm, pm, rgbmask; +unsigned long pm_array[3], i; +Status status; +int cells, rnreds, rngreens, rnblues; + + if( (vmask = visualsupported(display, vmask)) == 0L) { + tet_result(TET_UNSUPPORTED); + return; + } + + resetsupvis(vmask); + nextsupvis(&vp); + + colormap = makecolmap(display, vp->visual, AllocNone); + ncolors = 1; + nreds = bitcount(vp->red_mask); + ngreens = bitcount(vp->green_mask); + nblues = bitcount(vp->blue_mask); + cells = ncolors * (1 << (nreds+ngreens+nblues)); + contig = False; + pixels_return = ± + rmask_return = &rm; + gmask_return = &gm; + bmask_return = &bm; + + status = XCALL; + if(status == (Status) 0) { + report("%s failed to return non-zero", TestName); + FAIL; + } else { + trace("%d cells allocated in the colormap", cells); + CHECK; + } + + rnreds = bitcount(rm); + rngreens = bitcount(gm); + rnblues = bitcount(bm); + + if( (rnreds != nreds) || (rngreens != ngreens) || (rnblues != nblues) ) { + report("Request for %d reds %d greens %d blues returned %d reds %d greens %d blues.", + nreds, ngreens, nblues, rnreds, rngreens, rnblues); + FAIL; + } else + CHECK; + + rgbmask = rm | gm | bm ; + + if( bitcount(rgbmask) != rnreds + rnblues + rngreens) { + report("The returned colourplane masks had at least one shared bit."); + FAIL; + } else + CHECK; + + if( (rgbmask & pm) != 0L) { + report("A pixel shared at least one bit with a colourplane."); + FAIL; + } else + CHECK; + + /* + * Repeat requesting a number of colours and fewer planes. + */ + colormap = makecolmap(display, vp->visual, AllocNone); + + ncolors = 3; + /* Make sure that this visual is big enough to support so many colours */ + if (ncolors > bitcount(vp->blue_mask)) + ncolors = bitcount(vp->blue_mask); + if (ncolors > bitcount(vp->green_mask)) + ncolors = bitcount(vp->green_mask); + if (ncolors > bitcount(vp->red_mask)) + ncolors = bitcount(vp->red_mask); + debug(1, "ncolors = %d", ncolors); + + nreds = 1; + ngreens = 1; + nblues = 1; + cells = ncolors * (1 << (nreds+ngreens+nblues)); + contig = False; + pixels_return = &pm_array[0]; + rmask_return = &rm; + gmask_return = &gm; + bmask_return = &bm; + + status = XCALL; + if(status == (Status) 0) { + report("%s failed to return non-zero", TestName); + FAIL; + } else { + trace("%d cells allocated in the colormap", cells); + CHECK; + } + + rnreds = bitcount(rm); + rngreens = bitcount(gm); + rnblues = bitcount(bm); + + if( (rnreds != nreds) || (rngreens != ngreens) || (rnblues != nblues) ) { + report("Request for %d reds %d greens %d blues returned %d reds %d greens %d blues.", + nreds, ngreens, nblues, rnreds, rngreens, rnblues); + FAIL; + } else + CHECK; + + rgbmask = rm | gm | bm ; + + if( bitcount(rgbmask) != rnreds + rnblues + rngreens) { + report("The returned colourplane masks had at least one shared bit."); + FAIL; + } else + CHECK; + + for (i = 0; i < ncolors; i++) { + pm = pm_array[i]; + trace("pixel value of 0x%lx", pm); + if( (rgbmask & pm) != 0L) { + report("pixel value %ld shared at least one bit with a colourplane.", pm); + FAIL; + } else + CHECK; + if ((pm & ~DEPTHMASK(vp->depth)) != 0L) { + report("pixel value 0x%lx contained bits outside the depth", pm); + FAIL; + } else + CHECK; + } + + CHECKPASS(7+2*ncolors); + +>>ASSERTION Good A +If the visual class +.S DirectColor +is supported: +When the visual type of the +.A colormap +argument is +.S DirectColor , +then +.A rmask_return +lies within the red pixel subfield +and +the +.A gmask_return +lies within the green pixel subfield +and +the +.A bmask_return +lies within the blue pixel subfield. +>>STRATEGY +For the visual class DirectColor: + Create a colormap with alloc set to AllocNone. + Allocate one colour and all planes with XAllocColorPlanes. + Verify that the returned masks and the colour subfield masks are identical. +>>CODE +XVisualInfo *vp; +unsigned long vmask = (1<<DirectColor); +unsigned long *pixm, *rr, *gr, *br; +unsigned long rm, gm, bm, pm, rgbmask, pixel, i; +Status status; +int cells; + + if( (vmask = visualsupported(display, vmask)) == 0L) { + tet_result(TET_UNSUPPORTED); + return; + } + + resetsupvis(vmask); + nextsupvis(&vp); + + colormap = makecolmap(display, vp->visual, AllocNone); + ncolors = 1; + nreds = bitcount(vp->red_mask); + ngreens = bitcount(vp->green_mask); + nblues = bitcount(vp->blue_mask); + cells = ncolors * (1 << (nreds+ngreens+nblues)); + contig = False; + pixels_return = ± + rmask_return = &rm; + gmask_return = &gm; + bmask_return = &bm; + + status = XCALL; + if(status == (Status) 0) { + report("%s failed to return non-zero", TestName); + FAIL; + } else { + trace("%d cells allocated in the colormap", cells); + CHECK; + } + + /* + * We can check the mask returned matches the pixel subfield exactly + * since we requested all planes to be allocated. + */ + if( (vp->red_mask != rm) ) { + report("Returned red mask not contained in red pixel subfield"); + FAIL; + } else + CHECK; + if( (vp->green_mask != gm) ) { + report("Returned green mask not contained in green pixel subfield"); + FAIL; + } else + CHECK; + if( (vp->blue_mask != bm) ) { + report("Returned blue mask not contained in blue pixel subfield"); + FAIL; + } else + CHECK; + + CHECKPASS(4); + +>>ASSERTION Good A +When the +.A contig +argument is +.S True , +then +.A rmask_return , +.A gmask_return +and +.A bmask_return +each contains a contiguous set of bits set to one. +>>STRATEGY +For the visual class DirectColor: + Create a colormap with alloc set to AllocNone. + Allocate one colour and some planes with XAllocColorPlanes and contig = True. + Verify that the returned masks were contiguous. +>>CODE +XVisualInfo *vp; +unsigned long vmask = (1<<DirectColor); +unsigned long *pixm, *rr, *gr, *br; +unsigned long rm, gm, bm, pm, rgbmask, pixel, i; +XColor color; +Status status; +int cells; + + if( (vmask = visualsupported(display, vmask)) == 0L) { + tet_result(TET_UNSUPPORTED); + return; + } + + resetsupvis(vmask); + nextsupvis(&vp); + + colormap = makecolmap(display, vp->visual, AllocNone); + ncolors = 1; + nreds = bitcount(vp->red_mask); + ngreens = bitcount(vp->green_mask); + nblues = bitcount(vp->blue_mask); + cells = ncolors * (1 << (nreds+ngreens+nblues)); + contig = True; + pixels_return = ± + rmask_return = &rm; + gmask_return = &gm; + bmask_return = &bm; + + /* + * Just ask for a small number of planes if more was possible. + * Originally this test requested all planes - but of course this + * gave little scope for contig to make any difference. + */ + if(nreds > 2) + nreds = 2; + if(ngreens > 2) + ngreens = 2; + if(nblues > 2) + nblues = 2; + trace("test with %d reds %d greens %d blues", nreds, ngreens, nblues); + + status = XCALL; + if(status == (Status) 0) { + report("%s failed to return non-zero", TestName); + FAIL; + } else { + trace("%d cells allocated in the colormap", cells); + CHECK; + } + + if((contiguous(rm) && contiguous(gm) && contiguous(bm)) == 0) { + report("Returned colourplane masks were not contiguous"); + FAIL; + } else + CHECK; + + CHECKPASS(2); + +>>ASSERTION Bad A +.ER BadColor +>>ASSERTION Bad A +When the +.A ncolors +argument is zero, then a +.S BadValue +error occurs. +>>STRATEGY +For all supported visual classes: + Create a colormap with alloc set to AllocNone. + Call XAllocColorPlanes with ncolors = 0. +>>CODE BadValue +XVisualInfo *vp; +Visual *visual; +unsigned long vmask = (1<<DirectColor); + + if( (vmask = visualsupported(display, vmask)) == 0L) { + tet_result(TET_UNSUPPORTED); + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + colormap = makecolmap(display, vp->visual, AllocNone); + ncolors = 0; + XCALL; + if(geterr() == BadValue) + CHECK; + } + + CHECKPASS(nsupvis()); + +>>ASSERTION Bad A +.ER BadValue contig True False +>>#HISTORY Cal Completed Written in new style and format 4/12/90 +>>#HISTORY Cal Action Writing code. diff --git a/xts5/Xlib7/XAllocNamedColor/XAllocNamedColor.m b/xts5/Xlib7/XAllocNamedColor/XAllocNamedColor.m new file mode 100644 index 00000000..56611d24 --- /dev/null +++ b/xts5/Xlib7/XAllocNamedColor/XAllocNamedColor.m @@ -0,0 +1,444 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XAllocNamedColor/XAllocNamedColor.m,v 1.2 2005-11-03 08:43:42 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib7/XAllocNamedColor/XAllocNamedColor.m +>># +>># Description: +>># Tests for XAllocNamedColor() +>># +>># Modifications: +>># $Log: allcnmdclr.m,v $ +>># Revision 1.2 2005-11-03 08:43:42 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:29 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:26:56 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:14 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.1 1998/07/25 00:17:31 mar +>># req.4.W.00121: avoid undefined ANSI usage +>># +>># Revision 6.0 1998/03/02 05:19:09 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:40 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:11 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:48:22 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE XAllocNamedColor Xlib7 +Status +XAllocNamedColor(display, colormap, color_name, screen_def_return, exact_def_return) +Display *display = Dsp; +Colormap colormap = DefaultColormap(display, DefaultScreen(display)); +char *color_name = ""; +XColor *screen_def_return = &dummycol; +XColor *exact_def_return = &dummycol; +>>EXTERN +XColor dummycol; +>>ASSERTION Good A +A call to xname +allocates a read-only entry in the +.A colormap +argument +corresponding to the named colour specified by the +.A color_name +argument and +returns the exact RGB values in the +.M red , +.M green , +and +.M blue +components in the +.S XColor +structure named by the +.A exact_def_return +argument, +returns the closest colour supported by the screen with which the +.A colormap +argument is associated in the +.M red , +.M green , +and +.M blue +components in the +.S XColor +structure named by the +.A screen_def_return +argument +and returns the colourmap entry in the +.M pixel +component in the +.S XColor +structure named by the +.A screen_def_return +argument. +>>STRATEGY +For each supported visual type: + Create a colourmap with alloc set to AllocNone. + Allocate a read/only cell with colour XT_GOOD_COLORNAME + in the colourmap with XAllocNamedColor. + Verify that the function returned non-zero. + Allocate a read/only cell using returned RGB values with XAllocColor + (which is assumed to return correct RGB values) . + Verify that the pixel value and the RBG values from both calls are identical. + (so XAllocNamedColor previously returned correct RGB values) +>>CODE +XVisualInfo *vp; +char *goodname; +Status status; +XColor screencol, exactcol, testcol; +unsigned long vmask; +unsigned short trunc; + + if( (vmask = visualsupported(display, 0L)) == 0L) { + delete("No visuals reported as valid."); + return; + } + + if( (goodname = tet_getvar("XT_GOOD_COLORNAME")) == (char *) 0) { + delete("XT_GOOD_COLORNAME is not defined."); + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + trace("Attempting XAllocNamedColor() for class %s, color %s", displayclassname(vp->class), goodname); + colormap = makecolmap(display, vp -> visual, AllocNone); + color_name = goodname; + screen_def_return = &screencol; + exact_def_return = &exactcol; + status = XCALL; + + if( status == (Status) 0) { + report("%s failed to return non-zero.", TestName); + FAIL; + continue; + } else + CHECK; + + testcol = screencol; + trace("Screen: pixel %lu, r %u g %u b %u", screencol.pixel , screencol.red, screencol.green, screencol.blue); + trace("Exact : pixel %lu, r %u g %u b %u", exactcol.pixel, exactcol.red, exactcol.green, exactcol.blue); + trace("Test : pixel %lu, r %u g %u b %u", testcol.pixel, testcol.red, testcol.green, testcol.blue); + + status = XAllocColor(display, colormap, &testcol); + if(status == (Status) 0) { + report("XAllocColor() failed to return non-zero."); + FAIL; + continue; + } else + CHECK; + + trace("Exact : pixel %lu, r %u g %u b %u", exactcol.pixel, exactcol.red, exactcol.green, exactcol.blue); + + if( screencol.pixel != testcol.pixel ) { + report("%s return pixel value %lu instead of %lu.", + TestName, screencol.pixel, testcol.pixel); + FAIL; + } else + CHECK; + + if((screencol.red != testcol.red) || + (screencol.green != testcol.green) || + (screencol.blue != testcol.blue) ) { + report("%s return RGB values r %u g %u b %u instead of r %u g %u b %u.", + TestName, + screencol.red, screencol.green, screencol.blue, + testcol.red, testcol.green, testcol.blue); + FAIL; + } else + CHECK; + } + + CHECKPASS(4 * nsupvis()); + +>>ASSERTION Good A +When the +.A color_name +argument refers to a colour in the colour database, then xname +returns non-zero. +>>STRATEGY +For each supported visual type: + Create a colourmap with alloc set to AllocNone. + Allocate a read/only cell with colour XT_GOOD_COLORNAME + in the colourmap with XAllocNamedColor. + Verify that the function returned non-zero. +>>CODE +XVisualInfo *vp; +char *goodname; +Status status; +XColor screencol, exactcol, testcol; +unsigned long vmask; +unsigned short trunc; + + if( (vmask = visualsupported(display, 0L)) == 0L) { + delete("No visuals reported as valid."); + return; + } + + if( (goodname = tet_getvar("XT_GOOD_COLORNAME")) == (char *) 0) { + delete("XT_GOOD_COLORNAME is not defined."); + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + trace("Attempting XAllocNamedColor() for class %s, color %s", displayclassname(vp->class), goodname); + colormap = makecolmap(display, vp -> visual, AllocNone); + color_name = goodname; + screen_def_return = &screencol; + exact_def_return = &exactcol; + status = XCALL; + if( status == (Status) 0) { + report("%s failed to return non-zero with color %s.", + TestName, goodname); + FAIL; + } else + CHECK; + } + + CHECKPASS(nsupvis()); + +>>ASSERTION Good A +When the +.A color_name +argument does not refer to a colour in the colour database, then xname +returns zero. +>>STRATEGY +For each supported visual type: + Create a colomap with alloc set to AllocNone. + Allocate a read/only cell with colour XT_BAD_COLORNAME + in the colourmap with XAllocNamedColor. + Verify that the function returned zero. +>>CODE +XVisualInfo *vp; +char *badname; +Status status; +XColor screencol, exactcol, testcol; +unsigned long vmask; +unsigned short trunc; + + if( (vmask = visualsupported(display, 0L)) == 0L) { + delete("No visuals reported as valid."); + return; + } + + if( (badname = tet_getvar("XT_BAD_COLORNAME")) == (char *) 0) { + delete("XT_BAD_COLORNAME is not defined."); + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + trace("Attempting XAllocNamedColor() for class %s, color %s", displayclassname(vp->class), badname); + colormap = makecolmap(display, vp -> visual, AllocNone); + color_name = badname; + screen_def_return = &screencol; + exact_def_return = &exactcol; + status = XCALL; + if( status != (Status) 0) { + report("%s failed to return zero with color %s.", + TestName, badname); + FAIL; + } else + CHECK; + } + + CHECKPASS(nsupvis()); + + +>>ASSERTION Good A +Upper and lower case characters in the +.A color_name +argument refer to the same colour. +>>STRATEGY +For each supported visual type: + Create a colomap with alloc set to AllocNone. + Allocate a read/only cell with colour name XT_GOOD_COLORNAME + in the colourmap with XAllocNamedColor. + Allocate a read/only cell with colour name XT_GOOD_COLORNAME, + with alternate characters in alternating case, + in the colourmap with XAllocNamedColor. + Verify that the function returned non-zero. + Verify that the exact and closest supported rbg values from both calls + are identical. + Verify that the pixel value of the cell allocated by both calls + is the same. +>>CODE +XVisualInfo *vp; +char *cp, *goodname, *casename; +Status status; +XColor screencol, exactcol, alscreencol, alexactcol; +unsigned long vmask; +unsigned short trunc; +int i; + + if( (vmask = visualsupported(display, 0L)) == 0L) { + delete("No visuals reported as valid."); + return; + } + + if( (goodname = tet_getvar("XT_GOOD_COLORNAME")) == (char *) 0) { + delete("XT_GOOD_COLORNAME is not defined."); + return; + } + + casename = (char *) malloc( strlen(goodname) + 1); + strcpy(casename, goodname); + + for(i=0, cp=casename; *cp; i++, cp++) + if(i&1) + *cp = tolower(*cp); + else + *cp = toupper(*cp); + + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + trace("Attempting XAllocNamedColor() for class %s, color %s", displayclassname(vp->class), goodname); + colormap = makecolmap(display, vp -> visual, AllocNone); + color_name = goodname; + screen_def_return = &screencol; + exact_def_return = &exactcol; + status = XCALL; + + if( status == (Status) 0) { + report("%s failed to return non-zero with color %s.", + TestName, goodname); + FAIL; + continue; + } else + CHECK; + + color_name = casename; + trace("Testing colourname %s", color_name); + screen_def_return = &alscreencol; + exact_def_return = &alexactcol; + status = XCALL; + + if( status == (Status) 0) { + report("%s failed to return non-zero with color %s.", + TestName, casename); + FAIL; + continue; + } else + CHECK; + + if(screencol.pixel != alscreencol.pixel) { + report("%s for name %s", TestName, casename); + report("returned pixel value %lu", alscreencol.pixel); + report("%s for name %s", TestName, goodname); + report("returned pixel value %lu", screencol.pixel); + FAIL; + } else + CHECK; + + if((exactcol.red != alexactcol.red) || + (exactcol.green != alexactcol.green) || + (exactcol.blue != alexactcol.blue)) { + report("%s for name %s", TestName, casename); + report("returned exact RGB values r %u g %u b %u", + alexactcol.red, alexactcol.green, alexactcol.blue); + report("%s for name %s", TestName, goodname); + report("returned exact RGB values r %u g %u b %u", + exactcol.red, exactcol.green, exactcol.blue); + FAIL; + } else + CHECK; + + if((screencol.red != alscreencol.red) || + (screencol.green != alscreencol.green) || + (screencol.blue != alscreencol.blue)) { + report("%s for name %s", TestName, casename); + report("returned closest RGB values r %u g %u b %u", + alscreencol.red, alscreencol.green, alscreencol.blue); + report("%s for name %s", TestName, goodname); + report("returned closest RGB values r %u g %u b %u", + screencol.red, screencol.green, screencol.blue); + FAIL; + } else + CHECK; + } + + free(casename); + CHECKPASS(5 * nsupvis()); + +>>ASSERTION Bad A +.ER BadColor +>>ASSERTION Bad B 1 +.ER Alloc +>>#HISTORY Cal Completed Written in new format and style. +>>#HISTORY Kieron Completed <Have a look> +>>#HISTORY Cal Action Writting code. diff --git a/xts5/Xlib7/XCopyColormapAndFree/XCopyColormapAndFree.m b/xts5/Xlib7/XCopyColormapAndFree/XCopyColormapAndFree.m new file mode 100644 index 00000000..2fa77664 --- /dev/null +++ b/xts5/Xlib7/XCopyColormapAndFree/XCopyColormapAndFree.m @@ -0,0 +1,524 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XCopyColormapAndFree/XCopyColormapAndFree.m,v 1.2 2005-11-03 08:43:42 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib7/XCopyColormapAndFree/XCopyColormapAndFree.m +>># +>># Description: +>># Tests for XCopyColormapAndFree() +>># +>># Modifications: +>># $Log: cpyclrmpan.m,v $ +>># Revision 1.2 2005-11-03 08:43:42 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:30 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:26:56 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:14 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:09 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:41 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:13 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:48:25 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE XCopyColormapAndFree Xlib7 +Colormap +XCopyColormapAndFree(display, colormap) +Display *display = Dsp; +Colormap colormap = DefaultColormap(display, DefaultScreen(display)); +>>ASSERTION Good A +A call to xname creates a colourmap of the same visual type and for the same screen as the +.A colormap +argument and returns the new colourmap ID. +>>STRATEGY +For each supported visual: + Create a colourmap using XCreateColormap with alloc set to AllocNone. + Allocate one r/o cell, get it's actual rgb values + Allocate the rest of the cmap as r/w and store known values, read them back. + Create a new colourmap with XCopyColormapAndFree. + Check that it contains the values we know we had in the original. + Verify that no error occurred. + +>>CODE +Colormap testcmap; +XVisualInfo *vp; +unsigned long vmask = (1<<DirectColor)|(1<<PseudoColor)|(1<<GrayScale); +XColor *cellmap, *cellptr; +XColor cell; +unsigned long l; +unsigned int i; +int pathcnt = 0, size; +XColor color, color1, color2, ncol1, ncol2; +Display *disp2; + + + if( (vmask = visualsupported(display, vmask)) == 0L) { + UNSUPPORTED; + return; + } + + color1.pixel = 0xffff; + color1.red = 0x0ff0; + color1.green = 0xf0f0; + color1.blue = 0x0f0f; + color1.flags = DoRed|DoGreen|DoBlue; + + color2.pixel = 1; + color2.red = 0xffff; + color2.green = 0xffff; + color2.blue = 0xffff; + color2.flags = DoRed|DoGreen|DoBlue; + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + + colormap = makecolmap(display, vp->visual, AllocNone); + size = maxsize(vp); + + cellmap = (XColor *) malloc(size * sizeof(XColor)); + + if (cellmap == (XColor *)NULL) { + delete("malloc failure"); + return; + } else + CHECK; + + *cellmap = color1; + + if( XAllocColor(display, colormap, cellmap) == False ) { + delete("XAllocColor() failed to allocate a r/o colourcell"); + return; + } + XQueryColor(display, colormap, cellmap); + + for(i=1, cellptr = cellmap+1; i < size; i++, cellptr++) { + if(XAllocColorCells(display, colormap, False, 0, 0L, &(cellptr->pixel), 1) == False ) { + delete("XAllocColorCells() failed to allocate a r/w colourcell (%d)",i); + return; + } + cellptr->red = 0xffff; + cellptr->green = 0xf00f; + cellptr->blue = 0x0ff0; + cellptr->flags = DoRed|DoGreen|DoBlue; + XStoreColor(display, colormap, cellptr); + XQueryColor(display, colormap, cellptr); + } + if(i == size) + CHECK; + + testcmap = XCALL; + + for(i=0, cellptr = cellmap; i< size; i++, cellptr++) { + cell.pixel = cellptr->pixel; + cell.flags = DoRed|DoGreen|DoBlue; + XQueryColor(display, testcmap, &cell); + if( (cell.red != cellptr->red) || + (cell.green != cellptr->green) || (cell.blue != cellptr->blue) ){ + report("Copied colourmap cell pixel %ld had r %u g %u b %u instead of pixel %ld r %u g %u b %u", + cell.pixel, cell.red, cell.green, cell.blue, + cellptr->pixel, cellptr->red, cellptr->green, cellptr->blue); + FAIL; + } + + if(i==size) + CHECK; + } + } + + CHECKPASS(2*nsupvis()); + +>>ASSERTION Good C +When the +.A colormap +argument +was created by the client with +.A alloc +set to +.S AllocAll , +then all entries from the +argument +.A colormap +are moved to the new colourmap with the same colour values +and are freed +in +.A colormap . +>>STRATEGY +For each supported visual class: + Create a colormap with using XCreateColormap with alloc set to AllocAll. + Fill with recognisable values. + For each of the colour cells, record the rgb value with XQueryColors. + Create a new colourmap with XCopyColormapAndFree. + Verify that colourmap entries are identical with XQueryColors. + Verify that all the previous cells in the original colormap are freed (i.e. + that they can all be reallocated again). +>>CODE +Colormap testcmap; +XVisualInfo *vp; +unsigned long vmask = (1<<DirectColor)|(1<<PseudoColor)|(1<<GrayScale); +XColor *cellmap, *cellptr; +XColor cell; +unsigned long l; +int i; +int pathcnt = 0; +int size; + + if( (vmask = visualsupported(display, vmask)) == 0L) { + UNSUPPORTED; + return; + } + + for (resetsupvis(vmask); nextsupvis(&vp); ) { + + colormap = makecolmap(display, vp->visual, AllocAll); + size = maxsize(vp); + cellmap = (XColor *) malloc( (size * sizeof(XColor))); + if(cellmap == (XColor *) 0) { + delete("malloc() failed to allocate memory for XColor array."); + return; + } + +/* fill colour map with some recognisable and distinguishable values */ + for(l=0, cellptr=cellmap; l< size; l++, cellptr++) { + cellptr->pixel = l; + cellptr->green = cellptr->blue = cellptr->red = l << 8; + cellptr->flags = DoRed | DoGreen | DoBlue; + } + XStoreColors(display, colormap, cellmap, size); + +/* server sets to "closest available values" so find what they were */ + XQueryColors(display, colormap, cellmap, size); + + testcmap = XCALL; + + pathcnt += size; + + for(l=0, cellptr=cellmap; l < size; l++, cellptr++) { + cell.pixel = l; + XQueryColor(display, testcmap, &cell); + if((cell.pixel != cellptr->pixel) || (cell.red != cellptr->red) || + (cell.green != cellptr->green) || (cell.blue != cellptr->blue)) { + report("Cell %lu had pixelvalue %lu (r %u g %u b %u) instead of pixelvalue %lu (r %u g %u b %u)", + l, + cell.pixel, cell.red, cell.green, cell.blue, + cellptr->pixel, cellptr->red, cellptr->green, cellptr->blue); + FAIL; + } else + CHECK; + } + + for(l=0; l < size; l++) { + if (XAllocColorCells(display, colormap, False, NULL, 0, &cell.pixel, 1) == False) { + report("Cell %u was not deallocated.", l); + FAIL; + } else + CHECK; + } + + free(cellmap); + } + + CHECKPASS(pathcnt*2); + +>>ASSERTION Good C +If any of the visual classes +.S PseudoColor , +.S GrayScale , +or +.S DirectColor +are supported: +When the +.A colormap +argument +was created by the client with +.S AllocNone , +then all of the entries from the +.A colormap +argument +that have been +allocated by the client using +.S XAllocColor , +.S XAllocNamedColor , +.S XAllocColorCells , +or +.S XAllocColorPlanes +and not freed since they were allocated +are moved to the new colourmap with the same colour values +and the same read-only or writable characteristics and are freed +in +.A colormap . +>>STRATEGY +For each of the visual classes DirectColor, PseudoColor and GrayScale: + Create a colormap with XCreateColormap and AllocNone. + Create a new client with XOpenDisplay. + Allocate two ro cells for First client with XAllocColor. + Record their rgb values. + Allocate two rw cells for First client with XAllocColorCells. + Set their rgb values and record their rgb values. + Allocate the rest of the colormap for Second client with XAllocColorCells. + First client copies the colormap and free owned cells with with XCopyColormapAndFree. + Verify that the Second clients cells in copy are not allocated with XAllocColorCells. + Verify that the First clients four cells in copy are still there with correct rgb values. + Verify that the four allocated cells are freed, can be reallocated, in old cmap. + Verify r/o and r/w behaviour of these 4 in copy, with XStoreColors. + +>>EXTERN +static Bool check_rgb(dpy, cmap, xcp) + Display *dpy; + Colormap cmap; + XColor *xcp; +{ + XColor ncol; + + ncol.pixel = xcp->pixel; + ncol.flags = DoRed | DoGreen | DoBlue; + XQueryColor(dpy, cmap, &ncol); + + if ( ncol.red != xcp->red || ncol.green != xcp->green || ncol.blue != xcp->blue ) { + report("mismatch, got rgb = 0x%x,0x%x,0x%x instead of 0x%x,0x%x,0x%x for pixel %lu", + ncol.red, ncol.green, ncol.blue, + xcp->red, xcp->green, xcp->blue, xcp->pixel); + return False; + } else + return True; +} +>>CODE +Colormap testcmap; +XVisualInfo *vp; +unsigned long vmask = (1<<DirectColor)|(1<<PseudoColor)|(1<<GrayScale); +XColor *cellmap, *cellptr; +XColor cell; +unsigned long l; +int i; +int pathcnt = 0, size; +XColor color, ncol1, ncol2, cols[4]; +Display *disp2; +unsigned long pix[2]; +unsigned long *copypix; + + if( (vmask = visualsupported(display, vmask)) == 0L) { + UNSUPPORTED; + return; + } + + cols[0].pixel = 0xffff; + cols[0].red = 0x0ff0; + cols[0].green = 0xf0f0; + cols[0].blue = 0x0f0f; + cols[0].flags = DoRed|DoGreen|DoBlue; + + cols[1].pixel = 1; + cols[1].red = 0xffff; + cols[1].green = 0xffff; + cols[1].blue = 0xffff; + cols[1].flags = DoRed|DoGreen|DoBlue; + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + + disp2 = opendisplay(); + colormap = makecolmap(display, vp->visual, AllocNone); +/* Allocate 2 r/o cells for a new client */ +/* set them and find what they ended up as */ + if (XAllocColor(display, colormap, &cols[0]) == False) { + delete("failed to allocate first r/o cell."); + return; + } else + CHECK; + trace("r/o Pixel value allocated was %lu", cols[0].pixel); + XQueryColor(display, colormap, &cols[0]); + + if (XAllocColor(display, colormap, &cols[1]) == False) { + delete("failed to allocate second r/o cell."); + return; + } else + CHECK; + trace("r/o Pixel value allocated was %lu", cols[1].pixel); + XQueryColor(display, colormap, &cols[1]); + + size = maxsize(vp) - 4; + if (size >= 0) { +/* Allocate 2 r/w cells for a new client */ + if(XAllocColorCells(display, colormap, False, 0L, 0, pix, 2) == False) { + delete("XAllocColorCells() failed."); + return; + } +/* set the 2 r/w cells to the same values as the first two. */ + cols[2] = cols[0]; + cols[2].pixel = pix[0]; + cols[3] = cols[1]; + cols[3].pixel = pix[1]; + trace("r/w Pixel values allocated were %lu & %lu", + cols[2].pixel, cols[3].pixel); + XStoreColors(display, colormap, &cols[2], 2); + XQueryColors(display, colormap, &cols[2], 2); + CHECK; + } else + CHECK; + +/* Allocate remaining cells to the other client */ + debug(1, "size=%d, maxsize=%d", size, maxsize(vp)); + copypix = (unsigned long *) malloc( maxsize(vp) * sizeof(unsigned long)); + + for(i=0; i < size; i++) { + if( XAllocColorCells(disp2, colormap, False, 0L, 0, ©pix[i], 1) == False) { + delete("XAllocColorCells failed after %d cells", i); + return; + } + } + + if( XAllocColorCells(disp2, colormap, False, 0L, 0, ©pix[i], 1) != False) { + trace("Did not fail as expected"); + } else + CHECK; + +/* do copy and free with first client */ + testcmap = XCALL; + +/* check remaining ones are free in copy */ + for ( i=0; XAllocColorCells(disp2, testcmap, False, 0L, 0, ©pix[i], 1) != False; i++) { + ; /* do nothing */ + } + if ( (size >= 0 && i != size) || (size < 0 && i > 0) ) { + report("allocated %d cells instead of %d, in copy", + i, (size >= 0) ? size : 0); + FAIL; + } else + CHECK; + +/* now check the first four cells of copy are as we set them in original. */ + + if (!check_rgb(disp2, testcmap, &cols[0]) | + !check_rgb(disp2, testcmap, &cols[1]) | + (size >= 0 && !check_rgb(disp2, testcmap, &cols[2])) | + (size >= 0 && !check_rgb(disp2, testcmap, &cols[3])) ) { + report("RGB values not the same!"); + FAIL; + } else + CHECK; +/* should check that can now allocate 4 more in old cmap */ + for(i=0; i < 4; i++) { + if (size < 0 && i > 1) { + CHECK; + } + else if( XAllocColorCells(disp2, colormap, False, 0L, 0, ©pix[i], 1) == False) { + report("Could not allocate the supposedly freed cell (%d) in original cmap", i); + FAIL; + } else { + trace("allocated cell %d, pixel %lu", i, copypix[i]); + CHECK; + } + } + + if( XAllocColorCells(disp2, colormap, False, 0L, 0, ©pix[i], 1) != False) { + report("Allocated one more cell in original cmap than expected"); + FAIL; + } else + CHECK; +/* chould check that the r/w or r/o characteristics are preserved in copy */ + startcall(disp2); + XStoreColors(disp2, testcmap, cols, 2); + endcall(disp2); + if (geterr() != BadAccess) { + report("Trying to update 2 r/o cells. Got %s, Expecting BadAccess", errorname(geterr())); + FAIL; + } else + CHECK; + + if (size >= 0) { + startcall(disp2); + XStoreColors(disp2, testcmap, &cols[2], 2); + endcall(disp2); + if (geterr() != Success) { + report("Trying to update 2 r/w cells. Got %s, Expecting Success", errorname(geterr())); + FAIL; + } else + CHECK; + } else + CHECK; + } + + CHECKPASS(13*nsupvis()); + +>>ASSERTION Bad B 1 +.ER BadAlloc +>>ASSERTION Bad A +.ER BadColor +>>#HISTORY Cal Completed Written in new format and style - 3/11/90. +>>#HISTORY Kieron Completed <Have a look> +>>#HISTORY Cal Completed Writing code. +>>#HISTORY Kieron Completed re-writing code and strategy. diff --git a/xts5/Xlib7/XCreateColormap/XCreateColormap.m b/xts5/Xlib7/XCreateColormap/XCreateColormap.m new file mode 100644 index 00000000..7842de23 --- /dev/null +++ b/xts5/Xlib7/XCreateColormap/XCreateColormap.m @@ -0,0 +1,630 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XCreateColormap/XCreateColormap.m,v 1.2 2005-11-03 08:43:43 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib7/XCreateColormap/XCreateColormap.m +>># +>># Description: +>># Tests for XCreateColormap() +>># +>># Modifications: +>># $Log: crtclrmp.m,v $ +>># Revision 1.2 2005-11-03 08:43:43 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:31 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:26:57 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:15 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:10 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:41 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:15 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:48:29 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE XCreateColormap Xlib7 +Colormap +XCreateColormap(display, win, visual, alloc) +Display *display = Dsp; +Window win = DRW(display); +Visual *visual = &dummyvisual; +int alloc = AllocNone; +>>EXTERN +Visual dummyvisual; +>>ASSERTION Good A +A call to xname +creates a colourmap of the type +.A visual +on the screen for which the +.A window +argument was created +and returns a colourmap ID. +>>STRATEGY +For each visual type + Create a colourmap for that visual. + Verify that the colourpmap is usable by Installing it. +>>CODE +XVisualInfo *vp; +Colormap cmap; +Display *d2; +Window w2; +int i; + + + alloc = AllocNone; + for (resetvinf(VI_WIN); nextvinf(&vp); ) { + + win = makewin(display, vp); + visual = vp->visual; + cmap = XCALL; + /* + * The only way that we can really check that we have a valid colourmap + * is to try and use it. So try to install it. Of course it + * could be that the install routine is broken but the point is that + * something is wrong. Print out both routine names to alert the tester + * about possible sources of the problem. + */ + CATCH_ERROR(display); + XInstallColormap(display, cmap); + RESTORE_ERROR(display); + if (GET_ERROR(display) != Success) { + report("Result of a XCreateColormap could not be used with XInstallColormap"); + FAIL; + } else { + CATCH_ERROR(display); + XUninstallColormap(display, cmap); + RESTORE_ERROR(display); + + if (GET_ERROR(display) != Success) { + report("Result of a XCreateColormap could not be used with XUninstallColormap"); + FAIL; + } else + CHECK; + } + } + CHECKPASS(nvinf()); + +>>ASSERTION Good D 2 +If any of the visual classes +.S StaticGray , +.S StaticColor +or +.S TrueColor +are supported: +When xname is called with a visual class that is one of +.S StaticGray , +.S StaticColor +or +.S TrueColor +and alloc is +.S AllocNone , +then the entries have defined values specific to the visual that are +implementation defined. +>>STRATEGY +For the visual classes TrueColor, StaticColor and StaticGray: + Verify that a colormap of that class can be created with XCreateColormap. +>>CODE +Colormap cmap; +XVisualInfo *vp; +unsigned long vmask = ((1L<<TrueColor) | (1L<<StaticColor) | (1L<<StaticGray)); + + if( (vmask = visualsupported(display, vmask)) == 0L) { + unsupported("TrueColor, StaticColor and StaticGray are not supported"); + return; + } + + alloc = AllocNone; + for ( resetsupvis(vmask); nextsupvis(&vp); ) { + + visual = vp->visual; + cmap = XCALL; + if (geterr() == Success) + CHECK; + } + + CHECKUNTESTED(nsupvis()); + +>>ASSERTION Good C +If any of the visual classes +.S PseudoColor , +.S GrayScale +or +.S DirectColor +are supported: +When xname is called with a visual class that is one of +.S PseudoColor , +.S GrayScale +or +.S DirectColor +and alloc is +.S AllocNone , +then the colourmap has no allocated entries. +>>STRATEGY +For each visual class PseudoColor, GrayScale and DirectColor: + Create a colourmap with alloc set to AllocNone. + Verify that no cells were allocated by Allocating all the colourmap cells + with XAllocColorCells. +>>CODE +Colormap cmap; +XVisualInfo *vi; +Status status; +unsigned long *pix; +unsigned long vmask; +int n; + + +#define RW_COLORMAP_MASK ((1L<<DirectColor) | (1L<<PseudoColor) | (1L<<GrayScale)) + + if( (vmask = visualsupported(display, RW_COLORMAP_MASK)) == 0L) { + unsupported("DirectColor, PseudoColor and GrayScale are not supported"); + return; + } + + alloc = AllocNone; + for(resetsupvis(vmask); nextsupvis(&vi); ) { + + visual = vi->visual; + cmap = XCALL; + n = maxsize(vi); + pix = (unsigned long *)malloc(n * sizeof(unsigned long)); + + if (pix == NULL) { + delete("malloc failed for pix array"); + return; + } + + trace("allocate %d colour cells", n); + status = XAllocColorCells(display, cmap, False, (unsigned long *)0, 0, pix, n); + free((void*)pix); + if (status == False) { + report("Unable to allocate all colour cells"); + FAIL; + } else + CHECK; + } + + CHECKPASS(nsupvis()); + +>>ASSERTION Good A +If any of the visual classes +.S PseudoColor , +.S GrayScale +or +.S DirectColor +are supported: +When xname is called with a visual class that is one of +.S PseudoColor , +.S GrayScale +or +.S DirectColor +and the argument +.A alloc +is +.S AllocAll , +then the entire colourmap is allocated read-write. +>>STRATEGY +For each of the visual classes DirectColor, PseudoColor and GrayScale: + Create a colormap with alloc set to AllocAll. + Verify that the allocation of another r/w cell fails with XAllocColorCells. +>>CODE +XVisualInfo *vi; +Colormap cmap; +Status status; +unsigned long pix; +unsigned long vmask; + +#define RW_COLORMAP_MASK ((1L<<DirectColor) | (1L<<PseudoColor) | (1L<<GrayScale)) + + if( (vmask = visualsupported(display, RW_COLORMAP_MASK)) == 0L) { + unsupported("DirectColor, PseudoColor and GrayScale are not supported"); + return; + } + + alloc = AllocAll; + for (resetsupvis(vmask); nextsupvis(&vi); ) { + + visual = vi->visual; + cmap = XCALL; + + /* + * If the entire colourmap is allocated then it should not be + * possible to allocate any more entries. + */ + + status = XAllocColorCells(display, cmap, False, (unsigned long*)0, 0, &pix, 1); + + if (status != (Status) 0) { + report("There was an unallocated colour cell"); + FAIL; + } else + CHECK; + } + + CHECKPASS(nsupvis()); + +>>ASSERTION Good C +If either of the visual classes +.S GrayScale +or +.S PseudoColor +are supported: +When the visual class is +.S GrayScale +or +.S PseudoColor , +and the argument +.A alloc +is +.S AllocAll , +then a call to xname +allocates N read-write colourmap entries with +pixel values from zero to N \- 1, +where N is the number of colourmap entries value in the specified visual. +>>STRATEGY +For each of the visuals GrayScale and PseudoColor: + Create a colormap with alloc set to AllocAll. + For each of the 0..N-1 allocated cells: + Write value r 31<<8, g 63<<8, b 127<<8 with XStoreColor. +>>CODE +Colormap cmap; +XVisualInfo *vi; +XColor col; +unsigned long pix; +unsigned long vmask = (1L<<PseudoColor) | (1L<<GrayScale); +int n; + + if( (vmask = visualsupported(display, vmask)) == 0L) { + unsupported("PseudoColor and GrayScale are not supported"); + return; + } + + col.red = 31<<8; + col.green = 63<<8; + col.blue = 127<<8; + col.flags = DoRed|DoGreen|DoBlue; + + alloc = AllocAll; + for(resetsupvis(vmask); nextsupvis(&vi); ) { + + visual = vi->visual; + cmap = XCALL; + if(geterr() != Success) + continue; + + n = maxsize(vi); + for(pix = 0L; pix < n; pix++) { + col.pixel = pix; + + CATCH_ERROR(display); + XStoreColor(display, cmap, &col); + RESTORE_ERROR(display); + + if(GET_ERROR(display) != Success) { + report("Pixel %lu could not be written in the colourmap.", pix); + FAIL; + } + } + + if(pix == n) + CHECK; + } + + CHECKPASS(nsupvis()); + +>>ASSERTION Good C +If the visual class +.S DirectColor +is supported: +When the visual class is +.S DirectColor +and the argument +.A alloc +is +.S AllocAll, +then a call to xname +allocates +.S 2pow(nred+ngreen+nblue) +read-write colourmap entries with +pixel values obtained by ORing zero or more +of the planes obtained by ORing the +.M red_mask , +.M green_mask +and +.M blue_mask +values in the +.A visual +argument, +where +.S nreds , +.S ngreens +and +.S nblues +are the number of bits in the respective masks. +>>STRATEGY +For the visual Directcolor: + Create a colormap with alloc set to AllocAll. + For each of the 0..N-1 allocated cells: + Write value r 31<<8, g 63<<8, b 127<<8 with XStoreColor. +>>CODE +>># +>># WARNING. +>># For now this test assumes that the OR of the +>># rgb masks will form a contiguous set of bits. This makes +>># generation of all the subsets very straightforward. +>># +#define NUM_COLS 4096 +Colormap cmap; +XVisualInfo *vi; +XColor colarr[NUM_COLS]; +unsigned long plane, count; +unsigned long vmask = (1L<<DirectColor), b, planemask; +int n, i, j, bitsum; +int bitpos[sizeof(long) * 8]; + + + if( (vmask = visualsupported(display, vmask)) == 0L) { + unsupported("DirectColor is not supported"); + return; + } + + for(i=0; i<NUM_COLS; i++) { + colarr[i].red = 31<<8; + colarr[i].green = 63<<8; + colarr[i].blue = 127<<8; + colarr[i].flags = DoRed|DoGreen|DoBlue; + } + + resetsupvis(vmask); + nextsupvis(&vi); + + alloc = AllocAll; + visual = vi->visual; + cmap = XCALL; + if(geterr() == Success) { + bitsum = (bitcount(vi->red_mask) + bitcount(vi->green_mask) + bitcount(vi->blue_mask)); + n = 1<< bitsum; + for(count = 0L; count < n; count+=NUM_COLS) { + for (i=0; i<NUM_COLS; i++) + colarr[i].pixel = count+i; + CATCH_ERROR(display); + XStoreColors(display, cmap, colarr, + (count+NUM_COLS <= n) ? NUM_COLS : n-count); + RESTORE_ERROR(display); + + if(GET_ERROR(display) != Success) { + report("Pixel in range [%lu-%lu] could not be written in the colourmap.", count,count+NUM_COLS); + FAIL; + } + + } + } + + if (count >= n) + CHECK; + + CHECKPASS(1); + +>>ASSERTION Good C +If any of the visual classes +.S PseudoColor , +.S GrayScale +or +.S DirectColor +are supported: +When xname is called with a visual class that is one of +.S PseudoColor , +.S GrayScale +or +.S DirectColor +and the +.A alloc +argument is +.S AllocAll , +then none of the entries can be freed with +.S XFreeColors(). +>>STRATEGY +For the visual classes DirectColor, PseudoColor and GrayScale: + Create a colourmap with XCreateColormap with alloc set to AllocAll. + Deallocate a colorcell with XFreeColor. + Allocate a colorcell with XAllocColorCell. + Verify that the allocation failed. +>>CODE +XVisualInfo *vi; +Colormap cmap; +Status status; +unsigned long pix; +unsigned long vmask = ((1L<<DirectColor) | (1L<<PseudoColor) | (1L<<GrayScale)); + + if( (vmask = visualsupported(display, vmask)) == 0L) { + unsupported("DirectColor, PseudoColor and GrayScale are not supported"); + return; + } + + alloc = AllocAll; + for (resetsupvis(vmask); nextsupvis(&vi); ) { + + visual = vi->visual; + cmap = XCALL; + + status = XAllocColorCells(display, cmap, False, (unsigned long*)0, 0, &pix, 1); + + pix = 0; + + CATCH_ERROR(display); + XFreeColors(display, cmap, &pix, 1, 0); + RESTORE_ERROR(display); + if( GET_ERROR(display) == Success) { + delete("XFreeColors() did not give an error deallocating a cell."); + FAIL; + } else + CHECK; + + status = XAllocColorCells(display, cmap, False, (unsigned long*)0, 0, &pix, 1); + + if (status != (Status) 0) { + report("A cell was deallocated by XFreeColors()."); + FAIL; + } else + CHECK; + } + + CHECKPASS(2*nsupvis()); + +>>ASSERTION Bad C +If any of the visual classes +.S StaticGray , +.S StaticColor +or +.S TrueColor +are supported: +When xname is called with a visual that is one of +.S StaticGray , +.S StaticColor +or +.S TrueColor , +and the argument +.A alloc +is other than +.S AllocNone , +then a +.S BadMatch +error occurs. +>>STRATEGY +For each visual class in TrueColor, StaticColor and StaticGray: + Call XCreateColormap with Alloc set to AllocAll. + Verify that a BadMatch error occurred. +>>CODE BadMatch +Colormap cmap; +XVisualInfo *vp; +unsigned long vmask = (1L<<TrueColor) | (1L<<StaticColor) | (1L<<StaticGray); + + if( (vmask = visualsupported(display, vmask)) == 0L) { + unsupported("TrueColor, StaticColor and StaticGray are not supported"); + return; + } + + alloc = AllocAll; + for ( resetsupvis(vmask); nextsupvis(&vp); ) { + visual = vp->visual; + cmap = XCALL; + if (geterr() == BadMatch) + CHECK; + } + + CHECKPASS(nsupvis()); + +>>ASSERTION Bad D 3 +>># Can't see how to obtain a visual that isn't +>># supported in order to provoke the error. +If there is a visual class that is not supported on the screen: +When xname is called with a visual that is not supported +on the screen for which the +.A window +argument was created, +then a +.S BadMatch +error occurs. +>>ASSERTION Bad A +.ER Value alloc AllocNone AllocAll +>>ASSERTION Bad A +When xname is called with an invalid visual, +then a +.S BadValue +error occurs. +>>STRATEGY +Make a visual structure invalid using badvis. +Create a colourmap for this visual with XCreateColorMap. +Verify that a BadValue error occurred. +>>CODE BadValue +Visual vi; + + alloc = AllocNone; + badvis(&vi); + visual = &vi; + XCALL; + if(geterr() == BadValue) + PASS; +>>ASSERTION Bad A +.ER BadWindow +>>ASSERTION Bad B 1 +.ER BadAlloc +>>#HISTORY Steve Completed Written in old format. +>>#HISTORY Cal Completed Re-written in new style and format. +>>#HISTORY Kieron Completed <Have a look> +>>#HISTORY Cal Action Writing code. diff --git a/xts5/Xlib7/XFreeColormap/XFreeColormap.m b/xts5/Xlib7/XFreeColormap/XFreeColormap.m new file mode 100644 index 00000000..637014d3 --- /dev/null +++ b/xts5/Xlib7/XFreeColormap/XFreeColormap.m @@ -0,0 +1,309 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XFreeColormap/XFreeColormap.m,v 1.2 2005-11-03 08:43:43 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib7/XFreeColormap/XFreeColormap.m +>># +>># Description: +>># Tests for XFreeColormap() +>># +>># Modifications: +>># $Log: frclrmp.m,v $ +>># Revision 1.2 2005-11-03 08:43:43 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:31 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:26:57 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:16 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:10 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:42 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:17 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:48:31 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE XFreeColormap Xlib7 +void +XFreeColormap(display, colormap) +Display *display = Dsp; +Colormap colormap = DefaultColormap(display, DefaultScreen(display)); +>>ASSERTION Good A +A call to xname +removes the association between the +.A colormap +argument +and the colourmap ID, and frees the associated storage. +>>STRATEGY +For each supported visual type: + Create a colourmap with XCreateColormap. + Free the colourmap with XFreeColormap. + Verify that XAllocColor fails. +>>CODE +XVisualInfo *vi; +unsigned long vmask; +XColor col; + + if( (vmask = visualsupported(display, 0L)) == 0L) { + delete("No visuals are supported."); + return; + } + + for(resetsupvis(vmask); nextsupvis(&vi); ) { + trace("Attempting XFreeColormap() for class %s", displayclassname(vi->class)); + colormap = XCreateColormap(display, DRW(display), vi->visual, AllocNone); + + XCALL; + + startcall(display); + XAllocColor(display, colormap, &col); + endcall(display); + + if( geterr() == Success) { + report("XAllocColor() succeeded with a freed colormap"); + FAIL; + } else + CHECK; + } + + CHECKPASS(nsupvis()); + +>>ASSERTION Good A +When the +.A colormap +argument is the default colourmap, then a call to xname +does not remove the association between the +.A colormap +argument +and the colourmap ID or free the associated storage. +>>STRATEGY +Free the default colourmap with XFreeColormap. +Verify that XAllocColor succeeds in allocating 1 shared cell with this colormap. +>>CODE +XColor col; + + col.red = col.green = col.blue = 0; + colormap = DefaultColormap(display, DefaultScreen(display)); + XCALL; + if(XAllocColor(display, colormap, &col) == False) { + report("XAllocColor() failed to allocate a colourcell with the default colormap."); + FAIL; + } else + PASS; + +>>ASSERTION Good A +When the +.A colormap +argument is an installed colourmap, then a call to xname uninstalls the colourmap. +>>STRATEGY +For each visual class: + Create a colourmap with XCreateColormap. + Install the colourmap with XInstallColormap. + Obtain a list of installed colourmaps with XListInstalledColormaps. + Verify that the created colourmap is in the list. + Free the colourmap with XFreeColormap. + Obtain a list of installed colourmaps with XListInstalledColormaps. + Verify that the created colourmap is not in the list. +>>CODE +int i, len, notfound; +XVisualInfo *vi; +Colormap *maplist; +unsigned long vmask; +XColor col; + + if( (vmask = visualsupported(display, 0L)) == 0L) { + delete("No visuals are supported."); + return; + } + + for(resetsupvis(vmask); nextsupvis(&vi); ) { + trace("Attempting XFreeColormap() for class %s", displayclassname(vi->class)); + colormap = XCreateColormap(display, DRW(display), vi->visual, AllocNone); + + + XAllocColor(display, colormap, &col); + XInstallColormap(display, colormap); + maplist = XListInstalledColormaps(display, DRW(display), &len); + for(i=0, notfound = 1; i<len && notfound; i++ ) + if(maplist[i] == colormap) { + CHECK; + trace("Found map at position %d of the required list", i); + notfound = 0; + } + + XFree((char*)maplist); + if(notfound) { + delete("The installed colourmap was not on the required list."); + return; + } + + XCALL; + + maplist = XListInstalledColormaps(display, DRW(display), &len); + + for(i=0, notfound = 1 ; i<len && notfound; i++) + if(maplist[i] == colormap) { + report("Colormap is still on the required list."); + FAIL; + notfound = 0; + } + + XFree((char*)maplist); + + if(notfound == 1) + CHECK; + } + + CHECKPASS(2*nvinf()); + +>>ASSERTION Good A +When the specified colourmap is defined as the colourmap for a window, +then a call to xname changes the colourmap associated with the window to +.S None +and generates a +.S ColormapNotify +event. +>>STRATEGY +For each supported visual class: + Create a colourmap with XCreateColormap. + Create a window with XCreateWindow. + Select ColormapNotify events with XSelectInput. + Make the colormap the colormap for the window with XSetWindowColormap. + Free the colormap with XFreeColormap + Verify that a ColorMapnotify event was generated with XNextEvent. + Verify that the window's colourmap is set to none with XGetWindowAttributes. +>>CODE +int i, len, notfound; +XVisualInfo *vi; +XWindowAttributes watts; +XEvent ev; +Colormap *maplist; +unsigned long vmask; +XColor col; +Window win; + + if( (vmask = visualsupported(display, 0L)) == 0L) { + delete("No visuals are supported."); + return; + } + + for(resetsupvis(vmask); nextsupvis(&vi); ) { + trace("Attempting XFreeColormap() for class %s", displayclassname(vi->class)); + colormap = XCreateColormap(display, DRW(display), vi->visual, AllocNone); + XAllocColor(display, colormap, &col); + + win = makewin(display, vi); + XSetWindowColormap(display, win, colormap); + XGetWindowAttributes(display, win, &watts); + + XSelectInput(display, win, ColormapChangeMask); + + + if(watts.colormap != colormap) { + delete("XSetWindowColormap() did not set the window colormap."); + return; + } + + XInstallColormap(display, colormap); + + XCALL; + + XGetWindowAttributes(display, win, &watts); + if(watts.colormap != None) { + report("Colormap of window was not set to None."); + FAIL; + } + + if(getevent(display, &ev) == 0) { + report("No Event was generated"); + FAIL; + } else + if(ev.type != ColormapNotify) { + report("Event generated was not ColormapNotify"); + FAIL; + } else + CHECK; + + } + + CHECKPASS(nsupvis()); + +>>ASSERTION Bad A +.ER BadColor +>>#HISTORY Cal Completed Written in new format and style - Cal 4/12/90. +>>#HISTORY Kieron Completed <Have a look> diff --git a/xts5/Xlib7/XFreeColors/XFreeColors.m b/xts5/Xlib7/XFreeColors/XFreeColors.m new file mode 100644 index 00000000..bfa5cb34 --- /dev/null +++ b/xts5/Xlib7/XFreeColors/XFreeColors.m @@ -0,0 +1,771 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XFreeColors/XFreeColors.m,v 1.2 2005-11-03 08:43:43 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib7/XFreeColors/XFreeColors.m +>># +>># Description: +>># Tests for XFreeColors() +>># +>># Modifications: +>># $Log: frclrs.m,v $ +>># Revision 1.2 2005-11-03 08:43:43 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:31 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:26:58 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:16 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:11 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:42 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:18 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:48:35 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE XFreeColors Xlib7 +void +XFreeColors(display, colormap, pixels, npixels, planes) +Display *display = Dsp; +Colormap colormap = DefaultColormap(display, DefaultScreen(display)); +unsigned long *pixels = &dummypix; +int npixels = 1; +unsigned long planes = 0L; +>>EXTERN +unsigned long dummypix; + +#define ENOUGH_TIME 100 + +static +Bool munch(size_in_out, pixels, npix) + int *size_in_out; + unsigned long *pixels; + int npix; +{ + int i; + int sz = 0; + unsigned long junk; + int max_sz = (*size_in_out) * ENOUGH_TIME; + + for(i=0; i < npix; i++, pixels++) { + if(XAllocColorCells(display, colormap, False, 0L, 0, pixels, 1) == False) { + delete("Could not allocate %d pixels with AllocColorCells (colormap size >= %d, done %d)", npix, *size_in_out, i); + return False; + } + } + + sz = i; + + for(i=0; XAllocColorCells(display, colormap, False, 0L, 0, &junk, 1); i++) { + if (i > max_sz) { + delete("Still allocating after %d cells allocated in a colormap of size %d cells.", + sz + i, *size_in_out); + return False; + } + } + + trace("Rest of colormap allocated (%d + %d = %d cells. Notional size = %d cells).", + sz, i, sz + i, *size_in_out); + sz += i; + *size_in_out = sz; + return True; +} + +>>ASSERTION Good C +If any of the visual classes DirectColor, PseudoColor or GrayScale is supported: +A call to xname function frees the colourmap entries +obtained by ORing the +.A npixels +pixel values specified in the +.A pixels +argument +with zero or more of the planes specified in the +.A planes +argument +that have been +allocated by the client using +.S XAllocColor , +.S XAllocNamedColor , +.S XAllocColorCells +or +.S 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. + +>>CODE +XVisualInfo *vp; +XColor color1, exactcol; +char *goodname; +int size; +unsigned long pixel; +unsigned long *pixels; +unsigned long vmask = (1<<DirectColor)|(1<<PseudoColor)|(1<<GrayScale); + + + if((vmask = visualsupported(display, vmask)) == 0L) { + UNSUPPORTED; + return; + } + + if((goodname = tet_getvar("XT_GOOD_COLORNAME")) == (char *) 0L) { + delete("XT_GOOD_COLORNAME is not defined."); + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp);) { + + trace("XAllocNamedColor()."); + colormap = makecolmap(display, vp->visual, AllocNone); + + if(XAllocNamedColor(display, colormap, goodname, &color1, &exactcol) == False) { + delete("XAllocNamedColor() failed."); + return; + } + + size = maxsize(vp); + + if (!munch(&size, &pixel, 1)) { + return; /* delete() already called in munch */ + } else + CHECK; + + pixels = &color1.pixel; + npixels = 1; + planes = 0L; + + XCALL; + + if(geterr() == Success) + CHECK; + + if(XAllocColorCells(display, colormap, False, 0L, 0, &pixel, 1) == False) { + report("XFreeColors() did not free a cell allocated by XAllocNamedColor()."); + FAIL; + } else + CHECK; + + freereg(); + } + + + + for(resetsupvis(vmask); nextsupvis(&vp);) { + + trace("XAllocColor()."); + colormap = makecolmap(display, vp->visual, AllocNone); + + if(XAllocColor(display, colormap, &color1) == False) { + delete("XAllocColor() failed."); + return; + } + + size = maxsize(vp); + + if (!munch(&size, &pixel, 1)) { + return; /* delete() already called in munch */ + } else + CHECK; + + pixels = &color1.pixel; + npixels = 1; + planes = 0L; + + XCALL; + + if(geterr() == Success) + CHECK; + + if(XAllocColorCells(display, colormap, False, 0L, 0, &pixel, 1) == False) { + report("XFreeColors() did not free a cell allocated by XAllocColor()."); + FAIL; + } else + CHECK; + + freereg(); + } + + + for(resetsupvis(vmask); nextsupvis(&vp);) { + trace("XAllocColorCells()."); + colormap = makecolmap(display, vp->visual, AllocNone); + + size = maxsize(vp); + + if (!munch(&size, &pixel, 1)) { + return; /* delete() already called in munch */ + } else + CHECK; + + pixels = &pixel; + npixels = 1; + planes = 0L; + + XCALL; + + if(geterr() == Success) + CHECK; + + if(XAllocColorCells(display, colormap, False, 0L, 0, &pixel, 1) == False) { + report("XFreeColors() did not free a cell allocated by XAllocColorCells()."); + FAIL; + } else + CHECK; + + freereg(); + } + + + + CHECKPASS(nsupvis() * 3 * 3); + +>>ASSERTION Good C +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 xname. +>>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. +>>CODE +Display *disp2; +XVisualInfo *vp; +XColor color1; +int size; +unsigned long pixel; +unsigned long *pixels; +unsigned long vmask = (1<<PseudoColor)|(1<<GrayScale)|(1<<DirectColor); + + + if((vmask = visualsupported(display, vmask)) == 0L) { + UNSUPPORTED; + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp);) { + + colormap = makecolmap(display, vp->visual, AllocNone); + + if((disp2 = opendisplay()) == (Display *) 0) { + delete("Could not open the display."); + return; + } + + if(XAllocColor(Dsp, colormap, &color1) == False) { + delete("XAllocColor() failed for second client."); + return; + } + + if(XAllocColor(disp2, colormap, &color1) == False) { + delete("XAllocColor() failed for first client."); + return; + } + + size = maxsize(vp); + + if (!munch(&size, &pixel, 1)) { + return; /* delete() already called in munch */ + } else + CHECK; + + display = Dsp; + pixels = &color1.pixel; + npixels = 1; + planes = 0L; + + XCALL; + if(geterr() == Success) + CHECK; + + if(XAllocColorCells(Dsp, colormap, False, 0L, 0, &pixel, 1) != False) { + report("Shared cell was freed while allocted to another client."); + FAIL; + } else + CHECK; + } + + CHECKPASS(3*nsupvis()); + +>>ASSERTION Good A +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 xname has been called one less time than the colormap entry was allocated, +then a call to xname 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. +>>CODE +XVisualInfo *vp; +XColor color1; +int size, i, refs; +unsigned long pixel; +unsigned long *pixels; +unsigned long vmask = (1<<DirectColor)|(1<<PseudoColor)|(1<<GrayScale); + + + if((vmask = visualsupported(display, vmask)) == 0L) { + UNSUPPORTED; + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp);) { + + colormap = makecolmap(display, vp->visual, AllocNone); + + size = maxsize(vp); + + refs = size-1; + color1.red = color1.green = color1.blue = 0; + for(i=0; i < refs; i++) + if(XAllocColor(display, colormap, &color1) == False) { + delete("XAllocColor() failed (Iteration %d).", i); + return; + } + + if (!munch(&size, &pixel, 1)) { + return; /* delete() already called in munch */ + } else + CHECK; + + for(i=0; i < refs-1; i++) { + pixels = &color1.pixel; + npixels = 1; + planes = 0L; + XCALL; + } + + if(XAllocColorCells(display, colormap, False, 0L, 0, &pixel, 1) != False) { + delete("XAllocColorCells() did not fail with a full colourmap."); + return; + } else + CHECK; + + pixels = &color1.pixel; + npixels = 1; + planes = 0L; + XCALL; + + if(XAllocColorCells(display, colormap, False, 0L, 0, &pixel, 1) == False) { + report("XFreeColors() did not free a cell allocated by XAllocColor()."); + FAIL; + } else + CHECK; + + freereg(); + } + + CHECKPASS(3*nsupvis()); + +>>ASSERTION Bad A +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. +>>CODE BadAccess +Display *disp2; +XVisualInfo *vp; +XColor color; +int size; +unsigned long pixel; +unsigned long *pixels, *cptr, *ptr; +unsigned long vmask = (1<<DirectColor)|(1<<PseudoColor)|(1<<GrayScale); + + + if((vmask = visualsupported(display, vmask)) == 0L) { + UNSUPPORTED; + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp);) { + + disp2 = opendisplay(); + colormap = makecolmap(disp2, vp->visual, AllocNone); + + size = maxsize(vp); + + if((cptr = (unsigned long *) malloc(size * sizeof(unsigned long))) == (unsigned long *)0) { + delete("malloc(%u) failed.", size * sizeof(unsigned long)); + return; + } + + ptr = cptr; + color.red = color.green = color.blue = 0; + if(XAllocColor(disp2, colormap, &color) == False) { + delete("XAllocColor() failed for client 2"); + return; + } + + *ptr++ = color.pixel; + + if (!munch(&size, ptr, size-1)) { + return; /* delete() already called in munch */ + } else + CHECK; + + pixels = cptr; + npixels = size + 1; + planes = 0L; + + startcall(disp2); + XFreeColors(disp2, colormap, pixels, npixels, planes); + endcall(disp2); + /* should be BadAccess! Often not on R4 */ + if (geterr() != BadAccess) { + report("Got %s, expecting BadAccess", errorname(geterr())); + FAIL; + } else + CHECK; + + if(XAllocColorCells(display, colormap, False, 0L, 0, &pixel, 1) == False) { + report("XFreeColors() did not free a cell allocated by XAllocColor()."); + FAIL; + } else + CHECK; + + if(XAllocColorCells(display, colormap, False, 0L, 0, &pixel, 1) != False) { + report("Colormap was not completely allocated."); + FAIL; + } + + free(cptr); + freereg(); + } + + CHECKPASS(3*nsupvis()); + +>>ASSERTION Good A +If the visual class +.S DirectColor +is supported: +When all related colormap entries are already freed, then a call to xname +with a particular pixel value allows that pixel value to be allocated +by a subsequent call to +.S XAllocColorPlanes . +>># +>># No matter what the plane argument is when given to XFreeColors, +>># a BadAccess error is always generated. +>># +>>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. +>>CODE +XVisualInfo *vp; +int nreds, ngreens, nblues; +int reds, greens, blues; +unsigned long pr[2], rr, gr, br; +unsigned long tpr[2], trr, tgr, tbr; +unsigned long vmask = (1<<DirectColor); + + if((vmask = visualsupported(display, vmask)) == 0L) { + UNSUPPORTED; + return; + } + resetsupvis(vmask); + nextsupvis(&vp); + + nreds = bitcount(vp->red_mask); + ngreens = bitcount(vp->green_mask); + nblues = bitcount(vp->blue_mask); + + reds = nreds - 1; + greens = ngreens - 1; + blues = nblues - 1; + + colormap = makecolmap(display, vp->visual, AllocNone); + + if((XAllocColorPlanes(display, colormap, False, pr, 2, reds, greens, blues, &rr, &gr, &br)) == False) { + delete("XAllocColorPlanes failed."); + return; + } else + CHECK; + + if((XAllocColorPlanes(display, colormap, False, tpr, 1, 0, 0, 0, &trr, &tgr, &tbr)) != False) { + delete("Allocated colormap was not completely filled"); + return; + } else + CHECK; + + pixels = pr+1; + npixels = 1; + planes = rr | gr | br; + XCALL; + + if((XAllocColorPlanes(display, colormap, False, pr, 1, reds, greens, blues, &rr, &gr, &br)) == False) { + trace("Freed colormap cells could not be re-allocated."); + FAIL; + } else + CHECK; + + CHECKPASS(3); + +>>ASSERTION Bad A +When a specified pixel is not a valid entry in the +.A colormap +argument, then a +.S 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. +>>CODE BadValue +XVisualInfo *vp; +XColor color; +unsigned long pixel[2]; +unsigned long vmask = 0L; + + if((vmask = visualsupported(display, vmask)) == 0L) { + delete("No visuals reported as supported"); + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + + colormap = makecolmap(display, vp->visual, AllocNone); + pixel[0] = ~0L; + pixels = pixel; + npixels = 1; + planes = 0L; + XCALL; + if(geterr() == BadValue) + CHECK; + + colormap = makecolmap(display, vp->visual, AllocNone); + if(XAllocColor(display, colormap, &color) == False) { + delete("XAllocColor Failed."); + return; + } + + pixel[0] = color.pixel; + pixel[1] = ~0L; + pixels = pixel; + npixels = 2; + planes = 0L; + XCALL; + if(geterr() == BadValue) + CHECK; + + } + + CHECKPASS(2*nsupvis()); + +>>ASSERTION Bad A +.ER BadAccess colormap-free +>>STRATEGY + Create a colormap with alloc set to AllocNone. + Free a pixel with pixel value = 0 with XFreeColors. + Verify that a BadValue error occurred. +>>CODE BadAccess +XVisualInfo *vp; +unsigned long pixel[1]; +unsigned long vmask = 0L; + + if((vmask = visualsupported(display, vmask)) == 0L) { + delete("No visuals reported as supported"); + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + + colormap = makecolmap(display, vp->visual, AllocNone); + pixel[0] = 0; + pixels = pixel; + npixels = 1; + planes = 0L; + XCALL; + if(geterr() == BadAccess) + CHECK; + } + + CHECKPASS(nsupvis()); + +>>ASSERTION Bad A +.ER BadColor +>>ASSERTION Bad A +When more than one +.M pixel +value is not a valid entry in the +.M colormap +argument, then a +.S 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. +>>CODE BadValue +XVisualInfo *vp; +XColor color; +int errval; +unsigned long pixel[3]; +unsigned long vmask = 0L; + + if((vmask = visualsupported(display, vmask)) == 0L) { + delete("No visuals reported as supported"); + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + + colormap = makecolmap(display, vp->visual, AllocNone); + if(XAllocColor(display, colormap, &color) == False) { + delete("XAllocColor Failed."); + return; + } + pixel[0] = ~0L; + pixel[1] = color.pixel; + pixel[2] = ~0L; + pixels = pixel; + npixels = 3; + planes = 0L; + XCALL; + if(geterr() == BadValue) { + errval = getbadvalue(); + if( (errval != -1) && (errval != -2) ) { + report("Erroneous value was reported as %d, instead of -1 or -2", errval); + FAIL; + } else + CHECK; + } + + } + CHECKPASS(nsupvis()); + + +>>#HISTORY Cal Completed Written in new format and style. +>>#HISTORY Kieron Completed <Have a look> +>>#HISTORY Cal Action Writing code. diff --git a/xts5/Xlib7/XLookupColor/XLookupColor.m b/xts5/Xlib7/XLookupColor/XLookupColor.m new file mode 100644 index 00000000..a4369e43 --- /dev/null +++ b/xts5/Xlib7/XLookupColor/XLookupColor.m @@ -0,0 +1,401 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XLookupColor/XLookupColor.m,v 1.2 2005-11-03 08:43:43 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib7/XLookupColor/XLookupColor.m +>># +>># Description: +>># Tests for XLookupColor() +>># +>># Modifications: +>># $Log: lkpclr.m,v $ +>># Revision 1.2 2005-11-03 08:43:43 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:31 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:26:58 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:17 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.1 1998/07/25 00:17:58 mar +>># req.4.W.00121: avoid undefined ANSI usage +>># +>># Revision 6.0 1998/03/02 05:19:11 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:42 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:21 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:48:39 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE XLookupColor Xlib7 +Status +LookupColor(display, colormap, color_name, exact_def_return, screen_def_return) +Display *display = Dsp; +Colormap colormap = DefaultColormap(display, DefaultScreen(display)); +char *color_name = ""; +XColor *exact_def_return = &dummycol; +XColor *screen_def_return = &dummycol; +>>EXTERN +XColor dummycol; +>>ASSERTION Good A +A call to xname obtains the exact and closest available RGB +values for the +.A colormap +argument to those specified for the colour named +.A color_name +in the database, and stores the exact values in the +.M red , +.M green +and +.M blue +components of the +.S XColor +structure named by the +.A exact_def_return +argument, and stores the closest available values in the +.M red , +.M green +and +.M blue +components of the +.S XColor +structure named by the +.A screen_def_return +argument. +>>STRATEGY +For each visual class: + Create a colourmap with alloc set to AllocNone. + Lookup the exact and closest supported rgb values + for colour XT_GOOD_COLORNAME with XLookupColor. + Verify that the function returned non-zero. + Allocate a read/only cell using returned RGB values with XAllocColor + (which is assumed to return correct RGB values) . + Verify that the RBG values from both calls are identical. + (so XLookupColor previously returned correct RGB values) +>>CODE +XVisualInfo *vp; +Status status; +XColor exactcol, screencol, testcol; +unsigned long vmask; + + if( (vmask = visualsupported(display, 0L)) == 0L) { + delete("No visuals reported as valid."); + return; + } + + if( (color_name = tet_getvar("XT_GOOD_COLORNAME")) == (char *) 0) { + delete("XT_GOOD_COLORNAME is not defined."); + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + colormap = makecolmap(display, vp->visual, AllocNone); + exact_def_return = &exactcol; + screen_def_return = &screencol; + status = XCALL; + + if( status == (Status) 0) { + report("%s failed to return non-zero.", TestName); + FAIL; + continue; + } else + CHECK; + + testcol = screencol; + trace("Screen: r %u g %u b %u", screencol.red, screencol.green, screencol.blue); + trace("Exact : r %u g %u b %u", exactcol.red, exactcol.green, exactcol.blue); + trace("Test : r %u g %u b %u", testcol.red, testcol.green, testcol.blue); + + status = XAllocColor(display, colormap, &testcol); + if(status == (Status) 0) { + report("XAllocColor() failed to return non-zero."); + FAIL; + continue; + } else + CHECK; + + trace("Exact : r %u g %u b %u", exactcol.red, exactcol.green, exactcol.blue); + + if((screencol.red != testcol.red) || + (screencol.green != testcol.green) || + (screencol.blue != testcol.blue) ) { + report("%s return RGB values r %u g %u b %u instead of r %u g %u b %u.", TestName, + screencol.red, screencol.green, screencol.blue, + testcol.red, testcol.green, testcol.blue); + FAIL; + } else + CHECK; + } + + CHECKPASS(3 * nsupvis()); + +>>ASSERTION Good A +Upper and lower case characters in the +.A color_name +argument refer to the same colour. +>>STRATEGY +For each supported visual type: + Create a colomap with alloc set to AllocNone. + Look up the rgb value of the colour name XT_GOOD_COLORNAME + in the database with XLookupNamedColor. + Look up the rbg value of the colour name XT_GOOD_COLORNAME, + with alternating characters in alternating case, + in the colourmap with XAllocNamedColor. + Verify that the function returned non-zero. + Verify that the exact and closest supported rbg values from both calls + are identical. +>>CODE +XVisualInfo *vp; +char *cp, *goodname, *casename; +Status status; +XColor screencol, exactcol, alscreencol, alexactcol; +unsigned long vmask; +unsigned short trunc; +int i; + + if( (vmask = visualsupported(display, 0L)) == 0L) { + delete("No visuals reported as valid."); + return; + } + + if( ( goodname = tet_getvar("XT_GOOD_COLORNAME")) == (char *) 0) { + delete("XT_GOOD_COLORNAME is not defined."); + return; + } + + casename = (char *) malloc( strlen(goodname) + 1); + strcpy(casename, goodname); + + for(i=0, cp=casename; *cp; i++, cp++) + if(i&1) + *cp = tolower(*cp); + else + *cp = toupper(*cp); + + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + colormap = makecolmap(display, vp -> visual, AllocNone); + color_name = goodname; + screen_def_return = &screencol; + exact_def_return = &exactcol; + status = XCALL; + + if( status == (Status) 0) { + report("%s failed to return non-zero with color %s.", + TestName, goodname); + FAIL; + continue; + } else + CHECK; + + color_name = casename; + trace("Testing colourname %s", color_name); + screen_def_return = &alscreencol; + exact_def_return = &alexactcol; + status = XCALL; + + if( status == (Status) 0) { + report("%s failed to return non-zero with color %s.", + TestName, casename); + FAIL; + continue; + } else + CHECK; + + if((exactcol.red != alexactcol.red) || + (exactcol.green != alexactcol.green) || + (exactcol.blue != alexactcol.blue)) { + report("%s for name %s", TestName, casename); + report("returned exact RGB values r %u g %u b %u", + alexactcol.red, alexactcol.green, alexactcol.blue); + report("%s for name %s", TestName, goodname); + report("returned exact RGB values r %u g %u b %u", + exactcol.red, exactcol.green, exactcol.blue); + FAIL; + } else + CHECK; + + if((screencol.red != alscreencol.red) || + (screencol.green != alscreencol.green) || + (screencol.blue != alscreencol.blue)) { + report("%s for name %s", TestName, casename); + report("returned closest RGB values r %u g %u b %u", + alscreencol.red, alscreencol.green, alscreencol.blue); + report("%s for name %s", TestName, goodname); + report("returned closest RGB values r %u g %u b %u", + screencol.red, screencol.green, screencol.blue); + FAIL; + } else + CHECK; + } + + free(casename); + CHECKPASS(4 * nsupvis()); + +>>ASSERTION Good A +When the +.A color_name +argument refers to a colour in the colour database, then xname +returns non-zero. +>>STRATEGY +For each supported visual class: + Create a colormap with XCreateColormap. + Lookup the rgb values for XT_GOOD_COLOR_NAME with XLookupColor. + Verify that the function returned non-zero. +>>CODE +XVisualInfo *vp; +Status status; +char *goodname; +XColor exactcol, screencol; +unsigned long vmask; + + if( (vmask = visualsupported(display, 0L)) == 0L) { + delete("No visuals reported as valid."); + return; + } + + if( (goodname = tet_getvar("XT_GOOD_COLORNAME")) == (char *) 0) { + delete("XT_GOOD_COLORNAME is not defined."); + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + + colormap = makecolmap(display, vp->visual, AllocNone); + color_name = goodname; + exact_def_return = &exactcol; + screen_def_return = &screencol; + status = XCALL; + + if( status == (Status) 0) { + report("%s failed to return non-zero with color %s.", + TestName, goodname); + FAIL; + } else + CHECK; + } + + CHECKPASS(nsupvis()); + +>>ASSERTION Good A +When the +.A color_name +argument does not refer to a colour in the colour database, then xname +returns zero. +>>STRATEGY +For each supported visual class: + Create a colormap with XCreateColormap. + Lookup the rgb values for XT_BAD_COLORNAME with XLookupColor. + Verify that the function returned zero. +>>CODE +XVisualInfo *vp; +char *badname; +Status status; +XColor exactcol, screencol; +unsigned long vmask; + + if( (vmask = visualsupported(display, 0L)) == 0L) { + delete("No visuals reported as valid."); + return; + } + + if( (badname = tet_getvar("XT_BAD_COLORNAME")) == (char *) 0) { + delete("XT_BAD_COLORNAME is not defined."); + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + + colormap = makecolmap(display, vp->visual, AllocNone); + color_name = badname; + exact_def_return = &exactcol; + screen_def_return = &screencol; + status = XCALL; + + if( status != (Status) 0) { + report("%s failed to return zero with color %s.", + TestName, badname); + FAIL; + } else + CHECK; + } + + CHECKPASS(nsupvis()); + +>>#HISTORY Cal Completed Written in new style and format. +>>#HISTORY kieron Completed <have a look> +>>#HISTORY Cal Action Writing code. diff --git a/xts5/Xlib7/XParseColor/XParseColor.m b/xts5/Xlib7/XParseColor/XParseColor.m new file mode 100644 index 00000000..69c76c82 --- /dev/null +++ b/xts5/Xlib7/XParseColor/XParseColor.m @@ -0,0 +1,515 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XParseColor/XParseColor.m,v 1.2 2005-11-03 08:43:43 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib7/XParseColor/XParseColor.m +>># +>># Description: +>># Tests for XParseColor() +>># +>># Modifications: +>># $Log: prsclr.m,v $ +>># Revision 1.2 2005-11-03 08:43:43 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:31 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:26:59 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:17 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:12 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:43 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:22 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:48:42 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE XParseColor Xlib7 +>># +>># Note Do{Red,Green,Blue} are set in the XColor structure. +>># +Status +XParseColor(display, colormap, spec, exact_def_return) +Display *display = Dsp; +Colormap colormap = DefaultColormap(Dsp, 0); +char *spec = config.good_colorname; +XColor *exact_def_return = &color_ret; +>>EXTERN + +#include <ctype.h> + +XColor color_ret; + +Status +checkcolor( red, green, blue, shift, ret_desired) +unsigned int red, green, blue; +unsigned int shift; +XColor *ret_desired; +{ + ret_desired->red = (unsigned short) red<<shift; + ret_desired->green = (unsigned short) green<<shift; + ret_desired->blue = (unsigned short) blue<<shift; + return((ret_desired->red == color_ret.red) && (ret_desired->green == color_ret.green) && (ret_desired->blue == color_ret.blue)); +} + +rgb_report(desired) +XColor *desired; +{ + report("%s() returned red 0x%x green 0x%x blue 0x%x instead of red 0x%x green 0x%x blue 0x%x.", + TestName, + (int) color_ret.red, (int) color_ret.green, (int) color_ret.blue, + (int) desired->red, (int) desired->green, (int) desired->blue); +} + +>>ASSERTION Good B 1 +When the first character of the +.A spec +argument is not "#", then a call to xname returns in the +.A exact_def_return +argument +the rgb values for +the colour named by the +.A spec +argument on the screen associated with the +.A colormap +argument +and returns non-zero. +>>STRATEGY +Parse the color XT_GOOD_COLORNAME using xname. +Verify that the call returns non-zero. +>>CODE +Status result; + + result = XCALL; + if(result == 0) { + report("%s() returned zero.", TestName); + FAIL; + } else + CHECK; + + CHECKUNTESTED(1); + +>>ASSERTION Good A +When the first character of the +.A spec +argument is a \"#\", and the remainder of the string comprises 3 hexadecimal digits, +then a call to xname sets the +.A exact_def_return +argument to have +.M red +component equal to the value of the first digit << 12, to have +.M green +component equal to the value of the second digit << 12, to have +.M blue +component equal to the value of the third digit << 12 and returns non-zero. +>>STRATEGY +Parse the string \"#18f\" using xname. +Verify that the returned XColor structure had red 0x1 green 0x8 blue 0xf. +>>CODE +Status ret; +XColor dcol; + + spec = "#18f"; + ret = XCALL; + if( ret == 0 ) { + report("%s() with spec \"%s\" returned 0.", TestName, spec); + FAIL; + } else + CHECK; + + if( checkcolor(0x1, 0x8, 0xf, 12, &dcol) == 0) { + rgb_report(&dcol); + FAIL; + } else + CHECK; + + CHECKPASS(2); + +>>ASSERTION Good A +When the first character of the +.A spec +argument is a \"#\", and the remainder of the string comprises 6 hexadecimal digits, +then a call to xname sets the +.A exact_def_return +argument to have +.M red +component equal to the value of the first two digits << 8, to have +.M green +component equal to the value of the second two digits << 8, to have +.M blue +component equal to the value of the third two digits << 8 and returns non-zero. +>>STRATEGY +Parse the string \"#f1f8ff\" using xname. +Verify that the returned XColor structure had red 0xf1 green 0xf8 blue 0xff. +>>CODE +Status ret; +XColor dcol; + + spec = "#f1f8ff"; + ret = XCALL; + if( ret == 0 ) { + report("%s() with spec \"%s\" returned 0.", TestName, spec); + FAIL; + } else + CHECK; + + if( checkcolor(0xf1, 0xf8, 0xff, 8, &dcol) == 0) { + rgb_report(&dcol); + FAIL; + } else + CHECK; + + CHECKPASS(2); + +>>ASSERTION Good A +When the first character of the +.A spec +argument is a \"#\", and the remainder of the string comprises 9 hexadecimal digits, +then a call to xname sets the +.A exact_def_return +argument to have +.M red +component equal to the value of the first three digits << 4, to have +.M green +component equal to the value of the second three digits << 4, to have +.M blue +component equal to the value of the third three digits << 4 and returns non-zero. +>>STRATEGY +Parse the string \"#af1bf8cff\" using xname. +Verify that the returned XColor structure had red 0xaf1 green 0xbf8 blue 0xcff. +>>CODE +Status ret; +XColor dcol; + + spec = "#af1bf8cff"; + ret = XCALL; + if( ret == 0 ) { + report("%s() with spec \"%s\" returned 0.", TestName, spec); + FAIL; + } else + CHECK; + + if( checkcolor(0xaf1, 0xbf8, 0xcff, 4, &dcol) == 0) { + rgb_report(&dcol); + FAIL; + } else + CHECK; + + CHECKPASS(2); + +>>ASSERTION Good A +When the first character of the +.A spec +argument is a \"#\", and the remainder of the string comprises 12 hexadecimal digits, +then a call to xname sets the +.A exact_def_return +argument to have +.M red +component equal to the value of the first four digits, to have +.M green +component equal to the value of the second four digits, to have +.M blue +component equal to the value of the third four digits and returns non-zero. +>>STRATEGY +Parse the string \"#faf01bf81cff\" using xname. +Verify that the returned XColor structure had red 0xfaf0 green 0x1bf8 blue 0x1cff. +>>CODE +Status ret; +XColor dcol; + + spec = "#faf01bf81cff"; + ret = XCALL; + if( ret == 0 ) { + report("%s() with spec \"%s\" returned 0.", TestName, spec); + FAIL; + } else + CHECK; + + if( checkcolor(0xfaf0, 0x1bf8, 0x1cff, 0, &dcol) == 0) { + rgb_report(&dcol); + FAIL; + } else + CHECK; + + CHECKPASS(2); + +>>ASSERTION Good A +Upper and lower case characters in the +.A spec +argument refer to the same colour. +>>STRATEGY +Parse the string XT_GOOD_COLORNAME using xname. +Verify that the call did not return zero. +Parse the string obtained by inverting each character of XT_GOOD_COLORNAME using xname. +Verify that the call did not return zero. +Verify that the returned red, green and blue values are the same. +Parse the string #feAAc1 using xname. +Verify that the call did not return zero. +Parse the string #FEAaC1 using xname. +Verify that the call did not return zero. +Verify that the returned red, green and blue values are the same. +>>CODE +char *ptr; +char *str; +Status result; +XColor dcol; +unsigned short red, green, blue; + + result = XCALL; + if(result == 0) { + report("%s() with spec \"%s\" returned zero.", TestName, config.good_colorname); + FAIL; + } else + CHECK; + + red = color_ret.red; + green = color_ret.green; + blue = color_ret.blue; + + str = xt_strdup(config.good_colorname); + + if(str == (char *) NULL) { + delete("xt_strdup() returned NULL."); + return; + } else + CHECK; + + for(ptr = str; *ptr; ptr++) + if(isupper(*ptr)) + *ptr = tolower(*ptr); + else + *ptr = toupper(*ptr); + + spec = str; + result = XCALL; + if(result == 0) { + report("%s() with spec \"%s\" returned zero.", TestName, str); + FAIL; + } else + CHECK; + + if((red != color_ret.red) || (green != color_ret.green) || (blue != color_ret.blue)) { + report("%s() did not map color names %s and %s to the same rgb values.", TestName, config.good_colorname, str); + FAIL; + } else + CHECK; + + spec = "#feAAc1"; + result = XCALL; + if( result == 0 ) { + report("%s() with spec \"%s\" returned 0.", TestName, spec); + FAIL; + } else + CHECK; + + if( checkcolor(0xfe, 0xaa, 0xc1, 8, &dcol) == 0) { + rgb_report(&dcol); + FAIL; + } else + CHECK; + + spec = "#FEAaC1"; + result = XCALL; + if( result == 0 ) { + report("%s() with spec \"%s\" returned 0.", TestName, spec); + FAIL; + } else + CHECK; + + if( checkcolor(0xfe, 0xaa, 0xc1, 8, &dcol) == 0) { + rgb_report(&dcol); + FAIL; + } else + CHECK; + + CHECKPASS(8); + + +>>ASSERTION Good A +A call to xname sets the +.M flags +component of the +.A exact_def_return +argument to +.S "DoRed|DoGreen|DoBlue" . +>>STRATEGY +Parse the string \"#000\" using xname. +Verify that the flags component of the returned XColor structure was DoRed|DoGreen|DoBlue. +>>CODE +Status ret; +char flags; +XColor dcol; + + spec = "#000"; + ret = XCALL; + if( ret == 0 ) { + report("%s() with spec \"%s\" returned 0.", TestName, spec); + FAIL; + } else + CHECK; + + if(color_ret.flags != (flags = DoRed | DoGreen | DoBlue)) { + report("%s() set the flags component of the retured XColor structure to %d instead of DoRed|DoGreen|DoBlue (%d).", + TestName, (int) color_ret.flags, (int) flags); + + FAIL; + } else + CHECK; + + CHECKPASS(2); + +>>ASSERTION Good A +When the first character of the +.A spec +argument is a \"#\" +and the remainder of the string does not comprise +3, 6, 9 or 12 hexadecimal digits, +then a call to xname returns zero. +>>STRATEGY +Parse the string \"#f0\" using xname. +Verify that the call returns zero. +Parse the string \"#1010\" using xname. +Verify that the call returns zero. +Parse the string \"##ffeeffeeffe\" using xname. +Verify that the call returns zero. +Parse the string \"##0011223344556\" using xname. +Verify that the call returns zero. +>>CODE +Status ret; + + spec = "#f0"; + ret = XCALL; + if( ret != 0 ) { + report("%s() with spec \"%s\" did not return zero.", TestName, spec); + FAIL; + } else + CHECK; + + spec = "#1010"; + ret = XCALL; + if( ret != 0 ) { + report("%s() with spec \"%s\" did not return zero.", TestName, spec); + FAIL; + } else + CHECK; + + spec = "#ffeeffeeffe"; /* 11 digits */ + ret = XCALL; + if( ret != 0 ) { + report("%s() with spec \"%s\" did not return zero.", TestName, spec); + FAIL; + } else + CHECK; + + spec = "#0011223344556"; /* 13 digits */ + ret = XCALL; + if( ret != 0 ) { + report("%s() with spec \"%s\" did not return zero.", TestName, spec); + FAIL; + } else + CHECK; + + CHECKPASS(4); + +>>ASSERTION Good A +When the first character of the +.A spec +argument is not a \"#\" +and the colour named by the +.A spec +argument is not in the colour database, +then a call to xname returns zero. +>>STRATEGY +Parse the string XT_BAD_COLORNAME using xname. +Verify that the call returns zero. +>>CODE +char *ptr; +char *str; +Status result; +XColor dcol; +unsigned short red, green, blue; + + spec = config.bad_colorname; + result = XCALL; + if(result != 0) { + report("%s() with spec \"%s\" did not return zero.", TestName, config.bad_colorname); + FAIL; + } else + PASS; + +>>ASSERTION Bad A +.ER BadColor diff --git a/xts5/Xlib7/XQueryColor/XQueryColor.m b/xts5/Xlib7/XQueryColor/XQueryColor.m new file mode 100644 index 00000000..38a39f6f --- /dev/null +++ b/xts5/Xlib7/XQueryColor/XQueryColor.m @@ -0,0 +1,228 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XQueryColor/XQueryColor.m,v 1.2 2005-11-03 08:43:44 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib7/XQueryColor/XQueryColor.m +>># +>># Description: +>># Tests for XQueryColor() +>># +>># Modifications: +>># $Log: qryclr.m,v $ +>># Revision 1.2 2005-11-03 08:43:44 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:31 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:26:59 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:18 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:12 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:43 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:24 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:48:45 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE XQueryColor Xlib7 +void +XQueryColor(display, colormap, def_in_out) +Display *display = Dsp; +Colormap colormap = DefaultColormap(display, DefaultScreen(display)); +XColor *def_in_out = &dummycol; +>>EXTERN +XColor dummycol; +>>ASSERTION Good A +A call to xname obtains the RGB +values of the colourmap entry specified by the +.M pixel +component of the +.S XColor +structure named by the +.A def_in_out +argument , +and returns the RGB values in the +.M red , +.M green +and +.M blue +components and sets the +.M flags +component to the bitwise OR of +.S DoRed , +.S DoGreen +and +.S DoBlue . +>>STRATEGY +For each supported visual class: + Create a colormap with XCreateColormap with alloc set to AllocNone. + Allocate a new r/o colourmap cell with XAllocColor. + Obtain the rgb values and flags components with XQueryColor using the pixel returned by XAllocColor. + Verify that the returned flags component was set to DORed|DoGreen|DoBlue. + Verify that the rgb values are identical to those returned by XAllocColor. + +>>CODE +XVisualInfo *vp; +XColor qcol, qcolr; +unsigned long vmask = 0L; + + if((vmask = visualsupported(display, 0L)) == 0L) { + delete("No visuals reported as valid."); + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + colormap = makecolmap(display, vp->visual, AllocNone); + qcol.pixel = ~0L; + qcol.red = 0xfefe; + qcol.green = 0xefef; + qcol.blue = 0xfeef; + qcol.flags = 0; + + if (XAllocColor(display, colormap, &qcol) == False) { + delete("XAllocColor() failed."); + return; + } else + CHECK; + + qcolr = qcol; + def_in_out = &qcol; + XCALL; + + if(geterr() == Success) + CHECK; + + if(qcol.flags != (DoRed|DoGreen|DoBlue)) { + report("XQueryColor() did not set the flags to (DoRed|DoGreen|DoBlue)"); + FAIL; + } else + CHECK; + + if((qcol.pixel != qcolr.pixel) || (qcol.red != qcolr.red) || (qcol.green != qcolr.green) || (qcol.blue != qcolr.blue)){ + report("XQueryColor() returned r %u g %u b %u instead of r %u g %u b %u", qcol.red, qcol.green, qcol.blue, qcolr.red, qcolr.green, qcolr.blue); + FAIL; + } else + CHECK; + } + + CHECKPASS(4*nsupvis()); + +>>ASSERTION Bad A +.ER BadColor +>>ASSERTION Bad A +When the +.M pixel +component in the +.S XColor +structure named by the +.A def_in_out +argument is not a valid entry in the +.A colormap +argument, +then a +.S BadValue +error occurs. +>>STRATEGY +For each supported visual class: + Create a colormap with XCreateColormap with alloc set to AllocNone. + Call XQueryColor with pixel component = -1. + Verify that a BadValue error occurs. +>>CODE BadValue +XVisualInfo *vp; +XColor qcol; +unsigned long vmask; + + if((vmask = visualsupported(display, 0L)) == 0L) { + delete("No visuals reported as valid."); + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + colormap = makecolmap(display, vp->visual, AllocNone); + def_in_out = &qcol; + qcol.pixel = ~0L; + XCALL; + if(geterr() == BadValue) + CHECK; + } + + CHECKPASS(nsupvis()); + + +>>#HISTORY Cal Completed Written in new style and format. +>>#HISTORY Kieron Completed <Have a look> +>>#HISTORY Cal Action Writting code. diff --git a/xts5/Xlib7/XQueryColors/XQueryColors.m b/xts5/Xlib7/XQueryColors/XQueryColors.m new file mode 100644 index 00000000..1a99006d --- /dev/null +++ b/xts5/Xlib7/XQueryColors/XQueryColors.m @@ -0,0 +1,280 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XQueryColors/XQueryColors.m,v 1.3 2005-11-03 08:43:44 jmichael Exp $ + +Copyright (c) 2002 The Open Group +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib7/XQueryColors/XQueryColors.m +>># +>># Description: +>># Tests for XQueryColors() +>># +>># Modifications: +>># $Log: qryclrs.m,v $ +>># Revision 1.3 2005-11-03 08:43:44 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.2 2005/04/21 09:40:42 ajosey +>># resync to VSW5.1.5 +>># +>># Revision 8.2 2005/01/21 10:50:33 gwc +>># Updated copyright notice +>># +>># Revision 8.1 2002/11/27 16:43:20 gwc +>># TSD4W.00175: tp1 - guard against BadLength error +>># +>># Revision 8.0 1998/12/23 23:27:00 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:18 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:13 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:44 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:25 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:48:47 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE XQueryColors Xlib7 +void +XQueryColors(display, colormap, defs_in_out, ncolors) +Display *display = Dsp; +Colormap colormap = DefaultColormap(display, DefaultScreen(display)); +XColor *defs_in_out = &dummycol; +int ncolors; +>>EXTERN +#include <X11/Xproto.h> +XColor dummycol; +>>ASSERTION Good A +A call to xname obtains the RGB values of the colourmap entries specified by the +.M pixel +components of the +.S XColor +structures named by the +.A defs_in_out +argument, and returns the RGB values in the +.M red , +.M green , +and +.M blue +components and sets the +.M flags +components to the bitwise OR of +.S DoRed , +.S DoGreen , +and +.S DoBlue . +>>STRATEGY +For each supported visual class : + Create a colormap with XCreateColormap with alloc = AllocNone. + Allocate a new r/o colourmap cell with XAllocColor. + Obtain the rgb values and flags components with XQueryColors using the pixel returned by XAllocCOlor. + Verify that the returned flags component was set to DORed|DoGreen|DoBlue. + Verify that the rgb values are identical to those returned by XAllocColor. +>>CODE +XVisualInfo *vp; +XColor *cellptr, *defptr, *refptr, *acptr; +int size; +unsigned long i; +unsigned long vmask = 0L; + + if((vmask = visualsupported(display, vmask)) != 0L) + for(resetsupvis(vmask); nextsupvis(&vp); ) { + size = vp->colormap_size; + if (vp->class == DirectColor) + size = maxsize(vp); + /* + * Ensure we won't exceed the longest possible + * QueryColors protocol request. (Can happen + * for StaticGray visuals with depth 16.) + */ + if (size > 65535 - sizeof(xQueryColorsReq)) + size = 65535 - sizeof(xQueryColorsReq); + + colormap = makecolmap(display, vp->visual, AllocNone); + + defptr = (XColor *) malloc( size * sizeof(XColor)); + refptr = (XColor *) malloc( size * sizeof(XColor)); + + if( (defptr == (XColor *) 0) || (refptr == (XColor *) 0)) { + delete("malloc() failed to allocate space for the colour array."); + return; + } + + for(i=0, cellptr = defptr; i<size; i++, cellptr++) { /* May or may not allocate the entire colourmap */ + cellptr->pixel = ~0L; + cellptr->red = i<<8; + cellptr->green = i<<8; + cellptr->blue = i<<8; + cellptr->flags = 0; + + if(XAllocColor(display, colormap, cellptr) == False) { + delete("XAllocColor() failed."); + return; + } + + refptr[i] = defptr[i]; + } + if(i == size) + CHECK; + + ncolors = size; + defs_in_out = defptr; + XCALL; + + if(geterr() == Success) + for(i=0, cellptr = defptr, acptr = refptr; i<size; i++, cellptr++, acptr++) { + if(cellptr->flags != (DoRed|DoGreen|DoBlue)) { + report("XQueryColors() did not set the flags of cell %u to (DoRed|DoGreen|DoBlue)", cellptr->pixel); + FAIL; + } + + if((cellptr->pixel != acptr->pixel) || (cellptr->red != acptr->red) || + (cellptr->green != acptr->green) || (cellptr->blue != acptr->blue)){ + report("XQueryColors() returned pixel %u r %u g %u b %u instead of pixel %u r %u g %u b %u", + cellptr->pixel, cellptr->red, cellptr->green, cellptr->blue, + acptr->pixel, acptr->red, acptr->green, acptr->blue); + FAIL; + } + } + else + FAIL; + + if(i == size) + CHECK; + + free(defptr); + free(refptr); + } + + CHECKPASS(2*nsupvis()); + +>>ASSERTION Bad A +.ER BadColor +>>ASSERTION Good A +When the +.M pixel +component in one or more of the +.A ncolors +.S XColor +structures named by the +.A defs_in_out +argument is not a valid entry in the +.A colormap +argument, +then a +.S BadValue +error occurs which will report any one of the +invalid pixel values. +>>STRATEGY +For each supported visual class: + Create a colormap with XCreateColormap with alloc set to AllocNone. + Allocate a r/o colormap cell with XAllocColor. + Call XQueryColors with pixel array comprising pixel components 0L, -1L, -2L. + Verify that a BadValue error occurs. + Verify that the reported BadValue was either -1 or -2. +>>CODE BadValue +XVisualInfo *vp; +XColor tcol; +XColor qcol[3]; +unsigned long vmask; + + if((vmask = visualsupported(display, 0L)) == 0L) { + delete("No visuals reported as valid."); + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + colormap = makecolmap(display, vp->visual, AllocNone); + XAllocColor(display, colormap, &tcol); + defs_in_out = qcol; + qcol[0].pixel = tcol.pixel; + qcol[1].pixel = (unsigned long)-1L; + qcol[2].pixel = (unsigned long)-2L; + ncolors = 3; + XCALL; + if(geterr() == BadValue) { + if((getbadvalue() != (unsigned long)-1) && (getbadvalue() != (unsigned long)-2)) { + report("BadValue reported was neither -1 or -2"); + FAIL; + } else + CHECK; + } + + } + + CHECKPASS(nsupvis()); + +>>#HISTORY Cal Completed Written in new style and format. +>>#HISTORY Kieron Completed <Have a look> +>>#HISTORY Cal Action Writting code. diff --git a/xts5/Xlib7/XStoreColor/XStoreColor.m b/xts5/Xlib7/XStoreColor/XStoreColor.m new file mode 100644 index 00000000..d6c4aefe --- /dev/null +++ b/xts5/Xlib7/XStoreColor/XStoreColor.m @@ -0,0 +1,654 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XStoreColor/XStoreColor.m,v 1.2 2005-11-03 08:43:44 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib7/XStoreColor/XStoreColor.m +>># +>># Description: +>># Tests for XStoreColor() +>># +>># Modifications: +>># $Log: strclr.m,v $ +>># Revision 1.2 2005-11-03 08:43:44 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:31 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:27:00 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:19 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:13 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:44 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:27 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:48:50 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE XStoreColor Xlib7 +void +XStoreColor(display, colormap, color) +Display *display = Dsp; +Colormap colormap = DefaultColormap(display, DefaultScreen(display)); +XColor *color = &dummycol; +>>EXTERN +XColor dummycol; +>>ASSERTION Good C +>># TODO dave - Jan 17 +>># The X11R4 spec is vague about whether it's the closest available or +>># or the actual values that are stored. +>># O'Reilly Vol one page 190 has a footnote saying the actual values +>># you tried to store may not be stored. +If any of the visual classes DirectColor, PseudoColor or Grayscale is supported: +A call to xname obtains the closest available RGB values for the +.A colormap +argument to those specified in the +.S red , +.S green +and +.S blue +components of the +.S XColor +structure named by the +.A color +argument, and stores those values in the read-write colourmap entry +specified by the +.M pixel +components of the +.S XColor +structure. +>>STRATEGY +For each visual class DirectColor, PseudoColor and GrayScale: + Create a colormap with alloc set to AllocAll. + Store the color r = 0xffff g = 0xf1f0 b = 0x0ff8 at cell 0. + Obtain the rbg values of the stored color with XQueryColor. + Store the returned rgb values in cell 0 + Obtain the stored values with XQueryColor. + Verify the rgb values stored in both cases were identical. +>>CODE +XVisualInfo *vp; +XColor testcol, storedcol, savedcol; +unsigned long vmask = (1<<DirectColor)|(1<<PseudoColor)|(1<<GrayScale); + + if( (vmask = visualsupported(display, vmask)) == 0L) { + unsupported("DirectColor, PseudoColor and GrayScale are not supported"); + return; + } + + storedcol.pixel = 0L; + testcol.pixel = 0L; + testcol.red = 0xffff; + testcol.green = 0xf1f0; + testcol.blue = 0x0ff8; + testcol.flags = DoRed|DoGreen|DoBlue; + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + colormap = makecolmap(display, vp->visual, AllocAll); + color = &testcol; + XCALL; + XQueryColor(display, colormap, &storedcol); + savedcol = storedcol; + color = &storedcol; + XCALL; + XQueryColor(display, colormap, &testcol); + + if( (savedcol.red != testcol.red) || (savedcol.green != testcol.green) || (savedcol.blue != testcol.blue) ) { + report("XStoreColor() return RGB values r %u g %u b %u instead of r %u g %u b %u.", + savedcol.red, savedcol.green, savedcol.blue, testcol.red, testcol.green, testcol.blue); + FAIL; + } else + CHECK; + } + CHECKPASS(nsupvis()); + +>>ASSERTION Good C +If any of the visual classes DirectColor, PseudoColor or GrayScale is supported: +A call to xname changes the red, green and blue values +in the read-write colourmap entry in accordance with the +.M flags +component of the +.S XColor +structure named by the +.A color +argument. +>>STRATEGY +For each supported visual class DirectColor, PseudoColor and GrayScale: + Create a colormap with XCreateColormap. + Store the color r = 0xffff g = 0xf1f0 b = 0x0ff8 at cell 0 with XStoreColor. + Obtain the r,g and b values with XQueryColor. + For each possible combination DoRed, DoGreen and DoBlue in flags: + Store the bitwise complementary rgb values in the same cell with XStoreColor. + Store the color r = 0xffff g = 0xf1f0 b = 0x0ff8 at cell 0 with XStoreColor. + Verify that only the components of the colourcell specified by the flags value have been altered with XQueryColor. + +>>CODE +XVisualInfo *vp; +int i; +XColor namedcol, testcol, storedcol; +unsigned long vmask = (1<<DirectColor)|(1<<PseudoColor)|(1<<GrayScale); +unsigned short redval, greenval, blueval; +char flags; + + if( (vmask = visualsupported(display, vmask)) == 0L) { + UNSUPPORTED; + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + + testcol.pixel = 0L; + testcol.red = 0xffff; + testcol.green = 0xf1f0; + testcol.blue = 0x0ff8; + testcol.flags = DoRed|DoGreen|DoBlue; + + color = &testcol; + colormap = makecolmap(display, vp->visual, AllocAll); + XCALL; + + namedcol.pixel = 0L; + XQueryColor(display, colormap, &namedcol); /* named color has expected r,g,b values.*/ + + testcol = namedcol; + testcol.red ^= 0xffff; + testcol.green ^= 0xffff; + testcol.blue ^= 0xffff; + testcol.flags = DoRed|DoGreen|DoBlue; + color = &testcol; + XCALL; + XQueryColor(display, colormap, &testcol); /* test color has the unexpected rgb vals */ + + for(i=0; i<8; i++) { + + flags = 0; + + if(i&DoRed) { + flags |= DoRed; + redval = namedcol.red; + } else + redval = testcol.red; + + if(i&DoGreen) { + flags |= DoGreen; + greenval = namedcol.green; + } else + greenval = testcol.green; + + if(i&DoBlue) { + flags |= DoBlue; + blueval = namedcol.blue; + } else + blueval = testcol.blue; + + testcol.flags = DoRed|DoGreen|DoBlue; + color = &testcol; + XCALL; /* Sore the inv colours */ + + namedcol.flags = flags; + color = &namedcol; + XCALL; + storedcol.pixel = 0L; + storedcol.flags = DoRed|DoGreen|DoBlue; + XQueryColor(display, colormap, &storedcol); + + if( (redval != storedcol.red) || (greenval != storedcol.green) || (blueval != storedcol.blue) ) { + report("XStoreColor() flags = %d RGB value r %u g %u b %u instead of r %u g %u b %u.", + (int) i, + storedcol.red, storedcol.green, storedcol.blue, redval, greenval, blueval); + FAIL; + } else + CHECK; + } + } + + CHECKPASS(i*nsupvis()); + +>>ASSERTION Good D 1 +If any of the visual classes DirectColor, PseudoColor or GrayScale is supported: +When the +.A colormap +is an installed colourmap for its screen, +then any changes made by a call to xname are visible immediately. +>>ASSERTION Bad C +If any of the visual classes DirectColor, PseudoColor or GrayScale is supported: +When the +.M pixel +component in the +.S XColor +structure named by the +.A color +argument is not a valid entry in the +.A colormap +argument, +then a +.S BadValue +error occurs. +>>STRATEGY +For each visual class DirectColor, PseudoColor and GrayScale: + Create a colourmap with alloc set to AllocAll. + Store the color r = 0xffff g = 0xf1f0 b = 0x0ff8 using XStoreColor with pixel = colormap_size. + Verify that a BadValue error is generated. +>>CODE BadValue +XVisualInfo *vp; +XColor testcol; +unsigned long vmask = (1<<DirectColor)|(1<<PseudoColor)|(1<<GrayScale); + + if( (vmask = visualsupported(display, vmask)) == 0L) { + UNSUPPORTED; + return; + } + + testcol.red = 0xffff; + testcol.green = 0xf1f0; + testcol.blue = 0x0ff8; + color = &testcol; + for(resetsupvis(vmask); nextsupvis(&vp); ) { + colormap = makecolmap(display, vp->visual, AllocAll); + testcol.pixel = maxsize(vp) + 1; + if (vp->class == DirectColor) { + testcol.pixel = (vp->red_mask | vp->blue_mask | vp->green_mask); + testcol.pixel |= testcol.pixel << 1; + } + trace("Testing with pixel set to > colormap_size (%ld).",testcol.pixel); + + XCALL; + if(geterr() == BadValue) + CHECK; + + } + + CHECKPASS(nsupvis()); + +>>ASSERTION Bad A +.ER BadAccess colormap-store +>>STRATEGY +>># For each visual class DirectColor, PseudoColor and GrayScale: +For all visuals: + Create a colormap with alloc set to AllocNone. (Unallocated for visual + classes DirectColor, PseudoColor and GrayScale; R/O for visual + classes TrueColor, StaticColor and StaticGray: all should + provoke BadAccess) + For each colormap cell: + Store the color r = 0xffff g = 0xf1f0 b = 0x0ff8 using xname. + Verify that a BadAccess error is generated. + Create a new client with XOpenDisplay. + Allocate a readonly cell for the new client with XAllocColor. + Store a value in the cell with xname. + Verify that a BadAccess error occurred. + Allocate a readonly cell with XAllocColor. + Store a value in the cell with xname. + Verify that a BadAccess error occurred. +>>CODE BadAccess +XVisualInfo *vp; +XColor testcol; +Display *disp2; +unsigned long i; + + for(resetvinf(VI_WIN); nextvinf(&vp); ) { + + testcol.red = 0xffff; + testcol.green = 0xf1f0; + testcol.blue = 0x0ff8; + + color = &testcol; + + colormap = makecolmap(display, vp->visual, AllocNone); + trace("Testing a colormap with no allocated/just r-o cells."); + for(i=0; i < maxsize(vp); i++) { + testcol.pixel = i; + XCALL; + /* the XCALL will have done a check for geterr() == + BadAccess (c.f. arg. after CODE keyword above) + and will FAIL if not. + */ + } + if(i == maxsize(vp)) + CHECK; + + disp2 = opendisplay(); + + if(XAllocColor(disp2, colormap, &testcol) == False) { + delete("XAllocColor() failed to allocate a r/o cell for a second client."); + return; + } else + CHECK; + + trace("Trying to write into a r/o cell allocated by another client."); + color = &testcol; + XCALL; + if(geterr() == BadAccess) + CHECK; + + testcol.red ^= 0xffff; + testcol.green ^= 0xffff; + testcol.blue ^= 0xffff; + + if(XAllocColor(display, colormap, &testcol) == False) { + delete("XAllocColor() failed to allocate a r/o cell"); + return; + } else + CHECK; + + trace("Trying to write into a r/o cell allocated by self."); + color = &testcol; + XCALL; + if(geterr() == BadAccess) + CHECK; + } + + CHECKPASS(5*nvinf()); +>>ASSERTION Bad A +.ER BadColor +>>ASSERTION Good D 3 +When +.A rmask_return , +.A gmask_return +and +.A bmask_return +have been returned by +a previous call to +.S XAllocColorPlanes +and a read-write colourmap entry +for a pixel value is changed by a call to xname, then the pixel value +is decomposed into three components using the masks and the +independent colourmap entries are updated. +>>ASSERTION Good C +If the visual class +.S DirectColor +is supported: +When the +.A colormap +argument was created with visual type +.S DirectColor +and with +.A alloc +set to +.S AllocAll , +and a read-write colourmap entry for a pixel value is changed by a call to xname, then +the pixel value is decomposed into three components using the +.S red_mask , +.S green_mask +and +.S blue_mask +in the visual and the independent colourmap entries are updated. +>>STRATEGY +If visual class DirectColor is supported: + Create a colourmap using makecolmap and AlocAll + Allocate an array of XColor's and one for each of reds, greens & blues + Set up each of reds, greens & blues to have a distinguishable value, + using xname, and make sure that's what's in the equivalent colourmaps. + Read back some suitably \"random\" triples and check their components + Verify that each component is the same as the corresponding entry in + reds, greens & blues. + Free the allocated storage: colors, reds, greens & blues. +>>EXTERN +#define lowbit(x) ((x) & (~(x) + 1)) +#define bitcontig(x) ((((x) + lowbit(x)) & (x)) == 0) +#define bitsubset(a,b) (((a) & (b)) == (a)) + +static int +maskshift(mask) +register unsigned long mask; +{ +register int i; + + for (i = 0; mask; i++) { + if (mask & 0x1) + return i; + mask >>= 1; + } + return i; +} + +static int ncolors = 0; + +static +Bool set_one_col(refp, s, flags, mask) + unsigned long *refp; + char *s; + char flags; + unsigned long mask; +{ + unsigned long i; + XColor *cp1; + XColor *save_col = color; /* for restoring color, later */ + unsigned long *lrefp = refp; + int fail = 0; /* used in the FAIL in XCall (spelt wrong intentionally) */ + /* expects to find color and ncolors in-scope */ + + for(i=0, cp1 = color; i < ncolors; i++, cp1++) { + unsigned long subfield_ix = i << maskshift(mask); + + if (!bitsubset(subfield_ix, mask)) { + delete("Inconsistent maxsize() result: size of %d is too big to fit into %s mask 0x%lx (detected at index %lu, giving pixel 0x%lx)", + ncolors, s, mask, i, subfield_ix); + return False; + } + cp1->pixel = subfield_ix; + cp1->flags = flags; + switch (flags) { + case DoRed: + cp1->red = i; + break; + case DoGreen: + cp1->green = i; + break; + case DoBlue: + cp1->blue = i; + break; + default: + delete("Flags 0x%x has more than one colour in it.", (unsigned int)flags); + color = save_col; + return False; + } + color = cp1; + /* The following may generate a warning about the return; */ + XCALL; + } + color = save_col; + XQueryColors(display, colormap, color, ncolors); + for(i=0,cp1=color,lrefp=refp; i < ncolors; i++, lrefp++, cp1++) { + *lrefp = (flags==DoRed) ? cp1->red : + ((flags==DoGreen) ? cp1->green : cp1->blue); + } + return (geterr() == Success); +} +>>CODE +XVisualInfo *vp; +unsigned long vmask = (1<<DirectColor); +XColor *colors; +unsigned long i; +XColor *refp; +unsigned long *reds, *greens, *blues; +int pathcnt = 0; +static XColor triples[] = { + (unsigned long)~0L, 0,0,0, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 1,0,0, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 0,1,0, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 0,0,1, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 3,2,1, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 1,3,0, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 7,3,1, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 7,8,5, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 15,11,12, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 42,99,13, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 112,127,64, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 255,64,33, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 64,255,33, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 64,33,255, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 255,255,255, DoRed|DoGreen|DoBlue, 0 + }; + +/* If visual class DirectColor is supported: */ + if( (vmask = visualsupported(display, vmask)) == 0L) { + UNSUPPORTED; + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + +/* Create a colourmap using makecolmap and AlocAll */ + colormap = makecolmap(display, vp->visual, AllocAll); + ncolors = maxsize(vp); +/* Allocate an array of XColor's and one for each of reds, greens & blues */ + colors = (XColor *) malloc(ncolors * sizeof(XColor)); + color = colors; + reds = (unsigned long *) malloc(ncolors * sizeof(unsigned long)); + greens = (unsigned long *) malloc(ncolors * sizeof(unsigned long)); + blues = (unsigned long *) malloc(ncolors * sizeof(unsigned long)); + if ((colors == (XColor *) 0) || (reds == (unsigned long *) 0) || + (greens == (unsigned long *) 0) || + (blues == (unsigned long *) 0)) { + delete("malloc() couldn't allocate %d cells for the XColor array.", ncolors); + return; + } else + CHECK; + + /* now it's safe to call set_one_col: color and ncolors are set. */ + + +/* Set up each of reds, greens & blues to have a distinguishable value, */ +/* using xname, and make sure that's what's in the equivalent colourmaps. */ + /* + kept in reds, greens or blues. This routine expects + color and ncolors to be set right. It uses XCall as well. + */ + if (!set_one_col(reds, "red", DoRed, vp->red_mask) || + !set_one_col(greens, "green", DoGreen, vp->green_mask) || + !set_one_col(blues, "blue", DoBlue, vp->blue_mask) + ) { + delete("Failed to set up colourmap for test."); + return; + } else + CHECK; + +/* Read back some suitably "random" triples and check their components */ + for (i=0, refp=triples; i < NELEM(triples); i++, refp++) { + XColor testcol; + unsigned long r,g,b; + + if (refp->red >= (unsigned)ncolors || + refp->green >= (unsigned)ncolors || + refp->blue >= (unsigned)ncolors) + continue; + + r = refp->red << maskshift(vp->red_mask); + if (!bitsubset(r, vp->red_mask)) + continue; + g = refp->green << maskshift(vp->green_mask); + if (!bitsubset(g, vp->green_mask)) + continue; + b = refp->blue << maskshift(vp->blue_mask); + if (!bitsubset(b, vp->blue_mask)) + continue; + testcol.pixel = r | g | b; + + XQueryColor(display, colormap, &testcol); + +/* Verify that each component is the same as the corresponding entry in */ +/* reds, greens & blues. */ + if (testcol.flags != (DoRed | DoGreen | DoBlue) || + testcol.red != reds[refp->red] || + testcol.green != greens[refp->green] || + testcol.blue != blues[refp->blue]) { + report("Expected r,g,b = %lu, %lu, %lu but got %lu, %lu, %lu for pixel 0x%lx with r-,g-,b-masks 0x%lx, 0x%lx, 0x%lx", + reds[refp->red], greens[refp->green], blues[refp->blue], + testcol.red, testcol.green, testcol.blue, + testcol.pixel, vp->red_mask, + vp->green_mask, vp->blue_mask); + FAIL; + } else + CHECK; + + pathcnt++; + } + +/* Free the allocated storage: colors, reds, greens & blues. */ + free((char*)colors); + free((char*)reds); + free((char*)greens); + free((char*)blues); + } + + CHECKPASS(pathcnt+2*nsupvis()); + + +>>#HISTORY Cal Completed Written in new style and format. +>>#HISTORY Kieron Completed <Have a look> +>>#HISTORY Cal Action Writing code. +>>#HISTORY Cal Completed Written in new style and format. +>>#HISTORY Kieron Completed <Have a look> +>>#HISTORY Cal Action Writing Code. diff --git a/xts5/Xlib7/XStoreColors/XStoreColors.m b/xts5/Xlib7/XStoreColors/XStoreColors.m new file mode 100644 index 00000000..d7965f46 --- /dev/null +++ b/xts5/Xlib7/XStoreColors/XStoreColors.m @@ -0,0 +1,828 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XStoreColors/XStoreColors.m,v 1.2 2005-11-03 08:43:44 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib7/XStoreColors/XStoreColors.m +>># +>># Description: +>># Tests for XStoreColors() +>># +>># Modifications: +>># $Log: strclrs.m,v $ +>># Revision 1.2 2005-11-03 08:43:44 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:31 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:27:01 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:19 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:14 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:45 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:29 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:48:54 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE XStoreColors Xlib7 +void +XStoreColors(display, colormap, color, ncolors) +Display *display = Dsp; +Colormap colormap = DefaultColormap(display, DefaultScreen(display)); +XColor *color = &dummycol; +int ncolors = 1; +>>EXTERN +XColor dummycol = { 0L, 0,0,0, DoRed|DoGreen|DoBlue, 0 }; +>>ASSERTION Good C +>># TODO dave - Jan 17 +>># The X11R4 spec is vague about whether it's the closest available or +>># or the actual values that are stored. +>># O'Reilly Vol one page 190 has a footnote saying the actual values +>># you tried to store may not be stored. +If any of the visual classes DirectColor, PseudoColor or Grayscale is supported: +A call to xname obtains the closest available RGB values for the +.A colormap +argument to those specified in the +.S red , +.S green +and +.S blue +components of the +.S XColor +structures named by the +.A color +argument, and stores those values in the read-write colourmap +entries specified by the +.M pixel +components of the +.S XColor +structures. +>>STRATEGY +For each visual class DirectColor, PseudoColor and GrayScale: + Create a colourmap with alloc set to AllocAll; + Store the color r = 0xffff g = 0xf1f0 b = 0x0ff8 in each cell of the colourmap with XStoreColors. + Obtain the stored r,g b values with XQueryColors. + Store the obtained r,g b values in each cell with XStoreColors. + Obtain the stored r, g, b values with XQueryColors. + Verify that these values are identical to those originally obtained. +>>CODE +XVisualInfo *vp; +XColor *colp, *cp, *testcol; +unsigned long vmask = (1<<DirectColor)|(1<<PseudoColor)|(1<<GrayScale); +unsigned long i; + + if( (vmask = visualsupported(display, vmask)) == 0L) { + UNSUPPORTED; + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + colormap = makecolmap(display, vp->visual, AllocAll); + ncolors = maxsize(vp); + + color = (XColor *) malloc(ncolors * sizeof(XColor)); + if(color == (XColor *) 0) { + delete("malloc() couldn't allocate %d cells for the XColor array.", ncolors); + return; + } else + CHECK; + + for(i=0, colp = color; i < ncolors; i++, colp++) { + colp->pixel = i; + colp->red = 0xffff ^ (i*4); + colp->green = 0xf1f0 ^ (i*8); + colp->blue = 0x0ff8 ^ (i*6); + colp->flags = (char) (DoRed|DoGreen|DoBlue); + } + + XCALL; + if(geterr() == Success) + CHECK; + + /* Write colormap stored values back over the original array */ + XQueryColors(display, colormap, color, ncolors); + + XCALL; + if(geterr() == Success) + CHECK; + + testcol = (XColor *) malloc(ncolors * sizeof(XColor)); + if(testcol == (XColor *) 0) { + delete("malloc() couldn't allocate %d cells for the XColor array.", ncolors); + return; + } else + CHECK; + + for(i=0; i<ncolors; i++) + testcol[i].pixel = i; + + XQueryColors(display, colormap, testcol, ncolors); + + for(i=0, colp = testcol, cp = color; i < ncolors; i++, colp++, cp++) + if( (cp->red != colp->red) || (cp->green != colp->green) || (cp->blue != colp->blue) ) { + report("cell %ld: r %u g %u b %u instead of r %u g %u b %u", + i, + cp->red, cp->green, cp->blue, + colp->red, colp->green, colp->blue); + FAIL; + } + + if( i == ncolors) + CHECK; + free((char *)color); + free((char *)testcol); + } + CHECKPASS(5*nsupvis()); + +>>ASSERTION Good C +If any of the visual classes DirectColor, PseudoColor or Grayscale is supported: +A call to xname changes the red, green and blue values +in each of the +.A ncolors +read-write colourmap entries in accordance with the +.M flags +components of the +.S XColor +structures named by the +.A color +argument. +>>STRATEGY +For each supported visual class DirectColor, PseudoColor and GrayScale: + Create a colormap with XCreateColormap. + Obtain two distinct colormap values using XStoreColors and XQueryColors. + For each possible combination DoRed, DoGreen and DoBlue in flags: + Set all colormap cells to the first value with flags = DoRed|DoGreen|DoBlue + Set all colormap cells to the second value with rbg components selected by the flag combination with XStoreColors. + Verify that only the components of the colourcell specified by the flags were altered with XQueryColor. +>>CODE +XVisualInfo *vp; +XColor *colp, *cp, *testcol, *refcol, *quercol; +unsigned long vmask = (1<<DirectColor)|(1<<PseudoColor)|(1<<GrayScale); +unsigned long i,j; +char flags; +XColor *redp, *greenp, *bluep; + + if( (vmask = visualsupported(display, vmask)) == 0L) { + UNSUPPORTED; + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + colormap = makecolmap(display, vp->visual, AllocAll); + ncolors = maxsize(vp); + + refcol = (XColor *) malloc(ncolors * sizeof(XColor)); + testcol = (XColor *) malloc(ncolors * sizeof(XColor)); + quercol = (XColor *) malloc(ncolors * sizeof(XColor)); + + if((quercol == (XColor *) 0) || (refcol == (XColor *) 0) || (testcol == (XColor *) 0)){ + delete("malloc() couldn't allocate %d cells for the XColor array.", ncolors); + return; + } else + CHECK; + + for(i=0, cp = testcol, colp = refcol; i < ncolors; i++, cp++, colp++) { + colp->pixel = i; + colp->red = 0; + colp->green = 0; + colp->blue = 0; + colp->flags = (DoRed|DoGreen|DoBlue); + + cp->pixel = i; + cp->red = 0xffff; + cp->green = 0xffff; + cp->blue = 0xffff; + cp->flags = (DoRed|DoGreen|DoBlue); + + quercol[(int)i].pixel = i; + } + + color = refcol; + XCALL; + if(geterr() == Success) + CHECK; + + /* Write colormap stored values back over the original array */ + XQueryColors(display, colormap, refcol, ncolors); + + + color = testcol; + XCALL; + if(geterr() == Success) + CHECK; + /* Write colormap stored values back over the original array */ + XQueryColors(display, colormap, testcol, ncolors); + + + for(i=0; i<8; i++) { + + flags = 0; + + if(i&DoRed) { + flags |= DoRed; + redp = testcol; + } else + redp = refcol; + + if(i&DoGreen) { + flags |= DoGreen; + greenp = testcol; + } else + greenp = refcol; + + if(i&DoBlue) { + flags |= DoBlue; + bluep = testcol; + } else + bluep = refcol; + + color = refcol; + XCALL; + if(geterr() == Success) + CHECK; + + for(j=0, cp=testcol; j < ncolors; cp++, j++) + cp->flags = flags; + + color = testcol; + XCALL; + if(geterr() == Success) + CHECK; + + + XQueryColors(display, colormap, quercol, ncolors); + + for(j=0, cp = quercol; j < ncolors; j++, cp++, redp++, greenp++, bluep++) + if( (cp->red != redp->red) || (cp->green != greenp->green) || (cp->blue != bluep->blue) ) { + report("cell %ld) r %u g %u b %u instead of r %u g %u b %u", + i, cp->red, cp->green, cp->blue, redp->red, greenp->green, bluep->blue); + FAIL; + } + if (j == ncolors) + CHECK; + } + + free((char*)quercol); + free((char*)testcol); + free((char*)refcol); + } + CHECKPASS((3 + 3*i) * nsupvis()); + + +>>ASSERTION Good D 1 +When the +.A colormap +is an installed colourmap for its screen, +then any changes made by a call to xname are visible immediately. +>>ASSERTION Good C +If any of the visual classes DirectColor, PseudoColor or GrayScale is supported: +When one or more colourmap entries cannot be changed, then all the specified +colourmap entries that are allocated writable by any client are changed. +>>STRATEGY +If visual class is DirectColor, PseudoColor or GrayScale: + Create a colormap with AllocNone + Check >= 2 cells in colormap + Allocate first cell as r/o, second as read write + Update r/w cell to known value with XStoreColor. + Discover what it was really set to, and remember. + Update both cells, the r/w one to an opposite value, with xname + Verify BadAccess occurred, will have Failed if not -- see CODE arg. + Check that despite error the 2nd, r/w, cell was changed in value + Repeat for next matching visual. +>>CODE BadAccess +XVisualInfo *vp; +XColor *cp1; +XColor *cp2; +XColor colors[2]; +unsigned long vmask = (1<<DirectColor)|(1<<PseudoColor)|(1<<GrayScale); +unsigned long i; +unsigned long junk; + + if( (vmask = visualsupported(display, vmask)) == 0L) { + UNSUPPORTED; + return; + } + +/* If visual class is DirectColor, PseudoColor or GrayScale: */ + for(resetsupvis(vmask); nextsupvis(&vp); ) { + +/* Create a colormap with AllocNone */ + colormap = makecolmap(display, vp->visual, AllocNone); + ncolors = maxsize(vp); +/* Check >= 2 cells in colormap */ + if (ncolors < 2) { + delete("Need at least two cells in colormap to test this assertion, only had %d available.", ncolors); + return; + } else + CHECK; + + ncolors = 2; + color = colors; + +/* Allocate first cell as r/o, second as read write */ + for(i=0, cp1 = color; i < 2; i++, cp1++) { + cp1->pixel = i; + cp1->green = cp1->blue = cp1->red = 0xffff ^ (i*32767); + cp1->flags = (DoRed|DoGreen|DoBlue); + } + if (XAllocColor(display, colormap, &color[0]) == False) { + delete("Could not allocate first cell as r/o."); + return; + } else + CHECK; + + if (XAllocColorCells(display, colormap, True, &junk, 0, + &color[1].pixel, 1) == False) { + delete("Could not allocate second cell as r/w."); + return; + } else + CHECK; + +/* Update r/w cell to known value with XStoreColor. */ + XStoreColor(display, colormap, &color[1]); +/* Discover what it was really set to, and remember. */ + XQueryColor(display, colormap, &color[0]); + +/* Update both cells, the r/w one to an opposite value, with xname */ + color[1].red = color[1].green = color[1].blue ^= 0xffff; + XCALL; +/* Verify BadAccess occurred, will have Failed if not -- see CODE arg. */ + if (geterr() == BadAccess) + CHECK; + else + report("Updating 2 cells, 1st r/o & 2nd r/w, did not give expected BadAccess error."); + +/* Check that despite error the 2nd, r/w, cell was changed in value */ + XQueryColor(display, colormap, cp2 = &color[1]); + cp1 = cp2 - 1; + /* now cp1 == remembered (different), cp2 == actual */ + + if (cp1->red == cp2->red && cp1->green == cp2->green && + cp1->blue == cp2->blue) { + report("After error the r/w cell was not updated: got r,g,b = %lu,%lu,%lu", + cp2->red, cp2->green, cp2->blue); + FAIL; + } else + CHECK; + +/* Repeat for next matching visual. */ + } + + CHECKPASS(5*nsupvis()); + +>>ASSERTION Bad C +If any of the visual classes DirectColor, PseudoColor or GrayScale is supported: +When the +.M pixel +component in more than one of the +.S XColor +structures named by the +.A color +argument is not a valid entry in the colormap +argument, then a +.S BadValue +error occurs which will report any one of the +invalid pixel values. +>>STRATEGY +For each visual class DirectColor, PseudoColor and GrayScale: + Create a colormap with alloc set to AllocAll. + Store an array of 3 colorvalues with pixel values -1, 0, -2. + Verify that a BadValue error occurs. + Verify that the erroneous pixel was reported as either -1 or -2. +>>CODE BadValue +int errval; +XVisualInfo *vp; +XColor *cp1; +unsigned long vmask = (1<<DirectColor)|(1<<PseudoColor)|(1<<GrayScale); +XColor colors[3]; +unsigned long i; + + if( (vmask = visualsupported(display, vmask)) == 0L) { + UNSUPPORTED; + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + + colormap = makecolmap(display, vp->visual, AllocAll); + for(i=0, cp1 = colors; i < 3; i++, cp1++) { + cp1->pixel = 0; + cp1->red = 0xffff; + cp1->green = 0; + cp1->blue = 0; + cp1->flags = (DoRed|DoGreen|DoBlue); + } + + colors[0].pixel = -1; + colors[1].pixel = 0; + colors[2].pixel = -2; + color = colors; + ncolors = 3; + XCALL; + if(geterr() == BadValue) { + errval = getbadvalue(); + if( (errval != -1) && (errval != -2) ) { + report("Erroneous value was reported as %d, instead of -1 or -2", errval); + FAIL; + } else { + CHECK; + trace("Reported BadValue was %d", errval); + } + } + } + + CHECKPASS(nsupvis()); + + +>>ASSERTION Bad A +.ER BadAccess colormap-store +>>STRATEGY +For all visuals: + Create a colormap with alloc set to AllocNone. (Unallocated for visual + classes DirectColor, PseudoColor and GrayScale; R/O for visual + classes TrueColor, StaticColor and StaticGray: all should + provoke BadAccess) + If visual class is not one of DirectColor, PseudoColor or GrayScale; + Store distinct colors into all of the (already r/o) cells using xname. + Verify that a BadAccess error is generated. + Create a new client with XOpenDisplay. + Allocate a readonly cell for the new client with XAllocColor. + Store a value in the cell with xname. + Verify that a BadAccess error occurred. + Allocate a readonly cell with XAllocColor. + Store a value in the cell with xname. + Verify that a BadAccess error occurred. +>>CODE BadAccess +XVisualInfo *vp; +XColor *cp, *testcol; +Display *disp2; +unsigned long i; + + for(resetvinf(VI_WIN); nextvinf(&vp); ) { + colormap = makecolmap(display, vp->visual, AllocNone); + ncolors = maxsize(vp); + testcol = (XColor *) malloc(ncolors * sizeof(XColor)); + + if(testcol == (XColor *) 0) { + delete("malloc() couldn't allocate %d cells for the XColor array.", ncolors); + return; + } else + CHECK; + + for(i=0, cp = testcol; i < ncolors; i++, cp++) { + cp->pixel = i; + cp->green = cp->blue = cp->red = 0xffff ^ (i*3); + cp->flags = (DoRed|DoGreen|DoBlue); + } + + if (vp->class == TrueColor || vp->class == StaticColor || + vp->class == StaticGray) { /* read-only map */ + + trace("Testing a colormap with just r-o cells."); + + color = testcol; + XCALL; + if(geterr() == BadAccess) + CHECK; + } else { + trace("Testing a colormap with unallocated cells."); + XSync(display, False); + CHECK; + } + + trace("Open second client connection."); + disp2 = opendisplay(); + + if(XAllocColor(disp2, colormap, &testcol[0]) == False) { + delete("XAllocColor() failed to allocate a r/o cell for a second client."); + return; + } else + CHECK; + + trace("Trying to write into a r/o cell allocated by another client."); + color = &testcol[0]; + ncolors = 1; + XCALL; + if(geterr() == BadAccess) + CHECK; + + if(XAllocColor(display, colormap, &testcol[1]) == False) { + delete("XAllocColor() failed to allocate a r/o cell"); + return; + } else + CHECK; + + trace("Trying to write into a r/o cell allocated by self."); + color = &testcol[1]; + ncolors = 1; + XCALL; + if(geterr() == BadAccess) + CHECK; + } + + CHECKPASS(6*nvinf()); + +>>ASSERTION Bad A +.ER BadColor +>>ASSERTION Good D 3 +When +.A rmask_return , +.A gmask_return +and +.A bmask_return +have been returned by +a previous call to +.S XAllocColorPlanes +and a read-write colourmap entry +for a pixel value is changed by a call to xname, then the pixel value +is decomposed into three components using the masks and the +independent colourmap entries are updated. +>>ASSERTION Good C +If the visual class +.S DirectColor +is supported: +When the +.A colormap +argument was created with visual type +.S DirectColor +and with +.A alloc +set to +.S AllocAll , +and a read-write colourmap entry for a pixel value is changed by a call to xname, then +the pixel value is decomposed into three components using the +.S red_mask , +.S green_mask +and +.S blue_mask +in the visual and the independent colourmap entries are updated. +>>STRATEGY +If visual class DirectColor is supported: + Create a colourmap using makecolmap and AlocAll + Allocate an array of XColor's and one for each of reds, greens & blues + Set up each of reds, greens & blues to have a distinguishable value, + using xname, and make sure that's what's in the equivalent colourmaps. + Read back some suitably \"random\" triples and check their components + Verify that each component is the same as the corresponding entry in + reds, greens & blues. + Free the allocated storage: colors, reds, greens & blues. +>>EXTERN +#define lowbit(x) ((x) & (~(x) + 1)) +#define bitcontig(x) ((((x) + lowbit(x)) & (x)) == 0) +#define bitsubset(a,b) (((a) & (b)) == (a)) + +static int +maskshift(mask) +register unsigned long mask; +{ +register int i; + + for (i = 0; mask; i++) { + if (mask & 0x1) + return i; + mask >>= 1; + } + return i; +} + +static +Bool set_one_col(refp, s, flags, mask) + unsigned long *refp; + char *s; + char flags; + unsigned long mask; +{ + unsigned long i; + XColor *cp1; + unsigned long *lrefp = refp; + int fail = 0; /* used in the FAIL in XCall (spelt wrong intentionally) */ + /* expects to find color and ncolors in-scope */ + + for(i=0, cp1 = color; i < ncolors; i++, cp1++, lrefp++) { + unsigned long subfield_ix = i << maskshift(mask); + + if (!bitsubset(subfield_ix, mask)) { + delete("Inconsistent maxsize() result: size of %d is too big to fit into %s mask 0x%lx (detected at index %lu, giving pixel 0x%lx)", + ncolors, s, mask, i, subfield_ix); + return False; + } + *lrefp = cp1->pixel = subfield_ix; + cp1->flags = flags; + switch (flags) { + case DoRed: + cp1->red = i; + break; + case DoGreen: + cp1->green = i; + break; + case DoBlue: + cp1->blue = i; + break; + default: + delete("Flags 0x%x has more than one colour in it.", (unsigned int)flags); + return False; + } + } + /* The following may give a warning about the return; */ + XCALL; + XQueryColors(display, colormap, color, ncolors); + for(i=0,cp1=color,lrefp=refp; i < ncolors; i++, lrefp++, cp1++) { + *lrefp = (flags==DoRed) ? cp1->red : + ((flags==DoGreen) ? cp1->green : cp1->blue); + } + return (geterr() == Success); +} +>>CODE +XVisualInfo *vp; +unsigned long vmask = (1<<DirectColor); +XColor *colors; +unsigned long i; +XColor *refp; +unsigned long *reds, *greens, *blues; +int pathcnt = 0; +static XColor triples[] = { + (unsigned long)~0L, 0,0,0, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 1,0,0, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 0,1,0, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 0,0,1, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 3,2,1, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 1,3,0, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 7,3,1, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 7,8,5, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 15,11,12, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 42,99,13, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 112,127,64, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 255,64,33, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 64,255,33, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 64,33,255, DoRed|DoGreen|DoBlue, 0, + (unsigned long)~0L, 255,255,255, DoRed|DoGreen|DoBlue, 0 + }; + +/* If visual class DirectColor is supported: */ + if( (vmask = visualsupported(display, vmask)) == 0L) { + UNSUPPORTED; + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + +/* Create a colourmap using makecolmap and AlocAll */ + colormap = makecolmap(display, vp->visual, AllocAll); + ncolors = maxsize(vp); +/* Allocate an array of XColor's and one for each of reds, greens & blues */ + colors = (XColor *) malloc(ncolors * sizeof(XColor)); + color = colors; + reds = (unsigned long *) malloc(ncolors * sizeof(unsigned long)); + greens = (unsigned long *) malloc(ncolors * sizeof(unsigned long)); + blues = (unsigned long *) malloc(ncolors * sizeof(unsigned long)); + if ((colors == (XColor *) 0) || (reds == (unsigned long *) 0) || + (greens == (unsigned long *) 0) || + (blues == (unsigned long *) 0)) { + delete("malloc() couldn't allocate %d cells for the XColor array.", ncolors); + return; + } else + CHECK; + +/* Set up each of reds, greens & blues to have a distinguishable value, */ +/* using xname, and make sure that's what's in the equivalent colourmaps. */ + /* + kept in reds, greens or blues. This routine expects + color and ncolors to be set right. It uses XCall as well. + */ + if (!set_one_col(reds, "red", DoRed, vp->red_mask) || + !set_one_col(greens, "green", DoGreen, vp->green_mask) || + !set_one_col(blues, "blue", DoBlue, vp->blue_mask) + ) { + delete("Failed to set up colourmap for test."); + return; + } else + CHECK; + +/* Read back some suitably "random" triples and check their components */ + for (i=0, refp=triples; i < NELEM(triples); i++, refp++) { + XColor testcol; + unsigned long r,g,b; + + if (refp->red >= (unsigned)ncolors || + refp->green >= (unsigned)ncolors || + refp->blue >= (unsigned)ncolors) + continue; + + r = refp->red << maskshift(vp->red_mask); + if (!bitsubset(r, vp->red_mask)) + continue; + g = refp->green << maskshift(vp->green_mask); + if (!bitsubset(g, vp->green_mask)) + continue; + b = refp->blue << maskshift(vp->blue_mask); + if (!bitsubset(b, vp->blue_mask)) + continue; + testcol.pixel = r | g | b; + + XQueryColor(display, colormap, &testcol); + +/* Verify that each component is the same as the corresponding entry in */ +/* reds, greens & blues. */ + if (testcol.flags != (DoRed | DoGreen | DoBlue) || + testcol.red != reds[refp->red] || + testcol.green != greens[refp->green] || + testcol.blue != blues[refp->blue]) { + report("Expected r,g,b = %lu, %lu, %lu but got %lu, %lu, %lu for pixel 0x%lx with r-,g-,b-masks 0x%lx, 0x%lx, 0x%lx", + reds[refp->red], greens[refp->green], blues[refp->blue], + testcol.red, testcol.green, testcol.blue, + testcol.pixel, vp->red_mask, + vp->green_mask, vp->blue_mask); + FAIL; + } else + CHECK; + + pathcnt++; + } + +/* Free the allocated storage: colors, reds, greens & blues. */ + free((char*)colors); + free((char*)reds); + free((char*)greens); + free((char*)blues); + } + + CHECKPASS(pathcnt+2*nsupvis()); + + +>>#HISTORY Cal Completed Written in new style and format. +>>#HISTORY Kieron Completed <Have a look> +>>#HISTORY Cal Action Writing code. diff --git a/xts5/Xlib7/XStoreNamedColor/XStoreNamedColor.m b/xts5/Xlib7/XStoreNamedColor/XStoreNamedColor.m new file mode 100644 index 00000000..35ff30cf --- /dev/null +++ b/xts5/Xlib7/XStoreNamedColor/XStoreNamedColor.m @@ -0,0 +1,560 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XStoreNamedColor/XStoreNamedColor.m,v 1.2 2005-11-03 08:43:44 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib7/XStoreNamedColor/XStoreNamedColor.m +>># +>># Description: +>># Tests for XStoreNamedColor() +>># +>># Modifications: +>># $Log: strnmdclr.m,v $ +>># Revision 1.2 2005-11-03 08:43:44 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:31 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:27:01 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:20 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.1 1998/07/25 00:18:15 mar +>># req.4.W.00121: avoid undefined ANSI usage +>># +>># Revision 6.0 1998/03/02 05:19:14 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:45 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:31 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:48:58 andy +>># Prepare for GA Release +>># +/* +Portions of this software are based on Xlib and X Protocol Test Suite. +We have used this material under the terms of its copyright, which grants +free use, subject to the conditions below. Note however that those +portions of this software that are based on the original Test Suite have +been significantly revised and that all such revisions are copyright (c) +1995 Applied Testing and Technology, Inc. Insomuch as the proprietary +revisions cannot be separated from the freely copyable material, the net +result is that use of this software is governed by the ApTest copyright. + +Copyright (c) 1990, 1991 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +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 name of UniSoft not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. UniSoft +makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. +*/ +>>TITLE XStoreNamedColor Xlib7 +void +XStoreNamedColor(display, colormap, color, pixel, flags) +Display *display = Dsp; +Colormap colormap = DefaultColormap(display, DefaultScreen(display)); +char *color = ""; +unsigned long pixel; +int flags = DoRed|DoGreen|DoBlue; +>>ASSERTION Good C +>># +>># TODO dave - Jan 17 +>># The X11R4 spec is vague about whether it's the closest available or +>># or the actual values that are stored. +>># O'Reilly Vol one page 190 has a footnote saying the actual values +>># you tried to store may not be stored. +>># +If any of the visual classes DirectColor, PseudoColor or GrayScale is supported: +A call to xname obtains the closest available RGB values for the +.A colormap +argument to those specified for the colour named +.A color +in the database, and stores those values in the read-write colourmap entry +specified by the +.M pixel +component of the +.S XColor +structure. +>>STRATEGY +For each visual class DirectColor, PseudoColor and GrayScale: + Create a colormap with alloc set to AllocAll. + Store the r,g and b colour values of XT_GOOD_COLOUR_NAME in the colourmap with XStoreNamedColor. + Obtain the rbg values of the stored color with XQueryColor. + Store those rgb values in the colormap with XStoreColor. + Obtain the stored rgb values with XQueryColor. + Verify the rgb values stored in the two cells are identical. +>>CODE +XVisualInfo *vp; +char *goodname; +XColor namedcol, testcol, storedcol; +unsigned long vmask = (1<<DirectColor)|(1<<PseudoColor)|(1<<GrayScale); + + if( (vmask = visualsupported(display, vmask)) == 0L) { + UNSUPPORTED; + return; + } + + if((goodname = tet_getvar("XT_GOOD_COLORNAME")) == (char *) 0) { + delete("XT_GOOD_COLORNAME is not defined."); + return; + } + + flags = DoRed|DoGreen|DoBlue; + for(resetsupvis(vmask); nextsupvis(&vp); ) { + trace("Attempting XStoreNamedColor() for class %s, color %s", displayclassname(vp->class), goodname); + colormap = makecolmap(display, vp -> visual, AllocAll); + color = goodname; + pixel = 0L; + + XCALL; + + namedcol.pixel = 0L; + XQueryColor(display, colormap, &namedcol); + testcol = namedcol; + testcol.pixel = 1L; + testcol.flags = flags; + XStoreColor(display, colormap, &testcol); + storedcol.pixel = 1L; + storedcol.flags = flags; + XQueryColor(display, colormap, &storedcol); + + trace("Named Color : pixel %lu, r %u g %u b %u", namedcol.pixel , namedcol.red, namedcol.green, namedcol.blue); + trace("Stored Color: pixel %lu, r %u g %u b %u", storedcol.pixel, storedcol.red, storedcol.green, storedcol.blue); + + + if( (namedcol.red != storedcol.red) || (namedcol.green != storedcol.green) || (namedcol.blue != storedcol.blue) ) { + report("XStoreNamedColor() return RGB values r %u g %u b %u instead of r %u g %u b %u.", + namedcol.red, namedcol.green, namedcol.blue, storedcol.red, storedcol.green, storedcol.blue); + FAIL; + } else + CHECK; + } + + CHECKPASS(nsupvis()); + + +>>ASSERTION Good A +If any of the visual classes DirectColor, PseudoColor or GrayScale is supported: +A call to xname changes the red, green and blue values +in the read-write colourmap entry in accordance with the +.A flags +argument. +>>STRATEGY +For each supported visual class DirectColor, PseudoColor and GrayScale: + Create a colormap with XCreateColormap. + Store XT_GOOD_COLOR_NAME r, g and b values in cell 0 with XStoreNamedColor. + Obtain the r,g and b values with XQueryColor. + Complement the rgb values and store the value in cell 0 with XStoreColor. + Obtain the bitwise complemented rgb values using XQueryColor. + For each possible combination DoRed, DoGreen and DoBlue in flags: + Store the bitwise complementary rgb values in the same cell with XStoreColor. + Store the XT_GOOD_COLOR_NAME values in the colourmap cell using XStoreNamedColor. + Verify that only the components of the colourcell specified by the flags value have been altered with XQueryColor. +>>CODE +XVisualInfo *vp; +int i; +char *goodname; +XColor namedcol, testcol, storedcol; +unsigned long vmask = (1<<DirectColor)|(1<<PseudoColor)|(1<<GrayScale); +unsigned short redval, greenval, blueval; + + + if( (vmask = visualsupported(display, vmask)) == 0L) { + UNSUPPORTED; + return; + } + + if((goodname = tet_getvar("XT_GOOD_COLORNAME")) == (char *) 0) { + delete("XT_GOOD_COLORNAME is not defined."); + return; + } + + color = goodname; + pixel = 0L; + storedcol.pixel = 0L; + testcol.pixel = 0L; + namedcol.pixel = 0L; + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + trace("Attempting XStoreNamedColor() for class %s, color %s", displayclassname(vp->class), goodname); + colormap = makecolmap(display, vp -> visual, AllocAll); + flags = DoRed|DoGreen|DoBlue; + XCALL; + XQueryColor(display, colormap, &namedcol); + + testcol = namedcol; + testcol.red ^= 0xffff; + testcol.green ^= 0xffff; + testcol.blue ^= 0xffff; + testcol.flags = DoRed | DoGreen | DoBlue; + + XStoreColor(display, colormap, &testcol); + XQueryColor(display, colormap, &testcol); + + for(i=0; i<8; i++) { + + flags = 0; + + if(i&DoRed) { + flags |= DoRed; + redval = namedcol.red; + } else + redval = testcol.red; + + if(i&DoGreen) { + flags |= DoGreen; + greenval = namedcol.green; + } else + greenval = testcol.green; + + if(i&DoBlue) { + flags |= DoBlue; + blueval = namedcol.blue; + } else + blueval = testcol.blue; + + XStoreColor(display, colormap, &testcol); + XCALL; + XQueryColor(display, colormap, &storedcol); + + if( (redval != storedcol.red) || (greenval != storedcol.green) || (blueval != storedcol.blue) ){ + report("XStoreNamedColor() RGB value r %u g %u b %u instead of r %u g %u b %u.", + storedcol.red, storedcol.green, storedcol.blue, redval, greenval, blueval); + FAIL; + } + } + + if(i == 8) + CHECK; + } + + CHECKPASS(nsupvis()); + +>>ASSERTION Good A +If any of the visual classes DirectColor, PseudoColor or GrayScale is supported: +Upper and lower case characters in the +.A color +argument refer to the same color. +>>STRATEGY +For each supported visual class: + Create a colomap with alloc set to AllocAll. + Store colour XT_GOOD_COLOR_NAME in the colourmap with XStoreNamedColor. + Obtain the stored rgb values with XQueryColor, + Store colour XT_GOOD_COLOR_NAME with alternating characters in alternating case with XStoreNamedColor. + Verify that the rgb values written by both calls was identical. +>>CODE +XVisualInfo *vp; +char *cp, *goodname, *casename; +XColor casecol, testcol; +unsigned long vmask = (1<<DirectColor)|(1<<PseudoColor)|(1<<GrayScale); +unsigned short trunc; +int i; + + if( (vmask = visualsupported(display, vmask)) == 0L) { + UNSUPPORTED; + return; + } + + if( (goodname = tet_getvar("XT_GOOD_COLORNAME")) == (char *) 0) { + delete("XT_GOOD_COLORNAME is not defined."); + return; + } + + + casename = (char *) malloc( strlen(goodname) + 1); + strcpy(casename, goodname); + + for(i=0, cp=casename; *cp; i++, cp++) + if(i&1) + *cp = tolower(*cp); + else + *cp = toupper(*cp); + + + testcol.pixel = 0L; + casecol.pixel = 0L; + pixel = 0L; + flags = DoRed|DoGreen|DoBlue; + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + + colormap = makecolmap(display, vp -> visual, AllocAll); + color = goodname; + + XCALL; + + XQueryColor(display, colormap, &testcol); + + + color = casename; + trace("Testing colourname %s", color); + + XCALL; + + XQueryColor(display, colormap, &casecol); + + if((casecol.pixel != testcol.pixel) || (casecol.red != testcol.red) || (casecol.green != testcol.green) || (casecol.blue != testcol.blue)) { + report("Colour name %s pixel %lu ( r %u g %u b %u) instead of pixel %lu ( r %u g %u b %u)", + goodname, casecol.pixel, casecol.red, casecol.green, casecol.blue, + testcol.pixel, testcol.red, testcol.green, testcol.blue); + FAIL; + } else + CHECK; + + } + CHECKPASS(nsupvis()); + + +>>ASSERTION Bad A +If any of the visual classes DirectColor, PseudoColor or GrayScale is supported: +When the +.A pixel +argument is not a valid entry in the +.A colormap +argument, +then a +.S BadValue +error occurs. +>>STRATEGY +For each visual class DirectColor, PseudoColor and GrayScale: + Create a colourmap with alloc set to AllocAll. + Store the colour XT_GOOD_COLOR_NAME at pixel = colourmap_size with XStoreNamedColor. + Verify that a BadValue error is generated. +>>CODE BadValue +XVisualInfo *vp; +char *goodname; +XColor namedcol, testcol, storedcol; +unsigned long vmask = (1<<DirectColor)|(1<<PseudoColor)|(1<<GrayScale); + + if( (vmask = visualsupported(display, vmask)) == 0L) { + UNSUPPORTED; + return; + } + + if((goodname = tet_getvar("XT_GOOD_COLORNAME")) == (char *) 0) { + delete("XT_GOOD_COLORNAME is not defined."); + return; + } + + flags = DoRed|DoGreen|DoBlue; + for(resetsupvis(vmask); nextsupvis(&vp); ) { + trace("Attempting XStoreNamedColor() for class %s, color %s", displayclassname(vp->class), goodname); + colormap = makecolmap(display, vp -> visual, AllocAll); + color = goodname; + pixel = maxsize(vp) + 1; + if (vp->class == DirectColor) { + pixel = (vp->red_mask | vp->green_mask | vp->blue_mask); + pixel |= pixel << 1; + } + trace("Pixel set to %ld", pixel); + XCALL; + if(geterr() == BadValue) + CHECK; + } + + CHECKPASS(nsupvis()); + +>>ASSERTION Bad A +.ER BadAccess colormap-store +>>STRATEGY +For each visual class DirectColor, PseudoColor and GrayScale: + Create a colormap (r/o) with alloc set to AllocNone. + Store the color XT_GOOD_COLORNAME with XStoreNamedColor + Verify that a BadAccess error is generated. + Create a new client with XOpenDisplay. + Allocate a full red readonly cell for the new client with XAllocColor. + Store the color XT_GOOD_COLORNAME with XStoreNamedColor. + Verify that a BadAccess error occurred. + Allocate another readonly cell with XAllocColor. + Store the color XT_GOOD_COLORNAME with XStoreNamedColor. + Verify that a BadAccess error occurred. +>>CODE BadAccess +XVisualInfo *vp; +XColor testcol; +char *goodname; +Display *disp2; +unsigned long vmask = (1<<DirectColor)|(1<<PseudoColor)|(1<<GrayScale); + + if( (vmask = visualsupported(display, vmask)) == 0L) { + UNSUPPORTED; + return; + } + + if((goodname = tet_getvar("XT_GOOD_COLORNAME")) == (char *) 0) { + delete("XT_GOOD_COLORNAME is not defined."); + return; + } + + color = goodname; + for(resetsupvis(vmask); nextsupvis(&vp); ) { + + pixel = 0L; + colormap = makecolmap(display, vp->visual, AllocNone); + trace("Testing a colormap with no allocated cells."); + XCALL; + + if(geterr() == BadAccess) + CHECK; + + disp2 = opendisplay(); + + testcol.flags = DoRed; + testcol.red = 65535; + if(XAllocColor(disp2, colormap, &testcol) == False) { + delete("XAllocColor() failed to allocate a full red r/o cell for a second client."); + return; + } else + CHECK; + + trace("Trying to write into a r/o cell allocated by another client."); + pixel = testcol.pixel; + XCALL; + if(geterr() == BadAccess) + CHECK; + + testcol.red ^= 0xffff; + testcol.green ^= 0xffff; + testcol.blue ^= 0xffff; + testcol.flags = flags; + + if(XAllocColor(display, colormap, &testcol) == False) { + delete("XAllocColor() failed to allocate a r/o cell with r,g,b = 0x%x,0x%x,0x%x", testcol.red, testcol.green, testcol.blue); + return; + } else + CHECK; + + trace("Trying to write into a r/o cell allocated by self."); + pixel = testcol.pixel; + XCALL; + + if(geterr() == BadAccess) + CHECK; + } + + CHECKPASS(5*nsupvis()); + +>>ASSERTION Bad A +.ER BadColor +>>ASSERTION Bad A +.ER BadName colour +>>STRATEGY +For the visual classes DirectColor, PseudoColor and GrayScale : + Create a colormap with alloc set to AllocAll. + Allocate a cell with colour XT_BAD_COLORNAME + in the colourmap with XStoreNamedColor. + Verify that a BadName error occurred. +>>CODE BadName +XVisualInfo *vp; +char *badname; +Status status; +unsigned long vmask = (1<<DirectColor)|(1<<PseudoColor)|(1<<GrayScale); + + if( (vmask = visualsupported(display, vmask)) == 0L) { + unsupported("DirectColor, PseudoColor visual classes are not supported."); + return; + } + + if( (badname = tet_getvar("XT_BAD_COLORNAME")) == (char *) 0) { + delete("XT_BAD_COLORNAME is not defined."); + return; + } + + for(resetsupvis(vmask); nextsupvis(&vp); ) { + colormap = makecolmap(display, vp -> visual, AllocAll); + color = badname; + XCALL; + if(geterr() == BadName) + CHECK; + } + + CHECKPASS(nsupvis()); + +>>ASSERTION Good D 3 +When +.A rmask_return , +.A gmask_return +and +.A bmask_return +have been returned by +a previous call to +.S XAllocColorPlanes +and a read-write colourmap entry +for a pixel value is changed by a call to xname, then the pixel value +is decomposed into three components using the masks and the +independent colourmap entries are updated. +>>ASSERTION Good D 3 +If the visual class +.S DirectColor +is supported: +When the +.A colormap +argument was created with visual type +.S DirectColor +and with +.A alloc +set to +.S AllocAll , +and a read-write colourmap entry for a pixel value is changed by a call to xname, then +the pixel value is decomposed into three components using the +.S red_mask , +.S green_mask +and +.S blue_mask +in the visual and the independent colourmap entries are updated. +>>#HISTORY Cal Completed Written in new format and style. +>>#HISTORY Kieron Completed <Have a look> +>>#HISTORY Cal Completed Writing code. +>>#HISTORY Kieron Completed Bug-fixes and re-engineering diff --git a/xts5/Xlib7/XcmsAddColorSpace/XcmsAddColorSpace.m b/xts5/Xlib7/XcmsAddColorSpace/XcmsAddColorSpace.m new file mode 100644 index 00000000..01d67f3d --- /dev/null +++ b/xts5/Xlib7/XcmsAddColorSpace/XcmsAddColorSpace.m @@ -0,0 +1,312 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsAddColorSpace/XcmsAddColorSpace.m,v 1.1 2005-02-12 14:37:35 anderson Exp $ + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsAllocColor/XcmsAllocColor.m +>># +>># Description: +>># Tests for XcmsAllocColor() +>># +>># Modifications: +>># $Log: cmsacs.m,v $ +>># Revision 1.1 2005-02-12 14:37:35 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:02 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:21 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:15 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:46 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:35 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:49:05 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsAddColorSpace Xlib7 +void +XcmsAddColorSpace() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +XcmsColor color_good ; +XcmsColorFormat format_good ; +int screen_good ; +int depth_good ; +extern XcmsColorSpace XcmsCIELabColorSpace; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, y_init, h_init, w_init; + +/****** + * routines + ******/ + +/***** + * svccmsAddColorSpace routine + *****/ +svccmsAddColorSpace(display, color_space) +Display *display ; +XcmsColorSpace *color_space ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsAddColorSpace("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " color_space);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + + /****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , gc_id, display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ + /****** + * service call + ******/ + + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsAddColorSpace(color_space); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + + /****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , gc_id, display_arg, + drawable_id, ss_status); + else + stat_status = REGR_NORMAL; + + /****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + /****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + check_dec(XcmsSuccess, svc_ret_value, "return value") ; + } + XSync(display_arg, 0); + + /****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + cleanup_status = REGR_NORMAL; + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + + /***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} /* end of svccmsAddColorSpace service routine */ + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname shall make a device-independent color space structure +.A XcmsColorSpace +acessible by the color management system and return +.A XcmsSuccess. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; + /* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg, + XRootWindow(display_arg, XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + + display_good = display_arg; + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XDefaultColormap(display_good, screen_good ); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + /***** + * Ending of testcase set + *****/ + if ( writeable_colormaps ) + { + step("service specific testcase set.\n"); + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) + { + tet_infoline("TEST: Testing XcmsAddColorSpace for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + XcmsColorSpace *color_space_good; + + color_space_good = &XcmsCIELabColorSpace ; + svccmsAddColorSpace( + display_good, + color_space_good + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsAddFunctionSet/XcmsAddFunctionSet.m b/xts5/Xlib7/XcmsAddFunctionSet/XcmsAddFunctionSet.m new file mode 100644 index 00000000..f8e41eed --- /dev/null +++ b/xts5/Xlib7/XcmsAddFunctionSet/XcmsAddFunctionSet.m @@ -0,0 +1,343 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsAddFunctionSet/XcmsAddFunctionSet.m,v 1.1 2005-02-12 14:37:35 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsAllocColor/XcmsAllocColor.m +>># +>># Description: +>># Tests for XcmsAddFunctionSet() +>># +>># Modifications: +>># $Log: cmsadfs.m,v $ +>># Revision 1.1 2005-02-12 14:37:35 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:03 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:21 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:16 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:47 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:36 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:49:07 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsAddFunctionSet Xlib7 +void +XcmsAddFunctionSet() +>>EXTERN +/****** + * libraries + ******/ + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +Colormap rw_colormap ; +XcmsColor color_good ; +XcmsColorFormat format_good ; +int screen_good ; +int depth_good ; +extern XcmsColorSpace XcmsCIEXYZColorSpace; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, + y_init, + h_init, + w_init; + +/****** + * routines + ******/ + +int +func1() +{ + return XcmsInitSuccess; +} + +void +func2() +{ + return; +} + +/***** + * svccmsAddFunctionSet routine + *****/ +svccmsAddFunctionSet(display, function_set) +Display *display ; +XcmsFunctionSet *function_set ; +{ + +/***** + * external defs + *****/ + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsAddFunctionSet("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " function_set);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , gc_id, + display_arg, drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsAddFunctionSet(function_set) ; + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && (stat_status == REGR_NORMAL)) + { + check_dec(Success, svc_ret_value, "return value") ; + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + cleanup_status = REGR_NORMAL; + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname shall add a Color Characterization Function Set to the color +management system. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; + /* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + + /****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + + /***** + * Test wide set up + *****/ + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + colormap_good = XDefaultColormap(display_good, screen_good ); + + rw_colormap = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + ccc_good = XcmsCCCOfColormap(display_good, rw_colormap) ; + } + + if (writeable_colormaps) + { + step("service specific testcase set.\n"); + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) + { + tet_infoline("TEST: XcmsAddFunctionSet for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + XcmsFunctionSet function ; + XcmsColorSpace *DDColorarray[2]; + + function.DDColorSpaces = &DDColorarray[0]; + DDColorarray[0] = &XcmsCIEXYZColorSpace ; + DDColorarray[1] = NULL; + function.screenInitProc = (XcmsScreenInitProc)func1; + function.screenFreeProc = (XcmsScreenFreeProc)func2; + svccmsAddFunctionSet(display_good, &function); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsAllocColor/XcmsAllocColor.m b/xts5/Xlib7/XcmsAllocColor/XcmsAllocColor.m new file mode 100644 index 00000000..8bcedcbd --- /dev/null +++ b/xts5/Xlib7/XcmsAllocColor/XcmsAllocColor.m @@ -0,0 +1,407 @@ +Copyright (c) 2005 X.Org Foundation L.L.C. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsAllocColor/XcmsAllocColor.m,v 1.2 2005-04-21 09:40:42 ajosey Exp $ + +Copyright (c) 2003 The Open Group +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsAllocColor/XcmsAllocColor.m +>># +>># Description: +>># Tests for XcmsAllocColor() +>># +>># Modifications: +>># $Log: cmsac.m,v $ +>># Revision 1.2 2005-04-21 09:40:42 ajosey +>># resync to VSW5.1.5 +>># +>># Revision 8.2 2005/01/21 10:49:31 gwc +>># Updated copyright notice +>># +>># Revision 8.1 2003/12/08 12:15:12 gwc +>># PR1854: incorrect bits_per_rgb bit shift in svccmsAllocColor +>># +>># Revision 8.0 1998/12/23 23:27:02 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:20 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:15 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.1 1998/03/02 03:43:47 tbr +>># vswsr165; changed to use only the most significant bits_per_rgb bits +>># of the color spec returned by XParseColor when comparing it to the color +>># spec returned by XcmsAllocColor. This is debatable when you closely +>># read the spec, but appears to be how the code was implemented. +>># +>># Revision 5.0 1998/01/26 03:15:46 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1998/01/23 03:37:31 tbr +>># Modified test to useXParseColor to find the RGB values for +>># XT_GOOD_COLORNAME and pass those to the function being tested. +>># Changed result if colormap is not writeable to unsupported. +>># Changed TP#2 to pass all good args, except colormap, to fn. +>># +>># Revision 4.0 1995/12/15 08:49:33 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:49:02 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsAllocColor Xlib7 +void +XcmsAllocColor() +>>EXTERN +#include "xtest.h" + +Bool writeable_colormaps = 1; +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +XcmsColor cmsColorSpec ; +XcmsColor color_in_out ; +XcmsColorFormat format_good ; +int screen_good ; +int depth_good ; +int x_init, y_init, h_init, w_init; +XColor goodColorSpec; +char tmpbuf[255]; + +void +svccmsAllocColor(display, colormap, color, format) +Display *display ; +Colormap colormap ; +XcmsColor color ; +XcmsColorFormat format ; +{ +extern int errcnt; +extern int errflg; +extern int chkflg; +extern int signal_status(); +extern int unexp_err(); + +char fmtstr[256], *call_string; +union msglst fmt_lst[1]; +int skip_pixcheck; +int red, green, blue; +int tmpRGB; + +int ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + +Status svc_ret_value; + + + /****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsAllocColor("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " display, colormap, color, format);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + XSync(display_arg, 0); + + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, display_arg, drawable_id); + + first_error = 0; /* no errors encountered yet */ + + tet_infoline("TEST: Calling XcmsAllocColor"); + errflg = 0; + svc_ret_value = XcmsAllocColor(display, colormap, &color, + format); + XSync(display_arg, 0); + + /* no colormap by default */ + r_wait(display_arg, window_arg, time_delay, None); + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat(dpy_msk | win_msk , gc_id, + display_arg, drawable_id, ss_status); + else + stat_status = REGR_NORMAL; + + /****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + /****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + check_dec(XcmsSuccess, svc_ret_value, "return value") ; + tmpRGB = (goodColorSpec.red & + ((0xFFFF << (16 - ccc_good->visual->bits_per_rgb)) & 0xFFFF)); + check_dec(tmpRGB, color.spec.RGB.red, "red") ; + tmpRGB = (goodColorSpec.green & + ((0xFFFF << (16 - ccc_good->visual->bits_per_rgb)) & 0xFFFF)); + check_dec(tmpRGB, color.spec.RGB.green, "green") ; + tmpRGB = (goodColorSpec.blue & + ((0xFFFF << (16 - ccc_good->visual->bits_per_rgb)) & 0xFFFF)); + check_dec(tmpRGB, color.spec.RGB.blue, "blue") ; + } + XSync(display_arg, 0); + + /****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + /* if there was an error ... */ + if (errflg) + { + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + tet_result(TET_FAIL); + } + + /***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} /* end of svccmsAllocColor service routine */ +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall allocate a device-independent color and return the pixel value +of the color cell and the color specification actually allocated. +>>CODE +#if XT_X_RELEASE > 4 + display_arg = Dsp; + /* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg, + XRootWindow(display_arg,XDefaultScreen(display_arg)), + (unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + + /****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + + /***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if (writeable_colormaps) { + estatus[0] = 1; + estatus[1] = Success; + + sprintf(tmpbuf, "PREP: determining the color spec for %s", + config.good_colorname); + tet_infoline(tmpbuf); + colormap_good = XDefaultColormap(display_good, screen_good ); + if (!XParseColor(display_good, colormap_good, config.good_colorname, + &goodColorSpec)) + { tet_result(TET_UNRESOLVED); return; } + + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + sprintf(tmpbuf, "INFO: bits_per_rgb(%d)", ccc_good->visual->bits_per_rgb); + tet_infoline(tmpbuf); + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) + { + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + format_good = XcmsRGBFormat ; + cmsColorSpec.format = XcmsRGBFormat ; + cmsColorSpec.pixel = goodColorSpec.pixel; + cmsColorSpec.spec.RGB.red = goodColorSpec.red; + cmsColorSpec.spec.RGB.green = goodColorSpec.green; + cmsColorSpec.spec.RGB.blue = goodColorSpec.blue; + svccmsAllocColor(display_good, colormap_good, cmsColorSpec, + format_good); + + } + tet_result(TET_PASS); + } /* end if */ + } + else + { + tet_infoline("colormap is not writeable"); + tet_result(TET_UNSUPPORTED); + } +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif +>>ASSERTION Good C +If the implementation is X11R5 or later: +If the value for the colormap argument does not name a defined colormap, a +call to xname shall return the BadColor error code. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; + + /* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg, + XRootWindow(display_arg,XDefaultScreen(display_arg)), + (unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + + /****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + + /***** + * Test wide set up + *****/ + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if (writeable_colormaps) + { + estatus[0] = 1; + estatus[1] = BadColor ; + + colormap_good = XDefaultColormap(display_good, screen_good ); + + sprintf(tmpbuf, "PREP: determining the color spec for %s", + config.good_colorname); + tet_infoline(tmpbuf); + colormap_good = XDefaultColormap(display_good, screen_good ); + if (!XParseColor(display_good, colormap_good, config.good_colorname, + &goodColorSpec)) + { tet_result(TET_UNRESOLVED); return; } + + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) + { + regr_args.l_flags.check = 0; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + chkflg = 1; + + format_good = XcmsRGBFormat ; + cmsColorSpec.format = XcmsRGBFormat ; + cmsColorSpec.pixel = goodColorSpec.pixel; + cmsColorSpec.spec.RGB.red = goodColorSpec.red; + cmsColorSpec.spec.RGB.green = goodColorSpec.green; + cmsColorSpec.spec.RGB.blue = goodColorSpec.blue; + svccmsAllocColor(display_good, -999, cmsColorSpec, format_good); + tet_result(TET_PASS); + } /* end if */ + } + else + { + tet_infoline("colormap is not writeable"); + tet_result(TET_UNSUPPORTED); + } +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsAllocNamedColor/XcmsAllocNamedColor.m b/xts5/Xlib7/XcmsAllocNamedColor/XcmsAllocNamedColor.m new file mode 100644 index 00000000..98281ed3 --- /dev/null +++ b/xts5/Xlib7/XcmsAllocNamedColor/XcmsAllocNamedColor.m @@ -0,0 +1,466 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsAllocNamedColor/XcmsAllocNamedColor.m,v 1.1 2005-02-12 14:37:35 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsAllocNamedColor/XcmsAllocNamedColor.m +>># +>># Description: +>># Tests for XcmsAllocNamedColor() +>># +>># Modifications: +>># $Log: cmsanc.m,v $ +>># Revision 1.1 2005-02-12 14:37:35 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:03 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:22 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:16 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:47 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:38 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:49:11 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsAllocNamedColor Xlib7 +XcmsAllocNamedColor() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +Colormap rw_colormap ; +XcmsColor color_good ; +XcmsColor color_array[2] ; +XcmsColor write_many_color[2] ; +XcmsColor query_many_color[2] ; +XcmsColor scrnColor, exactColor ; +XcmsColor color_in_out ; +XcmsColorFormat format_good ; +double minv, maxv, deltav ; +double hue, chroma ; +int screen_good ; +int depth_good ; +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, + y_init, + h_init, + w_init; + +/****** + * routines + ******/ + +/***** + * svccmsAllocNamedColor routine + *****/ +svccmsAllocNamedColor(display, colormap, color_string, scrn, exact, format) +Display *display ; +Colormap colormap ; +char *color_string ; +XcmsColor scrn ; +XcmsColor exact ; +XcmsColorFormat format ; +{ +/***** + * external defs + *****/ + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + + +#ifdef DEBUG + step("Inside the service routine"); +#endif + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsAllocNamedColor("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " display, colormap, color_string, scrn. exact, format);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsAllocNamedColor( + display, + colormap, + color_string, + &scrn, + &exact, + format + ); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + /* All the display may not return the exact value */ + /* look for within delta value */ + double closer_to_one = 0.900000 ; + check_dec(XcmsSuccess, svc_ret_value, "return value") ; + if ( scrn.spec.RGBi.red < closer_to_one ) { + errflg = 1 ; + message("Expected screen red color closer to 1.00\n", NULL, 0) ; + } + if ( exact.spec.RGBi.red <= closer_to_one ) { + errflg = 1 ; + message("Expected exact red color closer to 1.00\n", NULL, 0) ; + } + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} /* end of svccmsAllocNamedColor service routine */ + + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall allocate a named device-independent color. A color string +shall be in the client-side color database or device independent color +specification in one of the following formats +.P +RGB:red/green/blue +.br +RGBi:R/G/B +.br +CIEXYZ:X/Y/Z +.br +CIEuvY:u/v/Y +.br +CIExyY:x/y/Y +.br +CIELab:L/a/b +.br +CIELuv:L/u/v +.br +TekHVC:H/V/C +.P +The RGB color space, +.I red, +.I green +and +.I blue +parameters shall be hexadecimal strings of one to four digits, and other +color spaces, each parameter shall be a floating-point number in standard +string format. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; + + /* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg, XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + colormap_good = XDefaultColormap(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XDefaultColormap(display_good, screen_good ); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if (writeable_colormaps) + { + step("service specific testcase set.\n"); + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) + { + tet_infoline("TEST: Testing XcmsAllocNamedColor for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + { + svccmsAllocNamedColor( display_good, colormap_good, "red", + scrnColor, exactColor, XcmsRGBiFormat); + + } + } + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif +>>ASSERTION Good C +If the implementation is X11R5 or later: +If the value for the colormap argument does not name a defined colormap a +call to xname shall return the BadColor error code. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; + + /* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + colormap_good = XDefaultColormap(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XDefaultColormap(display_good, screen_good ); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + + if (writeable_colormaps) + { + chkflg = 1; + estatus[0] = 1; + estatus[1] = BadColor; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) + { + tet_infoline("TEST: Testing XcmsAllocNamedColor for BadColor\n"); + regr_args.l_flags.check = 0; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + svccmsAllocNamedColor( + display_good, + -999, + "red", + scrnColor, + exactColor, + XcmsRGBiFormat + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsCCCOfColormap/XcmsCCCOfColormap.m b/xts5/Xlib7/XcmsCCCOfColormap/XcmsCCCOfColormap.m new file mode 100644 index 00000000..1c811f07 --- /dev/null +++ b/xts5/Xlib7/XcmsCCCOfColormap/XcmsCCCOfColormap.m @@ -0,0 +1,323 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsCCCOfColormap/XcmsCCCOfColormap.m,v 1.1 2005-02-12 14:37:35 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsCCCOfColormap/XcmsCCCOfColormap.m +>># +>># Description: +>># Tests for XcmsCCCOfColormap() +>># +>># Modifications: +>># $Log: cmsccoc.m,v $ +>># Revision 1.1 2005-02-12 14:37:35 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:04 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:22 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:17 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:48 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:40 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:49:14 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsCCCOfColormap Xlib7 +XcmsCCCOfColormap() +>>EXTERN + + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good ; +XcmsColor color_good ; +XcmsColorFormat format_good ; +int screen_good ; +int depth_good ; +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, + y_init, + h_init, + w_init; + +/****** + * routines + ******/ + +/***** + * svccmsCCCOfColormap routine + *****/ +svccmsCCCOfColormap(display, colormap) +Display *display ; +Colormap colormap ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + XcmsCCC svc_ret_value; + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsCCCOfColormap("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " display, colormap);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsCCCOfColormap(display, colormap); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + double one = 1.000000 ; + if (svc_ret_value != (XcmsCCC )0 ) { + XcmsQueryWhite(svc_ret_value, XcmsRGBiFormat, &color_good) ; + check_dou(one, color_good.spec.RGBi.red, "red" ) ; + check_dou(one, color_good.spec.RGBi.green, "green" ) ; + check_dou(one, color_good.spec.RGBi.blue, "blue" ) ; + } else { + errflg = 1 ; + message("XcmsCCCOfColormap() call failed\n", NULL, 0) ; + } + + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} /* end of svccmsCCCOfColormap service routine */ + + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname shall return the color conversion context +associated with the specified colormap. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; + /* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + + display_good = display_arg; + + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XDefaultColormap(display_good, screen_good ); + } + + if ( writeable_colormaps ) + { + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsCCCOfColormap for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + svccmsCCCOfColormap( + display_good, + colormap_good + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsCIELabQueryMaxC/XcmsCIELabQueryMaxC.m b/xts5/Xlib7/XcmsCIELabQueryMaxC/XcmsCIELabQueryMaxC.m new file mode 100644 index 00000000..b6577d62 --- /dev/null +++ b/xts5/Xlib7/XcmsCIELabQueryMaxC/XcmsCIELabQueryMaxC.m @@ -0,0 +1,281 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsCIELabQueryMaxC/XcmsCIELabQueryMaxC.m,v 1.1 2005-02-12 14:37:35 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsCIELabQueryMaxC/XcmsCIELabQueryMaxC.m +>># +>># Description: +>># Tests for XcmsCIELabQueryMaxC() +>># +>># Modifications: +>># $Log: cmscieqc.m,v $ +>># Revision 1.1 2005-02-12 14:37:35 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:05 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:23 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:18 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:49 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:43 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:49:19 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsCIELabQueryMaxC Xlib7 +XcmsCIELabQueryMaxC() +>>EXTERN + +Bool writeable_colormaps = 1; +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +XcmsColor color_good, color_return ; +XcmsColor color_in_out ; +XcmsColorFormat format_good ; +int screen_good ; +int depth_good ; + +char *exec_file_name; +int x_init, y_init, h_init, w_init; + +svccmsCIELabQueryMaxC(display, ccc, hue_a, L_s, color ) +Display *display ; +XcmsCCC ccc ; +XcmsFloat hue_a ; +XcmsFloat L_s ; +XcmsColor color ; +{ + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + Status svc_ret_value; + + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsCIELabQueryMaxC("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " ccc, hue_angle, L_star, color);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + + XSync(display_arg, 0); + + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ + + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsCIELabQueryMaxC( + ccc, + hue_a, + L_s, + &color + ); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + /* since it is difficult to get exact values */ + /* check values are within range */ + XcmsFloat L_star, a_star, b_star ; + L_star = color.spec.CIELab.L_star ; + a_star = color.spec.CIELab.a_star ; + b_star = color.spec.CIELab.b_star ; + check_dec(XcmsSuccess, svc_ret_value, "return value") ; + if ( ((L_star < 45.000000) || (L_star > 55.000000)) || + ((a_star < 0.000000) || (a_star > 100.000000)) || + ((b_star < 0.000000) || (b_star > 100.000000)) ) { + errflg = 1 ; + message("Returned invalid CIELab values\n", NULL, 0) ; + } + } + XSync(display_arg, 0); + + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname shall find the point +of maximum chroma displayable by the screen for given hue, angle and lightness. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; + /* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XDefaultColormap(display_good, screen_good ); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if ( writeable_colormaps ) + { + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) + { + tet_infoline("TEST: Testing XcmsCIELabQueryMaxC for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + double hue_angle = 29.000000 ; + double L_star = 50.000000 ; + svccmsCIELabQueryMaxC(display_good, ccc_good, + hue_angle, L_star, + color_return); + } + } /* end if */ + } else + message("Warning: not a writeable colormap\n", NULL, 0) ; + + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsCIELabQueryMaxL/XcmsCIELabQueryMaxL.m b/xts5/Xlib7/XcmsCIELabQueryMaxL/XcmsCIELabQueryMaxL.m new file mode 100644 index 00000000..8707c994 --- /dev/null +++ b/xts5/Xlib7/XcmsCIELabQueryMaxL/XcmsCIELabQueryMaxL.m @@ -0,0 +1,315 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsCIELabQueryMaxL/XcmsCIELabQueryMaxL.m,v 1.1 2005-02-12 14:37:35 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsCIELabQueryMaxL/XcmsCIELabQueryMaxL.m +>># +>># Description: +>># Tests for XcmsCIELabQueryMaxL() +>># +>># Modifications: +>># $Log: cmscieql.m,v $ +>># Revision 1.1 2005-02-12 14:37:35 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:06 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:24 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:18 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:49 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:44 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:49:22 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsCIELabQueryMaxL Xlib7 +XcmsCIELabQueryMaxL() +>>EXTERN + + +Bool writeable_colormaps = 1; +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +XcmsColor color_good, color_return ; +XcmsColor color_in_out ; +XcmsColorFormat format_good ; +int screen_good ; +int depth_good ; + +char *exec_file_name; +int x_init, y_init, h_init, w_init; + +svccmsCIELabQueryMaxL(display, ccc, hue_a, chroma, color ) +Display *display ; +XcmsCCC ccc ; +XcmsFloat hue_a ; +XcmsFloat chroma ; +XcmsColor color ; +{ + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsCIELabQueryMaxL("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " ccc, hue_angle, chroma, color);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsCIELabQueryMaxL( + ccc, + hue_a, + chroma, + &color + ); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + /* check values are legal */ + XcmsFloat L_star, a_star, b_star ; + L_star = color.spec.CIELab.L_star ; + a_star = color.spec.CIELab.a_star ; + b_star = color.spec.CIELab.b_star ; + check_dec(XcmsSuccess, svc_ret_value, "return value") ; + if ( ((L_star < 0.000000) || (L_star > 100.000000)) || + ((a_star < 0.000000) || (a_star > 100.000000)) || + ((b_star < 0.000000) || (b_star > 100.000000)) ) { + errflg = 1 ; + message("Returned invalid CIELab values\n", NULL, 0) ; + } + } + XSync(display_arg, 0); + + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); + } /* end of svccmsCIELabQueryMaxL service routine */ + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall find the point in CIELab color space of maximum +lightness displayable by the screen at the given hue angle and chroma. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; + + /* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg, + XRootWindow(display_arg,XDefaultScreen(display_arg)), + (unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + display_good = display_arg; + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XDefaultColormap(display_good, screen_good ); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if ( writeable_colormaps ) { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) + { + tet_infoline("TEST: Testing XcmsCIELabQueryMaxL for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + double hue_angle = 29.000000 ; + double chroma = 50.000000 ; + svccmsCIELabQueryMaxL( + display_good, + ccc_good, + hue_angle, + chroma, + color_return + ) ; + + } + } /* end if */ + } else + message("Warning: not a writeable colormap\n", NULL, 0) ; + + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsCIELabQueryMaxLC/XcmsCIELabQueryMaxLC.m b/xts5/Xlib7/XcmsCIELabQueryMaxLC/XcmsCIELabQueryMaxLC.m new file mode 100644 index 00000000..e443ee1c --- /dev/null +++ b/xts5/Xlib7/XcmsCIELabQueryMaxLC/XcmsCIELabQueryMaxLC.m @@ -0,0 +1,283 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsCIELabQueryMaxLC/XcmsCIELabQueryMaxLC.m,v 1.1 2005-02-12 14:37:35 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsCIELabQueryMaxLC/XcmsCIELabQueryMaxLC.m +>># +>># Description: +>># Tests for XcmsCIELabQueryMaxLC() +>># +>># Modifications: +>># $Log: cmscielq.m,v $ +>># Revision 1.1 2005-02-12 14:37:35 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:04 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:23 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:17 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:48 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:41 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:49:17 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsCIELabQueryMaxLC Xlib7 +XcmsCIELabQueryMaxLC() +>>EXTERN + + +Bool writeable_colormaps = 1; + +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +XcmsColor color_good, color_return ; +XcmsColor color_in_out ; +XcmsColorFormat format_good ; +int screen_good ; +int depth_good ; + +char *exec_file_name; +int x_init, y_init, h_init, w_init; + +svccmsCIELabQueryMaxLC(display, ccc, hue_a, color ) +Display *display ; +XcmsCCC ccc ; +XcmsFloat hue_a ; +XcmsColor color ; +{ + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + Status svc_ret_value; + + /****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsCIELabQueryMaxLC("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " ccc, hue_angle, color);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + + XSync(display_arg, 0); + + /****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , gc_id, + display_arg, drawable_id); + + first_error = 0; /* no errors encountered yet */ + + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsCIELabQueryMaxLC( + ccc, + hue_a, + &color + ); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , gc_id, + display_arg, drawable_id, ss_status); + else + stat_status = REGR_NORMAL; + + /****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + + /****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + /* check values are within range */ + XcmsFloat L_star, a_star, b_star ; + L_star = color.spec.CIELab.L_star ; + a_star = color.spec.CIELab.a_star ; + b_star = color.spec.CIELab.b_star ; + check_dec(XcmsSuccess, svc_ret_value, "return value") ; + if ( ((L_star < 0.000000) || (L_star > 100.000000)) || + ((a_star < 0.000000) || (a_star > 100.000000)) || + ((b_star < 0.000000) || (b_star > 100.000000)) ) { + errflg = 1 ; + message("Returned invalid CIELab values\n", NULL, 0) ; + } + } + XSync(display_arg, 0); + + /****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + /***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname shall find the point of maximum chroma displayable by +the screen at the given hue angle. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; + /* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + + display_good = display_arg; + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XDefaultColormap(display_good, screen_good ); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if ( writeable_colormaps ) + { + step("service specific testcase set.\n"); + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) + { + tet_infoline("TEST: Testing XcmsCIELabQueryMaxLC for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + double hue_angle = 29.000000 ; + svccmsCIELabQueryMaxLC(display_good, ccc_good, + hue_angle, color_return); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsCIELabQueryMinL/XcmsCIELabQueryMinL.m b/xts5/Xlib7/XcmsCIELabQueryMinL/XcmsCIELabQueryMinL.m new file mode 100644 index 00000000..11d2ae19 --- /dev/null +++ b/xts5/Xlib7/XcmsCIELabQueryMinL/XcmsCIELabQueryMinL.m @@ -0,0 +1,345 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsCIELabQueryMinL/XcmsCIELabQueryMinL.m,v 1.1 2005-02-12 14:37:35 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsCIELabQueryMinL/XcmsCIELabQueryMinL.m +>># +>># Description: +>># Tests for XcmsCIELabQueryMinL() +>># +>># Modifications: +>># $Log: cmslqml.m,v $ +>># Revision 1.1 2005-02-12 14:37:35 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:10 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:29 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:22 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:53 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:50:01 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:49:52 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsCIELabQueryMinL Xlib7 +XcmsCIELabQueryMinL() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +XcmsColor color_good, color_return ; +XcmsColor color_in_out ; +XcmsColorFormat format_good ; +int screen_good ; +int depth_good ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, y_init, h_init, w_init; + +/****** + * routines + ******/ + +/***** + * svccmsCIELabQueryMinL routine + *****/ +svccmsCIELabQueryMinL(display, ccc, hue_a, chroma, color ) +Display *display ; +XcmsCCC ccc ; +XcmsFloat hue_a ; +XcmsFloat chroma ; +XcmsColor color ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsCIELabQueryMinL("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " ccc, hue_angle, chroma, color);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsCIELabQueryMinL( + ccc, + hue_a, + chroma, + &color + ); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + /* check values are within range */ + XcmsFloat L_star, a_star, b_star ; + L_star = color.spec.CIELab.L_star ; + a_star = color.spec.CIELab.a_star ; + b_star = color.spec.CIELab.b_star ; + check_dec(XcmsSuccess, svc_ret_value, "return value") ; + if ( ((L_star < 0.000000) || (L_star > 100.000000)) || + ((a_star < 0.000000) || (a_star > 100.000000)) || + ((b_star < 0.000000) || (b_star > 100.000000)) ) { + errflg = 1 ; + message("Returned invalid CIELab values\n", NULL, 0) ; + } + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall find the point of minimum lightness displayable by the screen +at the given hue angle and chroma. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + colormap_good = XDefaultColormap(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || + (estatus[1] == Success)) + { + tet_infoline("TEST: Testing XcmsCIELabQueryMinL for Success"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + double hue_angle = 29.000000 ; + double chroma = 50.000000 ; + svccmsCIELabQueryMinL( + display_good, + ccc_good, + hue_angle, + chroma, + color_return + ) ; + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsCIELuvQueryMaxC/XcmsCIELuvQueryMaxC.m b/xts5/Xlib7/XcmsCIELuvQueryMaxC/XcmsCIELuvQueryMaxC.m new file mode 100644 index 00000000..ef43b26b --- /dev/null +++ b/xts5/Xlib7/XcmsCIELuvQueryMaxC/XcmsCIELuvQueryMaxC.m @@ -0,0 +1,349 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsCIELuvQueryMaxC/XcmsCIELuvQueryMaxC.m,v 1.1 2005-02-12 14:37:36 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsCIELuvQueryMaxC/XcmsCIELuvQueryMaxC.m +>># +>># Description: +>># Tests for XcmsCIELuvQueryMaxC() +>># +>># Modifications: +>># $Log: cmsqmc.m,v $ +>># Revision 1.1 2005-02-12 14:37:36 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:14 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:32 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:26 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:57 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:50:13 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:50:14 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsCIELuvQueryMaxC Xlib7 +XcmsCIELuvQueryMaxC() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +XcmsColor color_good, color_return ; +XcmsColor color_in_out ; +XcmsColorFormat format_good ; +int screen_good ; +int depth_good ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, + y_init, + h_init, + w_init; + +/****** + * routines + ******/ + +/***** + * svccmsCIELuvQueryMaxC routine + *****/ +svccmsCIELuvQueryMaxC(display, ccc, hue_a, L_s, color ) +Display *display ; +XcmsCCC ccc ; +XcmsFloat hue_a ; +XcmsFloat L_s ; +XcmsColor color ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + call_string = "svc_ret_value = XcmsCIELuvQueryMaxC("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " ccc, hue_angle, L_star, color);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsCIELuvQueryMaxC( + ccc, + hue_a, + L_s, + &color + ); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + XcmsFloat L_star, u_star, v_star ; + L_star = color.spec.CIELuv.L_star ; + u_star = color.spec.CIELuv.u_star ; + v_star = color.spec.CIELuv.v_star ; + check_dec(XcmsSuccess, svc_ret_value, "return value") ; + if ( ((L_star < 45.000000) || (L_star > 55.000000)) || + ((u_star < 0.000000) || (u_star > 100.000000)) || + ((v_star < 0.000000) || (v_star > 100.000000)) ) { + errflg = 1 ; + message("Returned invalid CIELuv values\n", NULL, 0) ; + } + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall find the point of maximum chroma displayable by the screen +at the given hue angle and lightness. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + + depth_good = DisplayPlanes( display_good, screen_good ); + + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XDefaultColormap(display_good, screen_good ); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || + (estatus[1] == Success)) + { + tet_infoline("TEST: Testing XcmsCIELuvQueryMaxC for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + double hue_angle = 29.000000 ; + double L_star = 50.000000 ; + svccmsCIELuvQueryMaxC( + display_good, + ccc_good, + hue_angle, + L_star, + color_return + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsCIELuvQueryMaxL/XcmsCIELuvQueryMaxL.m b/xts5/Xlib7/XcmsCIELuvQueryMaxL/XcmsCIELuvQueryMaxL.m new file mode 100644 index 00000000..7c9a3a1d --- /dev/null +++ b/xts5/Xlib7/XcmsCIELuvQueryMaxL/XcmsCIELuvQueryMaxL.m @@ -0,0 +1,346 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsCIELuvQueryMaxL/XcmsCIELuvQueryMaxL.m,v 1.1 2005-02-12 14:37:36 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsCIELuvQueryMaxL/XcmsCIELuvQueryMaxL.m +>># +>># Description: +>># Tests for XcmsCIELuvQueryMaxL() +>># +>># Modifications: +>># $Log: cmsqml.m,v $ +>># Revision 1.1 2005-02-12 14:37:36 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:15 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:33 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:27 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:58 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:50:16 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:50:20 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsCIELuvQueryMaxL Xlib7 +XcmsCIELuvQueryMaxL() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +XcmsColor color_good, color_return ; +XcmsColor color_in_out ; +XcmsColorFormat format_good ; +int screen_good ; +int depth_good ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, + y_init, + h_init, + w_init; + +/****** + * routines + ******/ + +/***** + * svccmsCIELuvQueryMaxL routine + *****/ +svccmsCIELuvQueryMaxL(display, ccc, hue_a, chroma, color ) +Display *display ; +XcmsCCC ccc ; +XcmsFloat hue_a ; +XcmsFloat chroma ; +XcmsColor color ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsCIELuvQueryMaxL("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " ccc, hue_angle, chroma, color);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsCIELuvQueryMaxL( + ccc, + hue_a, + chroma, + &color + ); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + XcmsFloat L_star, u_star, v_star ; + L_star = color.spec.CIELuv.L_star ; + u_star = color.spec.CIELuv.u_star ; + v_star = color.spec.CIELuv.v_star ; + check_dec(XcmsSuccess, svc_ret_value, "return value") ; + if ( ((L_star < 0.000000) || (L_star > 100.000000)) || + ((u_star < 0.000000) || (u_star > 100.000000)) || + ((v_star < 0.000000) || (v_star > 100.000000)) ) { + errflg = 1 ; + message("Returned invalid CIELab values\n", NULL, 0) ; + } + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall find the point in CIE L*u*v color space of maximum lightness +displayable by the screen at the given hue angle and chroma. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XDefaultColormap(display_good, screen_good ); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsCIELuvQueryMaxL for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + double hue_angle = 29.000000 ; + double chroma = 50.000000 ; + svccmsCIELuvQueryMaxL( + display_good, + ccc_good, + hue_angle, + chroma, + color_return + ) ; + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsCIELuvQueryMaxLC/XcmsCIELuvQueryMaxLC.m b/xts5/Xlib7/XcmsCIELuvQueryMaxLC/XcmsCIELuvQueryMaxLC.m new file mode 100644 index 00000000..ff74255b --- /dev/null +++ b/xts5/Xlib7/XcmsCIELuvQueryMaxLC/XcmsCIELuvQueryMaxLC.m @@ -0,0 +1,337 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsCIELuvQueryMaxLC/XcmsCIELuvQueryMaxLC.m,v 1.1 2005-02-12 14:37:36 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsCIELuvQueryMaxLC/XcmsCIELuvQueryMaxLC.m +>># +>># Description: +>># Tests for XcmsCIELuvQueryMaxLC() +>># +>># Modifications: +>># $Log: cmsqmlc.m,v $ +>># Revision 1.1 2005-02-12 14:37:36 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:15 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:34 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:27 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:58 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:50:17 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:50:22 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsCIELuvQueryMaxLC Xlib7 +XcmsCIELuvQueryMaxLC() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +XcmsColor color_good, color_return ; +XcmsColor color_in_out ; +XcmsColorFormat format_good ; +int screen_good ; +int depth_good ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, y_init, h_init, w_init; + +/****** + * routines + ******/ + +/***** + * svccmsCIELuvQueryMaxLC routine + *****/ +svccmsCIELuvQueryMaxLC(display, ccc, hue_a, color) +Display *display ; +XcmsCCC ccc ; +XcmsFloat hue_a ; +XcmsColor color ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsCIELuvQueryMaxLC("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " ccc, hue_angle, color);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsCIELuvQueryMaxLC( + ccc, + hue_a, + &color + ); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + XcmsFloat L_star, u_star, v_star ; + L_star = color.spec.CIELuv.L_star ; + u_star = color.spec.CIELuv.u_star ; + v_star = color.spec.CIELuv.v_star ; + check_dec(XcmsSuccess, svc_ret_value, "return value") ; + if ( ((L_star < 0.000000) || (L_star > 100.000000)) || + ((u_star < 0.000000) || (u_star > 100.000000)) || + ((v_star < 0.000000) || (v_star > 100.000000)) ) { + errflg = 1 ; + message("Returned invalid CIELuv values\n", NULL, 0) ; + } + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall find the point of maximum chroma displayable by the screen +at the given hue angle. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XDefaultColormap(display_good, screen_good ); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if ( writeable_colormaps ) { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsCIELuvQueryMaxLC for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + double hue_angle = 29.000000 ; + svccmsCIELuvQueryMaxLC( + display_good, + ccc_good, + hue_angle, + color_return + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsCIELuvQueryMinL/XcmsCIELuvQueryMinL.m b/xts5/Xlib7/XcmsCIELuvQueryMinL/XcmsCIELuvQueryMinL.m new file mode 100644 index 00000000..60ac7279 --- /dev/null +++ b/xts5/Xlib7/XcmsCIELuvQueryMinL/XcmsCIELuvQueryMinL.m @@ -0,0 +1,349 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsCIELuvQueryMinL/XcmsCIELuvQueryMinL.m,v 1.1 2005-02-12 14:37:36 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsCIELuvQueryMinL/XcmsCIELuvQueryMinL.m +>># +>># Description: +>># Tests for XcmsCIELuvQueryMinL() +>># +>># Modifications: +>># $Log: cmsqmil.m,v $ +>># Revision 1.1 2005-02-12 14:37:36 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:14 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:33 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:26 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:57 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:50:14 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:50:17 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsCIELuvQueryMinL Xlib7 +XcmsCIELuvQueryMinL() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +XcmsColor color_good, color_return ; +XcmsColor color_in_out ; +XcmsColorFormat format_good ; +int screen_good ; +int depth_good ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, + y_init, + h_init, + w_init; + +/****** + * routines + ******/ + +/***** + * svccmsCIELuvQueryMinL routine + *****/ +svccmsCIELuvQueryMinL(display, ccc, hue_a, chroma, color ) +Display *display ; +XcmsCCC ccc ; +XcmsFloat hue_a ; +XcmsFloat chroma ; +XcmsColor color ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsCIELuvQueryMinL("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " ccc, hue_angle, chroma, color);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsCIELuvQueryMinL( + ccc, + hue_a, + chroma, + &color + ); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + XcmsFloat L_star, u_star, v_star ; + L_star = color.spec.CIELuv.L_star ; + u_star = color.spec.CIELuv.u_star ; + v_star = color.spec.CIELuv.v_star ; + check_dec(XcmsSuccess, svc_ret_value, "return value") ; + if ( ((L_star < 0.000000) || (L_star > 100.000000)) || + ((u_star < 0.000000) || (u_star > 100.000000)) || + ((v_star < 0.000000) || (v_star > 100.000000)) ) { + errflg = 1 ; + message("Returned invalid CIELab values\n", NULL, 0) ; + } + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + + + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall find the point of minimum ligthness displayable by +the screen at the given hue angle and chroma. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + + depth_good = DisplayPlanes( display_good, screen_good ); + + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XDefaultColormap(display_good, screen_good ); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsCIELuvQueryMinL for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + double hue_angle = 29.000000 ; + double chroma = 50.000000 ; + svccmsCIELuvQueryMinL( + display_good, + ccc_good, + hue_angle, + chroma, + color_return + ) ; + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsClientWhitePointOfCCC/XcmsClientWhitePointOfCCC.m b/xts5/Xlib7/XcmsClientWhitePointOfCCC/XcmsClientWhitePointOfCCC.m new file mode 100644 index 00000000..0555abd2 --- /dev/null +++ b/xts5/Xlib7/XcmsClientWhitePointOfCCC/XcmsClientWhitePointOfCCC.m @@ -0,0 +1,323 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsClientWhitePointOfCCC/XcmsClientWhitePointOfCCC.m,v 1.1 2005-02-12 14:37:36 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsClientWhitePointOfCCC/XcmsClientWhitePointOfCCC.m +>># +>># Description: +>># Tests for XcmsClientWhitePointOfCCC() +>># +>># Modifications: +>># $Log: cmswpoc.m,v $ +>># Revision 1.1 2005-02-12 14:37:36 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:22 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:41 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:34 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:16:05 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:50:40 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:51:05 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsClientWhitePointOfCCC Xlib7 +XcmsClientWhitePointOfCCC() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +Colormap rw_colormap ; +XcmsColor color_good ; +XcmsColorFormat format_good ; +int screen_good ; +int depth_good ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, y_init, h_init, w_init; + +/****** + * routines + ******/ + +/***** + * svccmsClientWhitePointOfCCC routine + *****/ +svccmsClientWhitePointOfCCC(display, ccc) +Display *display ; +XcmsCCC ccc ; +{ + +/***** + * external defs + *****/ +extern int errcnt; +extern int errflg; +extern int chkflg; +extern int signal_status(); +extern int unexp_err(); +extern char *svc_user_arg; + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + XcmsColor *svc_ret_value; + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsClientWhitePointOfCCC("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " ccc);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsClientWhitePointOfCCC(ccc); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + if (svc_ret_value == (XcmsColor *)NULL) { + errflg = 1 ; + message("XcmsClientWhitePointOfCCC call failed\n", NULL, 0) ; + } + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall return the client white point associated with the specified +Color Conversion Context. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; + +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + + display_good = display_arg; + + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + rw_colormap = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll) ; + ccc_good = XcmsCCCOfColormap(display_good, rw_colormap) ; + } + + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsClientWhitePointOfCCC for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + color_good.format = XcmsRGBFormat ; + color_good.pixel = 0 ; + color_good.spec.RGB.red = 0xffff ; + color_good.spec.RGB.green = 0xffff ; + color_good.spec.RGB.blue = 0xffff ; + + XcmsSetWhitePoint(ccc_good, &color_good); + svccmsClientWhitePointOfCCC( + display_good, + ccc_good + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsConversionProc/XcmsConversionProc.m b/xts5/Xlib7/XcmsConversionProc/XcmsConversionProc.m new file mode 100644 index 00000000..b429342f --- /dev/null +++ b/xts5/Xlib7/XcmsConversionProc/XcmsConversionProc.m @@ -0,0 +1,1008 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsConversionProc/XcmsConversionProc.m,v 1.1 2005-02-12 14:37:35 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsConversionProc/XcmsConversionProc.m +>># +>># Description: +>># Tests for XcmsConversionProc() +>># +>># Modifications: +>># $Log: cmscproc.m,v $ +>># Revision 1.1 2005-02-12 14:37:35 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:06 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:24 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:19 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:50 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:46 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:49:26 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsConversionProc Xlib7 +XcmsConversionProc() +>>EXTERN + +Bool writeable_colormaps = 1; +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +Colormap rw_colormap ; +XcmsColor color_good[2] ; +XcmsColor white_point[2] ; +XcmsColor *white_ptr ; +XcmsColorFormat format_good ; +int screen_good ; +int depth_good ; +unsigned int ncolors ; +/* +Bool compression_flags_return[] ; +*/ + +int (*XcmsConversionFunc)() ; + +char *exec_file_name; +int x_init, y_init, h_init, w_init; + +svccmsConversionProc(display, ccc, white_point, colors, num) +Display *display ; +XcmsCCC ccc ; +XcmsColor white_point[] ; +XcmsColor colors[] ; +unsigned int num ; +{ + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsConversionProc("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " ccc, white_point, colors, ncolors);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsConversionFunc(ccc, &white_point[0], colors, num) ; + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + check_dec(XcmsSuccess, svc_ret_value, "return value") ; + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall convert color specifications from XcmsCIELab to XcmsCIELXYZ. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; + /* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + display_good = display_arg; + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) + { + tet_infoline("TEST: Testing XcmsCIELabToCIEXYZ for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + color_good[0].format = XcmsCIELabFormat ; + color_good[0].spec.CIELab.L_star = 1.8 ; + color_good[0].spec.CIELab.a_star = 0.6 ; + color_good[0].spec.CIELab.b_star = 1.4 ; + white_point[0].format = XcmsCIEXYZFormat ; + white_point[0].spec.CIEXYZ.X = 1.0 ; + white_point[0].spec.CIEXYZ.Y = 1.0 ; + white_point[0].spec.CIEXYZ.Z = 1.0 ; + ncolors = 1 ; + XcmsConversionFunc = XcmsCIELabToCIEXYZ ; + svccmsConversionProc( + display_good, + ccc_good, + &white_point[0], + &color_good[0], + ncolors + ); + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall convert color specifications from XcmsCIELuv to XcmsCIEuvY. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; + /* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + display_good = display_arg; + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if (writeable_colormaps) + { + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) + { + tet_infoline("TEST: Testing XcmsCIELuvToCIEuvY for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + color_good[0].format = XcmsCIELuvFormat ; + color_good[0].spec.CIELuv.L_star = 100.0 ; + color_good[0].spec.CIELuv.u_star = 100.0 ; + color_good[0].spec.CIELuv.v_star = 100.0 ; + white_point[0].format = XcmsCIEXYZFormat ; + white_point[0].spec.CIEXYZ.X = 1.0 ; + white_point[0].spec.CIEXYZ.Y = 1.0 ; + white_point[0].spec.CIEXYZ.Z = 1.0 ; + ncolors = 1 ; + XcmsConversionFunc = XcmsCIELuvToCIEuvY ; + svccmsConversionProc( + display_good, + ccc_good, + &white_point[0], + &color_good[0], + ncolors + ); + + } + } /* end if */ + } else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall convert color specifications from XcmsCIEXYZ to XcmsCIELab. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; + /* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + display_good = display_arg; + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + message("Assertion #3\n", NULL, 0); + if ( writeable_colormaps ) { + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) + { + tet_infoline("TEST: Testing XcmsCIEXYZToCIELab for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + color_good[0].format = XcmsCIEXYZFormat ; + color_good[0].spec.CIEXYZ.X = 1.0 ; + color_good[0].spec.CIEXYZ.Y = 1.0 ; + color_good[0].spec.CIEXYZ.Z = 1.0 ; + white_point[0].format = XcmsCIEXYZFormat ; + white_point[0].spec.CIEXYZ.X = 1.0 ; + white_point[0].spec.CIEXYZ.Y = 1.0 ; + white_point[0].spec.CIEXYZ.Z = 1.0 ; + ncolors = 1 ; + XcmsConversionFunc = XcmsCIEXYZToCIELab ; + svccmsConversionProc( + display_good, + ccc_good, + &white_point[0], + &color_good[0], + ncolors + ); + + } + } /* end if */ + } else + message("Warning: not a writeable colormap\n", NULL, 0) ; + + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall convert color specifications from XcmsCIEXYZ to XcmsCIELuvY. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; + /* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + display_good = display_arg; + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if (writeable_colormaps) + { + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) + { + tet_infoline("TEST: Testing XcmsCIEXYZToCIEuvY for Success\n"); + + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + color_good[0].format = XcmsCIEXYZFormat ; + color_good[0].spec.CIEXYZ.X = 1.0 ; + color_good[0].spec.CIEXYZ.Y = 1.0 ; + color_good[0].spec.CIEXYZ.Z = 1.0 ; + white_point[0].format = XcmsCIEXYZFormat ; + white_point[0].spec.CIEXYZ.X = 1.0 ; + white_point[0].spec.CIEXYZ.Y = 1.0 ; + white_point[0].spec.CIEXYZ.Z = 1.0 ; + ncolors = 1 ; + XcmsConversionFunc = XcmsCIEXYZToCIEuvY ; + svccmsConversionProc( + display_good, + ccc_good, + &white_point[0], + &color_good[0], + ncolors + ); + + } + } /* end if */ + } else + message("Warning: not a writeable colormap\n", NULL, 0) ; + + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall convert color specifications from XcmsCIEXYZ to XcmsCIExyY. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; + /* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + display_good = display_arg; + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if (writeable_colormaps) + { + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) + { + tet_infoline("TEST: Testing XcmsCIEXYZToCIExyY for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + color_good[0].format = XcmsCIEXYZFormat ; + color_good[0].spec.CIEXYZ.X = 1.0 ; + color_good[0].spec.CIEXYZ.Y = 1.0 ; + color_good[0].spec.CIEXYZ.Z = 1.0 ; + white_point[0].format = XcmsCIEXYZFormat ; + white_point[0].spec.CIEXYZ.X = 1.0 ; + white_point[0].spec.CIEXYZ.Y = 1.0 ; + white_point[0].spec.CIEXYZ.Z = 1.0 ; + ncolors = 1 ; + XcmsConversionFunc = XcmsCIEXYZToCIExyY ; + svccmsConversionProc( + display_good, + ccc_good, + &white_point[0], + &color_good[0], + ncolors + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname shall convert color specifications from XcmsCIEXYZ +to XcmsCIExyY. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; + /* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + display_good = display_arg; + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + message("Assertion #6\n", NULL, 0); + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) + { + tet_infoline("TEST: Testing XcmsCIEuvYToCIELuv for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + color_good[0].format = XcmsCIEuvYFormat ; + color_good[0].spec.CIEuvY.u_prime = 0.6 ; + color_good[0].spec.CIEuvY.v_prime = 0.6 ; + color_good[0].spec.CIEuvY.Y = 1.0 ; + white_point[0].format = XcmsCIEXYZFormat ; + white_point[0].spec.CIEXYZ.X = 1.0 ; + white_point[0].spec.CIEXYZ.Y = 1.0 ; + white_point[0].spec.CIEXYZ.Z = 1.0 ; + ncolors = 1 ; + XcmsConversionFunc = XcmsCIEuvYToCIELuv ; + svccmsConversionProc(display_good, ccc_good, &white_point[0], + &color_good[0], ncolors); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall convert color specifications from XcmsCIEuvY to XcmsCIEXYZ. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; + /* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + display_good = display_arg; + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + message("Assertion #7\n", NULL, 0); + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsCIEuvYToCIEXYZ for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + color_good[0].format = XcmsCIEuvYFormat ; + color_good[0].spec.CIEuvY.u_prime = 1.0 ; + color_good[0].spec.CIEuvY.v_prime = 1.0 ; + color_good[0].spec.CIEuvY.Y = 1.0 ; + white_point[0].format = XcmsCIEXYZFormat ; + white_point[0].spec.CIEXYZ.X = 1.0 ; + white_point[0].spec.CIEXYZ.Y = 1.0 ; + white_point[0].spec.CIEXYZ.Z = 1.0 ; + ncolors = 1 ; + XcmsConversionFunc = XcmsCIEuvYToCIEXYZ ; + svccmsConversionProc( + display_good, + ccc_good, + &white_point[0], + &color_good[0], + ncolors + ); + + } + } /* end if */ + } else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall convert color specifications from XcmsCIExyY to XcmsCIEXYZ. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; + /* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + display_good = display_arg; + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if (writeable_colormaps) + { + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) + { + tet_infoline("TEST: Testing XcmsCIExyYToCIEXYZ for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + color_good[0].format = XcmsCIExyYFormat ; + color_good[0].spec.CIExyY.x = 0.75 ; + color_good[0].spec.CIExyY.y = 0.85 ; + color_good[0].spec.CIExyY.Y = 1.0 ; + white_point[0].format = XcmsCIEXYZFormat ; + white_point[0].spec.CIEXYZ.X = 1.0 ; + white_point[0].spec.CIEXYZ.Y = 1.0 ; + white_point[0].spec.CIEXYZ.Z = 1.0 ; + ncolors = 1 ; + XcmsConversionFunc = XcmsCIExyYToCIEXYZ ; + svccmsConversionProc( + display_good, + ccc_good, + &white_point[0], + &color_good[0], + ncolors + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall convert color specifications from XcmsTekHVC to XcmsCIEuvY. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; + /* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + display_good = display_arg; + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) + { + tet_infoline("TEST: Testing XcmsTekHVCToCIEuvY for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + color_good[0].format = XcmsTekHVCFormat ; + color_good[0].spec.TekHVC.H = 360.0 ; + color_good[0].spec.TekHVC.V = 100.0 ; + color_good[0].spec.TekHVC.C = 100.0 ; + white_point[0].format = XcmsCIEXYZFormat ; + white_point[0].spec.CIEXYZ.X = 1.0 ; + white_point[0].spec.CIEXYZ.Y = 1.0 ; + white_point[0].spec.CIEXYZ.Z = 1.0 ; + ncolors = 1 ; + XcmsConversionFunc = XcmsTekHVCToCIEuvY ; + svccmsConversionProc( + display_good, + ccc_good, + &white_point[0], + &color_good[0], + ncolors + ); + + } + } /* end if */ + } else + message("Warning: not a writeable colormap\n", NULL, 0) ; + + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsConversionProc/cmscprocd/XcmsConversionProc.m b/xts5/Xlib7/XcmsConversionProc/cmscprocd/XcmsConversionProc.m new file mode 100644 index 00000000..2f176d4a --- /dev/null +++ b/xts5/Xlib7/XcmsConversionProc/cmscprocd/XcmsConversionProc.m @@ -0,0 +1,609 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsConversionProc/XcmsConversionProc.m,v 1.1 2005-02-12 14:37:35 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsConversionProc/XcmsConversionProc.m +>># +>># Description: +>># Tests for XcmsConversionProc() +>># +>># Modifications: +>># $Log: cmscprocd.m,v $ +>># Revision 1.1 2005-02-12 14:37:35 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:07 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:25 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:19 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:50 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:49 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:49:31 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsConversionProc Xlib7 +XcmsConversionProc() +>>EXTERN + + +Bool writeable_colormaps = 1; + +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +Colormap rw_colormap ; +XcmsColor color_good[2] ; +XcmsColor white_point[2] ; +XcmsColor *white_ptr ; +XcmsColorFormat format_good ; +int screen_good ; +int depth_good ; +unsigned int ncolors ; +Bool compression_flags_return[2] ; + +int (*XcmsConversionFunc)() ; + +char *exec_file_name; +int x_init, y_init, h_init, w_init; + +svccmsConversionProc(display, ccc, colors, num, flags) +Display *display ; +XcmsCCC ccc ; +XcmsColor colors[] ; +unsigned int num ; +Bool flags[] ; +{ +/***** + * external defs + *****/ + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsConversionProc("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " ccc, colors, ncolors, flags);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsConversionFunc(ccc, colors, num, &flags[0]) ; + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + if (svc_ret_value == 0) { + errflg = 1 ; + message ("XcmsConversionProc call failed\n", NULL , 0) ; + } + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall convert color specifications from XcmsCIEXYZ to XcmsRGBi. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + message("Assertion #1\n", NULL, 0); + if (writeable_colormaps) + { + step("service specific testcase set.\n"); + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsCIEXYZToRGBi for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + color_good[0].format = XcmsCIEXYZFormat ; + color_good[0].spec.CIEXYZ.X = 1.0 ; + color_good[0].spec.CIEXYZ.Y = 1.0 ; + color_good[0].spec.CIEXYZ.Z = 1.0 ; + ncolors = 1 ; + XcmsConversionFunc = XcmsCIEXYZToRGBi ; + svccmsConversionProc( + display_good, + ccc_good, + &color_good[0], + ncolors, + &compression_flags_return[0] + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall convert color specifications from XcmsRGB to XcmsRGBi. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + + depth_good = DisplayPlanes( display_good, screen_good ); + + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + message("Assertion #2\n", NULL, 0); + if ( writeable_colormaps ) { + step("service specific testcase set.\n"); + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsRGBToRGBi for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + color_good[0].format = XcmsRGBFormat ; + color_good[0].spec.RGB.red = 0xffff ; + color_good[0].spec.RGB.green = 0xffff ; + color_good[0].spec.RGB.blue = 0xffff ; + ncolors = 1 ; + XcmsConversionFunc = XcmsRGBToRGBi ; + svccmsConversionProc( + display_good, + ccc_good, + &color_good[0], + ncolors, + &compression_flags_return[0] + ); + + } + } /* end if */ + } + } else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall convert color specifications from XcmsRGBi to XcmsCIEXYZ. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + + depth_good = DisplayPlanes( display_good, screen_good ); + + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + message("Assertion #3\n", NULL, 0); + if ( writeable_colormaps ) { + step("service specific testcase set.\n"); + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsRGBiToCIEXYZ for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + color_good[0].format = XcmsRGBiFormat ; + color_good[0].spec.RGBi.red = 1.0 ; + color_good[0].spec.RGBi.green = 1.0 ; + color_good[0].spec.RGBi.blue = 1.0 ; + ncolors = 1 ; + XcmsConversionFunc = XcmsRGBiToCIEXYZ ; + svccmsConversionProc( + display_good, + ccc_good, + &color_good[0], + ncolors, + &compression_flags_return[0] + ); + + } + } /* end if */ + } + } else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall convert color specifications from XcmsRGBi to XcmsRGB. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + + depth_good = DisplayPlanes( display_good, screen_good ); + + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + message("Assertion #4\n", NULL, 0); + if ( writeable_colormaps ) { + step("service specific testcase set.\n"); + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsRGBiToRGB for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + color_good[0].format = XcmsRGBiFormat ; + color_good[0].spec.RGBi.red = 1.0 ; + color_good[0].spec.RGBi.green = 1.0 ; + color_good[0].spec.RGBi.blue = 1.0 ; + ncolors = 1 ; + XcmsConversionFunc = XcmsRGBiToRGB ; + svccmsConversionProc( + display_good, + ccc_good, + &color_good[0], + ncolors, + &compression_flags_return[0] + ); + + } + } /* end if */ + } + } else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsConvertColors/XcmsConvertColors.m b/xts5/Xlib7/XcmsConvertColors/XcmsConvertColors.m new file mode 100644 index 00000000..16904571 --- /dev/null +++ b/xts5/Xlib7/XcmsConvertColors/XcmsConvertColors.m @@ -0,0 +1,363 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsConvertColors/XcmsConvertColors.m,v 1.1 2005-02-12 14:37:35 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsConvertColors/XcmsConvertColors.m +>># +>># Description: +>># Tests for XcmsConvertColors() +>># +>># Modifications: +>># $Log: cmsccol.m,v $ +>># Revision 1.1 2005-02-12 14:37:35 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:23 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:41 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:35 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:16:06 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:50:43 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:44:31 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsConvertColors Xlib7 +XcmsConvertColors() +>>EXTERN + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good ; +Colormap rw_colormap ; +XcmsColor color_good[2] ; +int screen_good ; +int depth_good ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, + y_init, + h_init, + w_init; + +/****** + * routines + ******/ + +/***** + * svccmsConvertColors routine + *****/ +svccmsConvertColors(display, ccc, colors_in_out, ncolors, + target_format, c_flag) +Display *display ; +XcmsCCC ccc ; +XcmsColor colors_in_out[] ; +unsigned int ncolors ; +XcmsColorFormat target_format ; +Bool c_flag[] ; +{ + +/***** + * external defs + *****/ +extern int errcnt; +extern int errflg; +extern int chkflg; +extern int signal_status(); +extern int unexp_err(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsConvertColors("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " ccc, colors_in_out, ncolors, target_format, c_flag);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + +/****** + * Make sure we invoke the service at least once + ******/ + + if (regr_args.iter == 0) + regr_args.iter = 1; /* set number of iterations to 1. */ + +/****** + * iteration loop + ******/ + + for (i1 = 0; i1 < regr_args.iter; i1++) + { +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsConvertColors( + ccc, + colors_in_out, + ncolors, + target_format, + c_flag + ); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + + /****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + + /****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + + /****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + double one = 1.000000 ; + if (svc_ret_value != 0 ) { + check_dou(one, colors_in_out[0].spec.RGBi.red, "red" ) ; + check_dou(one, colors_in_out[0].spec.RGBi.green, "green" ) ; + check_dou(one, colors_in_out[0].spec.RGBi.blue, "blue" ) ; + } else { + errflg = 1 ; + message("XcmsConvertColors() call failed\n", NULL, 0) ; + } + } + XSync(display_arg, 0); + + /****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + } /* end of service test loop. */ + + if (errflg) + { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + tet_result(TET_FAIL); + } + /***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + dumpbuf(); +} +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to .B XcmsConvertColors +function shall convert the color specifications in the specified array of +.I XcmsColor +structure from their current format and return Success. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; + /* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg, + XRootWindow(display_arg,XDefaultScreen(display_arg)), + (unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + + display_good = display_arg; + + screen_good = XDefaultScreen(display_good); + + depth_good = DisplayPlanes( display_good, screen_good ); + + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) + { + colormap_good = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if (writeable_colormaps) + { + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) + { + tet_infoline("TEST: XcmsConvertColors returns Success"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + int ncolors = 1 ; + Bool flags[1]; + + color_good[0].format = XcmsRGBFormat ; + color_good[0].spec.RGB.red = 0xffff ; + color_good[0].spec.RGB.green = 0xffff ; + color_good[0].spec.RGB.blue = 0xffff ; + svccmsConvertColors( + display_good, + ccc_good, + color_good, + ncolors, + XcmsRGBiFormat, + flags + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap", NULL, 0) ; + + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsCreateCCC/XcmsCreateCCC.m b/xts5/Xlib7/XcmsCreateCCC/XcmsCreateCCC.m new file mode 100644 index 00000000..bed5a8f9 --- /dev/null +++ b/xts5/Xlib7/XcmsCreateCCC/XcmsCreateCCC.m @@ -0,0 +1,327 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsCreateCCC/XcmsCreateCCC.m,v 1.1 2005-02-12 14:37:35 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsCreateCCC/XcmsCreateCCC.m +>># +>># Description: +>># Tests for XcmsCreateCCC() +>># +>># Modifications: +>># $Log: cmscrcc.m,v $ +>># Revision 1.1 2005-02-12 14:37:35 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:07 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:25 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:20 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:51 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:51 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:49:35 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsCreateCCC Xlib7 +XcmsCreateCCC() +>>EXTERN + +Bool writeable_colormaps = 1; + +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap rw_colormap ; +XcmsColor color_good ; +XcmsColor scrnColor, exactColor ; +XcmsColor color_in_out ; +XcmsColorFormat format_good ; +int screen_good ; +int depth_good ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, y_init, h_init, w_init; + +svccmsCreateCCC(display, screen, visual, client_white_point, + compression_proc, compression_client_data, + white_adjust_proc, white_adjust_client_data) +Display *display ; +int screen ; +Visual *visual ; +XcmsColor *client_white_point ; +XcmsCompressionProc compression_proc ; +XPointer compression_client_data ; +XcmsWhiteAdjustProc white_adjust_proc ; +XPointer white_adjust_client_data ; +{ + +/***** + * external defs + *****/ +extern int errcnt; +extern int errflg; +extern int chkflg; +extern int signal_status(); +extern int unexp_err(); +extern char *svc_user_arg; +extern char *strcpy(); + +/****** + * local storage + ******/ +char fmtstr[256], *call_string; +union msglst fmt_lst[1]; +int skip_pixcheck; + +int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + +XcmsCCC svc_ret_value; + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsCreateCCC("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " display, screen_number, visual);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsCreateCCC( + display, + screen, + visual, + client_white_point, + compression_proc, + compression_client_data, + white_adjust_proc, + white_adjust_client_data + ); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + if (svc_ret_value == (XcmsCCC )0) { + errflg = 1 ; + message("Invalid CCC, XcmsCreateCCC() call failed\n", NULL, 0) ; + } + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall create a color conversion context for the specified display, +screen and visual. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || + (estatus[1] == Success)) + { + tet_infoline("TEST: Testing XcmsCreateCCC for Success\n"); + + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + svccmsCreateCCC( + display_good, + screen_good, + visual_good, + (XcmsColor *)0, + (XcmsCompressionProc )0, + (XPointer )0, + (XcmsWhiteAdjustProc)0, + (XPointer )0); + + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsDefaultCCC/XcmsDefaultCCC.m b/xts5/Xlib7/XcmsDefaultCCC/XcmsDefaultCCC.m new file mode 100644 index 00000000..921f437c --- /dev/null +++ b/xts5/Xlib7/XcmsDefaultCCC/XcmsDefaultCCC.m @@ -0,0 +1,315 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsDefaultCCC/XcmsDefaultCCC.m,v 1.1 2005-02-12 14:37:35 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsDefaultCCC/XcmsDefaultCCC.m +>># +>># Description: +>># Tests for XcmsDefaultCCC() +>># +>># Modifications: +>># $Log: cmsdcc.m,v $ +>># Revision 1.1 2005-02-12 14:37:35 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:08 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:26 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:20 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:51 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:53 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:49:38 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsDefaultCCC Xlib7 +XcmsDefaultCCC() +>>EXTERN + +Bool writeable_colormaps = 1; + +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +XcmsColor color_good ; +XcmsColorFormat format_good ; +int screen_good ; +int depth_good ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, y_init, h_init, w_init; + +/***** + * svccmsDefaultCCC routine + *****/ +svccmsDefaultCCC(display, screen_number) +Display *display ; +int screen_number ; +{ +/***** + * external defs + *****/ + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + XcmsCCC svc_ret_value; + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsDefaultCCC("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " display, screen_number);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ +/****** + * If there is a pixmap_id parameter or a window_id parameter then + * set variable drawable_id equal to it. + ******/ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsDefaultCCC( + display, + screen_number + ); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + double one = 1.000000 ; + if (svc_ret_value != (XcmsCCC )0 ) { + XcmsQueryWhite(svc_ret_value, XcmsRGBiFormat, &color_good) ; + check_dou(one, color_good.spec.RGBi.red, "red" ) ; + check_dou(one, color_good.spec.RGBi.green, "green" ) ; + check_dou(one, color_good.spec.RGBi.blue, "blue" ) ; + } else { + errflg = 1 ; + message("XcmsDefaultccc() call failed\n", NULL, 0) ; + } + + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall return the default +color conversion context for the specified screen. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + + if ( writeable_colormaps ) { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsDefaultCCC for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + svccmsDefaultCCC( + display_good, + screen_good + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsDisplayOfCCC/XcmsDisplayOfCCC.m b/xts5/Xlib7/XcmsDisplayOfCCC/XcmsDisplayOfCCC.m new file mode 100644 index 00000000..29b69183 --- /dev/null +++ b/xts5/Xlib7/XcmsDisplayOfCCC/XcmsDisplayOfCCC.m @@ -0,0 +1,330 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsDisplayOfCCC/XcmsDisplayOfCCC.m,v 1.1 2005-02-12 14:37:35 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsDisplayOfCCC/XcmsDisplayOfCCC.m +>># +>># Description: +>># Tests for XcmsDisplayOfCCC() +>># +>># Modifications: +>># $Log: cmsdocc.m,v $ +>># Revision 1.1 2005-02-12 14:37:35 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:08 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:27 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:20 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:52 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:54 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:49:41 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsDisplayOfCCC Xlib7 +XcmsDisplayOfCCC() +>>EXTERN + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +XcmsColor color_good ; +XcmsColorFormat format_good ; +int screen_good ; +int depth_good ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, y_init, h_init, w_init; + +/****** + * routines + ******/ + +/***** + * svccmsDisplayOfCCC routine + *****/ +svccmsDisplayOfCCC(display, ccc) +Display *display ; +XcmsCCC ccc ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Display *svc_ret_value; + + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsDisplayOfCCC("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " ccc);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ +/****** + * If there is a pixmap_id parameter or a window_id parameter then + * set variable drawable_id equal to it. + ******/ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsDisplayOfCCC(ccc); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + int screen ; + if (svc_ret_value != (Display *)0 ) { + screen = XDefaultScreen(svc_ret_value) ; + check_dec(screen_good, screen, "screen") ; + } else { + errflg = 1 ; + message("XcmsDisplayOfCCC() call failed\n", NULL, 0) ; + } + + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall return the display associated with the specified +Color Conversion Context. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + + depth_good = DisplayPlanes( display_good, screen_good ); + + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XDefaultColormap(display_good, screen_good ); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if (writeable_colormaps) + { + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || + (estatus[1] == Success)) + { + tet_infoline("TEST: Testing XcmsDisplayOfCCC for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + svccmsDisplayOfCCC( + display_good, + ccc_good + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsFormatOfPrefix/XcmsFormatOfPrefix.m b/xts5/Xlib7/XcmsFormatOfPrefix/XcmsFormatOfPrefix.m new file mode 100644 index 00000000..8216be97 --- /dev/null +++ b/xts5/Xlib7/XcmsFormatOfPrefix/XcmsFormatOfPrefix.m @@ -0,0 +1,407 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsFormatOfPrefix/XcmsFormatOfPrefix.m,v 1.1 2005-02-12 14:37:35 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsFormatOfPrefix/XcmsFormatOfPrefix.m +>># +>># Description: +>># Tests for XcmsFormatOfPrefix() +>># +>># Modifications: +>># $Log: cmsfopr.m,v $ +>># Revision 1.1 2005-02-12 14:37:35 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:09 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:28 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:21 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:53 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:57 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:49:47 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsFormatOfPrefix Xlib7 +XcmsFormatOfPrefix() +>>EXTERN +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +XcmsColorFormat svc_format ; +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +int screen_good ; +int depth_good, i ; +XcmsColorFormat format_good[] = { XcmsCIEXYZFormat, XcmsCIExyYFormat, + XcmsCIEuvYFormat, XcmsTekHVCFormat, + XcmsCIELabFormat, XcmsCIELuvFormat, + XcmsRGBFormat, XcmsRGBiFormat, } ; + +char *prefix[] = { "CIEXYZ", "CIExyY", "CIEuvY", "TekHVC", "CIELab", "CIELuv", "RGB" , "RGBi", } ; +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, + y_init, + h_init, + w_init; + +/****** + * routines + ******/ + +/***** + * svccmsFormatOfPrefix routine + *****/ +svccmsFormatOfPrefix(display, prefix_good) +Display *display ; +char *prefix_good ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + XcmsColorFormat svc_ret_value; + + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsFormatOfPrefix("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " prefix_good);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsFormatOfPrefix( prefix_good ); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + if (svc_format != svc_ret_value) { + sprintf(ebuf, "ERROR: Expected return value of %lx, received %lx", (unsigned long)svc_format, (unsigned long)svc_ret_value); + tet_infoline(ebuf); + tet_result(TET_FAIL); + } + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + +>>ASSERTION Good A +If the implementation is X11R5 or later: +A call to xname +shall return the format ID for the specified color space prefix. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XDefaultColormap(display_good, screen_good ); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsFormatOfPrefix for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + for ( i = 0 ; i < 8 ; i++) { + svc_format = format_good[i] ; + svccmsFormatOfPrefix( + display_good, + prefix[i] + ); + } + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif +>>ASSERTION Good A +If the implementation is X11R5 or later: +If the color space is not accessible in the color management system +a call to xname shall return XcmsUndefinedFormat. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XDefaultColormap(display_good, screen_good ); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || + (estatus[1] == Success)) + { + tet_infoline("TEST: Testing XcmsFormatOfPrefix for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + svc_format = XcmsUndefinedFormat ; + svccmsFormatOfPrefix( display_good, "NoColor"); + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsFreeCCC/XcmsFreeCCC.m b/xts5/Xlib7/XcmsFreeCCC/XcmsFreeCCC.m new file mode 100644 index 00000000..67192ff2 --- /dev/null +++ b/xts5/Xlib7/XcmsFreeCCC/XcmsFreeCCC.m @@ -0,0 +1,326 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsFreeCCC/XcmsFreeCCC.m,v 1.1 2005-02-12 14:37:35 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsFreeCCC/XcmsFreeCCC.m +>># +>># Description: +>># Tests for XcmsFreeCCC() +>># +>># Modifications: +>># $Log: cmsfccc.m,v $ +>># Revision 1.1 2005-02-12 14:37:35 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:09 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:27 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:21 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:52 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:56 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:49:43 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsFreeCCC Xlib7 +XcmsFreeCCC() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +Colormap rw_colormap ; +XcmsColor color_good ; +XcmsColor color_in_out ; +XcmsColorFormat format_good ; +int screen_good ; +int depth_good ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, y_init, h_init, w_init; + +/****** + * routines + ******/ + +/***** + * svccmsFreeCCC routine + *****/ +svccmsFreeCCC(display, ccc) +Display *display ; +XcmsCCC ccc ; +{ + +/***** + * external defs + *****/ + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + XcmsCCC svc_ret_value; + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsFreeCCC("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " display, ccc);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + errflg = 0; + XSetErrorHandler(signal_status); + XcmsFreeCCC( ccc); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall free the memory used for the specified Color Conversion Context. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + colormap_good = XDefaultColormap(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsFreeCCC for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + ccc_good = XcmsCreateCCC( + display_good, + screen_good, + visual_good, + (XcmsColor *)0, + (XcmsCompressionProc )0, + (XPointer )0, + (XcmsWhiteAdjustProc)0, + (XPointer )0 + ); + + svccmsFreeCCC( + display_good, + ccc_good + ) ; + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsLookupColor/XcmsLookupColor.m b/xts5/Xlib7/XcmsLookupColor/XcmsLookupColor.m new file mode 100644 index 00000000..16dc6468 --- /dev/null +++ b/xts5/Xlib7/XcmsLookupColor/XcmsLookupColor.m @@ -0,0 +1,393 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsLookupColor/XcmsLookupColor.m,v 1.1 2005-02-12 14:37:35 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsLookupColor/XcmsLookupColor.m +>># +>># Description: +>># Tests for XcmsLookupColor() +>># +>># Modifications: +>># $Log: cmslkcl.m,v $ +>># Revision 1.1 2005-02-12 14:37:35 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:10 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:28 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:22 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:53 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:49:59 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:49:49 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsLookupColor Xlib7 +XcmsLookupColor() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +Colormap rw_colormap ; +XcmsColor color_good ; +XcmsColor color_array[2] ; +XcmsColor write_many_color[2] ; +XcmsColor query_many_color[2] ; +XcmsColor scrnColor, exactColor ; +XcmsColor color_in_out ; +XcmsColorFormat format_good ; +double minv, maxv, deltav ; +double hue, chroma ; +int screen_good ; +int depth_good ; +unsigned long plane_mask[2] ; +unsigned long pixels_return[2] ; +unsigned int npixels ; +unsigned int nplanes = 2; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, + y_init, + h_init, + w_init; + +/****** + * routines + ******/ + +/***** + * svccmsLookupColor routine + *****/ +svccmsLookupColor(display, colormap, color_return, exact, + scrn, result_format) +Display *display ; +Colormap colormap ; +char *color_return ; +XcmsColor exact ; +XcmsColor scrn ; +XcmsColorFormat result_format ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsLookupColor("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " display, colormap, color, exact, screen, result);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsLookupColor( + display, + colormap, + color_return, + &exact, + &scrn, + result_format + ); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + double closer_to_one = 0.900000 ; + check_dec(XcmsSuccess, svc_ret_value, "return value") ; + if ( scrn.spec.RGBi.red < closer_to_one ) { + errflg = 1 ; + message("Expected screen red color closer to 1.00\n", NULL, 0 +) ; + } + if ( exact.spec.RGBi.red <= closer_to_one ) { + errflg = 1 ; + message("Expected exact red color closer to 1.00\n", NULL, 0) + ; + } + + if ( scrn.spec.RGBi.green < closer_to_one ) { + errflg = 1 ; + message("Expected screen green color closer to 1.00\n", NULL, 0 +) ; + } + if ( exact.spec.RGBi.green <= closer_to_one ) { + errflg = 1 ; + message("Expected exact green color closer to 1.00\n", NULL, 0) + ; + } + + if ( scrn.spec.RGBi.blue < closer_to_one ) { + errflg = 1 ; + message("Expected screen blue color closer to 1.00\n", NULL, 0 +) ; + } + if ( exact.spec.RGBi.blue <= closer_to_one ) { + errflg = 1 ; + message("Expected exact blue color closer to 1.00\n", NULL, 0) + ; + } + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall return the exact color values and the closest values +provide by the screen with respect to the visual type of the specified +colormap with a status of XcmsSuccess. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; + +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + + depth_good = DisplayPlanes( display_good, screen_good ); + + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XDefaultColormap(display_good, screen_good ); + rw_colormap = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if (writeable_colormaps) + { + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || + (estatus[1] == Success)) + { + tet_infoline("TEST: Testing XcmsLookupColor for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + svccmsLookupColor( + display_good, + colormap_good, + "RGBi:1.0/1.0/1.0", + exactColor, + scrnColor, + XcmsRGBiFormat + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsPrefixOfFormat/XcmsPrefixOfFormat.m b/xts5/Xlib7/XcmsPrefixOfFormat/XcmsPrefixOfFormat.m new file mode 100644 index 00000000..5401344a --- /dev/null +++ b/xts5/Xlib7/XcmsPrefixOfFormat/XcmsPrefixOfFormat.m @@ -0,0 +1,332 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsPrefixOfFormat/XcmsPrefixOfFormat.m,v 1.1 2005-02-12 14:37:36 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsPrefixOfFormat/XcmsPrefixOfFormat.m +>># +>># Description: +>># Tests for XcmsPrefixOfFormat() +>># +>># Modifications: +>># $Log: cmspoft.m,v $ +>># Revision 1.1 2005-02-12 14:37:36 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:11 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:29 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:23 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:54 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:50:02 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:49:55 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsPrefixOfFormat Xlib7 +XcmsPrefixOfFormat() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +char *svc_prefix ; +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +int screen_good ; +int depth_good , i; +XcmsColorFormat format_good[] = { XcmsCIEXYZFormat, XcmsCIExyYFormat, + XcmsCIEuvYFormat, XcmsTekHVCFormat, + XcmsCIELabFormat, XcmsCIELuvFormat, + XcmsRGBFormat, XcmsRGBiFormat, } ; + +char *prefix[] = { "ciexyz", "ciexyy", "cieuvy", "tekhvc", "cielab", "cieluv", "rgb" , "rgbi", } ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, + y_init, + h_init, + w_init; + +/****** + * routines + ******/ + +/***** + * svccmsPrefixOfFormat routine + *****/ +svccmsPrefixOfFormat(display, format) +Display *display ; +XcmsColorFormat format ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + char *svc_ret_value; + + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsPrefixOfFormat("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " format);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsPrefixOfFormat(format); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + check_str(svc_prefix, svc_ret_value, "prefix") ; + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall return the string prefix associated with the color +specification encoding specified by +.A format. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + + depth_good = DisplayPlanes( display_good, screen_good ); + + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XDefaultColormap(display_good, screen_good ); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if ( writeable_colormaps ) + { + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || + (estatus[1] == Success)) + { + tet_infoline("TEST: Testing XcmsPrefixOfFormat for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + for ( i = 0 ; i < 8 ; i++) { + svc_prefix = (char *)prefix[i] ; + svccmsPrefixOfFormat( + display_good, + format_good[i] + ); + } + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsQueryBlack/XcmsQueryBlack.m b/xts5/Xlib7/XcmsQueryBlack/XcmsQueryBlack.m new file mode 100644 index 00000000..5462f0de --- /dev/null +++ b/xts5/Xlib7/XcmsQueryBlack/XcmsQueryBlack.m @@ -0,0 +1,398 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsQueryBlack/XcmsQueryBlack.m,v 1.1 2005-02-12 14:37:36 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsQueryBlack/XcmsQueryBlack.m +>># +>># Description: +>># Tests for XcmsQueryBlack() +>># +>># Modifications: +>># $Log: cmsqbk.m,v $ +>># Revision 1.1 2005-02-12 14:37:36 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:11 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:30 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:23 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:54 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:50:04 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:49:58 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsQueryBlack Xlib7 +XcmsQueryBlack() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +XcmsColor color_good ; +XcmsColorFormat format_good ; +XcmsColorFormat format_all[] = { XcmsCIEXYZFormat, XcmsCIExyYFormat, + XcmsCIELabFormat, XcmsCIELuvFormat, + XcmsRGBFormat, XcmsRGBiFormat, } ; +int screen_good ; +int depth_good, i ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, + y_init, + h_init, + w_init; + +/****** + * routines + ******/ + +/***** + * svccmsQueryBlack routine + *****/ +svccmsQueryBlack(display, ccc, format, color) +Display *display ; +XcmsCCC ccc ; +XcmsColorFormat format ; +XcmsColor color ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsQueryBlack("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " ccc, format, colormap);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + { + char *fmt_string; + union msglst f_lst[1]; + + f_lst[0].typ_uns = format ; + fmt_string = "\n format= %u\n" ; + message(fmt_string, f_lst, 1); + + } +/****** + * If there is a pixmap_id parameter or a window_id parameter then + * set variable drawable_id equal to it. + ******/ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsQueryBlack(ccc, format, &color); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + double zero = 0.000000 ; + check_dec(XcmsSuccess, svc_ret_value, "return value" ) ; + if ( (svc_ret_value = XcmsSuccess ) && + (format == XcmsCIEXYZFormat) ) { + check_dou(zero, color.spec.CIEXYZ.X, "X" ) ; + check_dou(zero, color.spec.CIEXYZ.Y, "Y" ) ; + check_dou(zero, color.spec.CIEXYZ.Z, "Z" ) ; + } + if ( (svc_ret_value = XcmsSuccess ) && + (format == XcmsCIEuvYFormat) ) { + check_dou(zero, color.spec.CIEuvY.u_prime, "u_prime" ) ; + check_dou(zero, color.spec.CIEuvY.v_prime, "v_prime" ) ; + check_dou(zero, color.spec.CIEuvY.Y, "Y" ) ; + } + if ( (svc_ret_value = XcmsSuccess ) && + (format == XcmsCIExyYFormat) ) { + check_dou(zero, color.spec.CIExyY.x, "x" ) ; + check_dou(zero, color.spec.CIExyY.y, "y" ) ; + check_dou(zero, color.spec.CIExyY.Y, "Y" ) ; + } + if ( (svc_ret_value = XcmsSuccess ) && + (format == XcmsCIELabFormat) ) { + check_dou(zero, color.spec.CIELab.L_star, "L_star" ) ; + check_dou(zero, color.spec.CIELab.a_star, "a_star" ) ; + check_dou(zero, color.spec.CIELab.b_star, "b_star" ) ; + } + if ( (svc_ret_value = XcmsSuccess ) && + (format == XcmsCIELuvFormat) ) { + check_dou(zero, color.spec.CIELuv.L_star, "L_star" ) ; + check_dou(zero, color.spec.CIELuv.u_star, "u_star" ) ; + check_dou(zero, color.spec.CIELuv.v_star, "v_star" ) ; + } + if ( (svc_ret_value = XcmsSuccess ) && + (format == XcmsTekHVCFormat) ) { + check_dou(zero, color.spec.TekHVC.H, "H" ) ; + check_dou(zero, color.spec.TekHVC.V, "V" ) ; + check_dou(zero, color.spec.TekHVC.C, "C" ) ; + } + if ( (svc_ret_value = XcmsSuccess ) && + (format == XcmsRGBFormat) ) { + check_dec(0, color.spec.RGB.red, "red" ) ; + check_dec(0, color.spec.RGB.green, "green" ) ; + check_dec(0, color.spec.RGB.blue, "blue" ) ; + } + if ( (svc_ret_value = XcmsSuccess ) && + (format == XcmsRGBiFormat) ) { + check_dou(zero, color.spec.RGBi.red, "red" ) ; + check_dou(zero, color.spec.RGBi.green, "green" ) ; + check_dou(zero, color.spec.RGBi.blue, "blue" ) ; + } + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall return device-independent color specification in the +specified target format for zero intensity of red, green and blue. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + + depth_good = DisplayPlanes( display_good, screen_good ); + + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XDefaultColormap(display_good, screen_good ); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || + (estatus[1] == Success)) + { + tet_infoline("TEST: Testing XcmsQueryBlack for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + for ( i = 0 ; i < 6 ; i++ ) { + format_good = format_all[i] ; + svccmsQueryBlack( + display_good, + ccc_good, + format_good, + color_good + ); + } + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsQueryBlue/XcmsQueryBlue.m b/xts5/Xlib7/XcmsQueryBlue/XcmsQueryBlue.m new file mode 100644 index 00000000..e55ba1bf --- /dev/null +++ b/xts5/Xlib7/XcmsQueryBlue/XcmsQueryBlue.m @@ -0,0 +1,349 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsQueryBlue/XcmsQueryBlue.m,v 1.1 2005-02-12 14:37:36 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsQueryBlue/XcmsQueryBlue.m +>># +>># Description: +>># Tests for XcmsQueryBlue() +>># +>># Modifications: +>># $Log: cmsqbl.m,v $ +>># Revision 1.1 2005-02-12 14:37:36 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:12 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:30 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:24 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:55 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:50:05 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:50:01 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsQueryBlue Xlib7 +XcmsQueryBlue() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +XcmsColor color_good ; +XcmsColorFormat format_good ; +XcmsColorFormat format_all[] = { XcmsRGBiFormat, } ; +int screen_good ; +int depth_good, i ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, + y_init, + h_init, + w_init; + +/****** + * routines + ******/ + +/***** + * svccmsQueryBlue routine + *****/ +svccmsQueryBlue(display, ccc, format, color) +Display *display ; +XcmsCCC ccc ; +XcmsColorFormat format ; +XcmsColor color ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsQueryBlue("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " ccc, format, colormap);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + { + char *fmt_string; + union msglst f_lst[1]; + + f_lst[0].typ_uns = format ; + fmt_string = "\n format= %u\n" ; + message(fmt_string, f_lst, 1); + + } +/****** + * If there is a pixmap_id parameter or a window_id parameter then + * set variable drawable_id equal to it. + ******/ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsQueryBlue(ccc, format, &color); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + double one = 1.000000 ; + double zero = 0.000000 ; + check_dec(XcmsSuccess, svc_ret_value, "return value" ) ; + if ( (svc_ret_value = XcmsSuccess ) && + (format == XcmsRGBiFormat) ) { + check_dou(zero, color.spec.RGBi.red, "red" ) ; + check_dou(zero, color.spec.RGBi.green, "green" ) ; + check_dou(one, color.spec.RGBi.blue, "blue" ) ; + } + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall return the device-independent color specification for the specified +target format for full intensity blue and zero intensity red and green. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + + depth_good = DisplayPlanes( display_good, screen_good ); + + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XDefaultColormap(display_good, screen_good ); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if ( writeable_colormaps ) { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || + (estatus[1] == Success)) + { + tet_infoline("TEST: Testing XcmsQueryBlue for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + format_good = XcmsRGBiFormat ; + svccmsQueryBlue( + display_good, + ccc_good, + format_good, + color_good + ); + + } + } /* end if */ + } else + message("Warning: not a writeable colormap\n", NULL, 0) ; + + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsQueryColor/XcmsQueryColor.m b/xts5/Xlib7/XcmsQueryColor/XcmsQueryColor.m new file mode 100644 index 00000000..3c5e112a --- /dev/null +++ b/xts5/Xlib7/XcmsQueryColor/XcmsQueryColor.m @@ -0,0 +1,378 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsQueryColor/XcmsQueryColor.m,v 1.1 2005-02-12 14:37:36 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsQueryColor/XcmsQueryColor.m +>># +>># Description: +>># Tests for XcmsQueryColor() +>># +>># Modifications: +>># $Log: cmsqc.m,v $ +>># Revision 1.1 2005-02-12 14:37:36 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:12 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:31 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.1 1998/10/27 01:33:39 mar +>># req.4.W.00119, vswsr176, vswsr187: tp1 - Use XcmsLookupColor() to find the +>># correct screen color, and then XcmsStoreColor() the pixel with selected +>># screen color. +>># +>># Revision 6.0 1998/03/02 05:19:24 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:55 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.2 1998/01/23 04:41:04 tbr +>># Changed test to use same colormap throughout. +>># +>># Revision 4.1 1998/01/23 04:15:38 tbr +>># Modified the test to get the pixel associated with the XT_GOOD_COLORNAME +>># and compare the results to the values for that pixel. +>># +>># Revision 4.0 1995/12/15 08:50:07 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:50:04 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsQueryColor Xlib7 +XcmsQueryColor() +>>EXTERN + +#include "xtest.h" +/****** + * User defined globals for test + ******/ +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +Colormap rw_colormap ; +XcmsColor color_in_out ; +XcmsColor goodExactColorSpec ; +XcmsColor goodScreenColorSpec ; +XcmsColorFormat format_good ; +int screen_good ; +int depth_good ; +char tmpbuf[255]; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, + y_init, + h_init, + w_init; + +/****** + * routines + ******/ + +/***** + * svccmsQueryColor routine + *****/ +svccmsQueryColor(display, colormap, color, format) +Display *display ; +Colormap colormap ; +XcmsColor color ; +XcmsColorFormat format ; +{ +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsQueryColor("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " display, colormap, color, format);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + { + char *fmt_string; + union msglst f_lst[1]; + + f_lst[0].typ_dec = colormap ; + fmt_string = "\n colormap= %d\n" ; + message(fmt_string, f_lst, 1); + + } +/****** + * If there is a pixmap_id parameter or a window_id parameter then + * set variable drawable_id equal to it. + ******/ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + tet_infoline("TEST: Calling XcmsQueryColor"); + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + + svc_ret_value = XcmsQueryColor( display, colormap, &color, format); + + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + check_dec(XcmsSuccess, svc_ret_value, "return value" ) ; + check_dec(goodScreenColorSpec.pixel, color.pixel, "pixel") ; + check_dec(goodScreenColorSpec.spec.RGB.red, color.spec.RGB.red, "red") ; + check_dec(goodScreenColorSpec.spec.RGB.green, color.spec.RGB.green, "green") ; + check_dec(goodScreenColorSpec.spec.RGB.blue, color.spec.RGB.blue, "blue") ; + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall return the RGB value for the colormap cell specified by the +.A pixel +field of the specified +.A XcmsColor +structure, and then convert the value to the target format specified by the +.A result_format +argument. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + rw_colormap = XCreateColormap( display_good, + XRootWindow(display_good, screen_good), visual_good, AllocAll); + + sprintf(tmpbuf, "PREP: determining the color spec for %s", + config.good_colorname); + tet_infoline(tmpbuf); + colormap_good = XDefaultColormap(display_good, screen_good ); + if (!XcmsLookupColor(display_good, rw_colormap, config.good_colorname, + &goodExactColorSpec, &goodScreenColorSpec, XcmsRGBFormat)) + { tet_infoline("ERROR: XcmsLookupColor failed"); tet_result(TET_UNRESOLVED); return; } + goodScreenColorSpec.pixel = 2; + if (!XcmsStoreColor(display_good, rw_colormap, &goodScreenColorSpec)) + { tet_infoline("ERROR: XcmsStoreColor failed"); tet_result(TET_UNRESOLVED); return; } + if ((regr_args.l_flags.good == 0) || + (estatus[1] == Success)) + { + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + color_in_out.format = XcmsRGBFormat ; + color_in_out.pixel = goodScreenColorSpec.pixel; + + svccmsQueryColor( display_good, rw_colormap, + color_in_out, XcmsRGBFormat); + + } + } /* end if */ + tet_result(TET_PASS); + } + else + { + tet_infoline("colormap is not writeable"); + tet_result(TET_UNSUPPORTED); + } +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsQueryColors/XcmsQueryColors.m b/xts5/Xlib7/XcmsQueryColors/XcmsQueryColors.m new file mode 100644 index 00000000..f48ab6a8 --- /dev/null +++ b/xts5/Xlib7/XcmsQueryColors/XcmsQueryColors.m @@ -0,0 +1,607 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsQueryColors/XcmsQueryColors.m,v 1.1 2005-02-12 14:37:36 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsQueryColors/XcmsQueryColors.m +>># +>># Description: +>># Tests for XcmsQueryColors() +>># +>># Modifications: +>># $Log: cmsqcl.m,v $ +>># Revision 1.1 2005-02-12 14:37:36 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:13 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:31 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.1 1998/10/27 02:00:24 mar +>># req.4.W.00119, vswsr176, vswsr187: tp1 - Use XcmsLookupColor() to find the +>># correct screen color, and then XcmsStoreColor() the pixel with selected +>># screen color. +>># +>># Revision 6.0 1998/03/02 05:19:25 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:56 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1998/01/23 05:56:15 tbr +>># vswsr119 vswsr118 +>># Modified test #1 to get the pixel associated with the XT_GOOD_COLORNAME +>># and compare the results to the values for that pixel. +>># +>># Modified test #2 to properly checl for BadValue which is what +>># was originally intended since #3 checks for BadColor. Removed +>># returned colors check from test. +>># +>># Recoded #3 somewhat. +>># +>># Revision 4.0 1995/12/15 08:50:09 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:50:07 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsQueryColors Xlib7 +XcmsQueryColors() +>>EXTERN +#include "xtest.h" +#include "limits.h" + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +Colormap rw_colormap ; +XcmsColor color_good ; +XcmsColor color_array[2] ; +XcmsColor write_many_color[2] ; +XcmsColor query_many_color[2] ; +XcmsColor scrnColor, exactColor ; +XcmsColor color_in_out ; +XcmsColor goodExactColorSpec; +XcmsColor goodScreenColorSpec; +XcmsColorFormat format_good ; +int screen_good ; +int depth_good ; +char tmpbuf[255]; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, y_init, h_init, w_init; + +/****** + * routines + ******/ + +/***** + * svccmsQueryColors routine + *****/ +svccmsQueryColors(display, colormap, colors, ncolors, format) +Display *display ; +Colormap colormap ; +XcmsColor colors[2] ; +unsigned int ncolors ; +XcmsColorFormat format ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsQueryColors("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " display, colormap, colors, ncolors, format);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + { + char *fmt_string; + union msglst f_lst[1]; + + f_lst[0].typ_dec = colormap ; + fmt_string = "\n colormap= %d\n" ; + message(fmt_string, f_lst, 1); + + } +/****** + * If there is a pixmap_id parameter or a window_id parameter then + * set variable drawable_id equal to it. + ******/ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + tet_infoline("TEST: Calling XcmsQueryColors"); + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + + svc_ret_value = XcmsQueryColors( display, colormap, &colors[0], + ncolors, format); + + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + check_dec(XcmsSuccess, svc_ret_value, "return value" ) ; + check_dec(goodScreenColorSpec.pixel, colors[0].pixel, "pixel0") ; + check_dec(goodScreenColorSpec.spec.RGB.red, colors[0].spec.RGB.red, "red0") ; + check_dec(goodScreenColorSpec.spec.RGB.green, colors[0].spec.RGB.green, "green0") ; + check_dec(goodScreenColorSpec.spec.RGB.blue, colors[0].spec.RGB.blue, "blue0") ; + + check_dec(goodScreenColorSpec.pixel, colors[1].pixel, "pixel1") ; + check_dec(goodScreenColorSpec.spec.RGB.red, colors[1].spec.RGB.red, "red1") ; + check_dec(goodScreenColorSpec.spec.RGB.green, colors[1].spec.RGB.green, "green1") ; + check_dec(goodScreenColorSpec.spec.RGB.blue, colors[1].spec.RGB.blue, "blue1") ; + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall return the RGB values for the colormap cells specified by the +.A pixel +fields of the specified +.A XcmsColor +structures, and then convert the value to the target format specified by the +.A result_format +argument. +>>CODE +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + colormap_good = XDefaultColormap(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + rw_colormap = XCreateColormap( display_good, + XRootWindow(display_good, screen_good), visual_good, AllocAll); + + sprintf(tmpbuf, "PREP: determining the color spec for %s", + config.good_colorname); + tet_infoline(tmpbuf); + colormap_good = XDefaultColormap(display_good, screen_good ); + if (!XcmsLookupColor(display_good, rw_colormap, config.good_colorname, + &goodExactColorSpec, &goodScreenColorSpec, XcmsRGBFormat)) + { tet_infoline("ERROR: XcmsLookupColor failed"); tet_result(TET_UNRESOLVED); return; } + goodScreenColorSpec.pixel = 2; + if (!XcmsStoreColor(display_good, rw_colormap, &goodScreenColorSpec)) + { tet_infoline("ERROR: XcmsStoreColor failed"); tet_result(TET_UNRESOLVED); return; } + + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + + if ((regr_args.l_flags.good == 0) || + (estatus[1] == Success)) + { + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + format_good = XcmsRGBFormat ; + + query_many_color[0].format = XcmsRGBFormat ; + query_many_color[0].pixel = goodScreenColorSpec.pixel; + query_many_color[1].format = XcmsRGBFormat ; + query_many_color[1].pixel = goodScreenColorSpec.pixel; + + svccmsQueryColors( + display_good, + rw_colormap, + &query_many_color[0], + (unsigned int)2, + format_good + ); + + } + } /* end if */ + tet_result(TET_PASS); + } + else + { + tet_infoline("colormap is not writeable"); + tet_result(TET_UNSUPPORTED); + } +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif +>>ASSERTION Good C +When the value for a XcmsColor pixel argument argument does not name a +valid pixel, a call to +.B XcmsQueryColors +shall return a BadValue error code. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + colormap_good = XDefaultColormap(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if (writeable_colormaps) + { + chkflg = 1 ; + estatus[0] = 1; + estatus[1] = BadValue ; + + rw_colormap = XCreateColormap( display_good, + XRootWindow(display_good, screen_good), visual_good, AllocAll); + + sprintf(tmpbuf, "PREP: determining the color spec for %s", + config.good_colorname); + tet_infoline(tmpbuf); + colormap_good = XDefaultColormap(display_good, screen_good ); + if (!XcmsLookupColor(display_good, rw_colormap, config.good_colorname, + &goodExactColorSpec, &goodScreenColorSpec, XcmsRGBFormat)) + { tet_infoline("ERROR: XcmsLookupColor failed"); tet_result(TET_UNRESOLVED); return; } + goodScreenColorSpec.pixel = 2; + if (!XcmsStoreColor(display_good, rw_colormap, &goodScreenColorSpec)) + { tet_infoline("ERROR: XcmsStoreColor failed"); tet_result(TET_UNRESOLVED); return; } + + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + + if ((regr_args.l_flags.good == 0) || + (estatus[1] == Success)) + { + regr_args.l_flags.check = 0; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + format_good = XcmsRGBFormat ; + + query_many_color[0].format = XcmsRGBFormat ; + query_many_color[0].pixel = goodScreenColorSpec.pixel; + query_many_color[1].format = XcmsRGBFormat ; + query_many_color[1].pixel = ULONG_MAX; + + svccmsQueryColors( display_good, rw_colormap, + &query_many_color[0], (unsigned int)2, + format_good); + + } + } /* end if */ + tet_result(TET_PASS); + } + else + { + tet_infoline("colormap is not writeable"); + tet_result(TET_UNSUPPORTED); + } +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif + +>>ASSERTION Good C +If the implementation is X11R5 or later: +If the value for the colormap argument does not name a defined colormap a +call to xname shall return the BadColor error code. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + colormap_good = XDefaultColormap(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if (writeable_colormaps) + { + chkflg = 1 ; + estatus[0] = 1 ; + estatus[1] = BadColor ; + + rw_colormap = XCreateColormap( display_good, + XRootWindow(display_good, screen_good), visual_good, AllocAll); + + sprintf(tmpbuf, "PREP: determining the color spec for %s", + config.good_colorname); + tet_infoline(tmpbuf); + colormap_good = XDefaultColormap(display_good, screen_good ); + if (!XcmsLookupColor(display_good, rw_colormap, config.good_colorname, + &goodExactColorSpec, &goodScreenColorSpec, XcmsRGBFormat)) + { tet_infoline("ERROR: XcmsLookupColor failed"); tet_result(TET_UNRESOLVED); return; } + goodScreenColorSpec.pixel = 2; + if (!XcmsStoreColor(display_good, rw_colormap, &goodScreenColorSpec)) + { tet_infoline("ERROR: XcmsStoreColor failed"); tet_result(TET_UNRESOLVED); return; } + + + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + + if ((regr_args.l_flags.good == 0) || + (estatus[1] == Success)) + { + regr_args.l_flags.check = 0; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + format_good = XcmsRGBFormat ; + + query_many_color[0].format = XcmsRGBFormat ; + query_many_color[0].pixel = goodScreenColorSpec.pixel; + query_many_color[1].format = XcmsRGBFormat ; + query_many_color[1].pixel = goodScreenColorSpec.pixel; + + svccmsQueryColors( display_good, -999, + &query_many_color[0], (unsigned int)2, + format_good); + + } + } /* end if */ + tet_result(TET_PASS); + } + else + { + tet_infoline("colormap is not writeable"); + tet_result(TET_UNSUPPORTED); + } +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsQueryGreen/XcmsQueryGreen.m b/xts5/Xlib7/XcmsQueryGreen/XcmsQueryGreen.m new file mode 100644 index 00000000..882c95ae --- /dev/null +++ b/xts5/Xlib7/XcmsQueryGreen/XcmsQueryGreen.m @@ -0,0 +1,347 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsQueryGreen/XcmsQueryGreen.m,v 1.1 2005-02-12 14:37:36 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsQueryGreen/XcmsQueryGreen.m +>># +>># Description: +>># Tests for XcmsQueryGreen() +>># +>># Modifications: +>># $Log: cmsqgr.m,v $ +>># Revision 1.1 2005-02-12 14:37:36 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:13 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:32 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:25 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:56 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:50:11 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:50:11 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsQueryGreen Xlib7 +XcmsQueryGreen() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +XcmsColor color_good ; +XcmsColorFormat format_good ; +XcmsColorFormat format_all[] = { XcmsRGBiFormat, } ; +int screen_good ; +int depth_good, i ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, + y_init, + h_init, + w_init; + +/****** + * routines + ******/ + +/***** + * svccmsQueryGreen routine + *****/ +svccmsQueryGreen(display, ccc, format, color) +Display *display ; +XcmsCCC ccc ; +XcmsColorFormat format ; +XcmsColor color ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsQueryGreen("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " ccc, format, colormap);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + { + char *fmt_string; + union msglst f_lst[1]; + + f_lst[0].typ_uns = format ; + fmt_string = "\n format= %u\n" ; + message(fmt_string, f_lst, 1); + + } +/****** + * If there is a pixmap_id parameter or a window_id parameter then + * set variable drawable_id equal to it. + ******/ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsQueryGreen(ccc, format, &color); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + double one = 1.000000 ; + double zero = 0.000000 ; + check_dec(XcmsSuccess, svc_ret_value, "return value" ) ; + if ( (svc_ret_value = XcmsSuccess ) && + (format == XcmsRGBiFormat) ) { + check_dou(zero, color.spec.RGBi.red, "red" ) ; + check_dou(one, color.spec.RGBi.green, "green" ) ; + check_dou(zero, color.spec.RGBi.blue, "blue" ) ; + } + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall return the device independent color specification for the specified +target format for full intensity green and zero intensity red and blue. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XDefaultColormap(display_good, screen_good ); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if ( writeable_colormaps ) + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsQueryGreen for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + format_good = XcmsRGBiFormat ; + svccmsQueryGreen( + display_good, + ccc_good, + format_good, + color_good + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsQueryRed/XcmsQueryRed.m b/xts5/Xlib7/XcmsQueryRed/XcmsQueryRed.m new file mode 100644 index 00000000..e01d6c99 --- /dev/null +++ b/xts5/Xlib7/XcmsQueryRed/XcmsQueryRed.m @@ -0,0 +1,284 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsQueryRed/XcmsQueryRed.m,v 1.1 2005-02-12 14:37:36 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsQueryRed/XcmsQueryRed.m +>># +>># Description: +>># Tests for XcmsQueryRed() +>># +>># Modifications: +>># $Log: cmsqred.m,v $ +>># Revision 1.1 2005-02-12 14:37:36 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:16 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:34 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:28 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:59 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:50:19 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:50:25 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsQueryRed Xlib7 +XcmsQueryRed() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +XcmsColor color_good ; +XcmsColorFormat format_good ; +XcmsColorFormat format_all[] = { XcmsRGBiFormat, } ; +int screen_good ; +int depth_good, i ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, + y_init, + h_init, + w_init; + +/****** + * routines + ******/ + +/***** + * svccmsQueryRed routine + *****/ +svccmsQueryRed(display, ccc, format, color) +Display *display ; +XcmsCCC ccc ; +XcmsColorFormat format ; +XcmsColor color ; +{ + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsQueryRed("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " ccc, format, colormap);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + { + char *fmt_string; + union msglst f_lst[1]; + + f_lst[0].typ_uns = format ; + fmt_string = "\n format= %u\n" ; + message(fmt_string, f_lst, 1); + + } + + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk, gc_id, + display_arg, drawable_id); + + first_error = 0; /* no errors encountered yet */ + + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsQueryRed(ccc, format, &color); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , gc_id, + display_arg, drawable_id, ss_status); + else + stat_status = REGR_NORMAL; + + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + double one = 1.000000 ; + double zero = 0.000000 ; + + check_dec(XcmsSuccess, svc_ret_value, "return value" ) ; + if ((svc_ret_value = XcmsSuccess ) && + (format == XcmsRGBiFormat)) + { + check_dou(one, color.spec.RGBi.red, "red" ) ; + check_dou(zero, color.spec.RGBi.green, "green" ) ; + check_dou(zero, color.spec.RGBi.blue, "blue" ) ; + } + } + XSync(display_arg, 0); + + if (regr_args.l_flags.cleanup) + cleanup_status = REGR_NORMAL; + XSync(display_arg, 0); + + /* if there was an error ... */ + if (errflg) + { + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname shall return the device-independent color specification +for the specified target format for full intensity red and zero intensity +green and blue. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + + display_good = display_arg; + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if (writeable_colormaps) + { + colormap_good = XDefaultColormap(display_good, screen_good ); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if (writeable_colormaps) + { + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsQueryRed for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + format_good = XcmsRGBiFormat ; + svccmsQueryRed(display_good, ccc_good, + format_good, color_good); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsQueryWhite/XcmsQueryWhite.m b/xts5/Xlib7/XcmsQueryWhite/XcmsQueryWhite.m new file mode 100644 index 00000000..87363f64 --- /dev/null +++ b/xts5/Xlib7/XcmsQueryWhite/XcmsQueryWhite.m @@ -0,0 +1,336 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsQueryWhite/XcmsQueryWhite.m,v 1.1 2005-02-12 14:37:36 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsQueryWhite/XcmsQueryWhite.m +>># +>># Description: +>># Tests for XcmsQueryWhite() +>># +>># Modifications: +>># $Log: cmsqwt.m,v $ +>># Revision 1.1 2005-02-12 14:37:36 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:16 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:35 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:28 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:59 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:50:20 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:50:28 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsQueryWhite Xlib7 +XcmsQueryWhite() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +XcmsColor color_good ; +XcmsColorFormat format_good ; +XcmsColorFormat format_all[] = { XcmsRGBiFormat, } ; +int screen_good ; +int depth_good, i ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, + y_init, + h_init, + w_init; + +/****** + * routines + ******/ + +/***** + * svccmsQueryWhite routine + *****/ +svccmsQueryWhite(display, ccc, format, color) +Display *display ; +XcmsCCC ccc ; +XcmsColorFormat format ; +XcmsColor color ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsQueryWhite("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " ccc, format, colormap);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsQueryWhite(ccc, format, &color); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + double one = 1.000000 ; + check_dec(XcmsSuccess, svc_ret_value, "return value" ) ; + if ( (svc_ret_value = XcmsSuccess ) && + (format == XcmsRGBiFormat) ) { + check_dou(one, color.spec.RGBi.red, "red" ) ; + check_dou(one, color.spec.RGBi.green, "green" ) ; + check_dou(one, color.spec.RGBi.blue, "blue" ) ; + } + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + + + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall return device-independent color specification for the specified +target format in full intensity red, green and blue. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + + depth_good = DisplayPlanes( display_good, screen_good ); + + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XDefaultColormap(display_good, screen_good ); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsQueryWhite for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + format_good = XcmsRGBiFormat ; + svccmsQueryWhite( + display_good, + ccc_good, + format_good, + color_good + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsScreenNumberOfCCC/XcmsScreenNumberOfCCC.m b/xts5/Xlib7/XcmsScreenNumberOfCCC/XcmsScreenNumberOfCCC.m new file mode 100644 index 00000000..19c30d76 --- /dev/null +++ b/xts5/Xlib7/XcmsScreenNumberOfCCC/XcmsScreenNumberOfCCC.m @@ -0,0 +1,323 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsScreenNumberOfCCC/XcmsScreenNumberOfCCC.m,v 1.1 2005-02-12 14:37:36 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsScreenNumberOfCCC/XcmsScreenNumberOfCCC.m +>># +>># Description: +>># Tests for XcmsScreenNumberOfCCC() +>># +>># Modifications: +>># $Log: cmssnoc.m,v $ +>># Revision 1.1 2005-02-12 14:37:36 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:17 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:35 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:29 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:15:59 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:50:22 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:50:31 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsScreenNumberOfCCC Xlib7 +XcmsScreenNumberOfCCC() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +int screen_good ; +int depth_good ; +unsigned long plane_mask[2] ; +unsigned long pixels_return[2] ; +unsigned int npixels ; +unsigned int nplanes = 2; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, + y_init, + h_init, + w_init; + +/****** + * routines + ******/ + +/***** + * svccmsScreenNumberOfCCC routine + *****/ +svccmsScreenNumberOfCCC(display, ccc) +Display *display ; +XcmsCCC ccc ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + int svc_ret_value; + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsScreenNumberOfCCC("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " ccc);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsScreenNumberOfCCC(ccc); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + check_dec(screen_good, svc_ret_value, "screen number") ; + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall return the number of screen associated with the specified +.A CCC. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XDefaultColormap(display_good, screen_good ); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsScreenNumberOfCCC for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + svccmsScreenNumberOfCCC( + display_good, + ccc_good + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsScreenWhitePointOfCCC/XcmsScreenWhitePointOfCCC.m b/xts5/Xlib7/XcmsScreenWhitePointOfCCC/XcmsScreenWhitePointOfCCC.m new file mode 100644 index 00000000..0729f519 --- /dev/null +++ b/xts5/Xlib7/XcmsScreenWhitePointOfCCC/XcmsScreenWhitePointOfCCC.m @@ -0,0 +1,331 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsScreenWhitePointOfCCC/XcmsScreenWhitePointOfCCC.m,v 1.1 2005-02-12 14:37:36 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsScreenWhitePointOfCCC/XcmsScreenWhitePointOfCCC.m +>># +>># Description: +>># Tests for XcmsScreenWhitePointOfCCC() +>># +>># Modifications: +>># $Log: cmswpcc.m,v $ +>># Revision 1.1 2005-02-12 14:37:36 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:22 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:40 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:34 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:16:04 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:50:39 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:51:02 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsScreenWhitePointOfCCC Xlib7 +XcmsScreenWhitePointOfCCC() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +Colormap rw_colormap ; +XcmsColor color_good ; +XcmsColorFormat format_good ; +int screen_good ; +int depth_good ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, y_init, h_init, w_init; + +/****** + * routines + ******/ + +/***** + * svccmsScreenWhitePointOfCCC routine + *****/ +svccmsScreenWhitePointOfCCC(display, ccc) +Display *display ; +XcmsCCC ccc ; +{ + +/***** + * external defs + *****/ + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + XcmsColor *svc_ret_value; + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsScreenWhitePointOfCCC("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " ccc);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsScreenWhitePointOfCCC(ccc); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + if (svc_ret_value == (XcmsColor *)NULL) { + errflg = 1 ; + message("XcmsScreenWhitePointOfCCC call failed\n", NULL, 0) ; + } + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) + { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall return the white point of the screen associated with the specified +Color Conversion Context. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + rw_colormap = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll) ; + ccc_good = XcmsCCCOfColormap(display_good, rw_colormap) ; + } + + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsScreenWhitePointOfCCC for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + color_good.format = XcmsRGBFormat ; + color_good.pixel = 0 ; + color_good.spec.RGB.red = 0xffff ; + color_good.spec.RGB.green = 0xffff ; + color_good.spec.RGB.blue = 0xffff ; + + XcmsSetWhitePoint(ccc_good, &color_good); + svccmsScreenWhitePointOfCCC( + display_good, + ccc_good + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsSetWhiteAdjustProc/XcmsSetWhiteAdjustProc.m b/xts5/Xlib7/XcmsSetWhiteAdjustProc/XcmsSetWhiteAdjustProc.m new file mode 100644 index 00000000..9d565c9e --- /dev/null +++ b/xts5/Xlib7/XcmsSetWhiteAdjustProc/XcmsSetWhiteAdjustProc.m @@ -0,0 +1,525 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsSetWhiteAdjustProc/XcmsSetWhiteAdjustProc.m,v 1.1 2005-02-12 14:37:36 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsSetWhiteAdjustProc/XcmsSetWhiteAdjustProc.m +>># +>># Description: +>># Tests for XcmsSetWhiteAdjustProc() +>># +>># Modifications: +>># $Log: cmswapr.m,v $ +>># Revision 1.1 2005-02-12 14:37:36 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:21 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:40 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:33 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:16:04 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:50:37 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:50:58 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsSetWhiteAdjustProc Xlib7 +XcmsSetWhiteAdjustProc() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap rw_colormap ; +XcmsColor color_good ; +XcmsColor color_in_out ; +XcmsColorFormat format_good ; +int screen_good ; +int depth_good ; +XcmsWhiteAdjustProc adjust_proc ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, + y_init, + h_init, + w_init; + +/****** + * routines + ******/ + +/***** + * svccmsSetWhiteAdjustProc routine + *****/ +svccmsSetWhiteAdjustProc(display, ccc, white_adjust_proc, client_data) +Display *display ; +XcmsCCC ccc ; +XcmsWhiteAdjustProc white_adjust_proc ; +XPointer client_data ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + XcmsWhiteAdjustProc svc_ret_value; + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsSetWhiteAdjustProc("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " ccc, white_adjust_proc, client_data);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsSetWhiteAdjustProc( + ccc, + white_adjust_proc, + client_data + ); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + /* check the procedure was set */ + XcmsWhiteAdjustProc prev_func ; + prev_func = XcmsSetWhiteAdjustProc(ccc, + adjust_proc, (XPointer)0); + check_adr((ADDRESS)adjust_proc, (ADDRESS)prev_func, + "address of previous function"); + + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall change the white point adjustment procedure in the specified +Color Conversion Context. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + rw_colormap = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + ccc_good = XcmsCCCOfColormap(display_good, rw_colormap) ; + } + + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || + (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsSetWhiteAdjustProc for Success\n"); + tet_infoline(" Testing procedure XcmsCIELabWhiteShiftColors\n") ; + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + adjust_proc = XcmsCIELabWhiteShiftColors ; + + svccmsSetWhiteAdjustProc( + display_good, + ccc_good, + adjust_proc, + (XPointer)0 + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif +>>ASSERTION Good C +If the implementation is X11R5 or later: +If the white point adjustment procedure is +.B XcmsCIELabWhiteShiftColors +it shall use the CIELab color space to shift the chromatic character of +colors by the chromatic displacement between the initial and target +white point. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + rw_colormap = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + ccc_good = XcmsCCCOfColormap(display_good, rw_colormap) ; + } + + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsSetWhiteAdjustProc for Success\n"); + tet_infoline(" Testing procedure XcmsCIELuvWhiteShiftColors\n") ; + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + adjust_proc = XcmsCIELuvWhiteShiftColors ; + + svccmsSetWhiteAdjustProc( + display_good, + ccc_good, + adjust_proc, + (XPointer)0 + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif +>>ASSERTION Good C +If the implementation is X11R5 or later: +If the white point adjustment procedure is +.B XcmsCIELuvWhiteShiftColors +it shall use the CIELuv color space to shift the chromatic character of +colors by the chromatic displacement between the initial and target white +point. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + rw_colormap = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + ccc_good = XcmsCCCOfColormap(display_good, rw_colormap) ; + } + + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsSetWhiteAdjustProc for Success\n"); + tet_infoline(" Testing procedure XcmsTekHVCWhiteShiftColors\n") ; + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + adjust_proc = XcmsTekHVCWhiteShiftColors ; + + svccmsSetWhiteAdjustProc( + display_good, + ccc_good, + adjust_proc, + (XPointer)0 + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsSetWhitePoint/XcmsSetWhitePoint.m b/xts5/Xlib7/XcmsSetWhitePoint/XcmsSetWhitePoint.m new file mode 100644 index 00000000..85218916 --- /dev/null +++ b/xts5/Xlib7/XcmsSetWhitePoint/XcmsSetWhitePoint.m @@ -0,0 +1,333 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsSetWhitePoint/XcmsSetWhitePoint.m,v 1.1 2005-02-12 14:37:36 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsSetWhitePoint/XcmsSetWhitePoint.m +>># +>># Description: +>># Tests for XcmsSetWhitePoint() +>># +>># Modifications: +>># $Log: cmswpt.m,v $ +>># Revision 1.1 2005-02-12 14:37:36 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:23 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:41 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:35 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:16:05 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:50:42 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:51:07 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsSetWhitePoint Xlib7 +XcmsSetWhitePoint() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +Colormap rw_colormap ; +XcmsColor color_good ; +XcmsColor color_in_out ; +XcmsColorFormat format_good ; +int screen_good ; +int depth_good ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, + y_init, + h_init, + w_init; + +/****** + * routines + ******/ + +/***** + * svccmsSetWhitePoint routine + *****/ +svccmsSetWhitePoint(display, ccc, color) +Display *display ; +XcmsCCC ccc ; +XcmsColor color ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + call_string = "svc_ret_value = XcmsSetWhitePoint("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " display, ccc, color);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsSetWhitePoint(ccc, &color) ; + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + check_dec(XcmsSuccess, svc_ret_value, "return value") ; + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname shall set the client white point for the specified +Color Conversion Context. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + colormap_good = XDefaultColormap(display_good, screen_good ); + + rw_colormap = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsSetWhitePoint for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + color_good.format = XcmsCIEXYZFormat ; + color_good.spec.CIEXYZ.X = 0.9 ; + color_good.spec.CIEXYZ.Y = 0.9 ; + color_good.spec.CIEXYZ.Z = 0.9 ; + svccmsSetWhitePoint( + display_good, + ccc_good, + color_good + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsStoreColor/XcmsStoreColor.m b/xts5/Xlib7/XcmsStoreColor/XcmsStoreColor.m new file mode 100644 index 00000000..9fb96333 --- /dev/null +++ b/xts5/Xlib7/XcmsStoreColor/XcmsStoreColor.m @@ -0,0 +1,619 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsStoreColor/XcmsStoreColor.m,v 1.1 2005-02-12 14:37:36 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsStoreColor/XcmsStoreColor.m +>># +>># Description: +>># Tests for XcmsStoreColor() +>># +>># Modifications: +>># $Log: cmsstclr.m,v $ +>># Revision 1.1 2005-02-12 14:37:36 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:17 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:36 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:29 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:16:00 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:50:23 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:50:34 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsStoreColor Xlib7 +XcmsStoreColor() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +Colormap colormap_good ; +Colormap colormap_dfl ; +XcmsColor color_good, color_return ; +XcmsColorFormat format_good ; +int screen_good ; +int depth_good ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, y_init, h_init, w_init; + +/****** + * routines + ******/ + +/***** + * svccmsStoreColor routine + *****/ +svccmsStoreColor(display, colormap, color) +Display *display ; +Colormap colormap ; +XcmsColor color ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsStoreColor("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " display, colormap, color);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsStoreColor( + display, + colormap, + &color + ); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + double one = 1.000000 ; + check_dec(XcmsSuccess, svc_ret_value, "return value" ) ; + format_good = XcmsRGBiFormat ; + color_return.format = XcmsRGBiFormat ; + color_return.pixel = 1 ; + XcmsQueryColor(display, colormap, &color_return, format_good) ; + if ( svc_ret_value = XcmsSuccess ) { + check_dou(one, color_return.spec.RGBi.red, "red" ) ; + check_dou(one, color_return.spec.RGBi.green, "green" ) ; + check_dou(one, color_return.spec.RGBi.blue, "blue" ) ; + } else { + errflg = 1 ; + message("XcmsStoreColor() call failed\n", NULL, 0) ; + } + + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall convert the color specified in the +.A XcmsColor +structure in RGB values, for the pixel member of the +.A XcmsColor +structure and return XcmsSuccess. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + + depth_good = DisplayPlanes( display_good, screen_good ); + + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + colormap_dfl = XDefaultColormap(display_good, screen_good ); + } + + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsStoreColor for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + color_good.format = XcmsRGBFormat ; + color_good.pixel = 1 ; + color_good.spec.RGB.red = 0xffff ; + color_good.spec.RGB.green = 0xffff ; + color_good.spec.RGB.blue = 0xffff ; + svccmsStoreColor( + display_good, + colormap_good, + color_good + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname shall return XcmsSuccesWithCompression +if it converted the requested device-independent color to the device +RGB color space with gamut compression. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + + depth_good = DisplayPlanes( display_good, screen_good ); + + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + colormap_dfl = XDefaultColormap(display_good, screen_good ); + } + if ( writeable_colormaps ) { + + estatus[0] = 1; + estatus[1] = BadAccess ; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsStoreColor for BadAccess\n"); + regr_args.l_flags.check = 0; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 1; + regr_args.l_flags.chkdpy = 0; + + { + color_good.format = XcmsRGBFormat ; + color_good.pixel = 1 ; + color_good.spec.RGB.red = 0xffff ; + color_good.spec.RGB.green = 0xffff ; + color_good.spec.RGB.blue = 0xffff ; + svccmsStoreColor( + display_good, + colormap_dfl, + color_good + ); + + } + } /* end if */ + } else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif +>>ASSERTION Good C +If the implementation is X11R5 or later: +If the color cell is unallocated or is allocated read-only +a call to xname shall return the BadAccess error. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + + depth_good = DisplayPlanes( display_good, screen_good ); + + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + colormap_dfl = XDefaultColormap(display_good, screen_good ); + } + if (writeable_colormaps) + { + + chkflg = 1; + estatus[0] = 1; + estatus[1] = BadColor ; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsStoreColor for BadColor\n"); + regr_args.l_flags.check = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 1; + regr_args.l_flags.chkdpy = 0; + + { + Colormap colormap_bad = (Colormap)-1 ; + color_good.format = XcmsRGBFormat ; + color_good.pixel = 1 ; + color_good.spec.RGB.red = 0xffff ; + color_good.spec.RGB.green = 0xffff ; + color_good.spec.RGB.blue = 0xffff ; + svccmsStoreColor( + display_good, + colormap_bad, + color_good + ); + + } + } /* end if */ + } else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif +>>ASSERTION Good C +If the implementation is X11R5 or later: +If the value for the colormap argument does not name a defined colormap +a call to xname shall return the BadColor error code. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + + depth_good = DisplayPlanes( display_good, screen_good ); + + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + colormap_dfl = XDefaultColormap(display_good, screen_good ); + } + + if ( writeable_colormaps ) { + + estatus[0] = 1; + estatus[1] = BadValue ; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsStoreColor for BadValue\n"); + regr_args.l_flags.check = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 1; + regr_args.l_flags.chkdpy = 0; + + { + color_good.format = XcmsRGBFormat ; + color_good.pixel = -999 ; + color_good.spec.RGB.red = 0xffff ; + color_good.spec.RGB.green = 0xffff ; + color_good.spec.RGB.blue = 0xffff ; + svccmsStoreColor( + display_good, + colormap_dfl, + color_good + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsStoreColors/XcmsStoreColors.m b/xts5/Xlib7/XcmsStoreColors/XcmsStoreColors.m new file mode 100644 index 00000000..5eac0dae --- /dev/null +++ b/xts5/Xlib7/XcmsStoreColors/XcmsStoreColors.m @@ -0,0 +1,663 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsStoreColors/XcmsStoreColors.m,v 1.1 2005-02-12 14:37:36 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsStoreColors/XcmsStoreColors.m +>># +>># Description: +>># Tests for XcmsStoreColors() +>># +>># Modifications: +>># $Log: cmsstcls.m,v $ +>># Revision 1.1 2005-02-12 14:37:36 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:18 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:36 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:30 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:16:00 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:50:26 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:50:38 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsStoreColors Xlib7 +XcmsStoreColors() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +Colormap colormap_good ; +Colormap colormap_dfl ; +XcmsColor color_good, color_return ; +XcmsColorFormat format_good ; +int screen_good ; +int depth_good ; +XcmsColor color_array[2] ; +XcmsColor write_many_color[2] ; +XcmsColor query_many_color[2] ; +XcmsColor scrnColor, exactColor ; +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, + y_init, + h_init, + w_init; + +/****** + * routines + ******/ + +/***** + * svccmsStoreColors routine + *****/ +svccmsStoreColors(display, colormap, colors, ncolors, flags_return) +Display *display ; +Colormap colormap ; +XcmsColor colors[2] ; +unsigned int ncolors ; +Bool flags_return[] ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsStoreColors("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " display, colormap, colors, ncolors, flags);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + { + char *fmt_string; + union msglst f_lst[1]; + + f_lst[0].typ_dec = colormap ; + fmt_string = "\n colormap= %d\n" ; + message(fmt_string, f_lst, 1); + + } +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsStoreColors( + display, + colormap, + &colors[0], + ncolors, + (Bool *)0 + ); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + check_dec(XcmsSuccess, svc_ret_value, "return value" ) ; + format_good = XcmsRGBFormat ; + query_many_color[0].pixel = 10 ; + query_many_color[0].format = XcmsRGBFormat ; + query_many_color[1].pixel = 11 ; + query_many_color[1].format = XcmsRGBFormat ; + XcmsQueryColors(display_good, colormap, + &query_many_color[0], (unsigned int)2, format_good) ; + check_dec(0xff00, colors[0].spec.RGB.red, "red") ; + check_dec(0x0000, colors[0].spec.RGB.green, "green") ; + check_dec(0x0000, colors[0].spec.RGB.blue, "blue") ; + check_dec(0x0000, colors[1].spec.RGB.red, "red") ; + check_dec(0xff00, colors[1].spec.RGB.green, "green") ; + check_dec(0x0000, colors[1].spec.RGB.blue, "blue") ; + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall convert the colors specified in the array of +.A XcmsColor +structure into RGB values for the pixels and return XcmsSuccess. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + + depth_good = DisplayPlanes( display_good, screen_good ); + + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + } + + if ( writeable_colormaps ) { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { +/********************/ + step ("Testing XcmsStoreColors for Success\n"); +/********************/ + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + write_many_color[0].format = XcmsRGBFormat ; + write_many_color[0].pixel = 10 ; + write_many_color[0].spec.RGB.red = 0xff00 ; + write_many_color[0].spec.RGB.green = 0x0000 ; + write_many_color[0].spec.RGB.blue = 0x00000 ; + write_many_color[1].format = XcmsRGBFormat ; + write_many_color[1].pixel = 11 ; + write_many_color[1].spec.RGB.red = 0x0000 ; + write_many_color[1].spec.RGB.green = 0xff00 ; + write_many_color[1].spec.RGB.blue = 0x0000 ; + svccmsStoreColors( + display_good, + colormap_good, + &write_many_color[0], + (unsigned int)2, + (Bool *)0 + ) ; + } + } /* end if */ + } else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif +>>ASSERTION Good C +If the implementation is X11R5 or later: +If the color cell is unallocated or is allocated read-only a call to +xname shall return the BadAccess error. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + + depth_good = DisplayPlanes( display_good, screen_good ); + + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + } + if ( writeable_colormaps ) { + + estatus[0] = 1; + estatus[1] = BadAccess ; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { +/********************/ + step ("Testing XcmsStoreColors for BadAccess\n"); +/********************/ + regr_args.l_flags.check = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 1; + regr_args.l_flags.chkdpy = 0; + + { + colormap_dfl = XDefaultColormap(display_good, screen_good ); + write_many_color[0].format = XcmsRGBFormat ; + write_many_color[0].pixel = 10 ; + write_many_color[0].spec.RGB.red = 0xffff ; + write_many_color[0].spec.RGB.green = 0x0 ; + write_many_color[0].spec.RGB.blue = 0x0 ; + write_many_color[1].format = XcmsRGBFormat ; + write_many_color[1].pixel = 11 ; + write_many_color[1].spec.RGB.red = 0x0 ; + write_many_color[1].spec.RGB.green = 0xffff ; + write_many_color[1].spec.RGB.blue = 0x0 ; + svccmsStoreColors( + display_good, + colormap_dfl, + write_many_color, + 2, + (Bool )0 + ) ; + } + } /* end if */ + } else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif + +>>ASSERTION Good C +If the implementation is X11R5 or later: +If the value for the colormap argument does not name a defined colormap, a +call to xname +shall return the BadColor error code. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + + depth_good = DisplayPlanes( display_good, screen_good ); + + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + } + if ( writeable_colormaps ) { + + chkflg = 1 ; + estatus[0] = 1; + estatus[1] = BadColor ; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { +/********************/ + step ("Testing XcmsStoreColors for BadColor\n"); +/********************/ + regr_args.l_flags.check = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 1; + regr_args.l_flags.chkdpy = 0; + + { + Colormap colormap_bad = (Colormap)-1 ; + write_many_color[0].format = XcmsRGBFormat ; + write_many_color[0].pixel = 10 ; + write_many_color[0].spec.RGB.red = 0xffff ; + write_many_color[0].spec.RGB.green = 0x0 ; + write_many_color[0].spec.RGB.blue = 0x0 ; + write_many_color[1].format = XcmsRGBFormat ; + write_many_color[1].pixel = 11 ; + write_many_color[1].spec.RGB.red = 0x0 ; + write_many_color[1].spec.RGB.green = 0xffff ; + write_many_color[1].spec.RGB.blue = 0x0 ; + svccmsStoreColors( + display_good, + colormap_bad, + write_many_color, + 2, + (Bool )0 + ) ; + } + } /* end if */ + } else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif +>>ASSERTION Good C +If the implementation is X11R5 or later: +If a numeric value falls outside of the range of values accepted by +the request, a call to xname shall return the BadValue error code. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + + depth_good = DisplayPlanes( display_good, screen_good ); + + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XCreateColormap( + display_good, + XRootWindow(display_good, screen_good), + visual_good, + AllocAll); + } + if ( writeable_colormaps ) { + + estatus[0] = 1; + estatus[1] = BadValue ; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { +/********************/ + step ("Testing XcmsStoreColors for BadValue\n"); +/********************/ + regr_args.l_flags.check = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 1; + regr_args.l_flags.chkdpy = 0; + + { + write_many_color[0].format = XcmsRGBFormat ; + write_many_color[0].pixel = -998 ; + write_many_color[0].spec.RGB.red = 0xffff ; + write_many_color[0].spec.RGB.green = 0x0 ; + write_many_color[0].spec.RGB.blue = 0x0 ; + write_many_color[1].format = XcmsRGBFormat ; + write_many_color[1].pixel = -999 ; + write_many_color[1].spec.RGB.red = 0x0 ; + write_many_color[1].spec.RGB.green = 0xffff ; + write_many_color[1].spec.RGB.blue = 0x0 ; + svccmsStoreColors( + display_good, + colormap_good, + write_many_color, + 2, + (Bool )0 + ) ; + + } + } /* end if */ + } else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsTekHVCQueryMaxC/XcmsTekHVCQueryMaxC.m b/xts5/Xlib7/XcmsTekHVCQueryMaxC/XcmsTekHVCQueryMaxC.m new file mode 100644 index 00000000..a3c1847d --- /dev/null +++ b/xts5/Xlib7/XcmsTekHVCQueryMaxC/XcmsTekHVCQueryMaxC.m @@ -0,0 +1,348 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsTekHVCQueryMaxC/XcmsTekHVCQueryMaxC.m,v 1.1 2005-02-12 14:37:36 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsTekHVCQueryMaxC/XcmsTekHVCQueryMaxC.m +>># +>># Description: +>># Tests for XcmsTekHVCQueryMaxC() +>># +>># Modifications: +>># $Log: cmstqmc.m,v $ +>># Revision 1.1 2005-02-12 14:37:36 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:18 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:37 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:30 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:16:01 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:50:28 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:50:42 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsTekHVCQueryMaxC Xlib7 +XcmsTekHVCQueryMaxC() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +XcmsColor color_good ; +XcmsColorFormat format_good ; +double minv, maxv, deltav ; +double hue, chroma, value ; +int screen_good ; +int depth_good ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, y_init, h_init, w_init; + +/****** + * routines + ******/ + +/***** + * svccmsTekHVCQueryMaxC routine + *****/ +svccmsTekHVCQueryMaxC(display, ccc, hue_good, value_good, color) +Display *display ; +XcmsCCC ccc ; +XcmsFloat hue_good ; +XcmsFloat value_good ; +XcmsColor color ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsTekHVCQueryMaxC("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " ccc, hue, chroma, color_return );\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ +/****** + * If there is a pixmap_id parameter or a window_id parameter then + * set variable drawable_id equal to it. + ******/ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsTekHVCQueryMaxC( + ccc, + hue_good, + value_good, + &color + ); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + double zero = 0.000000 ; + if (svc_ret_value == XcmsSuccess ) { + if (color.spec.TekHVC.C == zero) { + errflg = 1 ; + message("Expected non zero chroma returned zero\n", NULL, 0) ; + } + } + else { + errflg = 1 ; + message("XcmsTekHVCQueryMaxC() call failed\n", NULL, 0) ; + } + } + + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall find the maximum chroma for a given TekHVC Hue and value. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + + depth_good = DisplayPlanes( display_good, screen_good ); + + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XDefaultColormap(display_good, screen_good ); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if ( writeable_colormaps ) + { + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsTekHVCQueryMaxC for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + hue = 25.000000 ; + value = 68.000000 ; + svccmsTekHVCQueryMaxC( + display_good, + ccc_good, + hue, + value, + color_good + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsTekHVCQueryMaxV/XcmsTekHVCQueryMaxV.m b/xts5/Xlib7/XcmsTekHVCQueryMaxV/XcmsTekHVCQueryMaxV.m new file mode 100644 index 00000000..715ecbee --- /dev/null +++ b/xts5/Xlib7/XcmsTekHVCQueryMaxV/XcmsTekHVCQueryMaxV.m @@ -0,0 +1,352 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsTekHVCQueryMaxV/XcmsTekHVCQueryMaxV.m,v 1.1 2005-02-12 14:37:36 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsTekHVCQueryMaxV/XcmsTekHVCQueryMaxV.m +>># +>># Description: +>># Tests for XcmsTekHVCQueryMaxV() +>># +>># Modifications: +>># $Log: cmstqmv.m,v $ +>># Revision 1.1 2005-02-12 14:37:36 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:19 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:38 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:31 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:16:02 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:50:31 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:50:47 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsTekHVCQueryMaxV Xlib7 +XcmsTekHVCQueryMaxV() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +XcmsColor color_good ; +XcmsColorFormat format_good ; +double minv, maxv, deltav ; +double hue, chroma, value ; +int screen_good ; +int depth_good ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, + y_init, + h_init, + w_init; + +/****** + * routines + ******/ + +/***** + * svccmsTekHVCQueryMaxV routine + *****/ +svccmsTekHVCQueryMaxV(display, ccc, hue_good, chroma_good, color) +Display *display ; +XcmsCCC ccc ; +XcmsFloat hue_good ; +XcmsFloat chroma_good ; +XcmsColor color ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsTekHVCQueryMaxV("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " ccc, hue, chroma, color_return );\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ +/****** + * If there is a pixmap_id parameter or a window_id parameter then + * set variable drawable_id equal to it. + ******/ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsTekHVCQueryMaxV( + ccc, + hue_good, + chroma_good, + &color + ); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + double zero = 0.000000 ; + if (svc_ret_value == XcmsSuccess ) { + if (color.spec.TekHVC.V == zero) { + errflg = 1 ; + message("Expected non zero Value returned zero\n", NULL, 0) ; + } + } + else { + errflg = 1 ; + message("XcmsTekHVCQueryMinV() call failed\n", NULL, 0) ; + } + } + + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall find the maximum Value for a given TekHVC Hue and Chroma. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + + depth_good = DisplayPlanes( display_good, screen_good ); + + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XDefaultColormap(display_good, screen_good ); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if (writeable_colormaps) + { + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsTekHVCQueryMaxV for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + hue = 25.000000 ; + chroma = 29.00000 ; + svccmsTekHVCQueryMaxV( + display_good, + ccc_good, + hue, + chroma, + color_good + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsTekHVCQueryMaxVC/XcmsTekHVCQueryMaxVC.m b/xts5/Xlib7/XcmsTekHVCQueryMaxVC/XcmsTekHVCQueryMaxVC.m new file mode 100644 index 00000000..6311a1e6 --- /dev/null +++ b/xts5/Xlib7/XcmsTekHVCQueryMaxVC/XcmsTekHVCQueryMaxVC.m @@ -0,0 +1,346 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsTekHVCQueryMaxVC/XcmsTekHVCQueryMaxVC.m,v 1.1 2005-02-12 14:37:36 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsTekHVCQueryMaxVC/XcmsTekHVCQueryMaxVC.m +>># +>># Description: +>># Tests for XcmsTekHVCQueryMaxVC() +>># +>># Modifications: +>># $Log: cmstqmvc.m,v $ +>># Revision 1.1 2005-02-12 14:37:36 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:20 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:38 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:32 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:16:02 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:50:32 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:50:50 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsTekHVCQueryMaxVC Xlib7 +XcmsTekHVCQueryMaxVC() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +XcmsColor color_good ; +XcmsColorFormat format_good ; +double minv, maxv, deltav ; +double hue, chroma, value ; +int screen_good ; +int depth_good ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, + y_init, + h_init, + w_init; + +/***** + * svccmsTekHVCQueryMaxVC routine + *****/ +svccmsTekHVCQueryMaxVC(display, ccc, hue_good, color) +Display *display ; +XcmsCCC ccc ; +XcmsFloat hue_good ; +XcmsColor color ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsTekHVCQueryMaxVC("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " ccc, hue, chroma, color_return );\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ +/****** + * If there is a pixmap_id parameter or a window_id parameter then + * set variable drawable_id equal to it. + ******/ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsTekHVCQueryMaxVC( + ccc, + hue_good, + &color + ); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + double zero = 0.000000 ; + if (svc_ret_value == XcmsSuccess ) { + if (color.spec.TekHVC.C == zero) { + errflg = 1 ; + message("Expected non zero chroma returned zero\n", NULL, 0) ; + } + if (color.spec.TekHVC.V == zero) { + errflg = 1 ; + message("Expected non zero value returned zero\n", NULL, 0) ; + } + } + else { + errflg = 1 ; + message("XcmsTekHVCQueryMaxVC() call failed\n", NULL, 0) ; + } + } + + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall find the maximum displayable Chroma for a given Hue, and the +value at which that Chroma is reached. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XDefaultColormap(display_good, screen_good ); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsTekHVCQueryMaxVC for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + hue = 25.000000 ; + svccmsTekHVCQueryMaxVC( + display_good, + ccc_good, + hue, + color_good + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsTekHVCQueryMaxVSamples/XcmsTekHVCQueryMaxVSamples.m b/xts5/Xlib7/XcmsTekHVCQueryMaxVSamples/XcmsTekHVCQueryMaxVSamples.m new file mode 100644 index 00000000..bf2ed913 --- /dev/null +++ b/xts5/Xlib7/XcmsTekHVCQueryMaxVSamples/XcmsTekHVCQueryMaxVSamples.m @@ -0,0 +1,354 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsTekHVCQueryMaxVSamples/XcmsTekHVCQueryMaxVSamples.m,v 1.1 2005-02-12 14:37:36 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsTekHVCQueryMaxVSamples/XcmsTekHVCQueryMaxVSamples.m +>># +>># Description: +>># Tests for XcmsTekHVCQueryMaxVSamples() +>># +>># Modifications: +>># $Log: cmstqmvs.m,v $ +>># Revision 1.1 2005-02-12 14:37:36 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:20 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:39 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:32 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:16:03 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:50:34 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:50:53 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsTekHVCQueryMaxVSamples Xlib7 +XcmsTekHVCQueryMaxVSamples() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +XcmsColor color_good ; +XcmsColor color_return[2] ; +XcmsColorFormat format_good ; +double minv, maxv, deltav ; +double hue, chroma, value ; +int screen_good ; +int depth_good ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, + y_init, + h_init, + w_init; + +/****** + * routines + ******/ + +/***** + * svccmsTekHVCQueryMaxVSamples routine + *****/ +svccmsTekHVCQueryMaxVSamples(display, ccc, hue_good, color, nsamples) +Display *display ; +XcmsCCC ccc ; +XcmsFloat hue_good ; +XcmsColor color[2] ; +unsigned int nsamples ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsTekHVCQueryMaxVSamples("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " ccc, hue, color_return, nsamples);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ +/****** + * If there is a pixmap_id parameter or a window_id parameter then + * set variable drawable_id equal to it. + ******/ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsTekHVCQueryMaxVSamples( + ccc, + hue_good, + &color[0], + nsamples + ); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + double zero = 0.000000 ; + if (svc_ret_value == XcmsSuccess ) { + if ( (color[0].spec.TekHVC.V == zero) || + (color[1].spec.TekHVC.V == zero) ) { + errflg = 1 ; + message("Expected non zero Value returned zero\n", NULL, 0) ; + } + if ( (color[0].spec.TekHVC.C == zero) || + (color[1].spec.TekHVC.C == zero) ) { + errflg = 1 ; + message("Expected non zero Chroma returned zero\n", NULL, 0) ; + } + } + else { + errflg = 1 ; + message("XcmsTekHVCQueryMaxVSamples() call failed\n", NULL, 0) ; + } + } + + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall return the boundries of the TekHVC gamut for a given Hue. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XDefaultColormap(display_good, screen_good ); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if ( writeable_colormaps ) { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsTekHVCQueryMaxVSamples for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + hue = 25.000000 ; + svccmsTekHVCQueryMaxVSamples( + display_good, + ccc_good, + hue, + color_return, + 2 + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsTekHVCQueryMinV/XcmsTekHVCQueryMinV.m b/xts5/Xlib7/XcmsTekHVCQueryMinV/XcmsTekHVCQueryMinV.m new file mode 100644 index 00000000..4bd145b3 --- /dev/null +++ b/xts5/Xlib7/XcmsTekHVCQueryMinV/XcmsTekHVCQueryMinV.m @@ -0,0 +1,349 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsTekHVCQueryMinV/XcmsTekHVCQueryMinV.m,v 1.1 2005-02-12 14:37:36 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsTekHVCQueryMinV/XcmsTekHVCQueryMinV.m +>># +>># Description: +>># Tests for XcmsTekHVCQueryMinV() +>># +>># Modifications: +>># $Log: cmstqmiv.m,v $ +>># Revision 1.1 2005-02-12 14:37:36 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:19 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:37 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:31 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:16:01 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:50:29 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:50:44 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsTekHVCQueryMinV Xlib7 +XcmsTekHVCQueryMinV() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +XcmsColor color_good ; +XcmsColorFormat format_good ; +double minv, maxv, deltav ; +double hue, chroma, value ; +int screen_good ; +int depth_good ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, + y_init, + h_init, + w_init; + +/****** + * routines + ******/ + +/***** + * svccmsTekHVCQueryMinV routine + *****/ +svccmsTekHVCQueryMinV(display, ccc, hue_good, chroma_good, color) +Display *display ; +XcmsCCC ccc ; +XcmsFloat hue_good ; +XcmsFloat chroma_good ; +XcmsColor color ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Status svc_ret_value; + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsTekHVCQueryMinV("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " ccc, hue, chroma, color_return );\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ +/****** + * If there is a pixmap_id parameter or a window_id parameter then + * set variable drawable_id equal to it. + ******/ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + + svc_ret_value = 0 ; + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsTekHVCQueryMinV( + ccc, + hue_good, + chroma_good, + &color + ); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + double zero = 0.000000 ; + if (svc_ret_value == XcmsSuccess ) { + if (color.spec.TekHVC.V == zero) { + errflg = 1 ; + message("Expected non zero Value returned zero\n", NULL, 0) ; + } + } + else { + errflg = 1 ; + message("XcmsTekHVCQueryMinV() call failed\n", NULL, 0) ; + } + } + + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname shall return the TekHVC co-ordinates. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + depth_good = DisplayPlanes( display_good, screen_good ); + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + colormap_good = XDefaultColormap(display_good, screen_good ); + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + } + + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) { + tet_infoline("TEST: Testing XcmsTekHVCQueryMinV for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + hue = 25.000000 ; + chroma = 29.00000 ; + svccmsTekHVCQueryMinV( + display_good, + ccc_good, + hue, + chroma, + color_good + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib7/XcmsVisualOfCCC/XcmsVisualOfCCC.m b/xts5/Xlib7/XcmsVisualOfCCC/XcmsVisualOfCCC.m new file mode 100644 index 00000000..9eb613bc --- /dev/null +++ b/xts5/Xlib7/XcmsVisualOfCCC/XcmsVisualOfCCC.m @@ -0,0 +1,324 @@ +Copyright (c) 2005 X.Org Foundation LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +$Header: /cvs/xtest/xtest/xts5/tset/Xlib7/XcmsVisualOfCCC/XcmsVisualOfCCC.m,v 1.1 2005-02-12 14:37:36 anderson Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995 +Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993 +All Rights Reserved. + +>># +>># Project: VSW5 +>># +>># File: tset/Xlib7/XcmsVisualOfCCC/XcmsVisualOfCCC.m +>># +>># Description: +>># Tests for XcmsVisualOfCCC() +>># +>># Modifications: +>># $Log: cmsvofcc.m,v $ +>># Revision 1.1 2005-02-12 14:37:36 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:27:21 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:45:39 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:19:33 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:16:03 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 08:50:35 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 00:50:55 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XcmsVisualOfCCC Xlib7 +XcmsVisualOfCCC() +>>EXTERN + +/****** + * User defined globals for test + ******/ + +Bool writeable_colormaps = 1; + +/****** + * User defined globals for test case sets + ******/ +Display *display_good; +Visual *visual_good ; +XcmsCCC ccc_good ; +Colormap colormap_good, colormap_return ; +int screen_good ; +int depth_good ; + +/****** + * generated globals + ******/ +char *exec_file_name; +int x_init, + y_init, + h_init, + w_init; + +/****** + * routines + ******/ + +/***** + * svccmsVisualOfCCC routine + *****/ +svccmsVisualOfCCC(display, ccc) +Display *display ; +XcmsCCC ccc ; +{ + +/***** + * external defs + *****/ + + extern int errcnt; + extern int errflg; + extern int chkflg; + extern int signal_status(); + extern int unexp_err(); + extern char *svc_user_arg; + extern char *strcpy(); + +/****** + * local storage + ******/ + char fmtstr[256], *call_string; + union msglst fmt_lst[1]; + int skip_pixcheck; + + int + ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + Visual *svc_ret_value; + +/****** + * Turn on buffering and buffer parameter information + * in case an error occurs + ******/ + + regr_args.l_flags.bufrout = 1; + + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "An error occurred during a call to %s\n\n"); + fmt_lst[0].typ_str = TestName; + message(fmtstr, fmt_lst, 1); + + + call_string = "svc_ret_value = XcmsVisualOfCCC("; + + (void)strcpy(fmtstr, "The routine call looked like this - \n %s\n"); + fmt_lst[0].typ_str = call_string; + message(fmtstr, fmt_lst, 1); + + call_string = " display, ccc);\n\n"; + message(call_string, fmt_lst, 0); + (void)strcpy(fmtstr, "The parameter values were as follows... \n"); + message(fmtstr, fmt_lst, 0); + + bufrdisp(display); /* buffer display struct info for error checking */ + +/****** + * Setup code for this service - this should always be executed. + ******/ + + XSync(display_arg, 0); + +/****** + * save environment + ******/ + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id); + + + first_error = 0; /* no errors encountered yet */ +/****** + * service call + ******/ + errflg = 0; + XSetErrorHandler(signal_status); + svc_ret_value = XcmsVisualOfCCC(ccc); + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + r_wait(display_arg, window_arg, time_delay, None); /* no colormap by default */ + +/****** + * check saved environment with current environment. + ******/ + if (regr_args.l_flags.chksta == 1) + stat_status = chek_stat (dpy_msk | win_msk , + gc_id, + display_arg, + drawable_id, + ss_status); + else + stat_status = REGR_NORMAL; + +/****** + * check Success returns with expected returns + ******/ + if ((!errflg) && (!chkflg)) + if ((badstat(display_arg, estatus, Success)) != REGR_NORMAL) + errflg = 1; + + +/****** + * verify the results of the service if successful completion. + ******/ + if ((regr_args.l_flags.check) && + (errflg == 0) && + (stat_status == REGR_NORMAL)) + { + check_dec(visual_good->class, svc_ret_value->class, + "visual class") ; + } + XSync(display_arg, 0); + +/****** + * cleanup code for this service. + ******/ + if (regr_args.l_flags.cleanup) + { + cleanup_status = REGR_NORMAL; + } + XSync(display_arg, 0); + + if (errflg) { /* if there was an error ... */ + errcnt++; /* ...increment the error count */ + (void)strcpy(fmtstr, "\nEnd of error report\n"); + message(fmtstr, fmt_lst, 0); + (void)strcpy(fmtstr, "*********************\n"); + message(fmtstr, fmt_lst, 0); + } + +/***** + * clear all flags + *****/ + chkflg = 0; + regr_args.l_flags.bufrout = 0; + + dumpbuf(); +} + + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to xname +shall return the visual associated with the specified +.A ccc. +>>CODE + +#if XT_X_RELEASE > 4 + display_arg = Dsp; +/* + * Create a GC to save environmental data in + */ + gc_save = XCreateGC(display_arg,XRootWindow(display_arg,XDefaultScreen(display_arg)),(unsigned long)0,(XGCValues *)0); + + regr_args.l_flags.check = 0; + regr_args.l_flags.nostat = 0; + regr_args.l_flags.perf = 0; + regr_args.l_flags.setup = 0; + regr_args.l_flags.cleanup = 0; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + regr_args.l_flags.verbose = 0; + regr_args.iter = 1; /* execute service once */ + estatus[0] = 1; + + +/****** + * User defined initialization code for test case sets + ******/ + display_good = display_arg; + +/***** + * Test wide set up + *****/ + + screen_good = XDefaultScreen(display_good); + + depth_good = DisplayPlanes( display_good, screen_good ); + + visual_good = XDefaultVisual(display_good, screen_good ); + + if ((visual_good->class == StaticGray) || + (visual_good->class == StaticColor) || + (visual_good->class == TrueColor)) + writeable_colormaps = 0 ; + + if ( writeable_colormaps ) { + ccc_good = XcmsCCCOfColormap(display_good, colormap_good) ; + colormap_good = XDefaultColormap(display_good, screen_good ); + } + +/***** + * Ending of testcase set + *****/ + if (writeable_colormaps) + { + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || (estatus[1] == Success)) + { + tet_infoline("TEST: Testing XcmsVisualOfCCC for Success\n"); + regr_args.l_flags.check = 1; + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.chksta = 0; + regr_args.l_flags.chkdpy = 0; + + { + svccmsVisualOfCCC( + display_good, + ccc_good + ); + + } + } /* end if */ + } + else + message("Warning: not a writeable colormap\n", NULL, 0) ; + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif |