diff options
author | Dan Nicholson <dbn.lists@gmail.com> | 2009-09-16 12:20:41 -0700 |
---|---|---|
committer | Dan Nicholson <dbn.lists@gmail.com> | 2009-09-16 12:20:41 -0700 |
commit | 704eb8d4cbfa2f8c47882a8ea6c7732cf5fa20d1 (patch) | |
tree | 1f48212ecf5556fbff17172c6904e525481e8653 /xts5/Xlib15 | |
parent | 5d01bd434ff7186701c931883b110c179d4fa8b8 (diff) |
xts5: Move tests out of tset directory
The tset directory was mostly useless and causes extra baggage if the
scenario files are going to be used on an installed package. The test
directories are now flattened into xts5.
Diffstat (limited to 'xts5/Xlib15')
49 files changed, 13815 insertions, 0 deletions
diff --git a/xts5/Xlib15/.gitignore b/xts5/Xlib15/.gitignore new file mode 100644 index 00000000..9ddd0ec5 --- /dev/null +++ b/xts5/Xlib15/.gitignore @@ -0,0 +1,47 @@ +XAllocClassHint/XAllocClassHint +XAllocIconSize/XAllocIconSize +XAllocStandardColormap/XAllocStandardColormap +XAllocSizeHints/XAllocSizeHints +XAllocWMHints/XAllocWMHints +XDefaultString/XDefaultString +XFreeStringList/XFreeStringList +XFetchName/XFetchName +XGetClassHint/XGetClassHint +XGetCommand/XGetCommand +XGetIconName/XGetIconName +XGetIconSizes/XGetIconSizes +XGetRGBColormaps/XGetRGBColormaps +XGetTransientForHint/XGetTransientForHint +XGetTextProperty/XGetTextProperty +XGetWMClientMachine/XGetWMClientMachine +XGetWMColormapWindows/XGetWMColormapWindows +XGetWMHints/XGetWMHints +XGetWMIconName/XGetWMIconName +XGetWMName/XGetWMName +XGetWMNormalHints/XGetWMNormalHints +XGetWMProtocols/XGetWMProtocols +XGetWMSizeHints/XGetWMSizeHints +XIconifyWindow/XIconifyWindow +XReconfigureWMWindow/XReconfigureWMWindow +XSetClassHint/XSetClassHint +XSetCommand/XSetCommand +XSetIconName/XSetIconName +XSetIconSizes/XSetIconSizes +XSetRGBColormaps/XSetRGBColormaps +XStringListToTextProperty/XStringListToTextProperty +XStoreName/XStoreName +XSetTransientForHint/XSetTransientForHint +XSetTextProperty/XSetTextProperty +XSetWMClientMachine/XSetWMClientMachine +XSetWMColormapWindows/XSetWMColormapWindows +XSetWMHints/XSetWMHints +XSetWMIconName/XSetWMIconName +XSetWMName/XSetWMName +XSetWMNormalHints/XSetWMNormalHints +XSetWMProperties/XSetWMProperties +XSetWMProperties/Test1 +XSetWMProperties/Test2 +XSetWMProtocols/XSetWMProtocols +XSetWMSizeHints/XSetWMSizeHints +XTextPropertyToStringList/XTextPropertyToStringList +XWithdrawWindow/XWithdrawWindow diff --git a/xts5/Xlib15/Makefile.am b/xts5/Xlib15/Makefile.am new file mode 100644 index 00000000..c557b1ee --- /dev/null +++ b/xts5/Xlib15/Makefile.am @@ -0,0 +1,65 @@ +include ../../common.mk +AUTOMAKE_OPTIONS = subdir-objects + +AM_CFLAGS = $(XTS_LCFLAGS) $(XTS_CFLAGS) +LDADD = $(TCM) $(XTS_LLIBS) $(XTS_LIBS) + +libexec_PROGRAMS = $(tprogs) +BUILT_SOURCES = $(tprogs:$(EXEEXT)=.c) +CLEANFILES = $(BUILT_SOURCES) + +XDefaultString_XDefaultString_LDADD = $(LDADD) $(top_builddir)/xts5/src/libXR5/libXR5.a + +tprogs = \ + XAllocClassHint/XAllocClassHint \ + XAllocIconSize/XAllocIconSize \ + XAllocStandardColormap/XAllocStandardColormap \ + XAllocSizeHints/XAllocSizeHints \ + XAllocWMHints/XAllocWMHints \ + XDefaultString/XDefaultString \ + XFreeStringList/XFreeStringList \ + XFetchName/XFetchName \ + XGetClassHint/XGetClassHint \ + XGetCommand/XGetCommand \ + XGetIconName/XGetIconName \ + XGetIconSizes/XGetIconSizes \ + XGetRGBColormaps/XGetRGBColormaps \ + XGetTransientForHint/XGetTransientForHint \ + XGetTextProperty/XGetTextProperty \ + XGetWMClientMachine/XGetWMClientMachine \ + XGetWMColormapWindows/XGetWMColormapWindows \ + XGetWMHints/XGetWMHints \ + XGetWMIconName/XGetWMIconName \ + XGetWMName/XGetWMName \ + XGetWMNormalHints/XGetWMNormalHints \ + XGetWMProtocols/XGetWMProtocols \ + XGetWMSizeHints/XGetWMSizeHints \ + XIconifyWindow/XIconifyWindow \ + XReconfigureWMWindow/XReconfigureWMWindow \ + XSetClassHint/XSetClassHint \ + XSetCommand/XSetCommand \ + XSetIconName/XSetIconName \ + XSetIconSizes/XSetIconSizes \ + XSetRGBColormaps/XSetRGBColormaps \ + XStringListToTextProperty/XStringListToTextProperty \ + XStoreName/XStoreName \ + XSetTransientForHint/XSetTransientForHint \ + XSetTextProperty/XSetTextProperty \ + XSetWMClientMachine/XSetWMClientMachine \ + XSetWMColormapWindows/XSetWMColormapWindows \ + XSetWMHints/XSetWMHints \ + XSetWMIconName/XSetWMIconName \ + XSetWMName/XSetWMName \ + XSetWMNormalHints/XSetWMNormalHints \ + XSetWMProperties/XSetWMProperties \ + XSetWMProtocols/XSetWMProtocols \ + XSetWMSizeHints/XSetWMSizeHints \ + XTextPropertyToStringList/XTextPropertyToStringList \ + XWithdrawWindow/XWithdrawWindow + +# Auxiliary programs run from tests +libexec_PROGRAMS += \ + XSetWMProperties/Test1 \ + XSetWMProperties/Test2 +XSetWMProperties_Test1_LDADD = $(TCMCHILD) $(XTS_LLIBS) $(XTS_LIBS) +XSetWMProperties_Test2_LDADD = $(TCMCHILD) $(XTS_LLIBS) $(XTS_LIBS) diff --git a/xts5/Xlib15/XAllocClassHint/XAllocClassHint.m b/xts5/Xlib15/XAllocClassHint/XAllocClassHint.m new file mode 100644 index 00000000..69ab73e2 --- /dev/null +++ b/xts5/Xlib15/XAllocClassHint/XAllocClassHint.m @@ -0,0 +1,142 @@ +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/Xlib15/XAllocClassHint/XAllocClassHint.m,v 1.2 2005-11-03 08:42:47 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XAllocClassHint/XAllocClassHint.m +>># +>># Description: +>># Tests for XAllocClassHint() +>># +>># Modifications: +>># $Log: allcclsshn.m,v $ +>># Revision 1.2 2005-11-03 08:42:47 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:20 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:33:47 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:55:35 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:10 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:42 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:08:50 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:10:23 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 XAllocClassHint Xlib15 +XClassHint * +XAllocClassHint() +>>ASSERTION Good A +A call to xname allocates and returns a pointer to a +.S XClassHint +structure in which each component is set to NULL. +>>STRATEGY +Allocate an XClassHint structure with XAllocClassHint. +Verify that each component of the structure is set to NULL. +>>CODE +XClassHint *chint; + + chint = XCALL; + + if(chint == (XClassHint *) NULL) { + delete("XAllocClassHint() returned NULL."); + return; + } else + CHECK; + + if(chint->res_name != NULL) { + report("The res_name component of the XClassHints structure was not NULL."); + FAIL; + } else + CHECK; + + if(chint->res_class != NULL) { + report("The res_class component of the XClassHints structure was not NULL."); + FAIL; + } else + CHECK; + + XFree((char*)chint); + + CHECKPASS(3); + + +>>ASSERTION Good B 1 +When insufficient memory is available, then a call +to xname returns NULL. +>># Kieron Action Review diff --git a/xts5/Xlib15/XAllocIconSize/XAllocIconSize.m b/xts5/Xlib15/XAllocIconSize/XAllocIconSize.m new file mode 100644 index 00000000..bfbe5436 --- /dev/null +++ b/xts5/Xlib15/XAllocIconSize/XAllocIconSize.m @@ -0,0 +1,164 @@ +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/Xlib15/XAllocIconSize/XAllocIconSize.m,v 1.2 2005-11-03 08:42:47 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XAllocIconSize/XAllocIconSize.m +>># +>># Description: +>># Tests for XAllocIconSize() +>># +>># Modifications: +>># $Log: allcicnsz.m,v $ +>># Revision 1.2 2005-11-03 08:42:47 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:20 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:33:47 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:55:36 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:10 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:42 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:08:51 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:10: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 XAllocIconSize Xlib15 +XIconSize *XAllocIconSize() +>>ASSERTION Good A +A call to xname allocates and returns a pointer to a +.S XIconSize +structure in which each component is set to zero. +>>STRATEGY +Allocate a XIconSize structure using XAllocIconSize. +Verify that the function did not return NULL. +Verify that each component of the structure is 0. +Release the allocated memory using XFree. +>>CODE +XIconSize *isize; + + isize = XCALL; + + if(isize == (XIconSize *) NULL) { + delete("%s() returned NULL.", TestName); + return; + } else + CHECK; + + if(isize->min_width != 0) { + report("The min_width component of the XIconSize structure was %d instead of zero", isize->min_width); + FAIL; + } else + CHECK; + + if(isize->min_height != 0) { + report("The min_height component of the XIconSize structure was %d instead of zero", isize->min_height); + FAIL; + } else + CHECK; + + if(isize-> max_width != 0) { + report("The max_width component of the XIconSize structure was %d instead of zero", isize-> max_width); + FAIL; + } else + CHECK; + + if(isize->max_height != 0) { + report("The max_height component of the XIconSize structure was %d instead of zero", isize->max_height); + FAIL; + } else + CHECK; + + if(isize->width_inc != 0) { + report("The width_inc component of the XIconSize structure was %d instead of zero", isize->width_inc); + FAIL; + } else + CHECK; + + if(isize-> height_inc != 0) { + report("The height_inc component of the XIconSize structure was %d instead of zero", isize->height_inc); + FAIL; + } else + CHECK; + + CHECKPASS(7); + +>>ASSERTION Bad B 1 +When insufficient memory is available, then +a call to xname returns NULL. +>># Kieron Action Review diff --git a/xts5/Xlib15/XAllocSizeHints/XAllocSizeHints.m b/xts5/Xlib15/XAllocSizeHints/XAllocSizeHints.m new file mode 100644 index 00000000..3969d472 --- /dev/null +++ b/xts5/Xlib15/XAllocSizeHints/XAllocSizeHints.m @@ -0,0 +1,229 @@ +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/Xlib15/XAllocSizeHints/XAllocSizeHints.m,v 1.2 2005-11-03 08:42:47 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XAllocSizeHints/XAllocSizeHints.m +>># +>># Description: +>># Tests for XAllocSizeHints() +>># +>># Modifications: +>># $Log: allcszhnts.m,v $ +>># Revision 1.2 2005-11-03 08:42:47 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:20 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:33:48 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:55:38 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:11 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:43 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:08:54 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:10: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 XAllocSizeHints Xlib15 +XSizeHints * +XAllocSizeHints() +>>ASSERTION Good A +A call to xname allocates and returns a pointer to a +.S XSizeHints +structure, which can be freed with +.S XFree , +in which each component is set to zero. +>>STRATEGY +Allocate an XSizeHints structure with XAllocSizeHints. +Verify NULL is not returned. +Verify that each component of the structure is set to zero. +Release the allocated memory using XFree. +>>CODE +XSizeHints *shints; + + shints = XAllocSizeHints(); + + if (shints == (XSizeHints *)NULL) { + delete("XAllocSizeHints returned NULL."); + return; + } else + CHECK; + + if(shints->flags != 0L) { + report("The flags component of the XSizeHints structure was not zero."); + FAIL; + } else + CHECK; + + if(shints->x != 0) { + report("The x component of the XSizeHints structure was not zero."); + FAIL; + } else + CHECK; + + if(shints->y != 0) { + report("The y component of the XSizeHints structure was not zero."); + FAIL; + } else + CHECK; + + if(shints->width != 0) { + report("The width component of the XSizeHints structure was not zero."); + FAIL; + } else + CHECK; + + if(shints->height != 0) { + report("The height component of the XSizeHints structure was not zero."); + FAIL; + } else + CHECK; + + if(shints->min_width != 0) { + report("The min_width component of the XSizeHints structure was not zero."); + FAIL; + } else + CHECK; + + if(shints->min_height != 0) { + report("The min_height component of the XSizeHints structure was not zero."); + FAIL; + } else + CHECK; + + if(shints->max_width != 0) { + report("The max_width component of the XSizeHints structure was not zero."); + FAIL; + } else + CHECK; + + if(shints->max_height != 0) { + report("The max_height component of the XSizeHints structure was not zero."); + FAIL; + } else + CHECK; + + if(shints->width_inc != 0) { + report("The width_inc component of the XSizeHints structure was not zero."); + FAIL; + } else + CHECK; + + if(shints->height_inc != 0) { + report("The height_inc component of the XSizeHints structure was not zero."); + FAIL; + } else + CHECK; + + if((shints->min_aspect.x != 0) || (shints->min_aspect.y != 0)){ + report("The min_aspect components of the XSizeHints structure were not zero."); + FAIL; + } else + CHECK; + + if((shints->max_aspect.x != 0) || (shints->max_aspect.y != 0)){ + report("The max_aspect components of the XSizeHints structure were not zero."); + FAIL; + } else + CHECK; + + if(shints->base_width != 0) { + report("The base_width component of the XSizeHints structure was not zero."); + FAIL; + } else + CHECK; + + if(shints->base_height != 0) { + report("The base_height component of the XSizeHints structure was not zero."); + FAIL; + } else + CHECK; + + if(shints->win_gravity != 0) { + report("The win_gravity component of the XSizeHints structure was not zero."); + FAIL; + } else + CHECK; + + + XFree((char *) shints); + CHECKPASS(17); + +>>ASSERTION Good B 1 +When insufficient memory is available, then +a call to xname returns NULL. +>># Kieron Completed Review diff --git a/xts5/Xlib15/XAllocStandardColormap/XAllocStandardColormap.m b/xts5/Xlib15/XAllocStandardColormap/XAllocStandardColormap.m new file mode 100644 index 00000000..d0d3e1af --- /dev/null +++ b/xts5/Xlib15/XAllocStandardColormap/XAllocStandardColormap.m @@ -0,0 +1,199 @@ +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/Xlib15/XAllocStandardColormap/XAllocStandardColormap.m,v 1.2 2005-11-03 08:42:47 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XAllocStandardColormap/XAllocStandardColormap.m +>># +>># Description: +>># Tests for XAllocStandardColormap() +>># +>># Modifications: +>># $Log: allcstndrd.m,v $ +>># Revision 1.2 2005-11-03 08:42:47 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:20 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:33:48 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:55:37 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:11 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:43 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:08:52 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:10:27 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 XAllocStandardColormap Xlib15 +XStandardColormap * +XAllocStandardColormap() +>># +>># Added note to mention that the allocated structure can +>># be freed with XFree. +>># +>># Cal 29/05/91 +>>ASSERTION Good A +A call to xname allocates and returns a pointer to a +.S XStandardColormap +structure, which can be freed with +.S XFree +in which each component +is set to zero. +>>STRATEGY +Allocate a XStandardColormap using XAllocStandardColormap. +Verify that the function did not return NULL. +Verify that each component of the XStandardColormap structure was 0. +Release the allocated structure using XFree. +>>CODE +XStandardColormap *scmp = (XStandardColormap *) NULL; + + scmp = XAllocStandardColormap(); + + if(scmp == (XStandardColormap *) NULL) { + delete("%s() returned NULL.", TestName); + return; + } else + CHECK; + + if(scmp->colormap != (Colormap) 0) { + report("The colormap component of the XStandardColormap structure was non-zero."); + FAIL; + } else + CHECK; + + if(scmp->red_max != 0L) { + report("The red_max component of the XStandardColormap structure was non-zero."); + FAIL; + } else + CHECK; + + if(scmp->red_mult != 0L) { + report("The red_mult component of the XStandardColormap structure was non-zero."); + FAIL; + } else + CHECK; + + if(scmp->green_max != 0L) { + report("The green_max component of the XStandardColormap structure was non-zero."); + FAIL; + } else + CHECK; + + if(scmp->green_mult != 0L) { + report("The green_mult component of the XStandardColormap structure was non-zero."); + FAIL; + } else + CHECK; + + if(scmp->blue_max != 0L) { + report("The blue_max component of the XStandardColormap structure was non-zero."); + FAIL; + } else + CHECK; + + if(scmp->blue_mult != 0L) { + report("The blue_mult component of the XStandardColormap structure was non-zero."); + FAIL; + } else + CHECK; + + if(scmp->base_pixel != 0L) { + report("The base_pixel component of the XStandardColormap structure was non-zero."); + FAIL; + } else + CHECK; + + if(scmp->visualid != (VisualID) 0) { + report("The visualid component of the XStandardColormap structure was non-zero."); + FAIL; + } else + CHECK; + + if(scmp->killid != (XID) 0) { + report("The killid component of the XStandardColormap structure was non-zero."); + FAIL; + } else + CHECK; + + XFree((char*)scmp); + + CHECKPASS(11); + +>>ASSERTION Bad B 1 +When insufficient memory is available, then +a call to xname returns NULL. +>># Kieron Action Review diff --git a/xts5/Xlib15/XAllocWMHints/XAllocWMHints.m b/xts5/Xlib15/XAllocWMHints/XAllocWMHints.m new file mode 100644 index 00000000..9df171c1 --- /dev/null +++ b/xts5/Xlib15/XAllocWMHints/XAllocWMHints.m @@ -0,0 +1,186 @@ +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/Xlib15/XAllocWMHints/XAllocWMHints.m,v 1.2 2005-11-03 08:42:47 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XAllocWMHints/XAllocWMHints.m +>># +>># Description: +>># Tests for XAllocWMHints() +>># +>># Modifications: +>># $Log: allcwmhnts.m,v $ +>># Revision 1.2 2005-11-03 08:42:47 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:20 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:33:49 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:55:39 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:12 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:44 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:08:55 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:10: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 XAllocWMHints Xlib15 +XWMHints * +XAllocWMHints() +>>ASSERTION Good A +A call to xname allocates and returns a pointer to a +.S XWMHints +structure, which can be freed with XFree, +in which each component is set to zero. +>>STRATEGY +Allocate a XWMHints structure with XAllocWMHints. +Verify that the call did not return NULL. +Verify that each component of the allocated structure was set to 0. +Free the allocated structure using XFree. +>>CODE +XWMHints *hints; + + hints = XCALL; + + if(hints == (XWMHints *) NULL) { + delete("XAllocWMHints returned NULL."); + return; + } else + CHECK; + + if( hints->flags != 0L ) { + report("The flags component of the XWMHints structure was not 0."); + FAIL; + } else + CHECK; + + if( hints->input != (Bool) 0 ) { + report("The input component of the XWMHints structure was not 0."); + FAIL; + } else + CHECK; + + if( hints->initial_state != (int) 0 ) { + report("The initial_state component of the XWMHints structure was not 0."); + FAIL; + } else + CHECK; + + if( hints->icon_pixmap != (Pixmap) 0 ) { + report("The icon_pixmap component of the XWMHints structure was not 0."); + FAIL; + } else + CHECK; + + if( hints->icon_window != (Window) 0 ) { + report("The icon_window component of the XWMHints structure was not 0."); + FAIL; + } else + CHECK; + + if( hints->icon_x != (int) 0 ) { + report("The icon_x component of the XWMHints structure was not 0."); + FAIL; + } else + CHECK; + + if( hints->icon_y != (int) 0 ) { + report("The icon_y component of the XWMHints structure was not 0."); + FAIL; + } else + CHECK; + + if( hints->icon_mask != (Pixmap) 0 ) { + report("The icon_mask component of the XWMHints structure was not 0."); + FAIL; + } else + CHECK; + + if( hints->window_group != (XID) 0 ) { + report("The window_group component of the XWMHints structure was not 0."); + FAIL; + } else + CHECK; + + XFree((char*)hints); + + CHECKPASS(10); + +>>ASSERTION Bad B 1 +When insufficient memory is available, then +a call to xname returns NULL. +>># Completed Kieron Review diff --git a/xts5/Xlib15/XDefaultString/XDefaultString.m b/xts5/Xlib15/XDefaultString/XDefaultString.m new file mode 100644 index 00000000..d28f9401 --- /dev/null +++ b/xts5/Xlib15/XDefaultString/XDefaultString.m @@ -0,0 +1,220 @@ +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/Xlib15/XDefaultString/XDefaultString.m,v 1.1 2005-02-12 14:37:22 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/Xlib15/XDefaultString/XDefaultString.m +>># +>># Description: +>># Tests for XDefaultString() +>># +>># Modifications: +>># $Log: defstr.m,v $ +>># Revision 1.1 2005-02-12 14:37:22 anderson +>># Initial revision +>># +>># Revision 8.0 1998/12/23 23:34:11 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:56:22 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:31 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:22:04 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:09:51 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:12:02 andy +>># Prepare for GA Release +>># +>>AVSCODE +>>TITLE XDefaultString Xlib15 +void +XDefaultString() +>>EXTERN + +char *list[] = { "Xlib test string abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" } ; +int length_good = 79; + +Display *display_good; + +char *exec_file_name; +int x_init, + y_init, + w_init, + h_init; + +svcDefaultString(display) +Display *display ; +{ + 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; + char *ret_status ; + + int ss_status, /* save stat return status */ + stat_status, /* check stat return status */ + setup_status, + cleanup_status, + i1; + + regr_args.l_flags.bufrout = 1; + + /* buffer display struct info for error checking */ + bufrdisp(display_good); + + if (regr_args.l_flags.setup) + setup_status = REGR_NORMAL; + XSync(display_arg, 0); + + if (regr_args.l_flags.chksta == 1) + ss_status = save_stat(dpy_msk, gc_id, display_arg, + drawable_id); + + first_error = 0; /* no errors encountered yet */ + + errflg = 0; + XSetErrorHandler(signal_status); + + tet_infoline("TEST: XDefaultString returns default string for the"); + tet_infoline(" current locale"); + ret_status = XDefaultString(); + + XSync(display_arg, 0); + XSetErrorHandler(unexp_err); + /* 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, 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)) + { + if (ret_status == (char *)0) + { + tet_infoline("ERROR: XDefaultString failed"); + tet_infoline(" Expected non-NULL Received: NULL"); + errflg = 1 ; + tet_result(TET_FAIL); + } + } + XSync(display_arg, 0); + if (regr_args.l_flags.cleanup) + cleanup_status = REGR_NORMAL; + XSync(display_arg, 0); + if (errflg) + { + errcnt++; /* ...increment the error count */ + tet_result(TET_FAIL); + } + chkflg = 0; + regr_args.l_flags.bufrout = 0; + dumpbuf(); +} + + +>>ASSERTION Good C +If the implementation is X11R5 or later: +A call to +.B XDefaultString +shall return the default null terminated string used by Xlib +for text conversion in the current locale when an unconvertible character is +found during text conversion. The string return shall be the empty string ("") +if the characters are not missing. +>>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; + + estatus[0] = 1; + estatus[1] = Success; + + if ((regr_args.l_flags.good == 0) || + (estatus[1] == Success)) + { + tet_infoline("PREP: Set text list to XTextProperty structure"); + regr_args.l_flags.setup = 1; + regr_args.l_flags.cleanup = 1; + regr_args.l_flags.check = 1; + regr_args.l_flags.chksta = 1; + { + XTextProperty text_prop ; + int count = 1; + + XmbTextListToTextProperty( + display_good, list, + count, (XICCEncodingStyle)XStdICCTextStyle, + &text_prop + ); + + svcDefaultString(display_good) ; + } + } + tet_result(TET_PASS); +#else + tet_infoline("INFO: Implementation not X11R5 or greater"); + tet_result(TET_UNSUPPORTED); +#endif diff --git a/xts5/Xlib15/XFetchName/XFetchName.m b/xts5/Xlib15/XFetchName/XFetchName.m new file mode 100644 index 00000000..da59b6c4 --- /dev/null +++ b/xts5/Xlib15/XFetchName/XFetchName.m @@ -0,0 +1,262 @@ +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/Xlib15/XFetchName/XFetchName.m,v 1.2 2005-11-03 08:42:48 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XFetchName/XFetchName.m +>># +>># Description: +>># Tests for XFetchName() +>># +>># Modifications: +>># $Log: ftchnm.m,v $ +>># Revision 1.2 2005-11-03 08:42:48 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:20 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:33:50 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:55:41 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:12 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:45 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:28:45 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:08:57 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:10: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 XFetchName Xlib15 +Status +XFetchName(display, w, window_return_name) +Display *display = Dsp; +Window w = DRW(display); +char **window_return_name = &winname; +>>EXTERN +#include "X11/Xatom.h" +char *winname = "XtestJunkName"; +>>ASSERTION Good A +When the WM_NAME property has been set for the +window specified by the +.A w +argument and has type +.S STRING +and format 8, then a call to xname returns in the +.A window_name_return +argument, which can be freed with XFree, the null-terminated +name of the window, and returns non-zero. +>>STRATEGY +Create a window with XCreateWindow +Set the name of the window to XtestWindowName with XStoreName +Obtain the name of the window with XFetchName +Verify that the returned name is the one that was set. +Release the allocated name using XFree. +>>CODE +Status status; +Window win; +XVisualInfo *vp; +char *wname = "XtestWindowName"; +char *wnameret; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + XStoreName(display, win, wname); + + w = win; + window_return_name = &wnameret; + status = XCALL; + + if(status == 0) { + report("XFetchName() returned 0"); + FAIL; + } else + CHECK; + + if(strcmp(wname, (wnameret != NULL) ? wnameret : "NULL") != 0) { + report("Window name was \"%s\" instead of \"%s\".", wnameret, wname); + FAIL; + } else + CHECK; + + if (wnameret != NULL) + XFree(wnameret); + + CHECKPASS(2); + +>>ASSERTION Good A +When the WM_NAME property has not been set for the window specified by the +.A w +argument, or has format other than 8 or has type other than +.S STRING , +then a call to xname +sets the +.A window_name_return +argument to NULL, and returns zero. +>>STRATEGY +Create a window with XCreateWindow. +Obtain the value of the WM_NAME property with XFetchName. +Verify that the call returned zero. +Verify that the returned name was set to NULL. + +Create a window with XCreateWindow. +Set the WM_NAME property with format 32 and type STRING using XChangeProperty. +Obtain the value of the WM_NAME property with XFetchName. +Verify that the call returned zero. +Verify that the returned name was set to NULL. + +Create a window with XCreateWindow. +Set the WM_NAME property with format 8 type ATOM using XChangeProperty. +Obtain the value of the WM_NAME property with XFetchName. +Verify that the call returned zero. +Verify that the returned name was set to NULL. + +>>CODE +Status status; +Window win; +XVisualInfo *vp; +char *name = "XTWindowName"; +char *wnameret; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + +/* property unset */ + w = win; + window_return_name = &wnameret; + status = XCALL; + + + if(status != 0) { + report("XFetchName() did not return 0 when the WM_NAME property was not set."); + FAIL; + } else + CHECK; + + if(wnameret != NULL) { + report("Window name was \"%s\" instead of NULL when the WM_NAME property was not set.", wnameret); + FAIL; + } else + CHECK; + + win = makewin(display, vp); +/* format wrong */ + XChangeProperty(display, win, XA_WM_NAME, XA_STRING, 32, PropModeReplace, (unsigned char *) name, strlen(name)); + w = win; + window_return_name = &wnameret; + status = XCALL; + + if(status != 0) { + report("XFetchName() did not return 0 when the WM_NAME property format was 32."); + FAIL; + } else + CHECK; + + if(wnameret != NULL) { + report("Window name was \"%s\" instead of NULL when the WM_NAME property format was 32.", wnameret); + FAIL; + } else + CHECK; + + + win = makewin(display, vp); +/* type wrong */ + XChangeProperty(display, win, XA_WM_NAME, XA_ATOM, 8, PropModeReplace, (unsigned char *) name, strlen(name)); + w = win; + window_return_name = &wnameret; + status = XCALL; + + if(status != 0) { + report("XFetchName() did not return 0 when the WM_NAME property type was ATOM."); + FAIL; + } else + CHECK; + + if(wnameret != NULL) { + report("Window name was \"%s\" instead of NULL when the WM_NAME property type was ATOM.", wnameret); + FAIL; + } else + CHECK; + + CHECKPASS(6); + +>>ASSERTION Bad A +.ER BadWindow +>># Kieron Completed Review. diff --git a/xts5/Xlib15/XFreeStringList/XFreeStringList.m b/xts5/Xlib15/XFreeStringList/XFreeStringList.m new file mode 100644 index 00000000..9a0fe233 --- /dev/null +++ b/xts5/Xlib15/XFreeStringList/XFreeStringList.m @@ -0,0 +1,165 @@ +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/Xlib15/XFreeStringList/XFreeStringList.m,v 1.2 2005-11-03 08:42:48 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XFreeStringList/XFreeStringList.m +>># +>># Description: +>># Tests for XFreeStringList() +>># +>># Modifications: +>># $Log: frstrlst.m,v $ +>># Revision 1.2 2005-11-03 08:42:48 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:20 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:33:49 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:55:40 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:12 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:44 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:08:56 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:10:33 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 XFreeStringList Xlib15 +void +XFreeStringList(list) +char **list = (char **) NULL; +>>ASSERTION Good A +A call to xname frees the memory allocated by a call to +.S XTextPropertyToStringList +or +.S XGetCommand . +>>STRATEGY +Create a window using XCreateWindow. +Allocate a text property structure using XStringListToTextProperty. +Set the WM_COMMAND property using XSetCommand. +Obtain the value of the WM_COMMAND property using XGetCommand. +Obtain the strings from the XTextPropertyStructure using XTextPropertyToStringlist. +Release the memory allocated in the call to XGetCommand. +Release the memory allocated in the call to XTextPropertyToStringList. +>>CODE +char *str1 = "TestString1"; +char *str2 = "TestString2"; +char *str3 = "TestString3"; +int argc = 3; +char *argv[3]; +int rargc; +int rargc1; +char **rargv = (char **) NULL; +char **rargv1 = (char **) NULL; +Window w; +XVisualInfo *vp; +XTextProperty tp; + + argv[0] = str1; + argv[1] = str2; + argv[2] = str3; + + + if( XStringListToTextProperty(argv, 3, &tp) == 0) { + delete("XStringListToTextProperty() returned zero."); + return; + } else + CHECK; + + if( XTextPropertyToStringList(&tp, &rargv, &rargc) == 0) { + delete("XTextPropertyToStringList() returned zero."); + return; + } else + CHECK; + + XFree((char*)tp.value); + resetvinf(VI_WIN); + nextvinf(&vp); + w = makewin(Dsp, vp); + + XSetCommand(Dsp, w, argv, argc); + + if(XGetCommand(Dsp, w, &rargv1, &rargc) == 0 ) { + delete("XGetCommand() returned zero."); + return; + } else + CHECK; + + XFreeStringList(rargv1); + XFreeStringList(rargv); + + CHECKPASS(3); diff --git a/xts5/Xlib15/XGetClassHint/XGetClassHint.m b/xts5/Xlib15/XGetClassHint/XGetClassHint.m new file mode 100644 index 00000000..9bb39cb7 --- /dev/null +++ b/xts5/Xlib15/XGetClassHint/XGetClassHint.m @@ -0,0 +1,275 @@ +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/Xlib15/XGetClassHint/XGetClassHint.m,v 1.2 2005-11-03 08:42:48 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XGetClassHint/XGetClassHint.m +>># +>># Description: +>># Tests for XGetClassHint() +>># +>># Modifications: +>># $Log: gtclsshnt.m,v $ +>># Revision 1.2 2005-11-03 08:42:48 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:20 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:33:50 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:55:42 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:13 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:45 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:28:45 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:08:58 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:10:37 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 XGetClassHint Xlib15 +Status +XGetClassHint(display, w, class_hints_return) +Display *display = Dsp; +Window w = DRW(Dsp); +XClassHint *class_hints_return = &chints; +>>EXTERN +#include "X11/Xatom.h" +XClassHint chints; +XClassHint chints_ret = { "<Unset String>", "<UnsetString>" }; +>>ASSERTION Good A +When the WM_CLASS property is set for the window +.A w , +and has format 8 and type +.S STRING , +then a call to xname returns the class hint, which can be freed +with XFree, in the +.S XClassHint +structure named by the +.A class_hints_return +argument and returns non-zero. +>>STRATEGY +Create a window using XCreateWindow. +Set the WM_CLASS property using XSetClassHint. +Obtain the WM_CLASS property value with XGetWindowProperty. +Verify that the returned values are correct. +Release the allocated hints using XFree. +>>CODE +char *s; +Window win; +Status status; +XVisualInfo *vp; +XClassHint chints; + + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + chints.res_name = "Xtest_res_name"; + chints.res_class = "Xtest_res_class"; + + XSetClassHint(display, win, &chints); + + w = win; + class_hints_return = &chints_ret; + status = XCALL; + + if(status == False) { + report("XGetClassHint() returned False."); + FAIL; + } else + CHECK; + + if( strcmp((s=chints_ret.res_name), chints.res_name) != 0) { + report("The res_name component of the XClassHint structure was \"%s\" instead of %s.", + s == (char *)NULL ? "NULL" : s, + chints.res_name); + FAIL; + } else + CHECK; + + if(strcmp((s=chints_ret.res_class), chints.res_class) != 0) { + report("The res_class component of the XClassHint structure was \"%s\" instead of %s.", + s == (char *)NULL ? "NULL" : s, + chints.res_class); + FAIL; + } else + CHECK; + + + XFree(chints_ret.res_name); + XFree(chints_ret.res_class); + + CHECKPASS(3); + +>>ASSERTION Good A +When the WM_CLASS property is not set for the window +.A w , +or has a format other than 8 or a type other than +.S STRING , +then a call to xname returns zero. +>>STRATEGY +Create a window with XCreateWindow. +Obtain the value of the WM_CLASS property with XGetClassHint. +Verify that the call returned zero. + +Create a window with XCreateWindow. +Set the WM_CLASS property with format 16 and type STRING using XChangeProperty. +Obtain the value of the WM_CLASS property with XGetClassHint. +Verify that the call returned zero. + +Create a window with XCreateWindow. +Set the WM_CLASS property with format 8 type ATOM using XChangeProperty. +Obtain the value of the WM_CLASS property with XGetClassHint. +Verify that the call returned zero. + +>>CODE +Status status; +XVisualInfo *vp; +char *s1 = "XTestResName"; +char *s2 = "XTestResClass"; +unsigned lenname, lenclass; +char *hints, *hp; +XClassHint chints_ret; + + + resetvinf(VI_WIN); + nextvinf(&vp); + w = makewin(display, vp); + +/* property not set */ + if( (char *) (hints = malloc( (unsigned int) ((unsigned)2 + (lenname = strlen(s1)) + (lenclass = strlen(s2)))) ) == (char *) 0) { + delete("malloc() failed."); + return; + } else + CHECK; + + hp = hints; + strcpy( hp, s1); + hp += lenname + 1; + strcpy( hp, s2); + + class_hints_return = &chints_ret; + status = XCALL; + + if(status != False) { + report("XGetClassHint() did not return False with the WM_CLASS property unset."); + FAIL; + } else + CHECK; + +/* format not 8 */ + + w = makewin(display, vp); + + XChangeProperty(display, w, XA_WM_CLASS, XA_STRING, 16, + PropModeReplace, (unsigned char *) &hints, 2 + lenclass +lenname); + + class_hints_return = &chints_ret; + status = XCALL; + + if(status != False) { + report("XGetClassHint() did not return False with the WM_CLASS property format set to 16."); + FAIL; + } else + CHECK; + + +/* type wrong */ + + w = makewin(display, vp); + + XChangeProperty(display, w, XA_WM_CLASS, XA_ATOM, 8, + PropModeReplace, (unsigned char *) &hints, 2 + lenclass + lenname); + + class_hints_return = &chints_ret; + status = XCALL; + + if(status != False) { + report("XGetClassHint() did not return False with the WM_CLASS property type set to Atom."); + FAIL; + } else + CHECK; + + free(hints); + + CHECKPASS(4); + +>>ASSERTION Bad A +.ER BadWindow +>># Kieron Action Review diff --git a/xts5/Xlib15/XGetCommand/XGetCommand.m b/xts5/Xlib15/XGetCommand/XGetCommand.m new file mode 100644 index 00000000..9e1755cf --- /dev/null +++ b/xts5/Xlib15/XGetCommand/XGetCommand.m @@ -0,0 +1,276 @@ +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/Xlib15/XGetCommand/XGetCommand.m,v 1.2 2005-11-03 08:42:48 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XGetCommand/XGetCommand.m +>># +>># Description: +>># Tests for XGetCommand() +>># +>># Modifications: +>># $Log: gtcmmnd.m,v $ +>># Revision 1.2 2005-11-03 08:42:48 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:20 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:33:51 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:55:44 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:13 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:46 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:28:46 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:00 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:10:40 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 XGetCommand Xlib15 +Status +XGetCommand(display, w, argv_return, argc_return) +Display *display = Dsp; +Window w = DRW(Dsp); +char ***argv_return = &argvdef; +int *argc_return = &argcdef; +>>EXTERN +#include "X11/Xatom.h" +char **argvdef; +int argcdef; +>>ASSERTION Good A +When the WM_COMMAND property is set for the window +.A w , +is of +.M type +STRING, and is of +.M format +8, then a call to xname returns the property string list, +which can be freed with XFree, +in the +.A argv_return +argument and the number of strings in the +.A argc_return +argument and returns non-zero. +>>STRATEGY +Set the WM_COMMAND property using XSetCommand. +Obtain the value of the WM_COMMAND property using XGetCommand. +Verify that the call did not return zero. +Verify that the number and value of the returned strings is correct. +>>CODE +XVisualInfo *vp; +Status status; +char *nullstr = "<NULL>"; +char **strpp, *strp; +char *str1 = "XTest string 1____"; +char *str2 = "XTest string 2__"; +char *str3 = "XTest string 3___"; +int nstrs = 3; +char *prop[3]; +char **rstrings = (char**) NULL; +int rcount = 0; +int i; + + prop[0] = str1; + prop[1] = str2; + prop[2] = str3; + + resetvinf(VI_WIN); + nextvinf(&vp); + w = makewin(display, vp); + + XSetCommand(display, w, prop, nstrs); + + argv_return = &rstrings; + argc_return = &rcount; + status = XCALL; + + if(status == False) { + delete("XGetCommand() returned False."); + return; + } else + CHECK; + + if(rstrings == (char **) NULL) { + report("Returned list of strings was NULL"); + FAIL; + } else { + CHECK; + + if(rcount != nstrs) { + report("%d strings were returned instead of %d", rcount, nstrs); + FAIL; + } else { + CHECK; + + for(i=0, strpp = rstrings; i< nstrs; i++, strpp++) { + strp = (*strpp == NULL ? nullstr : *strpp); + + if(strcmp(strp, prop[i]) != 0) { + report("String %d was \"%s\" instead of \"%s\"", i, strp, prop[i]); + FAIL; + } else + CHECK; + } + + } + XFreeStringList(rstrings); + } + + CHECKPASS(nstrs + 3); + +>>ASSERTION Good A +When the WM_COMMAND property is not set for the window +.A w , +or is not of +.M type +STRING, or is not of +.M format +8, then a call to xname returns zero. +>>STRATEGY +Create a window with XCreateWindow. +Obtain the value of the unset WM_ICON_SIZES property using XGetCommand. +Verify that the function returned zero. + +Create a window with XCreateWindow. +Set the WM_COMMAND property to have format 16 type STRING using XChangeProperty. +Obtain the value of the WM_COMMAND property using XGetCommand. +Verify that the call returned zero + +Create a window with XCreateWindow. +Set the WM_COMMAND property to have format 8 and type ATOM using XChangeProperty. +Obtain the value of the WM_COMMAND property using XGetCommand. +Verify that the call returned zero. +>>CODE +Status status; +char *s = "XTestString1"; +XVisualInfo *vp; +char **rstrings = (char **) NULL; +int rcount = 0; + + resetvinf(VI_WIN); + nextvinf(&vp); + argv_return = &rstrings; + argc_return = &rcount; + + w = makewin(display, vp); + +/* unset property */ + + status = XCALL; + + if(status != False) { + report("%s() did not return False when the property was unset.", TestName); + FAIL; + } else + CHECK; + + + w = makewin(display, vp); + +/* format 16 */ + XChangeProperty(display, w, XA_WM_COMMAND, XA_STRING, 16, PropModeReplace, (unsigned char *) s, strlen(s) ); + + status = XCALL; + + if(status != False) { + report("%s() did not return False when property was of format 16.", TestName); + FAIL; + } else + CHECK; + + + w = makewin(display, vp); + +/* type ATOM */ + XChangeProperty(display, w, XA_WM_COMMAND, XA_ATOM, 8, PropModeReplace, (unsigned char *) s, strlen(s) ); + + status = XCALL; + + if(status != False) { + report("%s() did not return False when property was of type Atom.", TestName); + FAIL; + } else + CHECK; + + + CHECKPASS(3); + +>>ASSERTION Bad B 1 +When insufficient memory is available to contain the string list, +then a call to xname returns a zero status. +>># Kieron Completed Review diff --git a/xts5/Xlib15/XGetIconName/XGetIconName.m b/xts5/Xlib15/XGetIconName/XGetIconName.m new file mode 100644 index 00000000..e97a2c86 --- /dev/null +++ b/xts5/Xlib15/XGetIconName/XGetIconName.m @@ -0,0 +1,266 @@ +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/Xlib15/XGetIconName/XGetIconName.m,v 1.2 2005-11-03 08:42:48 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XGetIconName/XGetIconName.m +>># +>># Description: +>># Tests for XGetIconName() +>># +>># Modifications: +>># $Log: gticnnm.m,v $ +>># Revision 1.2 2005-11-03 08:42:48 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:20 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:33:51 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:55:44 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:14 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:46 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:28:47 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:01 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:10: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 XGetIconName Xlib15 +Status +XGetIconName(display, w, icon_name_return) +Display *display = Dsp; +Window w = DRW(Dsp); +char **icon_name_return = &iconname; +>>EXTERN +#include "X11/Xatom.h" +char *iconname = "XtestIC"; +>>ASSERTION Good A +When the +.S WM_ICON_NAME +property for the window +.A w +has been set, +and has format 8 and type +.S STRING , +then a call to xname returns that name, which can +be freed with XFree, in the +.A icon_name_return +argument and returns non-zero. +>>STRATEGY +Create a window with XCreateWindow. +Set the icon name for the window with XSetIconName. +Obtain the icon name with XGetIconName. +Verify that the returned name is that which was set. +Realease the allocated memory using XFree. +>>CODE +Window win; +char *iconname = "Xtest Icon Name"; +char *iconnameret; +Status status; +char **list_return; +int count_return; +XTextProperty tp, rtp; +XVisualInfo *vp; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + XSetIconName(display, win, iconname); + + w = win; + icon_name_return = &iconnameret; + status = XCALL; + + if(status == False) { + report("XGetIconName() returned False."); + FAIL; + } else + CHECK; + + if(strcmp(iconname, (iconnameret != NULL) ? iconnameret : "NULL") != 0) { + report("XGetIconName() returned \"%s\" instead of \"%s\"", iconnameret, iconname); + FAIL; + } else + CHECK; + + if(iconnameret != NULL) + XFree(iconnameret); + + CHECKPASS(2); + +>>ASSERTION Good A +When the +.S WM_ICON_NAME +property for the window +.A w +has not been set, +or has format other than 8 or type other than +.S STRING , +then a call to xname sets the string in the +.A icon_name_return +argument to NULL and returns zero. +>>STRATEGY +Create a window with XCreateWindow. +Obtain the value of the WM_ICON_NAME property with XGetIconName. +Verify that the call returned zero. +Verify that the returned name was set to NULL. + +Create a window with XCreateWindow. +Set the WM_ICON_NAME property with format 16 and type STRING using XChangeProperty. +Obtain the value of the WM_ICON_NAME property with XGetIconName. +Verify that the call returned zero. +Verify that the returned name was set to NULL. + +Create a window with XCreateWindow. +Set the WM_ICON_NAME property with format 8 type ATOM using XChangeProperty. +Obtain the value of the WM_ICON_NAME property with XGetIconName. +Verify that the call returned zero. +Verify that the returned name was set to NULL. + +>>CODE +char *iconnameret = "XTestUninit"; +char *name = "XTestIconName"; +Status status; +char **list_return; +int count_return; +XVisualInfo *vp; + + resetvinf(VI_WIN); + nextvinf(&vp); + w = makewin(display, vp); + +/* Property unset */ + + icon_name_return = &iconnameret; + status = XCALL; + + if(status != False) { + report("XGetIconName() did not return False when the WM_ICON_NAME property was unset."); + FAIL; + } else + CHECK; + + if( iconnameret != NULL) { + report("XGetIconName() returned \"%s\" instead of NULL when the WM_ICON_NAME was unset.", iconnameret); + FAIL; + } else + CHECK; + + w = makewin(display, vp); + +/* format 16 */ + XChangeProperty(display, w, XA_WM_ICON_NAME, XA_STRING, 16, PropModeReplace, (unsigned char *) name, strlen(name)); + + status = XCALL; + + if(status != False) { + report("XGetIconName() did not return False when the WM_ICON_NAME property format was 16."); + FAIL; + } else + CHECK; + + if( iconnameret != NULL) { + report("XGetIconName() returned \"%s\" instead of NULL when the WM_ICON_NAME property format was 16.", iconnameret); + FAIL; + } else + CHECK; + + w = makewin(display, vp); +/* type XA_ATOM */ + XChangeProperty(display, w, XA_WM_ICON_NAME, XA_ATOM, 8, PropModeReplace, (unsigned char *) name, strlen(name)); + status = XCALL; + + if(status != False) { + report("XGetIconName() did not return False when the WM_ICON_NAME property type was ATOM."); + FAIL; + } else + CHECK; + + if( iconnameret != NULL) { + report("XGetIconName() returned \"%s\" instead of NULL when the WM_ICON_NAME property type was ATOM", iconnameret); + FAIL; + } else + CHECK; + + CHECKPASS(6); + +>>ASSERTION Bad A +.ER BadWindow +>># Action Completed Review diff --git a/xts5/Xlib15/XGetIconSizes/XGetIconSizes.m b/xts5/Xlib15/XGetIconSizes/XGetIconSizes.m new file mode 100644 index 00000000..9579fec0 --- /dev/null +++ b/xts5/Xlib15/XGetIconSizes/XGetIconSizes.m @@ -0,0 +1,318 @@ +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/Xlib15/XGetIconSizes/XGetIconSizes.m,v 1.2 2005-11-03 08:42:48 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XGetIconSizes/XGetIconSizes.m +>># +>># Description: +>># Tests for XGetIconSizes() +>># +>># Modifications: +>># $Log: gticnszs.m,v $ +>># Revision 1.2 2005-11-03 08:42:48 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:20 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:33:52 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:55:45 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:14 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:47 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:28:47 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:02 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:10:44 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 XGetIconSizes Xlib15 +Status +XGetIconSizes(display, w, size_list_return, count_return) +Display *display = Dsp; +Window w = DRW(Dsp); +XIconSize **size_list_return = &icnszp; +int *count_return = &countret; +>>EXTERN +#include "X11/Xatom.h" +#define NumPropIconSizeElements 6 +XIconSize *icnszp; +int countret; +>>ASSERTION Good A +When the WM_ICON_SIZES property has been set for the window +.A w , +and has format 32, a value which is a multiple of 6 elements and type +.S WM_ICON_SIZE , +then a call to xname returns a list of +.S XIconSize +structures, which can be freed with XFree, in the +.A size_list_return +argument and the number of structures in the +.A count_return +argument and returns non-zero. +>>STRATEGY +Create a window using XCreateWindow. +Set the WM_ICON_SIZES property using XSetIconSizes. +Obtain the WM_ICON_SIZES property using XGetIconSizes. +Verify that the call did not return False. +Verify that the property value is correct. +Release the allocated memory using XFree. +>>CODE +Status status; +XVisualInfo *vp; +int i; +int v; +XIconSize sizelist[5]; +int count = 5; +int rcount; +XIconSize *sp = (XIconSize *) NULL, *sref; + + + resetvinf(VI_WIN); + nextvinf(&vp); + w = makewin(display, vp); + + for(i=0, sp=sizelist, v=0; i<count; i++, sp++) { + sp->min_width = v++; + sp->min_height = v++; + sp->max_width = v++; + sp->max_height = v++; + sp->width_inc = v++; + sp->height_inc = v++; + } + + XSetIconSizes(display, w, sizelist, count); + + size_list_return = &sp; + count_return = &rcount; + + status = XCALL; + + if(status == False) { + report("%s() returned False.", TestName); + FAIL; + } else + CHECK; + + if( sp == (XIconSize *) NULL) { + report("No value was set for the WM_ICON_SIZES property."); + FAIL; + } else { + + CHECK; + if( rcount != count ) { + report("%s() returned %d elements instead of %d.", TestName, rcount, count); + FAIL; + } else { + for(i=0, sref=sp, v=0; i<count; i++, sref++) { + + if( sref->min_width != v++ ) { + report("The min_width component of XIconSize structure %d was %d instead of %d.", i, sref->min_width, v-1); + FAIL; + } else + CHECK; + + if( sref->min_height != v++ ) { + report("The min_height component of XIconSize structure %d was %d instead of %d.", i, sref->min_height, v-1); + FAIL; + } else + CHECK; + + if( sref->max_width != v++ ) { + report("The max_width component of XIconSize structure %d was %d instead of %d.", i, sref->max_width, v-1); + FAIL; + } else + CHECK; + + if( sref->max_height != v++ ) { + report("The max_height component of XIconSize structure %d was %d instead of %d.", i, sref->max_height, v-1); + FAIL; + } else + CHECK; + + if( sref->width_inc != v++ ) { + report("The width_inc component of XIconSize structure %d was %d instead of %d.", i, sref->width_inc, v-1); + FAIL; + } else + CHECK; + + if( sref->height_inc != v++ ) { + report("The height_inc component of XIconSize structure %d was %d instead of %d.", i, sref->height_inc, v-1); + FAIL; + } else + CHECK; + + } + } + XFree((char *)sp); + } + + CHECKPASS(6*count+2); + +>>ASSERTION Good A +When the WM_ICON_SIZE property is not set for the window +.A w , +or has format other than 32, a value which is not a multiple of 6 elements +or type other than WM_ICON_SIZE, +then a call +to xname returns zero. +>>STRATEGY +Create a window with XCreateWindow. +Obtain the value of the unset WM_ICON_SIZES property using XGetIconSizes. +Verify that the function returned zero. + +Create a window with XCreateWindow. +Set the WM_ICON_SIZES property to have format 16 size 6 elements and type WM_ICON_SIZE using XChangeProperty. +Obtain the value of the WM_ICON_SIZES property using XGetIconSizes. +Verify that the call returned zero + +Create a window with XCreateWindow. +Set the WM_ICON_SIZES property to have format 32 size 13 elements and type WM_ICON_SIZE using XChangeProperty. +Obtain the value of the WM_ICON_SIZES property using XGetIconSizes. +Verify that the call returned zero + +Create a window with XCreateWindow. +Set the WM_ICON_SIZES property to have format 32 size 6 elements and type WM_SIZE_HINTS using XChangeProperty. +Obtain the value of the WM_ICON_SIZES property using XGetIconSizes. +Verify that the call returned zero + +>>CODE +Status status; +XVisualInfo *vp; +XIconSize *slp = (XIconSize *) NULL; +int cret; +int count = 3; +XIconSize sl[3]; + + resetvinf(VI_WIN); + nextvinf(&vp); + size_list_return = &slp; + count_return = &cret; + + w = makewin(display, vp); +/* unset property */ + + status = XCALL; + + if(status != False) { + report("%s() did not return False when the property was unset.", TestName); + FAIL; + } else + CHECK; + + w = makewin(display, vp); +/* format 16 */ + XChangeProperty(display, w, XA_WM_ICON_SIZE, XA_WM_ICON_SIZE, 16, PropModeReplace, (unsigned char *) sl, count*NumPropIconSizeElements); + + status = XCALL; + + if(status != False) { + report("%s() did not return False when the property format was 16.", TestName); + FAIL; + } else + CHECK; + + w = makewin(display, vp); +/* size 13 */ + XChangeProperty(display, w, XA_WM_ICON_SIZE, XA_WM_ICON_SIZE, 32, PropModeReplace, (unsigned char *) sl, NumPropIconSizeElements*2 + 1); + + status = XCALL; + + if(status != False) { + report("%s() did not return False when the number of elements was 13.", TestName); + FAIL; + } else + CHECK; + + w = makewin(display, vp); +/* type WM_SIZE_HINTS */ + XChangeProperty(display, w, XA_WM_ICON_SIZE, XA_WM_SIZE_HINTS, 32, PropModeReplace, (unsigned char *) sl, count*NumPropIconSizeElements); + + status = XCALL; + + if(status != False) { + report("%s() did not return False when the property type was WM_SIZE_HINTS.", TestName); + FAIL; + } else + CHECK; + + CHECKPASS(4); + +>>ASSERTION Bad A +.ER BadWindow +>># Kieron Action Review diff --git a/xts5/Xlib15/XGetRGBColormaps/XGetRGBColormaps.m b/xts5/Xlib15/XGetRGBColormaps/XGetRGBColormaps.m new file mode 100644 index 00000000..49af0e5d --- /dev/null +++ b/xts5/Xlib15/XGetRGBColormaps/XGetRGBColormaps.m @@ -0,0 +1,549 @@ +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/Xlib15/XGetRGBColormaps/XGetRGBColormaps.m,v 1.2 2005-11-03 08:42:48 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XGetRGBColormaps/XGetRGBColormaps.m +>># +>># Description: +>># Tests for XGetRGBColormaps() +>># +>># Modifications: +>># $Log: gtrgbclrmp.m,v $ +>># Revision 1.2 2005-11-03 08:42:48 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:20 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:33:53 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:55:46 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:15 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:47 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:28:48 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:04 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:10: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 XGetRGBColormaps Xlib15 +Status +XGetWMColormaps(display, w, std_colormap_return, count_return, property) +Display *display = Dsp; +Window w = DRW(Dsp); +XStandardColormap **std_colormap_return = &scolormap; +int *count_return = &cntret; +Atom property = XA_ATOM; +>>EXTERN + +#include "X11/Xatom.h" +static XStandardColormap *scolormap; +static int cntret; +static XStandardColormap scmp1 = { (Colormap) 1, 2L, 3L, 4L, 5L, 6L, 7L, 8L, (VisualID) -1, (XID) -2 }; +static XStandardColormap scmp2 = { (Colormap) 11, 12L, 13L, 14L, 15L, 16L, 17L, 18L, (VisualID) 19, (XID) 20 }; +static XStandardColormap scmp3 = { (Colormap) 21, 22L, 23L, 24L, 25L, 26L, 27L, 28L, (VisualID) 21, (XID) 22 }; + +>># +>># COMMENT: +>># This assertion does not match the Xlib code. +>># I think it maybe ought to read 8 * n or 9 * n or 10 * n elements +>># for positive integer n. +>># Until the review period has expired this test will avoid the +>># problem. +>># +>># Note also that a list of colormaps that are not all of 10 +>># elements in size will definitely fail with the current +>># Xlib. Hence Only single non-ICCCCCCCCCM structures can be +>># obtained from the server without failure. +>># +>># Cal 29/05/91 +>># +>>ASSERTION Good A +When the property named by the +.A property +argument is set on the window named by the +.A w +argument, is of +.M type +RGB_COLOR_MAP, is of +.M format +32, and is of length n1*8 + n2*9 + n3*10 elements (where n1,n2,n3 \(>= 0 and +n1+n2+n3 \(>= 1), then +a call to xname returns in the +.A std_colormap_return +argument the RBG colormap definitions, which can be freed with XFree, +and in +.A count_return +the number of structures and returns non-zero. +>>STRATEGY +Create a window using XCreateWindow. +Set the RGB_DEFAULT_MAP property using XSetRGBColormaps. +Obtain the value of the RGB_DEFAULT_MAP property using XGetRGBColormaps. +Verify that the call did not return False. +Verify that the value was correct. +Free the allocated memory using XFree. +>>CODE +Status status; +int ncmp = 3; +XStandardColormap scmp[3]; +XStandardColormap *rscmp = (XStandardColormap *) NULL; +XStandardColormap *cmpp; +int rncmp = 0; +int i; +XVisualInfo *vp; +Atom prop = XA_RGB_DEFAULT_MAP; + + scmp[0] = scmp1; + scmp[1] = scmp2; + scmp[2] = scmp3; + + resetvinf(VI_WIN); + nextvinf(&vp); + + w = makewin(display, vp); + XSetRGBColormaps(display, w, scmp, ncmp, prop); + + std_colormap_return = &rscmp; + count_return = &rncmp; + property = prop; + status = XCALL; + + if(status == False) { + delete("%s returned False.", TestName); + return; + } else + CHECK; + + if(rscmp == (XStandardColormap *) NULL) { + report("The returned list of XStandardColormap structures was NULL."); + FAIL; + } else { + + CHECK; + if( rncmp != ncmp) { + report("%d XStandardColormap structures were returned instead of %d.", rncmp, ncmp); + FAIL; + } else { + + CHECK; + + for(i = 0, cmpp = rscmp; i < ncmp; i++, cmpp++) { + + if(cmpp->colormap != scmp[i].colormap) { + report("The colormap component of the XStandardColormap structure %d was incorrect.", i); + FAIL; + } else + CHECK; + + if(cmpp->red_max != scmp[i].red_max) { + report("The red_max component of the XStandardColormap structure %d was incorrect.", i); + FAIL; + } else + CHECK; + + if(cmpp->red_mult != scmp[i].red_mult) { + report("The red_mult component of the XStandardColormap structure %d was incorrect.", i); + FAIL; + } else + CHECK; + + if(cmpp->green_max !=scmp[i].green_max) { + report("The green_max component of the XStandardColormap structure %d was incorrect.", i); + FAIL; + } else + CHECK; + + if(cmpp->green_mult != scmp[i].green_mult) { + report("The green_mult component of the XStandardColormap structure %d was incorrect.", i); + FAIL; + } else + CHECK; + + if(cmpp->blue_max != scmp[i].blue_max) { + report("The blue_max component of the XStandardColormap structure %d was incorrect.", i); + FAIL; + } else + CHECK; + + if(cmpp->blue_mult != scmp[i].blue_mult) { + report("The blue_mult component of the XStandardColormap structure %d was incorrect.", i); + FAIL; + } else + CHECK; + + if(cmpp->base_pixel != scmp[i].base_pixel) { + report("The base_pixel component of the XStandardColormap structure %d was incorrect.", i); + FAIL; + } else + CHECK; + + if(cmpp->visualid != scmp[i].visualid) { + report("The visualid component of the XStandardColormap structure %d was incorrect.", i); + FAIL; + } else + CHECK; + + if(cmpp->killid != scmp[i].killid ) { + report("The killid component of the XStandardColormap structure %d was incorrect.", i); + FAIL; + } else + CHECK; + + } + } + XFree((char*)rscmp); + } + + CHECKPASS(ncmp * 10 + 3); + +>># +>># COMMENT: +>># See above COMMENT +>># +>>ASSERTION Good A +When the property named by the +.A property +argument is not set on the window named by the +.A w +argument, or is not of +.M type +RGB_COLOR_MAP, or is not of +.M format +32, or is not +of length n1*8 + n2*9 + n3*10 elements (where n1,n2,n3 \(>= 0 and +n1+n2+n3 \(>= 1), then +a call to xname does not set the +.A std_colormap_return +or +.A count_return +arguments and returns zero. +>>STRATEGY +Create a window with XCreateWindow. +Obtain the value of the unset RGB_COLOR_MAP property using XGetRGBColormaps. +Verify that the call returned False. +Verify that the std_colormap_return argument was not changed. +Verify that the count_return argument was not changed. + +Create a window with XCreateWindow. +Set the RGB_COLOR_MAP property to have format 8. +Obtain the value of the RGB_COLOR_MAP property using XGetRGBColormaps. +Verify that the call returned False. +Verify that the std_colormap_return argument was not changed. +Verify that the count_return argument was not changed. + +Create a window with XCreateWindow. +Set the RGB_COLOR_MAP property to have type ATOM. +Obtain the value of the RGB_COLOR_MAP property using XGetRGBColormaps. +Verify that the call returned False. +Verify that the std_colormap_return argument was not changed. +Verify that the count_return argument was not changed. + +Create a window with XCreateWindow. +Set the RGB_COLOR_MAP property to have size 7 elements. +Obtain the value of the RGB_COLOR_MAP property using XGetRGBColormaps. +Verify that the call returned False. +Verify that the std_colormap_return argument was not changed. +Verify that the count_return argument was not changed. + +>>CODE +Status status; +char *when; +XStandardColormap *rscmp = (XStandardColormap *) NULL; +int rncmp = 0; +XVisualInfo *vp; +Atom prop = XA_RGB_BEST_MAP; + + resetvinf(VI_WIN); + nextvinf(&vp); + std_colormap_return = &rscmp; + count_return = &rncmp; + property = prop; + + w = makewin(display, vp); +/* Property unset */ + + rscmp = (XStandardColormap *) -1; + rncmp = -1; + status = XCALL; + + when = "when the RGB_BEST_MAP property was not set."; + + if( status != False ) { + report("%s() did not return False %s", TestName, when); + FAIL; + } else + CHECK; + + if(rscmp != (XStandardColormap *) -1) { + report("The std_colormap_return argument was updated %s", when); + FAIL; + } else + CHECK; + + if(rncmp != -1) { + report("The count_return argument was updated %s", when); + FAIL; + } else + CHECK; + + when = "when the RGB_BEST_MAP property format was 8."; + + w = makewin(display, vp); +/* format 8 */ + XChangeProperty(display, w, prop, XA_RGB_COLOR_MAP, 8, PropModeReplace, (unsigned char *) &scmp1, 10); + + rscmp = (XStandardColormap *) -1; + rncmp = -1; + status = XCALL; + + if( status != False ) { + report("%s() did not return False %s", TestName, when); + FAIL; + } else + CHECK; + + if(rscmp != (XStandardColormap *) -1) { + report("The std_colormap_return argument was updated %s", when); + FAIL; + } else + CHECK; + + if(rncmp != -1) { + report("The count_return argument was updated %s", when); + FAIL; + } else + CHECK; + + when = "when the RGB_BEST_MAP property type was ATOM."; + + w = makewin(display, vp); +/* type ATOM */ + XChangeProperty(display, w, prop, XA_ATOM, 32, PropModeReplace, (unsigned char *) &scmp1, 10); + + rscmp = (XStandardColormap *) -1; + rncmp = -1; + status = XCALL; + + if( status != False ) { + report("%s() did not return False %s.", TestName, when); + FAIL; + } else + CHECK; + + if(rscmp != (XStandardColormap *) -1) { + report("The std_colormap_return argument was updated %s", when); + FAIL; + } else + CHECK; + + if(rncmp != -1) { + report("The count_return argument was updated %s", when); + FAIL; + } else + CHECK; + + when = "when the RGB_BEST_MAP property number of elements was 7."; + + w = makewin(display, vp); +/* Bad number of elements */ + XChangeProperty(display, w, prop, XA_RGB_COLOR_MAP, 32, PropModeReplace, (unsigned char *) &scmp1, 7); + + rscmp = (XStandardColormap *) -1; + rncmp = -1; + status = XCALL; + + if( status != False ) { + report("%s() did not return False %s.", TestName, when); + FAIL; + } else + CHECK; + + if(rscmp != (XStandardColormap *) -1) { + report("std_colormap_return argument was updated %s", when); + FAIL; + } else + CHECK; + + if(rncmp != -1) { + report("The count_return argument was updated %s", when); + FAIL; + } else + CHECK; + + CHECKPASS(12); + +>>ASSERTION Good A +When the visualid is not specified in the property colormaps, then the +.M visualid +of the returned structures is set to the default +visual for the screen of the window +.A w . +>>STRATEGY +Create a window using XCreateWindow. +Set the RGB_GRAY_MAP property to have 8 elements using XChangeProperty. +Obtain the default visual ID using DefaultVisual. +Obtain the value of the RGB_GRAY_MAP property using XGetRGBColormaps. +Verify that the value of the visual component of the returned XStandardColormap + structure was the same as the default visual. +>>CODE +Status status; +XStandardColormap *rscmp = (XStandardColormap *) NULL; +int rncmp = 0; +XVisualInfo *vp; +Visual *vi; +VisualID vid; +Atom prop = XA_RGB_GRAY_MAP; + + resetvinf(VI_WIN); + nextvinf(&vp); + std_colormap_return = &rscmp; + count_return = &rncmp; + property = prop; + + w = makewin(display, vp); + XChangeProperty(display, w, prop, XA_RGB_COLOR_MAP, 32, PropModeReplace, (unsigned char *) &scmp1, 8); + + status = XCALL; + vi = XDefaultVisual(display, XDefaultScreen(display)); + vid = XVisualIDFromVisual(vi); + + if(status == False) { + delete("%s() returned False.", TestName); + return; + } else + CHECK; + + if(vid != rscmp->visualid) { + report("%s() did not report the default visual in the returned visualid component.", TestName); + FAIL; + } else + CHECK; + + XFree((char*)rscmp); + + CHECKPASS(2); + +>>ASSERTION Good A +When the killid is not specified in the property colormaps, then the +.M killid +of the returned structures is set to None. +>>STRATEGY +Create a window using XCreateWindow. +Set the RGB_GRAY_MAP property to have 9 elements using XChangeProperty. +Obtain the value of the RGB_GRAY_MAP property using XGetRGBColormaps. +Verify that the value of the killid component of the returned XStandardColormap + structure was set to None. +>>CODE +Status status; +XStandardColormap *rscmp = (XStandardColormap *) NULL; +int rncmp = 0; +XVisualInfo *vp; +Atom prop = XA_RGB_GRAY_MAP; + + resetvinf(VI_WIN); + nextvinf(&vp); + std_colormap_return = &rscmp; + count_return = &rncmp; + property = prop; + + w = makewin(display, vp); + XChangeProperty(display, w, prop, XA_RGB_COLOR_MAP, 32, PropModeReplace, (unsigned char *) &scmp1, 9); + + status = XCALL; + + if(status == False) { + delete("%s() returned False.", TestName); + return; + } else + CHECK; + + if(rscmp->killid != None) { + report("%s() did not set the returned killid component to None.", TestName); + FAIL; + } else + CHECK; + + XFree((char*)rscmp); + + CHECKPASS(2); + +>>ASSERTION Bad A +.ER BadAtom +>>ASSERTION Bad A +.ER BadWindow +>># Kieron Action Review diff --git a/xts5/Xlib15/XGetTextProperty/XGetTextProperty.m b/xts5/Xlib15/XGetTextProperty/XGetTextProperty.m new file mode 100644 index 00000000..e78fb485 --- /dev/null +++ b/xts5/Xlib15/XGetTextProperty/XGetTextProperty.m @@ -0,0 +1,308 @@ +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/Xlib15/XGetTextProperty/XGetTextProperty.m,v 1.2 2005-11-03 08:42:49 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XGetTextProperty/XGetTextProperty.m +>># +>># Description: +>># Tests for XGetTextProperty() +>># +>># Modifications: +>># $Log: gttxtprprt.m,v $ +>># Revision 1.2 2005-11-03 08:42:49 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:20 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:33:54 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:55:48 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:16 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:48 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:28:50 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:07 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:10:53 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 XGetTextProperty Xlib15 +Status +XGetTextProperty(display, w, text_prop_return, property); +Display *display = Dsp; +Window w = DRW(Dsp); +XTextProperty *text_prop_return = &textprop; +Atom property = XA_WM_NAME; +>>EXTERN +#include "X11/Xatom.h" +static XTextProperty textprop = { (unsigned char *) 0, XA_STRING, 8, (unsigned long) 0 }; +>>ASSERTION Good A +When the property specified by the +.A property +argument exists on the window specified by the +.A w +argument, then a call to xname stores +the data, which can be freed with XFree, in the +.M value +field, the type of the data in the +.M encoding +field, the format of the data in the +.M format +field, and the number of items of data in the +.M nitems +field of the +.S XTextProperty +structure named by the +.A text_prop_return +argument and returns non-zero. +>>STRATEGY +Create a window with XCreateWindow. +Set the property WM_NAME for the window with XSetTextProperty. +Obtain the value of the WM_NAME property with XGetTextProperty. +Verify that the encoding, format, value and nitems fields of the returned structure are correct. +Release the allocated memory using XFree. +>>CODE +Window win; +char *str1 = "Xtest test string1"; +char *str2 = "Xtest test string2"; +char *str[2]; +Status status; +char **list_return; +int count_return; +XTextProperty tp, rtp; +XVisualInfo *vp; + + str[0] = str1; + str[1] = str2; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + if(XStringListToTextProperty(str, 2, &tp) == False) { + delete("XStringListToTextProperty() Failed."); + return; + } else + CHECK; + + XSetTextProperty(display, win, &tp, property); + + text_prop_return = &rtp; + w = win; + status = XCALL; + + if(status == False) { + report("XGetTextProperty() returned False."); + FAIL; + } else + CHECK; + + if(rtp.encoding != XA_STRING) { + report("Property was not of type STRING"); + FAIL; + } else + CHECK; + + if(rtp.format != 8) { + report("Format was %d instead of 8", rtp.format); + FAIL; + } else + CHECK; + + if(rtp.nitems != strlen(str1) + strlen(str2) + 1) { + report("The nitems component was %lu instead of %d", rtp.nitems,1 + strlen(str1) + strlen(str2) ); + FAIL; + } else + CHECK; + + if(XTextPropertyToStringList( &rtp, &list_return, &count_return) == False) { + delete("XTextPropertyToStringList() returned False."); + return; + } else + CHECK; + + if (count_return != 2) { + delete("count_return was %d instead of 2.", count_return); + return; + } else + CHECK; + + if( (strncmp(str1, list_return[0], strlen(str1)) != 0) || + (strncmp(str2, list_return[1], strlen(str2)) != 0) ) { + + report("Value strings were:"); + report("\"%s\" and \"%s\"", list_return[0], list_return[1]); + report("Instead of:"); + report("\"%s\" and \"%s\"", str1, str2); + FAIL; + } else + CHECK; + + XFree((char*)tp.value); + XFree((char*)rtp.value); + XFreeStringList(list_return); + CHECKPASS(8); + +>>ASSERTION Good A +When the property specified by the +.A property +argument does not exist on the window +specified by the +.A w +argument, then a call to xname sets the +.M value +field to NULL, the +.M encoding +field to None, the +.M format +field to 0 and the +.M nitems +field to 0 of the +.S XTextProperty +structure named by the +.A text_prop_return +argument and returns zero. +>>STRATEGY +Create a window with XCreateWindow +Get the value of the unset property WM_NAME with XGetTextProperty +Verify that the call returned False +Verify that in the returned structure the encoding field was none, + the format component was 0, the nitems component was 0 and the + value component was NULL. +>>CODE +Window win; +Status status; +char **list_return; +int count_return; +XTextProperty tp; +XVisualInfo *vp; + + tp.value = (unsigned char *) "XTuninit"; + tp.format = 1; + tp.encoding = (Atom) 1; + tp.nitems = (unsigned long) 1; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + text_prop_return = &tp; + w = win; + status = XCALL; + + if(status != False) { + report("XGetTextProperty() did not return False."); + FAIL; + } else + CHECK; + + if(tp.encoding != None) { + report("Property was not of type None"); + FAIL; + } else + CHECK; + + if(tp.format != 0) { + report("The format component was %d instead of 0", tp.format); + FAIL; + } else + CHECK; + + if(tp.nitems != 0) { + report("The nitems component was %lu instead of 0", tp.nitems); + FAIL; + } else + CHECK; + + if(tp.value != (unsigned char *) NULL) { + report("The value component was not NULL."); + FAIL; + } else + CHECK; + + CHECKPASS(5); + +>>ASSERTION Bad A +.ER BadAtom +>>ASSERTION Bad A +.ER BadWindow +>># Does this contain the XStringListToTextProperty that crashes servers?? +>># kieron +>># See comment in test 1 for the answer to that question. +>># Cal +>># Kieron Completed Review diff --git a/xts5/Xlib15/XGetTransientForHint/XGetTransientForHint.m b/xts5/Xlib15/XGetTransientForHint/XGetTransientForHint.m new file mode 100644 index 00000000..720d6b8f --- /dev/null +++ b/xts5/Xlib15/XGetTransientForHint/XGetTransientForHint.m @@ -0,0 +1,249 @@ +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/Xlib15/XGetTransientForHint/XGetTransientForHint.m,v 1.2 2005-11-03 08:42:49 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XGetTransientForHint/XGetTransientForHint.m +>># +>># Description: +>># Tests for XGetTransientForHint() +>># +>># Modifications: +>># $Log: gttrnsntfr.m,v $ +>># Revision 1.2 2005-11-03 08:42:49 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:20 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:33:53 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:55:47 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:15 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:48 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:28:49 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:06 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:10: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 XGetTransientForHint Xlib15 +Status +XGetTransientForHint(display, w, prop_window_return) +Display *display = Dsp; +Window w = DRW(Dsp); +Window *prop_window_return = &propwindow; +>>EXTERN +#include "X11/Xatom.h" +Window propwindow; +>>ASSERTION Good A +When the WM_TRANSIENT_FOR property is set for the window +.A w , +and is format 32, length 1 element and of type +.S WINDOW , +then a call to xname returns the property value in the +.A prop_window_return +argument and returns non-zero. +>>STRATEGY +Create a window with XCreateWindow. +Set the WM_TRANSIENT_FOR property using XSetTransientForHint. +Obtain the value of the WM_TRANSIENT_FOR property using XGetTransientForHint. +Verify that the call did not return False. +Verify that the value was correct. +>>CODE +Status status; +Window win, twin; +Window rwin = (Window) -1; +XVisualInfo *vp; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + twin = makewin(display, vp); + + XSetTransientForHint(display, win, twin); + + w = win; + prop_window_return = &rwin; + status = XCALL; + + if(status == False) { + report("XGetTransientForHint() returned False."); + FAIL; + } else + CHECK; + + if(rwin != twin) { + report("The value of the WM_TRANSIENT_FOR property was %lx instead of %lx.", (long) rwin, (long) twin); + FAIL; + } else + CHECK; + + CHECKPASS(2); + +>>ASSERTION Good A +When the WM_TRANSIENT_FOR property is not set for the window +.A w , +or is format other than 32, length < 1 element or of type other than +.S WINDOW , +then a call to xname returns zero. +>>STRATEGY +Create a window with XCreateWindow. +Obtain the value of the unset WM_TRANSIENT_FOR property with XGetWMHints. +Verify that the call returned False. + +Create a window with XCreateWindow. +Set the WM_TRANSIENT_FOR property with format 16 and type WINDOW and size 1 using XChangeProperty. +Obtain the value of the WM_TRANSIENT_FOR property with XGetWMHints. +Verify that the call returned False. + +Create a window with XCreateWindow. +Set the WM_TRANSIENT_FOR property with format 32 type STRING and size 1 using XChangeProperty. +Obtain the value of the WM_TRANSIENT_FOR property with XGetWMHints. +Verify that the call returned False. + +Create a window with XCreateWindow. +Set the WM_TRANSIENT_FOR property with format 32 type WINDOW and size 0 using XChangeProperty. +Obtain the value of the WM_TRANSIENT_FOR property with XGetWMHints. +Verify that the call returned False. +>>CODE +Status status; +XVisualInfo *vp; +Window pwin; + + resetvinf(VI_WIN); + nextvinf(&vp); + + prop_window_return = &pwin; + pwin = makewin(display, vp); + w = makewin(display, vp); + +/* Property unset */ + + status = XCALL; + + if(status != False) { + report("%s() did not return False when the WM_TRANSIENT_FOR property was not set.", TestName); + FAIL; + } else + CHECK; + + w = makewin(display, vp); + +/* Format 16 */ + XChangeProperty(display, w, XA_WM_TRANSIENT_FOR, XA_WINDOW, 16, PropModeReplace, (unsigned char *) &pwin, 1); + + status = XCALL; + + if(status != False) { + report("%s() did not return False when the WM_TRANSIENT_FOR property format was 16.", TestName); + FAIL; + } else + CHECK; + + w = makewin(display, vp); + +/* Type STRING */ + XChangeProperty(display, w, XA_WM_TRANSIENT_FOR, XA_STRING, 32, PropModeReplace, (unsigned char *) &pwin, 1); + + status = XCALL; + + if(status != False) { + report("%s() did not return False when the WM_TRANSIENT_FOR property type was STRING.", TestName); + FAIL; + } else + CHECK; + + w = makewin(display, vp); + +/* No elements = 0 */ + XChangeProperty(display, w, XA_WM_TRANSIENT_FOR, XA_WINDOW, 32, PropModeReplace, (unsigned char *) &pwin, 0); + + status = XCALL; + + if(status != False) { + report("%s() did not return False when the WM_TRANSIENT_FOR property size was 0.", TestName); + FAIL; + } else + CHECK; + + CHECKPASS(4); + + +>>ASSERTION Bad A +.ER BadWindow +>># Kieron Completed Review diff --git a/xts5/Xlib15/XGetWMClientMachine/XGetWMClientMachine.m b/xts5/Xlib15/XGetWMClientMachine/XGetWMClientMachine.m new file mode 100644 index 00000000..951789f8 --- /dev/null +++ b/xts5/Xlib15/XGetWMClientMachine/XGetWMClientMachine.m @@ -0,0 +1,297 @@ +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/Xlib15/XGetWMClientMachine/XGetWMClientMachine.m,v 1.2 2005-11-03 08:42:49 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XGetWMClientMachine/XGetWMClientMachine.m +>># +>># Description: +>># Tests for XGetWMClientMachine() +>># +>># Modifications: +>># $Log: gtwmclntmc.m,v $ +>># Revision 1.2 2005-11-03 08:42:49 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:20 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:33:54 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:55:48 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:16 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:49 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:28:51 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:08 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:10:55 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 XGetWMClientMachine Xlib15 +Status +XGetWMClientMachine(display, w, text_prop_return) +Display *display = Dsp; +Window w = DRW(Dsp); +XTextProperty *text_prop_return = &textprop; +>>EXTERN +#include "X11/Xatom.h" +static XTextProperty textprop = { (unsigned char *) 0, XA_STRING, 8, (unsigned long) 0 }; +>>ASSERTION Good A +When the WM_CLIENT_MACHINE property +is set on the window +.A w , +then a call to xname stores +the data, which can be freed with XFree, in the +.M value +field, the type of the data in the +.M encoding +field, the format of the data in the +.M format +field, and the number of items of data in the +.M nitems +field of the +.S XTextProperty +structure named by the +.A text_prop_return +argument and returns non-zero. +>>STRATEGY +Create a window with XCreateWindow. +Set the property WM_CLIENT_MACHINE for the window with XSetWMClientMachine. +Obtain the value of the WM_CLIENT_MACHINE property with XGetWMClientMachine. +Verify that the function returned non-zero. +Verify that the encoding, format, value and nitems fields of the returned structure are correct. +Release the allocated memory using XFree. +>>CODE +Window win; +char *str1 = "Xtest Client Machine String"; +char *str[1]; +Status status; +char **list_return; +int count_return; +XTextProperty tp, rtp; +XVisualInfo *vp; + + str[0] = str1; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + if(XStringListToTextProperty(str, 1, &tp) == False) { + delete("XStringListToTextProperty() Failed."); + return; + } else + CHECK; + + XSetWMClientMachine(display, win, &tp); + + text_prop_return = &rtp; + w = win; + status = XCALL; + + if(status == False) { + report("%s() returned False.", TestName); + FAIL; + } else + CHECK; + + if(tp.encoding != rtp.encoding) { + report("The encoding component of the XTextProperty was incorrect."); + FAIL; + } else + CHECK; + + if(tp.format != rtp.format) { + report("The format component of the XTextProperty was incorrect."); + FAIL; + } else + CHECK; + + if(tp.nitems != rtp.nitems) { + report("The nitems component of the XTextProperty was incorrect."); + FAIL; + } else + CHECK; + + if(XTextPropertyToStringList( &rtp, &list_return, &count_return) == False) { + delete("XTextPropertyToStringList() returned False."); + return; + } else + CHECK; + + if (count_return != 1) { + delete("XTextPropertyToStringList() count_return was %d instead of 1.", count_return); + return; + } else + CHECK; + + if( strcmp(str1, list_return[0] ) != 0 ) { + report("Value string was \"%s\" instead of \"%s\"", list_return[0], str1); + FAIL; + } else + CHECK; + + XFree((char*)tp.value); + XFreeStringList(list_return); + + CHECKPASS(8); + +>>ASSERTION Good A +When the WM_CLIENT_MACHINE property +is not set on the window +.A w , +then a call to xname sets the +.M value +field to NULL, the +.M encoding +field to None, the +.M format +field to 0 and the +.M nitems +field to 0 of the +.S XTextProperty +structure named by the +.A text_prop_return +argument and returns zero. +>>STRATEGY +Create a window with XCreateWindow. +Get the value of the unset property WM_CLIENT_MACHINE with XGetWMClientMachine. +Verify that the call returned False. +Verify that in the returned XTextProperty structure the encoding field was none, + the format component was 0, the nitems component was 0 and the + value component was NULL. +>>CODE +Window win; +Status status; +XTextProperty tp; +XVisualInfo *vp; + + tp.value = (unsigned char *) "XTuninitialised\0"; + tp.encoding = XA_STRING; + tp.format = 8; + tp.nitems = 1 + strlen((char *)tp.value); + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + text_prop_return = &tp; + w = win; + status = XCALL; + + if(status != False) { + report("%s() did not return False.", TestName); + FAIL; + } else + CHECK; + + if(tp.encoding != None) { + report("The encoding component was not None."); + FAIL; + } else + CHECK; + + if(tp.format != 0) { + report("The format component was %d instead of 0", tp.format); + FAIL; + } else + CHECK; + + if(tp.nitems != 0) { + report("The nitems component was %lu instead of 0", tp.nitems); + FAIL; + } else + CHECK; + + if(tp.value != (unsigned char *) NULL) { + report("The value component was not NULL."); + FAIL; + } else + CHECK; + + CHECKPASS(5); + +>># +>># I cannot see how a BadAtom Can be generated. +>># Cal 28/05/91 +>>#>>ASSERTION +>>#.ER BadAtom +>># +>># +>>ASSERTION Bad A +.ER BadWindow +>># Kieron Action Review diff --git a/xts5/Xlib15/XGetWMColormapWindows/XGetWMColormapWindows.m b/xts5/Xlib15/XGetWMColormapWindows/XGetWMColormapWindows.m new file mode 100644 index 00000000..4e96ef4c --- /dev/null +++ b/xts5/Xlib15/XGetWMColormapWindows/XGetWMColormapWindows.m @@ -0,0 +1,346 @@ +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/Xlib15/XGetWMColormapWindows/XGetWMColormapWindows.m,v 1.2 2005-11-03 08:42:49 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XGetWMColormapWindows/XGetWMColormapWindows.m +>># +>># Description: +>># Tests for XGetWMColormapWindows() +>># +>># Modifications: +>># $Log: gtwmclrmpw.m,v $ +>># Revision 1.2 2005-11-03 08:42:49 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:20 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:33:54 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:55:49 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:17 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:49 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:28:52 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:09 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:10:57 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 XGetWMColormapWindows Xlib15 +Status +XGetWMColormapWindows(display, w, colormap_windows_return, count_return) +Display *display = Dsp; +Window w = DRW(display); +Window **colormap_windows_return = &window; +int *count_return = &count; +>>EXTERN +#include "X11/Xatom.h" +Window *window; +int count; +>>ASSERTION Good A +When the WM_COLORMAP_WINDOWS property is set on the window +.A w , +the property is of +.M type +WINDOW, and is of +.M format +32, +then a call to xname returns the list of window identifiers stored +in the property, which can be freed with XFree, in the +.A colormap_windows_return +argument and the number of windows in the +.A count_return +argument and returns non-zero. +>>STRATEGY +Create a window using XCreateWindow. +Set the WM_COLORMAP_WINDOWS property using XSetWMColormapWindows. +Obtain the WM_COLORMAP_WINDOWS property using XGetWMColormapWindows. +Verify that the call did not return False. +Verify that the value of the property is correct. +Release the allocated memory using XFree. +>>CODE +Status status; +Window rwin; +XVisualInfo *vp; +int nwins = 7; +Window pwins[7]; +Window *rwins = (Window *) NULL; +Window *wp; +int rcnt = 0; +int i; + + for(i=0; i<nwins; i++) + pwins[i] = (Window) i; + + resetvinf(VI_WIN); + nextvinf(&vp); + w = makewin(display, vp); + + XSetWMColormapWindows(display, w, pwins, nwins); + + colormap_windows_return = &rwins; + count_return = &rcnt; + status = XCALL; + + if(status == False) { + report("%s() returned False.", TestName); + FAIL; + } else + CHECK; + + if(rcnt != nwins) { + report("The number of elements set for the WM_COLORMAP_WINDOWS property was %d instead of %d", rcnt, nwins); + FAIL; + } else + CHECK; + + if(rwins == (Window *) NULL) { + report("The WM_COLORMAP_WINDOWS property had no associated value."); + FAIL; + } else { + + CHECK; + for(i = 0, wp = rwins; i < nwins; i++, wp++) + if( *wp != pwins[i]) { + report("Element %d of the WM_COLORMAP_WINDOWS value was %lu instead of %lu", i+1, (long) *wp, (long) pwins[i]); + FAIL; + } else + CHECK; + + XFree((char*)rwins); + } + + CHECKPASS(nwins + 3); + +>>ASSERTION Bad B 1 +When the atom name \(lqWM_COLORMAP_WINDOWS\(rq cannot be interned, +then a call to xname does not set the +.A colormap_windows_return +or +.A count_return +arguments and returns zero. +>>ASSERTION Good A +When the WM_COLORMAP_WINDOWS property is not set on the window +.A w , +or is not of +.M type +WINDOW, or is not of +.M format +32, +then a call to xname does not set the +.A colormap_windows_return +or +.A count_return +arguments and returns zero. +>>STRATEGY +Create a window with XCreateWindow. +Insure that the name \"WM_COLOMAP_WINDOWS\" is interned using XSetWMColormapWindows. +Obtain the WM_COLORMAP_WINDOWS atom using XInternAtom. + +Create a window with XCreateWindow. +Initialise the colormap_windows_return and count_return arguments. +Obtain the value of the WM_COLORMAP_WINDOWS property with XGetWMColormapWindows. +Verify that the call returned False. +Verify that colormap_windows_return and count_return arguments were unchanged. + +Create a window with XCreateWindow. +Set the WM_COLORMAP_WINDOWS property with format 8 and type WINDOW using XChangeProperty. +Initialise the colormap_windows_return and count_return arguments. +Obtain the value of the WM_COLORMAP_WINDOWS property with XGetWMColormapWindows. +Verify that the call returned False. +Verify that colormap_windows_return and count_return arguments were unchanged. + +Create a window with XCreateWindow. +Initialise the colormap_windows_return and count_return arguments. +Set the WM_COLORMAP_WINDOWS property with format 32 type ATOM using XChangeProperty. +Obtain the value of the WM_COLORMAP_WINDOWS property with XGetWMColormapWindows. +Verify that the call returned False. +Verify that colormap_windows_return and count_return arguments were unchanged. + +>>CODE +Status status; +Atom xa_wm_colormap_windows; +Atom *rat; +int rcnt; +XVisualInfo *vp; +Window wdw; + + resetvinf(VI_WIN); + nextvinf(&vp); + + colormap_windows_return = &rat; + count_return = &rcnt; + w = makewin(display, vp); + + if(XSetWMColormapWindows(display, w, &wdw, 1) == False) { + delete("XSetWMColormapWindows() returned False."); + return; + } else + CHECK; + + if( (xa_wm_colormap_windows = XInternAtom(display, "WM_COLORMAP_WINDOWS", True)) == None) { + delete("The \"WM_COLORMAP_WINDOWS\" string was not interned."); + return; + } else + CHECK; + + w = makewin(display, vp); + +/* property unset */ + + rat = (Atom *) -1; + rcnt = -1; + status = XCALL; + + if(status != False) { + report("%s() did not return False when the WM_COLORMAP_WINDOWS property was not set.", TestName); + FAIL; + } else + CHECK; + + if( rat != (Atom *) -1) { + report("Atom list pointer variable was updated when the WM_COLORMAP_WINDOWS property was not set."); + FAIL; + } else + CHECK; + + if( rcnt != -1) { + report("Atom count variable was updated when the WM_COLORMAP_WINDOWS property was not set."); + FAIL; + } else + CHECK; + + w = makewin(display, vp); + +/* format 8 */ + XChangeProperty(display, w, xa_wm_colormap_windows, XA_WINDOW, 8, PropModeReplace, (unsigned char *) &wdw, 1); + + rat = (Atom *) -1; + rcnt = -1; + status = XCALL; + + if(status != False) { + report("%s() did not return False when the WM_COLORMAP_WINDOWS property had format 8.", TestName); + FAIL; + } else + CHECK; + + if( rat != (Atom *) -1) { + report("Atom list pointer variable was updated when the WM_COLORMAP_WINDOWS property had format 8."); + FAIL; + } else + CHECK; + + if( rcnt != -1) { + report("Atom count variable was updated when the WM_COLORMAP_WINDOWS property had format 8."); + FAIL; + } else + CHECK; + + w = makewin(display, vp); + +/* type ATOM */ + XChangeProperty(display, w, xa_wm_colormap_windows, XA_ATOM, 32, PropModeReplace, (unsigned char *) &wdw, 1); + + rat = (Atom *) -1; + rcnt = -1; + status = XCALL; + + if(status != False) { + report("%s() did not return False when the WM_COLORMAP_WINDOWS property had type ATOM.", TestName); + FAIL; + } else + CHECK; + + if( rat != (Atom *) -1) { + report("Atom list pointer variable was updated when the WM_COLORMAP_WINDOWS property had type ATOM."); + FAIL; + } else + CHECK; + + if( rcnt != -1) { + report("Atom count variable was updated when the WM_COLORMAP_WINDOWS property had type ATOM."); + FAIL; + } else + CHECK; + + CHECKPASS(11); + +>>ASSERTION Bad A +.ER BadWindow +>># Kieron Action Review diff --git a/xts5/Xlib15/XGetWMHints/XGetWMHints.m b/xts5/Xlib15/XGetWMHints/XGetWMHints.m new file mode 100644 index 00000000..07ce233e --- /dev/null +++ b/xts5/Xlib15/XGetWMHints/XGetWMHints.m @@ -0,0 +1,304 @@ +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/Xlib15/XGetWMHints/XGetWMHints.m,v 1.2 2005-11-03 08:42:49 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XGetWMHints/XGetWMHints.m +>># +>># Description: +>># Tests for XGetWMHints() +>># +>># Modifications: +>># $Log: gtwmhnts.m,v $ +>># Revision 1.2 2005-11-03 08:42:49 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:20 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:33:55 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:55:50 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:17 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:50 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:28:52 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:11 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11:00 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 XGetWMHints Xlib15 +XWMHints * +XGetWMHints(display, w) +Display *display = Dsp; +Window w = DRW(Dsp); +>>EXTERN +#include "X11/Xatom.h" +>>ASSERTION Good A +When the WM_HINTS property has been set for the window +.A w , +and is format 32, length \(>= 9 elements, and of type +.S WM_HINTS , +then a call to xname returns a pointer to a +.S XWMHints +structure which contains the window manager hints for the window +and can be freed with XFree. +>>STRATEGY +Create a window with XCreateWindow. +Set the WM_HINTS property for the window with XSetWMHints. +Obtain the WM_HINTS property values with XGetWMHints. +Verify the result is non-NULL. +Verify that the returned values are correct. +Release the allocated memory using XFree. +>>CODE +Window win; +XVisualInfo *vp; +XWMHints hints; +XWMHints *hints_ret; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + hints.flags = AllHints; + hints.input = True; + hints.initial_state = IconicState; + hints.icon_pixmap = 1L; + hints.icon_window = 1L; + hints.icon_x = 13; + hints.icon_y = 7; + hints.icon_mask = 1L; + hints.window_group = 1L; + + XSetWMHints(display, win, &hints); + + w = win; + hints_ret = XCALL; + + if(hints_ret == (XWMHints *) 0) { + report("XGetWMHints() returned NULL."); + FAIL; + return; /* failure invalidates rest of test, and no freeing */ + } else + CHECK; + + if(hints_ret->flags != AllHints) { + report("The flags component was %lu instead of AllHints.", hints_ret->flags); + FAIL; + } else + CHECK; + + if(hints_ret->input != True) { + report("The hints_ret component of the XWMHints structure was %d instead of True.", (Bool) hints_ret->input); + FAIL; + } else + CHECK; + + if(hints_ret->initial_state != IconicState) { + report("The initial_state component of the XWMHints structure was %d instead of IconicState.", + hints_ret->initial_state); + FAIL; + } else + CHECK; + + if(hints_ret->icon_pixmap != 1L) { + report("The icon_pixmap component of the XWMHints structure was %lu instead of 1.", hints_ret->icon_pixmap); + FAIL; + } else + CHECK; + + if(hints_ret->icon_window != 1L) { + report("The icon_window component of the XWMHints structure was %lu instead of 1.", hints_ret->icon_window); + FAIL; + } else + CHECK; + + if(hints_ret->icon_x != 13) { + report("The icon_x component of the XWMHints structure was %d instead of 13.", hints_ret->icon_x); + FAIL; + } else + CHECK; + + if(hints_ret->icon_y != 7) { + report("The icon_y component of the XWMHints structure was %d instead of 7.", hints_ret->icon_y); + FAIL; + } else + CHECK; + + if(hints_ret->icon_mask != 1L) { + report("The icon_mask component of the XWMHints structure was %lu instead of 1.", hints_ret->icon_mask); + FAIL; + } else + CHECK; + + if(hints_ret->window_group != 1L) { + report("The window_group component of the XWMHints structure was %lu instead of 1.", hints_ret->window_group); + FAIL; + } else + CHECK; + + XFree((char*)hints_ret); + + CHECKPASS(10); + +>>ASSERTION Good A +When the WM_HINTS property has not been set for the window +.A w , +or is format other than 32, length < 9 elements, or of type other than +.S WM_HINTS , +then a call to xname returns NULL. +>>STRATEGY +Create a window with XCreateWindow. +Obtain the value of the unset WM_HINTS property with XGetWMHints. +Verify that the call returned NULL. + +Create a window with XCreateWindow. +Set the WM_HINTS property with format 16 and type WM_HINTS and size 9 using XChangeProperty. +Obtain the value of the WM_HINTS property with XGetWMHints. +Verify that the call returned NULL. + +Create a window with XCreateWindow. +Set the WM_HINTS property with format 32 type WM_ATOM and size 9 using XChangeProperty. +Obtain the value of the WM_HINTS property with XGetWMHints. +Verify that the call returned NULL. + +Create a window with XCreateWindow. +Set the WM_HINTS property with format 32 type WM_HINTS and size 1 using XChangeProperty. +Obtain the value of the WM_HINTS property with XGetWMHints. +Verify that the call returned NULL. + +>>CODE +XVisualInfo *vp; +XWMHints hints; +XWMHints *hints_ret; + + resetvinf(VI_WIN); + nextvinf(&vp); + + w = makewin(display, vp); +/* Property unset */ + + hints_ret = XCALL; + + if(hints_ret != (XWMHints *) NULL){ + report("XGetWMHints() did not return NULL with the WM_HINTS property unset."); + FAIL; + } else + CHECK; + + w = makewin(display, vp); +/* format 16 */ + XChangeProperty(display, w, XA_WM_HINTS, XA_WM_HINTS, 16, PropModeReplace, (unsigned char *) &hints, 9); + + hints_ret = XCALL; + + if(hints_ret != (XWMHints *) NULL){ + report("XGetWMHints() did not return NULL with the WM_HINTS property format set to 16."); + FAIL; + } else + CHECK; + + w = makewin(display, vp); +/* type ATOM */ + XChangeProperty(display, w, XA_WM_HINTS, XA_ATOM, 32, PropModeReplace, (unsigned char *) &hints, 9); + + hints_ret = XCALL; + + if(hints_ret != (XWMHints *) NULL){ + report("XGetWMHints() did not return NULL with the WM_HINTS type set to ATOM."); + FAIL; + } else + CHECK; + + + w = makewin(display, vp); +/* size 1 */ + XChangeProperty(display, w, XA_WM_HINTS, XA_WM_HINTS, 32, PropModeReplace, (unsigned char *) &hints, 1); + + hints_ret = XCALL; + + if(hints_ret != (XWMHints *) NULL){ + report("XGetWMHints() did not return NULL with the WM_HINTS size set to 1."); + FAIL; + } else + CHECK; + + CHECKPASS(4); + +>>ASSERTION Bad A +.ER BadWindow +>># Kieron Completed Review diff --git a/xts5/Xlib15/XGetWMIconName/XGetWMIconName.m b/xts5/Xlib15/XGetWMIconName/XGetWMIconName.m new file mode 100644 index 00000000..6564645a --- /dev/null +++ b/xts5/Xlib15/XGetWMIconName/XGetWMIconName.m @@ -0,0 +1,299 @@ +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/Xlib15/XGetWMIconName/XGetWMIconName.m,v 1.2 2005-11-03 08:42:49 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XGetWMIconName/XGetWMIconName.m +>># +>># Description: +>># Tests for XGetWMIconName() +>># +>># Modifications: +>># $Log: gtwmicnnm.m,v $ +>># Revision 1.2 2005-11-03 08:42:49 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:20 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:33:56 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:55:52 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:18 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:50 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:28:53 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:12 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11:02 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 XGetWMIconName Xlib15 +Status +XGetWMIconName(display, w, text_prop) +Display *display = Dsp; +Window w = DRW(Dsp); +XTextProperty *text_prop_return = &textprop; +>>EXTERN +#include "X11/Xatom.h" +static XTextProperty textprop = { (unsigned char *) 0, XA_STRING, 8, (unsigned long) 0 }; +>>ASSERTION Good A +When the WM_ICON_NAME property +exists on the window specified by the +.A w +argument, then a call to xname stores +the data, which can be freed with +.S XFree , +in the +.M value +field, the type of the data in the +.M encoding +field, the format of the data in the +.M format +field, and the number of items of data in the +.M nitems +field of the +.S XTextProperty +structure named by the +.A text_prop_return +argument and returns non-zero. +>>STRATEGY +Create a window with XCreateWindow. +Set the property WM_ICON_NAME for the window with XSetWMIconName. +Obtain the value of the WM_ICON_NAME property with XGetWMIconName. +Verify that the function returned non-zero. +Verify that the encoding, format, value and nitems fields of the returned structure are correct. +Release the allocated memory using XFree. +>>CODE +Window win; +char *str1 = "Xtest test string1"; +char *str2 = "Xtest test string2"; +char *str[2]; +Status status; +char **list_return; +int count_return; +XTextProperty tp, rtp; +XVisualInfo *vp; + + str[0] = str1; + str[1] = str2; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + if(XStringListToTextProperty(str, 2, &tp) == False) { + delete("XStringListToTextProperty() Failed."); + return; + } else + CHECK; + + XSetWMIconName(display, win, &tp); + + text_prop_return = &rtp; + w = win; + status = XCALL; + + if(status == False) { + report("%s() returned False.", TestName); + FAIL; + } else + CHECK; + + if(tp.encoding != rtp.encoding) { + report("The encoding component of the XTextProperty was incorrect."); + FAIL; + } else + CHECK; + + if(tp.format != rtp.format) { + report("The format component of the XTextProperty was %d instead of %d.", rtp.format, tp.format); + FAIL; + } else + CHECK; + + if(tp.nitems != rtp.nitems) { + report("The nitems component of the XTextProperty was %lu instead of %lu.", rtp.nitems, tp.nitems); + FAIL; + } else + CHECK; + + if(XTextPropertyToStringList( &rtp, &list_return, &count_return) == False) { + delete("XTextPropertyToStringList() returned False."); + return; + } else + CHECK; + + if (count_return != 2) { + delete("XTextPropertyToStringList() count_return was %d instead of 2.", count_return); + return; + } else + CHECK; + + if( (strncmp(str1, list_return[0], strlen(str1)) != 0) || (strncmp(str2, list_return[1], strlen(str2)) != 0) ) { + report("Value strings were:"); + report("\"%s\" and \"%s\"", list_return[0], list_return[1]); + report("Instead of:"); + report("\"%s\" and \"%s\"", str1, str2); + FAIL; + } else + CHECK; + + XFree((char*)tp.value); + XFreeStringList(list_return); + + CHECKPASS(8); + +>>ASSERTION Good A +When the WM_ICON_NAME +property does not exist on the window +specified by the +.A w +argument, then a call to xname sets the +.M value +field to NULL, the +.M encoding +field to None, the +.M format +field to 0 and the +.M nitems +field to 0 of the +.S XTextProperty +structure named by the +.A text_prop_return +argument and returns zero. +>>STRATEGY +Create a window with XCreateWindow. +Get the value of the unset property WM_ICON_NAME with XGetWMIconName. +Verify that the call returned False. +Verify that in the returned XTextProperty structure the encoding field was none, + the format component was 0, the nitems component was 0 and the + value component was NULL. +>>CODE +Window win; +Status status; +XTextProperty tp; +XVisualInfo *vp; + + tp.value = (unsigned char *) "XTuninitialised\0"; + tp.encoding = XA_STRING; + tp.format = 8; + tp.nitems = 1 + strlen((char *)tp.value); + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + text_prop_return = &tp; + w = win; + status = XCALL; + + if(status != False) { + report("%s() did not return False.", TestName); + FAIL; + } else + CHECK; + + if(tp.encoding != None) { + report("The encoding component was not None."); + FAIL; + } else + CHECK; + + if(tp.format != 0) { + report("The format component was %d instead of 0", tp.format); + FAIL; + } else + CHECK; + + if(tp.nitems != 0) { + report("The nitems component was %lu instead of 0", tp.nitems); + FAIL; + } else + CHECK; + + if(tp.value != (unsigned char *) NULL) { + report("The value component was not NULL."); + FAIL; + } else + CHECK; + + CHECKPASS(5); + + +>>ASSERTION Bad A +.ER BadWindow +>># Kieron Completed Review diff --git a/xts5/Xlib15/XGetWMName/XGetWMName.m b/xts5/Xlib15/XGetWMName/XGetWMName.m new file mode 100644 index 00000000..25ccfb10 --- /dev/null +++ b/xts5/Xlib15/XGetWMName/XGetWMName.m @@ -0,0 +1,300 @@ +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/Xlib15/XGetWMName/XGetWMName.m,v 1.2 2005-11-03 08:42:50 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XGetWMName/XGetWMName.m +>># +>># Description: +>># Tests for XGetWMName() +>># +>># Modifications: +>># $Log: gtwmnm.m,v $ +>># Revision 1.2 2005-11-03 08:42:50 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:21 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:33:56 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:55:52 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:18 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:51 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:28:54 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:14 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11:05 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 XGetWMName Xlib15 +Status +XGetWMName(display, w, text_prop_return) +Display *display = Dsp; +Window w = DRW(display); +XTextProperty *text_prop_return = &textprop; +>>EXTERN +#include "X11/Xatom.h" +static XTextProperty textprop = { (unsigned char *) 0, XA_STRING, 8, (unsigned long) 0 }; +>>ASSERTION Good A +When the WM_NAME property +exists on the window specified by the +.A w +argument, then a call to xname stores +the data, which can be freed with +.S XFree , +in the +.M value +field, the type of the data in the +.M encoding +field, the format of the data in the +.M format +field, and the number of items of data in the +.M nitems +field of the +.S XTextProperty +structure named by the +.A text_prop_return +argument and returns non-zero. +>>STRATEGY +Create a window with XCreateWindow. +Set the property WM_NAME for the window with XSetWMName. +Obtain the value of the WM_NAME property with XGetWMName. +Verify that the encoding, format, value and nitems fields of the returned structure are correct. +Release the allocated memory using XFree. +>>CODE +Window win; +char *str1 = "Xtest test string1"; +char *str2 = "Xtest test string2"; +char *str[2]; +Status status; +char **list_return; +int count_return; +XTextProperty tp, rtp; +XVisualInfo *vp; + + str[0] = str1; + str[1] = str2; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + if(XStringListToTextProperty(str, 2, &tp) == False) { + delete("XStringListToTextProperty() Failed."); + return; + } else + CHECK; + + XSetWMName(display, win, &tp); + + text_prop_return = &rtp; + w = win; + status = XCALL; + + if(status == False) { + report("XGetTextProperty() returned False."); + FAIL; + } else + CHECK; + + if(tp.encoding != rtp.encoding) { + report("The encoding component of the XTextProperty was incorrect."); + FAIL; + } else + CHECK; + + if(tp.format != rtp.format) { + report("The format component of the XTextProperty was %d instead of %d.", rtp.format, tp.format); + FAIL; + } else + CHECK; + + if(tp.nitems != rtp.nitems) { + report("The nitems component of the XTextProperty was %lu instead of %lu.", rtp.nitems, rtp.nitems); + FAIL; + } else + CHECK; + + if(XTextPropertyToStringList( &rtp, &list_return, &count_return) == False) { + delete("XTextPropertyToStringList() returned False."); + return; + } else + CHECK; + + if (count_return != 2) { + delete("XTextPropertyToStringList() count_return was %d instead of 2.", count_return); + return; + } else + CHECK; + + if( (strncmp(str1, list_return[0], strlen(str1)) != 0) || (strncmp(str2, list_return[1], strlen(str2)) != 0) ) { + report("Value strings were:"); + report("\"%s\" and \"%s\"", list_return[0], list_return[1]); + report("Instead of:"); + report("\"%s\" and \"%s\"", str1, str2); + FAIL; + } else + CHECK; + + XFree((char*)tp.value); + XFree((char*)rtp.value); + XFreeStringList(list_return); + + CHECKPASS(8); + +>>ASSERTION Good A +When the WM_NAME property +does not exist on the window +specified by the +.A w +argument, then a call to xname sets the +.M value +field to NULL, the +.M encoding +field to None, the +.M format +field to 0 and the +.M nitems +field to 0 of the +.S XTextProperty +structure named by the +.A text_prop_return +argument and returns zero. +>>STRATEGY +Create a window with XCreateWindow +Get the value of the unset property WM_NAME with XGetWMName +Verify that the call returned False +Verify that in the returned XTextProperty structure the encoding field was none, + the format component was 0, the nitems component was 0 and the + value component was NULL. +>>CODE +Window win; +Status status; +char **list_return; +int count_return; +XTextProperty tp; +XVisualInfo *vp; + + tp.value = (unsigned char *) "XTuninitialised\0"; + tp.encoding = XA_STRING; + tp.format = 13; + tp.nitems = 1 + strlen((char *)tp.value); + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + text_prop_return = &tp; + w = win; + status = XCALL; + + if(status != False) { + report("XGetTextProperty() did not return False."); + FAIL; + } else + CHECK; + + if(tp.encoding != None) { + report("The Property was not of type None."); + FAIL; + } else + CHECK; + + if(tp.format != 0) { + report("The format component was %d instead of 0.", tp.format); + FAIL; + } else + CHECK; + + if(tp.nitems != 0) { + report("The nitems component was %lu instead of 0.", tp.nitems); + FAIL; + } else + CHECK; + + if(tp.value != (unsigned char *) NULL) { + report("The value component was not NULL."); + FAIL; + } else + CHECK; + + CHECKPASS(5); + +>>ASSERTION Bad A +.ER BadWindow +>># Kieron Completed Review diff --git a/xts5/Xlib15/XGetWMNormalHints/XGetWMNormalHints.m b/xts5/Xlib15/XGetWMNormalHints/XGetWMNormalHints.m new file mode 100644 index 00000000..c705fd03 --- /dev/null +++ b/xts5/Xlib15/XGetWMNormalHints/XGetWMNormalHints.m @@ -0,0 +1,441 @@ +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/Xlib15/XGetWMNormalHints/XGetWMNormalHints.m,v 1.2 2005-11-03 08:42:50 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XGetWMNormalHints/XGetWMNormalHints.m +>># +>># Description: +>># Tests for XGetWMNormalHints() +>># +>># Modifications: +>># $Log: gtwmnrmlhn.m,v $ +>># Revision 1.2 2005-11-03 08:42:50 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:21 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:33:57 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:55:54 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:19 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:51 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:28:55 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:15 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11:07 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 XGetWMNormalHints Xlib15 +Status +XGetWMNormalHints(display, w, hints_return, supplied_return) +Display *display = Dsp; +Window w = DRW(Dsp); +XSizeHints *hints_return = &sizehints; +long *supplied_return = &supret; +>>EXTERN +#include "X11/Xatom.h" +#define NumPropSizeElements 18 +#define OldNumPropSizeElements 15 +static XSizeHints sizehints = { 0 ,1,2,3,4,5,6,7,8,9,10, {11,12} , {13,14}, 15, 16, 17}; +static XSizeHints rhints = { 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, + {111, 112}, {113, 114}, 115, 116, 117 }; +static long supret; +>>ASSERTION Good A +When the WM_NORMAL_HINTS property has been set on the window +.A w +with a +.M type +of WM_SIZE_HINTS, a +.M format +of 32 and is long enough to contain either a pre-ICCCM +structure or a new size hints structure, then a call to +xname sets the components of the +.S XSizeHints +structure named by the +.A hints_return +argument irrespective of whether the particular hint was +previously set, and returns non-zero. +>>STRATEGY +>># We do not verify the type and format, since we rely on XSetWMHints +>># which is tested elsewhere in Xlib15. +Create a window with XCreate window. +Set the WM_NORMAL_HINTS property with XSetWMNormalHints. +Obtain the value of the WM_NORMAL_HINTS property using XGetWMNormalhints. +Verify that the entire structure has been returned. +>>CODE +Status status; +Window win; +long rsupp; +XVisualInfo *vp; + + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + XSetWMNormalHints(display, win, &sizehints); + + w = win; + hints_return = &rhints; + supplied_return = &rsupp; + status = XCALL; + + if( status == False ) { + report("XGetWMNormalHints() returned False."); + FAIL; + } else + CHECK; + + if(rhints.flags != 0) { + report("The flags component of the XSizeHints structure was %lu instead of 0.", rhints.flags); + FAIL; + } else + CHECK; + + if(rhints.x != 1) { + report("The x component of the XSizeHints structure was %d instead of 1.", rhints.x); + FAIL; + } else + CHECK; + + if(rhints.y != 2) { + report("The y component of the XSizeHints structure was %d instead of 2.", rhints.y); + FAIL; + } else + CHECK; + + if(rhints.width != 3) { + report("The width component of the XSizeHints structure was %d instead of 3.", rhints.width); + FAIL; + } else + CHECK; + + if(rhints.height != 4) { + report("The height component of the XSizeHints structure was %d instead of 4.", rhints.height); + FAIL; + } else + CHECK; + + if(rhints.min_width != 5) { + report("The min_width component of the XSizeHints structure was %d instead of 5.", rhints.min_width); + FAIL; + } else + CHECK; + + if(rhints.min_height != 6) { + report("The min_height component of the XSizeHints structure was %d instead of 6.", rhints.min_height); + FAIL; + } else + CHECK; + + if(rhints.max_width != 7) { + report("The max_width component of the XSizeHints structure was %d instead of 7.", rhints.max_width); + FAIL; + } else + CHECK; + + if(rhints.max_height != 8) { + report("The max_height component of the XSizeHints structure was %d instead of 8.", rhints.max_height); + FAIL; + } else + CHECK; + + if(rhints.width_inc != 9) { + report("The width_inc component of the XSizeHints structure was %d instead of 9.", rhints.width_inc); + FAIL; + } else + CHECK; + + if(rhints.height_inc != 10) { + report("The height_inc component of the XSizeHints structure was %d instead of 10.", rhints.height_inc); + FAIL; + } else + CHECK; + + if((rhints.min_aspect.x != 11) || (rhints.min_aspect.y != 12)){ + report("The min_aspect components of the XSizeHints structure were %d, %d instead of 11, 12.", + rhints.min_aspect.x, rhints.min_aspect.y); + FAIL; + } else + CHECK; + + if((rhints.max_aspect.x != 13) || (rhints.max_aspect.y != 14)){ + report("The max_aspect components of the XSizeHints structure were %d, %d instead of 13, 14.", + rhints.max_aspect.x, rhints.max_aspect.y); + FAIL; + } else + CHECK; + + if(rhints.base_width != 15) { + report("The base_width component of the XSizeHints structure was %d instead of 15.", rhints.base_width); + FAIL; + } else + CHECK; + + if(rhints.base_height != 16) { + report("The base_height component of the XSizeHints structure was %d instead of 16.", rhints.base_height); + FAIL; + } else + CHECK; + + if(rhints.win_gravity != 17) { + report("The win_gravity component of the XSizeHints structure was %d instead of 17", rhints.win_gravity); + FAIL; + } else + CHECK; + + CHECKPASS(17); + +>>ASSERTION Good A +When the WM_NORMAL_HINTS property is not set on the window +.A w , +or is not of +.M type +WM_SIZE_HINTS, or is not of +.M format +32, or the property is not long enough to contain either a pre-ICCCM +structure or a new size hints structure, then a call to +xname returns zero. +>>STRATEGY +Create a window with XCreateWindow. +Obtain the unset WM_NORMAL_HINTS property with XGetWMNormalHints. +Verify that the call returned zero. + +Create a window with XCreateWindow. +Set the WM_NORMAL_HINTS property of format 32 type WM_SIZE_HINTS with OldNumPropSizeElements-1 elements XChangeProperty. +Obtain the WM_NORMAL_HINTS property with XGetWMNormalHints. +Verify that the call returned zero. + +Create a window with XCreateWindow. +Set the WM_NORMAL_HINTS property of format 16 type WM_SIZE_HINTS with NumPropSizeElements elements with XChangeProperty. +Obtain the WM_NORMAL_HINTS property with XGetWMNormalHints. +Verify that the call returned zero. + +Create a window with XCreateWindow. +Set the WM_NORMAL_HINTS property of format 32 type STRING with NumPropSizeElements elements with XChangeProperty. +Obtain the WM_NORMAL_HINTS property with XGetWMNormalHints. +Verify that the call returned zero. +>>CODE +Status status; +Window win; +XSizeHints rhints; +long rsupp; +XSizeHints dummy; /* Big enough (by definition). */ +XVisualInfo *vp; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + w = win; + status = XCALL; + + if(status != False) { + report("XGetWMNormalHints() did not return False when the property was unset."); + FAIL; + } else + CHECK; + + win = makewin(display, vp); + XChangeProperty(display, win, XA_WM_NORMAL_HINTS, XA_WM_SIZE_HINTS, 32, PropModeReplace, (unsigned char *)&dummy, OldNumPropSizeElements-1); + w = win; + hints_return = &rhints; + supplied_return = &rsupp; + status = XCALL; + if(status != False) { + report("XGetWMNormalHints() did not return False when size was %lu 32-bit elements.", (unsigned long) OldNumPropSizeElements-1); + FAIL; + } else + CHECK; + + win = makewin(display, vp); + XChangeProperty(display, win, XA_WM_NORMAL_HINTS, XA_WM_SIZE_HINTS, 16, PropModeReplace, (unsigned char *)&dummy, NumPropSizeElements); + w = win; + status = XCALL; + + if(status != False) { + report("XGetWMNormalHints() did not return False when format was 16."); + FAIL; + } else + CHECK; + + win = makewin(display, vp); + XChangeProperty(display, win, XA_WM_NORMAL_HINTS, XA_STRING, 32, PropModeReplace, (unsigned char *)&dummy, NumPropSizeElements); + w = win; + status = XCALL; + + if(status != False) { + report("XGetWMNormalHints() did not return False when type was STRING."); + FAIL; + } else + CHECK; + + CHECKPASS(4); + +>>ASSERTION Good A +When a call to xname returns successfully and a pre-ICCCM size hints property is read, +then the +.A supplied_return +argument contains the bits +.S "(USPosition | USSize | PPosition | PSize | PMinSize | PMaxSize | PResizeInc | PAspect)." +>>STRATEGY +Create a window with XCreateWindow. +Set the WM_NORMAL_HINTS property with size OldNumPropSizeElements using XChangeProperty. +Obtain the value of the WM_NORMAL_HINTS property using XGetWMNormalHints. +Verify that the value returned in supplied_return was (USPosition|USSize|PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect). +>>CODE +Status status; +Window win; +XSizeHints rhints; +long rsupp; +XSizeHints dummy; /* Big enough (by definition). */ +XVisualInfo *vp; +unsigned long flagval = (USPosition | USSize | PPosition | PSize | PMinSize | PMaxSize | PResizeInc | PAspect); + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + XChangeProperty(display, win, XA_WM_NORMAL_HINTS, XA_WM_SIZE_HINTS, 32, PropModeReplace, (unsigned char *)&dummy, OldNumPropSizeElements); + w = win; + hints_return = &rhints; + supplied_return = &rsupp; + status = XCALL; + if(status == False) { + report("XGetWMNormalHints() returned False."); + FAIL; + } else + CHECK; + + if( rsupp != flagval) { + report("supplied_return was %lu instead of (USPosition | USSize | PPosition | PSize | PMinSize | PMaxSize | PResizeInc | PAspect) (%ul)", rsupp, flagval); + report("for a pre-ICCCM structure."); + FAIL; + } else + CHECK; + + CHECKPASS(2); + +>>ASSERTION Good A +When the WM_NORMAL_HINTS property is large enough to contain the base size +and window gravity fields, then the +.A supplied_return +argument contains the bits +.S "(PBaseSize | PWinGravity | USPosition | USSize | PPosition | PSize | PMinSize | PMaxSize | PResizeInc | PAspect)." +>>STRATEGY +Create a window with XCreateWindow. +Set the WM_NORMAL_HINTS property with size OldNumPropSizeElements using XChangeProperty. +Obtain the value of the WM_NORMAL_HINTS property using XGetWMNormalHints. +Verify that the value returned in supplied_return was (PBaseSize|PWinGravity|USPosition|USSize|PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect). +>>CODE +Status status; +Window win; +XSizeHints rhints; +long rsupp; +XSizeHints dummy; /* Big enough (by definition). */ +XVisualInfo *vp; +unsigned long flagval = (PBaseSize | PWinGravity | USPosition | USSize | PPosition | PSize | PMinSize | PMaxSize | PResizeInc | PAspect); + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + XChangeProperty(display, win, XA_WM_NORMAL_HINTS, XA_WM_SIZE_HINTS, 32, PropModeReplace, (unsigned char *)&dummy, NumPropSizeElements); + w = win; + hints_return = &rhints; + supplied_return = &rsupp; + status = XCALL; + if(status == False) { + report("XGetWMNormalHints() returned False."); + FAIL; + } else + CHECK; + + if( rsupp != flagval) { + report("supplied_return was %lu instead of (PBaseSize | PWinGravity | USPosition | USSize | PPosition | PSize | PMinSize | PMaxSize | PResizeInc | PAspect) (%ul)", rsupp, flagval); + report("for an ICCCMv1 structure."); + FAIL; + } else + CHECK; + + CHECKPASS(2); + +>>ASSERTION Bad A +.ER BadWindow +>># Kieron Action Review. diff --git a/xts5/Xlib15/XGetWMProtocols/XGetWMProtocols.m b/xts5/Xlib15/XGetWMProtocols/XGetWMProtocols.m new file mode 100644 index 00000000..226ebccf --- /dev/null +++ b/xts5/Xlib15/XGetWMProtocols/XGetWMProtocols.m @@ -0,0 +1,354 @@ +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/Xlib15/XGetWMProtocols/XGetWMProtocols.m,v 1.2 2005-11-03 08:42:50 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XGetWMProtocols/XGetWMProtocols.m +>># +>># Description: +>># Tests for XGetWMProtocols() +>># +>># Modifications: +>># $Log: gtwmprtcls.m,v $ +>># Revision 1.2 2005-11-03 08:42:50 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:21 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:33:57 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:55:55 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:19 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:52 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:28:56 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:17 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11:10 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 XGetWMProtocols Xlib15 +Status +XGetWMProtocols(display, w, protocols_return, count_return) +Display *display = Dsp; +Window w = DRW(Dsp); +Atom **protocols_return = &protret; +int *count_return = &countret; +>>EXTERN +#include "X11/Xatom.h" +Atom *protret; +int countret; +>>ASSERTION Good A +When the WM_PROTOCOLS property is set on the window +.A w , +is of +.M type +ATOM, and is of +.M format +32, then a call to xname returns the list of atoms stored in the property, +which can be freed with +.S XFree , +in the +.A protocols_return +argument, the number of atoms in the +.A count_return +argument and returns non-zero. +>>STRATEGY +Create a window using XCreateWindow. +Set the WM_PROTOCOLS property using XSetWMProtocols. +Obtain the value of the WM_PROTOCOLS property using XGetWMProtocols. +Verify that the call did not return False. +Verify that the value was correct. +Free the allocated memory using XFree. +>>CODE +Status status; +XVisualInfo *vp; +int nats = 5; +Atom prots[5]; +Atom *retprots = (Atom *) NULL; +Atom at, *atp; +int i, cntret; + + + for(i=0, at = XA_LAST_PREDEFINED; i<nats; i++) + prots[i] = (int) --at; + + resetvinf(VI_WIN); + nextvinf(&vp); + w = makewin(display, vp); + + XSetWMProtocols(display, w, prots, nats); + + protocols_return = &retprots; + count_return = &cntret; + status = XCALL; + + if(status == False) { + delete("%s() returned False.", TestName); + return; + } else + CHECK; + + if(cntret != nats) { + report("The number of elements set for the WM_PROTOCOLS property was %d instead of %d", cntret, nats); + FAIL; + } else + CHECK; + + if(retprots == (Atom *) NULL) { + report("The WM_PROTOCOLS property had no associated value."); + FAIL; + } else { + + CHECK; + for(i = 0, atp = retprots; i<nats; i++, atp++) + if( *atp != prots[i]) { + report("Element %d of the WM_PROTOCOLS value was %lu instead of %lu", i+1, (long) *atp, (long) prots[i]); + FAIL; + } else + CHECK; + + XFree((char*)retprots); + } + + CHECKPASS(nats + 3); + + +>>ASSERTION Bad B 1 +When the atom name \(lqWM_PROTOCOLS\(rq cannot be interned, +then a call to xname does not set the +.A protocols_return +or +.A count_return +arguments and returns zero. +>>ASSERTION Good A +When the WM_PROTOCOLS property is not set on the window +.A w , +or is not of +.M type +ATOM, or is not of +.M format +32, then a call to xname does not set the +.A protocols_return +or +.A count_return +arguments and returns zero. +>>STRATEGY +Create a window with XCreateWindow. +Insure that the name \"WM_PROTOCOLS\" is interned using XSetWMProtocols. +Obtain the WM_PROTOCOLS atom using XInternAtom. + +Create a window with XCreateWindow. +Initialise the protocols_return and count_return arguments. +Obtain the value of the WM_PROTOCOLS property with XGetWMProtocols. +Verify that the call returned False. +Verify that protocols_return and count_return arguments were unchanged. + +Create a window with XCreateWindow. +Set the WM_PROTOCOLS property with format 16 and type ATOM using XChangeProperty. +Initialise the protocols_return and count_return arguments. +Obtain the value of the WM_PROTOCOLS property with XGetWMProtocols. +Verify that the call returned False. +Verify that protocols_return and count_return arguments were unchanged. + +Create a window with XCreateWindow. +Initialise the protocols_return and count_return arguments. +Set the WM_PROTOCOLS property with format 32 type STRING using XChangeProperty. +Obtain the value of the WM_PROTOCOLS property with XGetWMProtocols. +Verify that the call returned False. +Verify that protocols_return and count_return arguments were unchanged. + +>>CODE +Status status; +Atom at, xa_wm_protocols; +Atom *rat; +int rcnt; +XVisualInfo *vp; + + resetvinf(VI_WIN); + nextvinf(&vp); + + protocols_return = &rat; + count_return = &rcnt; + w = makewin(display, vp); + + if( (at = XInternAtom(display, XT_TIMESTAMP, False)) == None) { + delete("The \"%s\" string was not interned.", XT_TIMESTAMP); + return; + } else + CHECK; + + if(XSetWMProtocols(display, w, &at, 1) == False) { + delete("XSetWMProtocols() returned False."); + return; + } else + CHECK; + + if( (xa_wm_protocols = XInternAtom(display, "WM_PROTOCOLS", True)) == None) { + delete("The \"WM_PROTOCOLS\" string was not interned."); + return; + } else + CHECK; + + w = makewin(display, vp); + +/* Property unset */ + + rat = (Atom *) -1; + rcnt = -1; + status = XCALL; + + if(status != False) { + report("%s() did not return False when the WM_PROTOCOLS property was not set.", TestName); + FAIL; + } else + CHECK; + + if( rat != (Atom *) -1) { + report("Atom list pointer variable was updated when the WM_PROTOCOLS property was not set."); + FAIL; + } else + CHECK; + + if( rcnt != -1) { + report("Atom count variable was updated when the WM_PROTOCOLS property was not set."); + FAIL; + } else + CHECK; + + + + w = makewin(display, vp); + + +/* format 16 */ + XChangeProperty(display, w, xa_wm_protocols, XA_ATOM, 16, PropModeReplace, (unsigned char *) &at, 1); + + rat = (Atom *) -1; + rcnt = -1; + status = XCALL; + + if(status != False) { + report("%s() did not return False when the WM_PROTOCOLS property had format 16.", TestName); + FAIL; + } else + CHECK; + + if( rat != (Atom *) -1) { + report("Atom list pointer variable was updated when the WM_PROTOCOLS property had format 16."); + FAIL; + } else + CHECK; + + if( rcnt != -1) { + report("Atom count variable was updated when the WM_PROTOCOLS property had format 16."); + FAIL; + } else + CHECK; + + w = makewin(display, vp); + +/* Type STRING */ + XChangeProperty(display, w, xa_wm_protocols, XA_STRING, 32, PropModeReplace, (unsigned char *) &at, 1); + + rat = (Atom *) -1; + rcnt = -1; + status = XCALL; + + if(status != False) { + report("%s() did not return False when the WM_PROTOCOLS property had type STRING.", TestName); + FAIL; + } else + CHECK; + + if( rat != (Atom *) -1) { + report("Atom list pointer variable was updated when the WM_PROTOCOLS property had type STRING."); + FAIL; + } else + CHECK; + + if( rcnt != -1) { + report("Atom count variable was updated when the WM_PROTOCOLS property had type STRING."); + FAIL; + } else + CHECK; + + CHECKPASS(12); + +>>ASSERTION Bad A +.ER BadWindow +>># Kieron Action Review diff --git a/xts5/Xlib15/XGetWMSizeHints/XGetWMSizeHints.m b/xts5/Xlib15/XGetWMSizeHints/XGetWMSizeHints.m new file mode 100644 index 00000000..e640cae7 --- /dev/null +++ b/xts5/Xlib15/XGetWMSizeHints/XGetWMSizeHints.m @@ -0,0 +1,449 @@ +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/Xlib15/XGetWMSizeHints/XGetWMSizeHints.m,v 1.2 2005-11-03 08:42:50 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XGetWMSizeHints/XGetWMSizeHints.m +>># +>># Description: +>># Tests for XGetWMSizeHints() +>># +>># Modifications: +>># $Log: gtwmszhnts.m,v $ +>># Revision 1.2 2005-11-03 08:42:50 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:21 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:33:58 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:55:56 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:20 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:52 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:28:57 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:18 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11:13 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 XGetWMSizeHints Xlib15 +Status +XGetWMSizeHints(display, w, hints_return, supplied_return, property) +Display *display = Dsp; +Window w = DRW(Dsp); +XSizeHints *hints_return = &sizehints; +long *supplied_return = &supret; +Atom property = XA_WM_NORMAL_HINTS; +>>EXTERN +#include "X11/Xatom.h" +#define NumPropSizeElements 18 +#define OldNumPropSizeElements 15 +static XSizeHints sizehints = {0,1,2,3,4,5,6,7,8,9,10, {11,12} , {13,14}, 15, 16, 17}; +static XSizeHints rhints = {100,101,102,103,104,105,106,107,108,109,110, {111,112} , {113,114}, 115, 116, 117}; +static long supret; +>>ASSERTION Good A +When the property specified by the +.A property +argument is set on the window +.A w +with a +.M type +of WM_SIZE_HINTS, a +.M format +of 32 and is long enough to contain either a pre-ICCCM +structure or a new size hints structure, then a call to +xname sets the components of the +.S XSizeHints +structure named by the +.A hints_return +clear +argument and returns non-zero. +>>STRATEGY +Create a window with XCreateWindow. +Set the property WM_NORMAL_HINTS with XSetWMSizeHints. +Obtain the value of the WM_NORMAL_HINTS property using XGetWMSizeHints. +Verify that the function did not return False. +Verify that the entire structure has been returned. +>>CODE +Status status; +Window win; +long rsupp; +XVisualInfo *vp; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + XSetWMSizeHints(display, win, &sizehints, property); + + w = win; + hints_return = &rhints; + supplied_return = &rsupp; + status = XCALL; + + if( status == False ) { + report("XGetWMSizeHints() returned False."); + FAIL; + } else + CHECK; + + if(rhints.flags != 0) { + report("The flags component of the XSizeHints structure was %lu instead of 0.", rhints.flags); + FAIL; + } else + CHECK; + + if(rhints.x != 1) { + report("The x component of the XSizeHints structure was %d instead of 1.", rhints.x); + FAIL; + } else + CHECK; + + if(rhints.y != 2) { + report("The y component of the XSizeHints structure was %d instead of 2.", rhints.y); + FAIL; + } else + CHECK; + + if(rhints.width != 3) { + report("The width component of the XSizeHints structure was %d instead of 3.", rhints.width); + FAIL; + } else + CHECK; + + if(rhints.height != 4) { + report("The height component of the XSizeHints structure was %d instead of 4.", rhints.height); + FAIL; + } else + CHECK; + + if(rhints.min_width != 5) { + report("The min_width component of the XSizeHints structure was %d instead of 5.", rhints.min_width); + FAIL; + } else + CHECK; + + if(rhints.min_height != 6) { + report("The min_height component of the XSizeHints structure was %d instead of 6.", rhints.min_height); + FAIL; + } else + CHECK; + + if(rhints.max_width != 7) { + report("The max_width component of the XSizeHints structure was %d instead of 7.", rhints.max_width); + FAIL; + } else + CHECK; + + if(rhints.max_height != 8) { + report("The max_height component of the XSizeHints structure was %d instead of 8.", rhints.max_height); + FAIL; + } else + CHECK; + + if(rhints.width_inc != 9) { + report("The width_inc component of the XSizeHints structure was %d instead of 9.", rhints.width_inc); + FAIL; + } else + CHECK; + + if(rhints.height_inc != 10) { + report("The height_inc component of the XSizeHints structure was %d instead of 10.", rhints.height_inc); + FAIL; + } else + CHECK; + + if((rhints.min_aspect.x != 11) || (rhints.min_aspect.y != 12)){ + report("The min_aspect components of the XSizeHints structure were %d, %d instead of 11, 12.", + rhints.min_aspect.x, rhints.min_aspect.y); + FAIL; + } else + CHECK; + + if((rhints.max_aspect.x != 13) || (rhints.max_aspect.y != 14)){ + report("The max_aspect components of the XSizeHints structure were %d, %d instead of 13, 14.", + rhints.max_aspect.x, rhints.max_aspect.y); + FAIL; + } else + CHECK; + + if(rhints.base_width != 15) { + report("The base_width component of the XSizeHints structure was %d instead of 15.", rhints.base_width); + FAIL; + } else + CHECK; + + if(rhints.base_height != 16) { + report("The base_height component of the XSizeHints structure was %d instead of 16.", rhints.base_height); + FAIL; + } else + CHECK; + + if(rhints.win_gravity != 17) { + report("The win_gravity component of the XSizeHints structure was %d instead of 17", rhints.win_gravity); + FAIL; + } else + CHECK; + + CHECKPASS(17); + + +>>ASSERTION Good A +When the property specified by the +.A property +argument is not set on the window +.A w , +or is not of +.M type +WM_SIZE_HINTS, or is not of +.M format +32, or the property is not long enough to contain either a pre-ICCCM +structure or a new size hints structure, then a call to +xname returns zero. +>>STRATEGY +Create a window with XCreateWindow. +Obtain the property WM_NORMAL_HINTS with XGetWMSizeHints. +Verify that the call returned zero. + +Create a window with XCreateWindow. +Set the WM_NORMAL_HINTS property of format 32 type WM_SIZE_HINTS with OldNumPropSizeElements-1 elements XChangeProperty. +Obtain the property WM_NORMAL_HINTS with XGetWMSizeHints. +Verify that the call returned zero. + +Create a window with XCreateWindow. +Set the WM_NORMAL_HINTS property of format 16 type WM_SIZE_HINTS with NumPropSizeElements elements with XChangeProperty. +Obtain the property WM_NORMAL_HINTS with XGetWMSizeHints. +Verify that the call returned zero. + +Create a window with XCreateWindow. +Set the WM_NORMAL_HINTS property of format 32 type STRING with NumPropSizeElements elements with XChangeProperty. +Obtain the property WM_NORMAL_HINTS with XGetWMSizeHints. +Verify that the call returned zero. +>>CODE +Status status; +Window win; +XSizeHints rhints; +long rsupp; +XSizeHints dummy; /* Big enough (by definition). */ +XVisualInfo *vp; + + resetvinf(VI_WIN); + nextvinf(&vp); + + win = makewin(display, vp); + + w = win; + hints_return = &rhints; + supplied_return = &rsupp; + status = XCALL; + if(status != False) { + report("XGetWMSizeHints() did not return False when the WM_NORMAL_HINTS property was unset."); + FAIL; + } else + CHECK; + + win = makewin(display, vp); + XChangeProperty(display, win, XA_WM_NORMAL_HINTS, XA_WM_SIZE_HINTS, 32, PropModeReplace, (unsigned char *)&dummy, OldNumPropSizeElements-1); + w = win; + hints_return = &rhints; + supplied_return = &rsupp; + status = XCALL; + if(status != False) { + report("XGetWMSizeHints() did not return False when size was %lu 32-bit elements.", OldNumPropSizeElements-1); + FAIL; + } else + CHECK; + + win = makewin(display, vp); + XChangeProperty(display, win, XA_WM_NORMAL_HINTS, XA_WM_SIZE_HINTS, 16, PropModeReplace, (unsigned char *)&dummy, NumPropSizeElements); + w = win; + status = XCALL; + + if(status != False) { + report("XGetWMSizeHints() did not return False when format was 16."); + FAIL; + } else + CHECK; + + win = makewin(display, vp); + XChangeProperty(display, win, XA_WM_NORMAL_HINTS, XA_STRING, 32, PropModeReplace, (unsigned char *)&dummy, NumPropSizeElements); + w = win; + status = XCALL; + + if(status != False) { + report("XGetWMSizeHints() did not return False when type was STRING."); + FAIL; + } else + CHECK; + + CHECKPASS(4); + +>>ASSERTION Good A +When a call to xname returns successfully and a pre-ICCCM size hints property is read, +then the +.A supplied_return +argument contains the bits +.S "(USPosition | USSize | PPosition | PSize | PMinSize | PMaxSize | PResizeInc | PAspect)." +>>STRATEGY +Create a window with XCreateWindow. +Set the property WM_NORMAL_HINTS with size OldNumPropSizeElements using XChangeProperty. +Obtain the value of the WM_NORMAL_HINTS property using XGetWMSizeHints. +Verify that the value returned in supplied_return was (USPositionUSSize|PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect). +>>CODE +Status status; +Window win; +XSizeHints rhints; +long rsupp; +XSizeHints dummy; /* Big enough (by definition). */ +XVisualInfo *vp; +unsigned long flagval = (USPosition | USSize | PPosition | PSize | PMinSize | PMaxSize | PResizeInc | PAspect) ; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + XChangeProperty(display, win, XA_WM_NORMAL_HINTS, XA_WM_SIZE_HINTS, 32, PropModeReplace, (unsigned char *)&dummy, OldNumPropSizeElements); + w = win; + hints_return = &rhints; + supplied_return = &rsupp; + status = XCALL; + if(status == False) { + report("XGetWMSizeHints() returned False."); + FAIL; + } else + CHECK; + + if( rsupp != flagval ) { + report("supplied_return was %lu instead of (USPosition | USSize | PPosition | PSize | PMinSize | PMaxSize | PResizeInc | PAspect) (%lu)", rsupp, flagval); + report("for a pre-ICCCM structure."); + FAIL; + } else + CHECK; + + CHECKPASS(2); + +>>ASSERTION Good A +When the property specified by the +.A property +argument is large enough to contain the base size +and window gravity fields, then the +.A supplied_return +argument contains the bits +.S "(PBaseSize | PWinGravity | USPosition | USSize | PPosition | PSize | PMinSize | PMaxSize | PResizeInc | PAspect)." +>>STRATEGY +Create a window with XCreateWindow. +Set the property WM_NORMAL_HINTS with size OldNumPropSizeElements using XChangeProperty. +Obtain the value of the WM_NORMAL_HINTS property using XGetWMSizeHints. +Verify that the value returned in supplied_return was (PBaseSize|PWinGravity|USPosition|USSize|PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect). +>>CODE +Status status; +Window win; +XSizeHints rhints; +long rsupp; +XSizeHints dummy; /* Big enough (by definition). */ +XVisualInfo *vp; +long flagval = (PBaseSize | PWinGravity | USPosition | USSize | PPosition | PSize | PMinSize | PMaxSize | PResizeInc | PAspect); + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + XChangeProperty(display, win, XA_WM_NORMAL_HINTS, XA_WM_SIZE_HINTS, 32, PropModeReplace, (unsigned char *)&dummy, NumPropSizeElements); + w = win; + hints_return = &rhints; + supplied_return = &rsupp; + status = XCALL; + if(status == False) { + report("%s() returned False.", TestName); + FAIL; + } else + CHECK; + + if( rsupp != flagval) { + report("supplied_return was %lu instead of (PBaseSize | PWinGravity | USPosition | USSize | PPosition | PSize | PMinSize | PMaxSize | PResizeInc | PAspect) (%lu)", rsupp, flagval); + report("for an ICCCMv1 structure."); + FAIL; + } else + CHECK; + + CHECKPASS(2); + +>>ASSERTION Bad A +.ER BadAtom +>>ASSERTION Bad A +.ER BadWindow diff --git a/xts5/Xlib15/XIconifyWindow/XIconifyWindow.m b/xts5/Xlib15/XIconifyWindow/XIconifyWindow.m new file mode 100644 index 00000000..1401e762 --- /dev/null +++ b/xts5/Xlib15/XIconifyWindow/XIconifyWindow.m @@ -0,0 +1,249 @@ +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/Xlib15/XIconifyWindow/XIconifyWindow.m,v 1.2 2005-11-03 08:42:50 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XIconifyWindow/XIconifyWindow.m +>># +>># Description: +>># Tests for XIconifyWindow() +>># +>># Modifications: +>># $Log: icnfywdw.m,v $ +>># Revision 1.2 2005-11-03 08:42:50 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:21 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:33:58 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:55:57 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:20 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:53 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:09:20 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11:16 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 XIconifyWindow Xlib15 +Status +XIconifyWindow(display, w, screen_number) +Display *display = Dsp; +Window w = DRW(Dsp); +int screen_number = DefaultScreen(Dsp); +>>ASSERTION Good A +A call to xname sends a WM_CHANGE_STATE +.S ClientMessage +event with a +.M window +of +.A w , +a +.M format +of 32 and a first +.M data +element of +.S IconicState +to the root window of the screen specified by the +.A screen_number +argument using an event mask of +.S SubstructureRedirectMask | +.S SubstructureNotifyMask +and returns non-zero. +>>STRATEGY +Create a window using XCreateWindow. +Obtain the atom for the string \"WM_CHANGE_STATE\" using XInternAtom. +Select SubstructureNotify events on the root window with XSelectInput. +Generate an event on the root window using XIconifyWindow. +Verify that the call returned non-zero. +Verify that an event was generated with XNextEvent. +Verify that the event type was ClientMessage. +Verify that the event window was correct. +Verify that the event message_type was WM_CHANGE_STATE. +Verify that the event format was 32. +Verify that the first data element of the event structure was IconicState. + +Select SubstructureRedirect events on the root window with XSelectInput. +Generate an event on the root window using XIconifyWindow. +Verify that the call returned non-zero. +Verify that an event was generated with XNextEvent. +Verify that the event type was ClientMessage. +Verify that the event window was correct. +Verify that the event message_type was WM_CHANGE_STATE. +Verify that the event format was 32. +Verify that the first data element of the event structure was IconicState. +>>CODE +Status status; +Atom wm_change_state; +XEvent ev, rev; +int i; +int nevents = 0; +XVisualInfo *vp; +XWindowAttributes watts; +unsigned long event_mask[2]; + + resetvinf(VI_WIN); + nextvinf(&vp); + w = makewin(display, vp); + screen_number = DefaultScreen(display); + + event_mask[0] = SubstructureNotifyMask; + event_mask[1] = SubstructureRedirectMask; + + if( (wm_change_state = XInternAtom(display, "WM_CHANGE_STATE", False)) == None) { + delete("The string \"WM_CHANGE_STATE\" could not be interned."); + return; + } else + CHECK; + + ev.type = ClientMessage; + ev.xany.display = display; + + + ev.xclient.window = w; + ev.xclient.message_type = wm_change_state; + ev.xclient.format = 32; + ev.xclient.data.l[0] = IconicState; + ev.xclient.data.l[1] = 0; + ev.xclient.data.l[2] = 0; + ev.xclient.data.l[3] = 0; + ev.xclient.data.l[4] = 0; + + for(i=0; i < 2; i++) { + + startcall(display); + XSelectInput(display, DRW(display), event_mask[i]); + endcall(display); + + if(geterr() != Success) { + delete("XSelectInput() failed with an event mask of 0x%lx.", event_mask[i]); + return; + } else + CHECK; + + status = XCALL; + + if(status == 0) { + delete("%s() returned zero.", TestName); + return; + } else + CHECK; + + rev.type = -1; + if( (nevents = getevent(display, &rev)) == 0 ) { + report("No event was generated."); + FAIL; + } else { + CHECK; + if(nevents != 1) { + delete("There were %d events generated instead of 1.", nevents); + return; + } else { + CHECK; + + rev.xclient.data.l[1] = 0; + rev.xclient.data.l[2] = 0; + rev.xclient.data.l[3] = 0; + rev.xclient.data.l[4] = 0; + + if( checkevent(&ev, &rev) != 0 ) { + FAIL; + } else + CHECK; + } + } + } + + CHECKPASS(11); + +>>ASSERTION Bad B 1 +>># Untestable, and not worth the effort of adding XTest extension facilities +>># to provoke the error. +When the atom name \(lqWM_CHANGE_STATE\(rq cannot be interned, then +a call to xname +does not send a message and returns zero. +>>ASSERTION Bad B 1 +>># Untestable, and not worth the effort of adding XTest extension facilities +>># to provoke the error. +When the +.S ClientMessage +event cannot be sent, then +a call to xname +returns zero. +>># Assertion removed at request of MIT (Bug Report 67) because +>># XIconifyWindow cannot generate this error (Spec bug) +>># >>ASSERTION Bad A +>># .ER Window diff --git a/xts5/Xlib15/XReconfigureWMWindow/XReconfigureWMWindow.m b/xts5/Xlib15/XReconfigureWMWindow/XReconfigureWMWindow.m new file mode 100644 index 00000000..ad1f1dc4 --- /dev/null +++ b/xts5/Xlib15/XReconfigureWMWindow/XReconfigureWMWindow.m @@ -0,0 +1,378 @@ +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/Xlib15/XReconfigureWMWindow/XReconfigureWMWindow.m,v 1.2 2005-11-03 08:42:50 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XReconfigureWMWindow/XReconfigureWMWindow.m +>># +>># Description: +>># Tests for XReconfigureWMWindow() +>># +>># Modifications: +>># $Log: rcnfgrwmwd.m,v $ +>># Revision 1.2 2005-11-03 08:42:50 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:21 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:33:59 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:55:58 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:21 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:53 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:09:21 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11: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 XReconfigureWMWindow Xlib15 +Status +XReconfigureWMWIndow(display, w, screen_number, value_mask, values) +Display *display = Dsp; +Window w = DRW(Dsp); +int screen_number = DefaultScreen(Dsp); +unsigned int value_mask = 0; +XWindowChanges *values = &wchanges; +>>EXTERN +XWindowChanges wchanges; +>>ASSERTION Good A +A call to xname issues a +.S ConfigureWindow +request on the specified top-level window named by the +.A w +argument. +>>STRATEGY +Create a window using XCreateWindow. +Select ConfigureNotify events on the window using XSelectInput with SubstructureNotifyMask. +Generate a ConfigureWindow event on the window using XReconfigureWMWindow. +Verify that the call returned non-zero. +Verify that a single event was generated. +Verify that the event type was ConfigureWindow. +>>CODE +Status status; +XEvent ev; +int nevents = 0; +XVisualInfo *vp; +XWindowChanges changes; + + resetvinf(VI_WIN); + nextvinf(&vp); + w = makewin(display, vp); + XSelectInput(display, w, StructureNotifyMask); + + screen_number = DefaultScreen(display); + value_mask = CWBorderWidth; + changes.border_width = 5; + values = &changes; + + status = XCALL; + + if(status == 0) { + report("%s() returned zero.", TestName); + FAIL; + } else + CHECK; + + if( (nevents = getevent(display, &ev)) == 0 ) { + report("No event was generated."); + FAIL; + + } else { + + CHECK; + if(nevents != 1) { + delete("There were %d events generated instead of 1.", nevents); + return; + } else + CHECK; + + if(ev.type != ConfigureNotify) { + report("The type component of the generated event was %d instead of ConfigureWindow (%d)", + ev.xclient.type, ConfigureNotify); + FAIL; + } else + CHECK; + } + + CHECKPASS(4); + +>>ASSERTION Good A +When the ConfigureWindow request fails with a +.S BadMatch +error, then a call to xname sends a synthetic +.S ConfigureRequestEvent +to the root of the window specified by the +.A w +argument, with the event +containing the same configuration parameters specified by the +.A values +and +.A valuemask +arguments +and having a +.M window +element of +.A w +and a +.M parent +element equal to the receiving root window, +using an event mask of +.S SubstructureRedirectMask | +.S SubstructureNotifyMask +and returns non-zero. +>>STRATEGY +Create a window with XCreateWindow. +Select ConfigureRequest events using XSelectInput with SubstructureNotifyMask. +Call XReconfigureWMWindow using the root window as a sibling and no specified StackMode. +Verify that the call did not return zero. +Verify that one ConfigureRequest event is generated using XNextEvent. +Verify that the event components are correct. + +Select ConfigureRequest events using XSelectInput with SubstructureRedirectMask. +Call XReconfigureWMWindow using the root window as a sibling and no specified StackMode. +Verify that the call did not return zero. +Verify that one ConfigureRequest event is generated using XNextEvent. +Verify that the event components are correct. +>>CODE +Status status; +XEvent rev, expectev; +int nevents = 0; +int i; +XVisualInfo *vp; +XWindowChanges changes; +unsigned long event_mask[2]; +unsigned long valuemask = CWSibling /**/| CWStackMode/**/ | CWX | CWY | CWWidth | CWHeight | CWBorderWidth; + + event_mask[0] = SubstructureNotifyMask; + event_mask[1] = SubstructureRedirectMask; + + resetvinf(VI_WIN); + nextvinf(&vp); + w = makewin(display, vp); + + expectev.type = ConfigureRequest; + expectev.xany.display = display; + + expectev.xconfigurerequest.type = ConfigureRequest; + expectev.xconfigurerequest.send_event = True; + expectev.xconfigurerequest.display = display; + expectev.xconfigurerequest.window = w; + expectev.xconfigurerequest.parent = DRW(display); + expectev.xconfigurerequest.x = 1; + expectev.xconfigurerequest.y = 2; + expectev.xconfigurerequest.width = 3; + expectev.xconfigurerequest.height = 4; + expectev.xconfigurerequest.border_width = 5; + expectev.xconfigurerequest.above = DRW(display); + expectev.xconfigurerequest.detail = Above; + expectev.xconfigurerequest.value_mask = valuemask; + + screen_number = DefaultScreen(display); + value_mask = valuemask; + changes.x = 1; + changes.y = 2; + changes.width = 3; + changes.height = 4; + changes.border_width = 5; + changes.sibling = DRW(display); + changes.stack_mode = Above; + values = &changes; + + + for(i=0; i<2; i++) { + + startcall(display); + XSelectInput(display, DRW(display), event_mask[i]); + endcall(display); + + if(geterr() != Success) { + delete("XSelectInput() failed with an event mask of 0x%lx.", event_mask[i]); + return; + } else + CHECK; + + status = XCALL; + + if(status == 0) { + report("%s() returned zero.", TestName); + FAIL; + } else + CHECK; + + rev.type = -1; + if( (nevents = getevent(display, &rev)) == 0 ) { + report("No event was generated."); + FAIL; + + } else { + + CHECK; + if(nevents != 1){ + delete("There were %d events generated instead of 1.", nevents); + return; + } else + CHECK; + + if( checkevent( &expectev, &rev) != 0) + FAIL; + else + CHECK; + + } + } + + CHECKPASS(10); + +>>ASSERTION Bad B 1 +>># Untestable, and not worth the effort of adding XTest extension facilities +>># to provoke the error. +When the +.S ConfigureRequestEvent +is not successfully sent, then a call to xname returns zero. +>>ASSERTION Bad A +When the +.A value_mask +argument contains the bits +.S CWWidth +or +.S CWHeight +and either of the +.M width +or +.M height +components of the +.S XWindowChanges +structure named by the +.A values +argument is zero, then a +.S BadValue +error occurs. +>>STRATEGY +Create a window using XCreateWindow. +Configure the window to have a height of zero using XReconfigureWMWindow +Verify that a BadValue error was generated. +Configure the window to have a width of zero using XReconfigureWMWindow +Verify that a BadValue error was generated. +>>CODE BadValue +Status status; +XEvent ev; +int nevents = 0; +XVisualInfo *vp; +XWindowChanges changes; + + resetvinf(VI_WIN); + nextvinf(&vp); + w = makewin(display, vp); + + screen_number = DefaultScreen(display); + value_mask = CWHeight ; + changes.height = 0; + values = &changes; + status = XCALL; + + if(geterr() == BadValue) + CHECK; + + changes.width = 0; + value_mask = CWWidth; + status = XCALL; + + if(geterr() == BadValue) + CHECK; + + CHECKPASS(2); + +>>ASSERTION Bad A +When the window argument does not name a valid window, then a +.S BadWindow +error occurs. +>>STRATEGY +Create a bad window by creating and destroying a window. +Call test function using bad window as the window argument. +Verify that a BadWindow error occurs. +>>CODE BadWindow +Status status; + + A_WINDOW = badwin(A_DISPLAY); + + status = XCALL; + + if (geterr() == BadWindow) + PASS; + else + FAIL; + +>># Completed Kieron Review diff --git a/xts5/Xlib15/XSetClassHint/XSetClassHint.m b/xts5/Xlib15/XSetClassHint/XSetClassHint.m new file mode 100644 index 00000000..a1aaeb29 --- /dev/null +++ b/xts5/Xlib15/XSetClassHint/XSetClassHint.m @@ -0,0 +1,216 @@ +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/Xlib15/XSetClassHint/XSetClassHint.m,v 1.2 2005-11-03 08:42:50 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XSetClassHint/XSetClassHint.m +>># +>># Description: +>># Tests for XSetClassHint() +>># +>># Modifications: +>># $Log: stclsshnt.m,v $ +>># Revision 1.2 2005-11-03 08:42:50 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:21 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:33:59 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:55:59 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:21 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:53 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:28:59 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:23 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11:21 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 XSetClassHint Xlib15 + +XSetClassHint(display, w, class_hints) +Display *display = Dsp; +Window w = DRW(Dsp); +XClassHint *class_hints = &chint; +>>EXTERN +#include "X11/Xatom.h" +XClassHint chint = { "DefName", "DefClass"}; +>>ASSERTION Good A +A call to xname sets the WM_CLASS property for +the window +.A w +to be of +.M type +.S STRING , +.M format +8 and to have +.M value +set to the strings in the +.M res_name +and +.M res_class +members of the +.S XClassHint +structure named by the +.A class_hints +argument, in that order and null-separated. +>>STRATEGY +Create a window with XCreateWindow. +Set the WM_CLASS property for the window using XSetClassHint. +Obtain the value type and format of the WM_CLASS property using XGetWindowProperty. +Verify that the format is 8. +Verify that the type is STRING. +Verify that the value is correct. +>>CODE +Window win; +XVisualInfo *vp; +XClassHint classhint, retchint; +int reslen; +char *propp = NULL, *s; +unsigned long leftover, nitems, len; +int actual_format; +Atom actual_type; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + classhint.res_name = "XTestResName"; + classhint.res_class = "XTestClassName"; + + reslen = strlen(classhint.res_name); + len = reslen + 1 + strlen(classhint.res_class) + 1; + + w = win; + class_hints = &classhint; + XCALL; + + if (XGetWindowProperty(display, win, XA_WM_CLASS, 0L, len, False, + AnyPropertyType, &actual_type, &actual_format, &nitems, &leftover, + (unsigned char **)&propp) != Success) { + delete("XGetWindowProperty() did not return Success."); + return; + } else + CHECK; + + if(leftover != 0) { + report("The leftover elements numbered %lu instead of 0", leftover); + FAIL; + } else + CHECK; + + if(actual_format != 8) { + report("The format of the WM_HINTS property was %lu instead of 8", actual_format); + FAIL; + } else + CHECK; + + if(actual_type != XA_STRING) { + report("The type of the WM_CLASS property was %lu instead of STRING (%lu).", actual_type, (unsigned long) XA_STRING); + FAIL; + } else + CHECK; + + if(propp == NULL) { + + report("No value was set for the WM_CLASS property."); + FAIL; + + } else { + + if(strcmp(propp, classhint.res_name) != 0) { + report("The res_name component of the XClassHint structure was \"%s\" instead of \"%s\"", propp, classhint.res_name); + FAIL; + } else + CHECK; + + if(strcmp(s = propp+1+reslen, classhint.res_class) != 0) { + report("The res_class component of the XClassHint structure was \"%s\" instead of \"%s\".", s, classhint.res_class); + FAIL; + } else + CHECK; + XFree((char*)propp); + } + + CHECKPASS(6); + +>>ASSERTION Bad B 1 +.ER BadAlloc +>>ASSERTION Bad A +.ER BadWindow +>># Kieron Completed Review diff --git a/xts5/Xlib15/XSetCommand/XSetCommand.m b/xts5/Xlib15/XSetCommand/XSetCommand.m new file mode 100644 index 00000000..98ca9e38 --- /dev/null +++ b/xts5/Xlib15/XSetCommand/XSetCommand.m @@ -0,0 +1,239 @@ +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/Xlib15/XSetCommand/XSetCommand.m,v 1.2 2005-11-03 08:42:50 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XSetCommand/XSetCommand.m +>># +>># Description: +>># Tests for XSetCommand() +>># +>># Modifications: +>># $Log: stcmmnd.m,v $ +>># Revision 1.2 2005-11-03 08:42:50 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:21 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:34:00 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:56:00 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:22 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:54 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:29:00 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:24 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11:23 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 XSetCommand Xlib15 + +XSetCommand(display, w, argv, argc) +Display *display = Dsp; +Window w = DRW(Dsp); +char **argv = & argp; +int argc = 0; +>>EXTERN +#include "X11/Xatom.h" +char *argp; +>># +>># COMMENT: We now assume that the WM_COMMAND property is +>># of type STRING and of format 8. +>># +>># Cal 7/6/91 +>># +>># >>ASSERTION Good A +>># A call to xname sets the WM_COMMAND property for the window +>># .A w +>># to +>># .A argc +>># of the arguments specified by the +>># .A argv +>># argument. +>># +>>ASSERTION Good A +A call to xname sets the WM_COMMAND property +for the window +.A w +to +.A argc +of the arguments specified by the +.A argv +argument and to have +.M type +STRING and +.M format +8. +>>STRATEGY +Create a window using XCreateWindow. +Set the WM_COMMAND property using XSetCommand. +Obtain the value of the WM_COMMAND property using XGetTextProperty. +Verify that the number and value of the returned strings is correct. +Release the allocated memory using XFreeStringList. +>>CODE +XVisualInfo *vp; +char *nullstr = "<NULL>"; +char **strpp, *strp; +char *str1 = "XTest string 1"; +char *str2 = "XTest string 2"; +char *prop[2]; +char **rstrings = (char**) NULL; +int rcount = 0; +int i; +XTextProperty rtp; +Status status; +char **list_return; +int count_return; +int len; + + prop[0] = str1; + prop[1] = str2; + + resetvinf(VI_WIN); + nextvinf(&vp); + w = makewin(display, vp); + argv = prop; + argc = 2; + XCALL; + + if(XGetTextProperty(display, w, &rtp, XA_WM_COMMAND) == False) { + delete("XGetTextProperty() returned False."); + return; + } else + CHECK; + + if(rtp.encoding != XA_STRING ) { + report("The encoding component of the XTextProperty was %lu instead of STRING (%lu).", + (unsigned long)rtp.encoding, (unsigned long)XA_STRING); + FAIL; + } else + CHECK; + + if(rtp.format != 8) { + report("The format component of the XTextProperty was %d instead of %d.", rtp.format, 8 ); + FAIL; + } else + CHECK; + + len = strlen(str1) + 1 + strlen(str2) + 1; + + if(rtp.nitems != len) { + report("The nitems component of the XTextProperty was %lu instead of %lu.", rtp.nitems, len); + FAIL; + } else + CHECK; + + /* + * Ignore final <NUL> if present since UNIX WM_COMMAND is nul-terminated, unlike + * the nul-separated text properties. + * Cal - 7/6/91 + */ + if (rtp.value[rtp.nitems - 1] == '\0') rtp.nitems--; + + + if(XTextPropertyToStringList( &rtp, &list_return, &count_return) == False) { + delete("XTextPropertyToStringList() returned False."); + return; + } else + CHECK; + + if (count_return != argc) { + delete("XTextPropertyToStringList() count_return was %d instead of %d.", count_return, argc); + return; + } else + CHECK; + + if( (strcmp(str1, list_return[0]) != 0) || (strcmp(str2, list_return[1]) != 0) ) { + report("Value strings were:"); + report("\"%s\" and \"%s\"", list_return[0], list_return[1]); + report("Instead of:"); + report("\"%s\" and \"%s\"", str1, str2); + FAIL; + } else + CHECK; + + XFree((char*)rtp.value); + XFreeStringList(list_return); + + CHECKPASS(7); + +>>ASSERTION Bad B 1 +.ER BadAlloc +>>ASSERTION Bad A +.ER BadWindow +>># Kieron Action Review diff --git a/xts5/Xlib15/XSetIconName/XSetIconName.m b/xts5/Xlib15/XSetIconName/XSetIconName.m new file mode 100644 index 00000000..7802caa9 --- /dev/null +++ b/xts5/Xlib15/XSetIconName/XSetIconName.m @@ -0,0 +1,206 @@ +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/Xlib15/XSetIconName/XSetIconName.m,v 1.2 2005-11-03 08:42:51 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XSetIconName/XSetIconName.m +>># +>># Description: +>># Tests for XSetIconName() +>># +>># Modifications: +>># $Log: sticnnm.m,v $ +>># Revision 1.2 2005-11-03 08:42:51 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:21 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:34:00 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:56:01 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:22 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:54 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:29:00 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:25 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11:26 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 XSetIconName Xlib15 +int +XSetIconName(display, w, icon_name) +Display *display = Dsp; +Window w = DRW(Dsp); +char *icon_name = "XTestUninit"; +>>EXTERN +#include "X11/Xatom.h" +>>ASSERTION Good A +A call to xname sets the +.S WM_ICON_NAME +property for the window +.A w +to be of +.M type +.S STRING , +.M format +8 and to have +.M value +set to the null terminated string specified by the +.A icon_name +argument. +>>STRATEGY +Create a window with XCreateWindow +Set the icon name for the window with XSetIconName +Get the WM_ICON_NAME property for the window with XGetTextProperty. +Verify that type and format are STRING and 8 respectively. +Verify that the value was set correctly. +>>CODE +Window win; +int count; +char *wname = "XTestICNName"; +XTextProperty tp; +char **wnameret = NULL; +XVisualInfo *vp; +Status status; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + w = win; + icon_name = wname; + XCALL; + + status = XGetTextProperty(display, win, &tp, XA_WM_ICON_NAME); + + if (status == False || tp.value == NULL) { + status = False; + tp.value = NULL; + report("Failed to get WM_ICON_NAME."); + FAIL; + } else + CHECK; + + if (status && tp.encoding != XA_STRING) { + status = False; + report("Encoding is \"%s\", not STRING.", XGetAtomName(display, tp.encoding) ); + FAIL; + } else + CHECK; + + if (status && tp.format != 8) { + status = False; + report("Format is %d instead of 8.", tp.format); + FAIL; + } else { + CHECK; + + status = XTextPropertyToStringList(&tp, &wnameret, &count); + + if (status == False) { + wnameret = NULL; + delete("XTextPropertyToStringList returned False."); + return; + } else + CHECK; + + if (count != 1) { + status = False; + report("WM_ICON_NAME not single string."); + FAIL; + } else + CHECK; + } + + if(status && strcmp(wnameret[0], wname) != 0) { + report("Icon name was \"%s\" instead of \"%s\".", wnameret[0], wname); + FAIL; + } else + CHECK; + + if (wnameret != NULL) + XFree((char*)wnameret); + if (tp.value != NULL) + XFree((char*)tp.value); + CHECKPASS(6); + +>>ASSERTION Bad B 1 +.ER BadAlloc +>>ASSERTION Good A +.ER BadWindow +>># Kieron Completed Review diff --git a/xts5/Xlib15/XSetIconSizes/XSetIconSizes.m b/xts5/Xlib15/XSetIconSizes/XSetIconSizes.m new file mode 100644 index 00000000..b206ae6c --- /dev/null +++ b/xts5/Xlib15/XSetIconSizes/XSetIconSizes.m @@ -0,0 +1,252 @@ +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/Xlib15/XSetIconSizes/XSetIconSizes.m,v 1.2 2005-11-03 08:42:51 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XSetIconSizes/XSetIconSizes.m +>># +>># Description: +>># Tests for XSetIconSizes() +>># +>># Modifications: +>># $Log: sticnszs.m,v $ +>># Revision 1.2 2005-11-03 08:42:51 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:21 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:34:01 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:56:02 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:23 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:55 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:29:01 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:26 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11:28 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 XSetIconSizes Xlib15 + +XSetIconSizes(display, w, size_list, count) +Display *display = Dsp; +Window w = DRW(Dsp); +XIconSize *size_list = &sizelist; +int count = 1; +>>EXTERN +#include "X11/Xatom.h" +XIconSize sizelist; +>>ASSERTION Good A +A call to xname sets the WM_ICON_SIZE property for the window +.A w +to be of +type +.S WM_ICON_SIZE , +format 32 and to have value set +to the +.A count +.S XIconSize +structures named by the +.A size_list +argument. +>>STRATEGY +Create a window using XCreateWindow. +Set the WM_ICON_SIZE property using XSetIconSizes. +Obtain the WM_ICON_SIZE property using XGetWindowProperty. +Verify that the property type is WM_ICON_SIZE. +Verify that the property format is 32. +Verify that the returned number of elements is correct. +Verify that the property value is correct. +>>CODE +#define NumPropIconSizeElements 6 +XVisualInfo *vp; +unsigned long leftover, nitems, len; +int actual_format; +Atom actual_type; +long *rsizelist = (long *) NULL, *rsp; +XIconSize sizelist[7], *sp; +int cnt = 7; +int i, v; + + resetvinf(VI_WIN); + nextvinf(&vp); + w = makewin(display, vp); + + for(i=0, sp=sizelist, v=0; i<cnt; i++, sp++) { + sp->min_width = v++; + sp->min_height = v++; + sp->max_width = v++; + sp->max_height = v++; + sp->width_inc = v++; + sp->height_inc = v++; + } + + count = cnt; + size_list = sizelist; + XCALL; + + len = cnt * NumPropIconSizeElements; + if(XGetWindowProperty(display, w, XA_WM_ICON_SIZE, + 0L, len, False, + AnyPropertyType, &actual_type, &actual_format, + &nitems, &leftover, (unsigned char **) &rsizelist) != Success) { + delete("XGetWindowProperty() did not return Success."); + return; + } else + CHECK; + + if(leftover != 0) { + report("The leftover elements numbered %lu instead of 0", leftover); + FAIL; + } else + CHECK; + + if(actual_format != 32) { + report("The format of the WM_ICON_SIZE property was %lu instead of 32", actual_format); + FAIL; + } else + CHECK; + + if(actual_type != XA_WM_ICON_SIZE) { + report("The type of the WM_ICON_SIZE property was %lu instead of WM_ICON_SIZE (%lu)", actual_type, (long) XA_WM_ICON_SIZE); + FAIL; + } else + CHECK; + + if( rsizelist == (long *) NULL) { + report("No value was obtained for the WM_ICON_SIZES property."); + FAIL; + } else { + + CHECK; + if( nitems != len) { + report("The WM_ICON_SIZES property comprised %ul elements instead of %d", nitems, cnt); + FAIL; + } else + if(actual_format == 32) { + + CHECK; + for(i=0, rsp=rsizelist, v=0; i<cnt; i++) { + + if(*rsp++ != v++) { + report("The min_width component of the XIconSize structure %d was %d instead of %d.", i, rsp[-1], v-1); + FAIL; + } else + CHECK; + + if(*rsp++ != v++) { + report("The min_height component of the XIconSize structure %d was %d instead of %d.", i, rsp[-1], v-1); + FAIL; + } else + CHECK; + + if(*rsp++ != v++) { + report("The max_width component of the XIconSize structure %d was %d instead of %d.", i, rsp[-1], v-1); + FAIL; + } else + CHECK; + + if(*rsp++ != v++) { + report("The max_height component of the XIconSize structure %d was %d instead of %d.", i, rsp[-1], v-1); + FAIL; + } else + CHECK; + + if(*rsp++ != v++) { + report("The width_inc component of the XIconSize structure %d was %d instead of %d.", i, rsp[-1], v-1); + FAIL; + } else + CHECK; + + if(*rsp++ != v++) { + report("The height_inc component of the XIconSize structure %d was %d instead of %d.", i, rsp[-1], v-1); + FAIL; + } else + CHECK; + } + XFree( (char*) rsizelist); + } + } + + CHECKPASS(6*cnt+6); + +>>ASSERTION Bad B 1 +.ER BadAlloc +>>ASSERTION Bad A +.ER BadWindow +>># Kieron Action Review diff --git a/xts5/Xlib15/XSetRGBColormaps/XSetRGBColormaps.m b/xts5/Xlib15/XSetRGBColormaps/XSetRGBColormaps.m new file mode 100644 index 00000000..dccc9ed0 --- /dev/null +++ b/xts5/Xlib15/XSetRGBColormaps/XSetRGBColormaps.m @@ -0,0 +1,263 @@ +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/Xlib15/XSetRGBColormaps/XSetRGBColormaps.m,v 1.2 2005-11-03 08:42:51 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XSetRGBColormaps/XSetRGBColormaps.m +>># +>># Description: +>># Tests for XSetRGBColormaps() +>># +>># Modifications: +>># $Log: strgbclrmp.m,v $ +>># Revision 1.2 2005-11-03 08:42:51 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:21 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:34:01 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:56:03 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:23 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:55 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:29:02 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:28 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11:30 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 XSetRGBColormaps Xlib15 +void +XSetRGBColormaps(display, w, std_colormap, count, property) +Display *display = Dsp; +Window w = DRW(Dsp); +XStandardColormap *std_colormp = &sclrmp; +int count = 1; +Atom property = XA_RGB_DEFAULT_MAP; +>>EXTERN +#include "X11/Xatom.h" +static XStandardColormap sclrmp; +static XStandardColormap scmp1 = { (Colormap) 1, 2L, 3L, 4L, 5L, 6L, 7L, 8L, (VisualID) 9L, (XID) 10L }; +>>ASSERTION Good A +A call to xname sets the property, specified by +the +.A property +argument, for the window +.A w +to be of type +.S RGB_COLOR_MAP , +format 32, and to have value set to the +.A count +.S XStandardColormap +structures specified by the +.A std_colormap +argument. +>>STRATEGY +Create a window using XCreateWindow. +Set the RGB_DEFAULT_MAP property using XSetRGBColormaps. +Obtain the RGB_DEFAULT_MAP property using XGetWindowProperty. +Verify that the property type is RGB_COLOR_MAP. +Verify that the property format is 32. +Verify that property value is correct. +>>CODE +Atom actual_type; +int actual_format; +unsigned long leftover; +unsigned long nitems; +XVisualInfo *vp; +XStandardColormap *rcmap = (XStandardColormap *) NULL; + + resetvinf(VI_WIN); + nextvinf(&vp); + w = makewin(display, vp); + + std_colormp = &scmp1; + XCALL; + + if( XGetWindowProperty(display, w, property, 0L, 40L, False, XA_RGB_COLOR_MAP, &actual_type, + &actual_format, &nitems, &leftover, (unsigned char **) &rcmap) != Success ) { + delete("XGetWindowProperty() did not return Success."); + return; + } else + CHECK; + + if(leftover != 0) { + report("The leftover elements numbered %lu instead of 0", leftover); + FAIL; + } else + CHECK; + + if(actual_format != 32) { + report("The format of the RGB_DEFAULT_MAP property was %lu instead of 32", actual_format); + FAIL; + } else + CHECK; + + if(actual_type != XA_RGB_COLOR_MAP) { + report("The type of the RGB_DEFAULT_MAP property was %lu instead of RGB_DEFAULT_MAP (%lu)", actual_type, + (long) XA_RGB_DEFAULT_MAP); + FAIL; + } else + CHECK; + + if( rcmap == (XStandardColormap *) NULL) { + report("No value was obtained for the RGB_DEFAULT_MAP property."); + FAIL; + } else { + + CHECK; + + if(nitems != 10) { + report("The RGB_DEFAULT_MAP property comprised %d elements instead of %d", nitems, 10); + FAIL; + } else + if(actual_format == 32) { + CHECK; + if(rcmap->colormap != scmp1.colormap) { + report("The colormap component of the XStandardColormap structure %d was incorrect."); + FAIL; + } else + CHECK; + + if(rcmap->red_max != scmp1.red_max) { + report("The red_max component of the XStandardColormap structure %d was incorrect."); + FAIL; + } else + CHECK; + + if(rcmap->red_mult != scmp1.red_mult) { + report("The red_mult component of the XStandardColormap structure %d was incorrect."); + FAIL; + } else + CHECK; + + if(rcmap->green_max != scmp1.green_max) { + report("The green_max component of the XStandardColormap structure %d was incorrect."); + FAIL; + } else + CHECK; + + if(rcmap->green_mult != scmp1.green_mult) { + report("The green_mult component of the XStandardColormap structure %d was incorrect."); + FAIL; + } else + CHECK; + + if(rcmap->blue_max != scmp1.blue_max) { + report("The blue_max component of the XStandardColormap structure %d was incorrect."); + FAIL; + } else + CHECK; + + if(rcmap->blue_mult != scmp1.blue_mult) { + report("The blue_mult component of the XStandardColormap structure %d was incorrect."); + FAIL; + } else + CHECK; + + if(rcmap->base_pixel != scmp1.base_pixel) { + report("The base_pixel component of the XStandardColormap structure %d was incorrect."); + FAIL; + } else + CHECK; + + if(rcmap->visualid != scmp1.visualid) { + report("The visualid component of the XStandardColormap structure %d was incorrect."); + FAIL; + } else + CHECK; + + if(rcmap->killid != scmp1.killid ) { + report("The killid component of the XStandardColormap structure %d was incorrect."); + FAIL; + } else + CHECK; + + } + XFree((char *) rcmap); + } + + CHECKPASS(16); + +>>ASSERTION Bad A +.ER BadAlloc +>>ASSERTION Bad A +.ER BadAtom +>>ASSERTION Bad A +.ER BadWindow +>># Kieron Action Review diff --git a/xts5/Xlib15/XSetTextProperty/XSetTextProperty.m b/xts5/Xlib15/XSetTextProperty/XSetTextProperty.m new file mode 100644 index 00000000..4b3bbcbe --- /dev/null +++ b/xts5/Xlib15/XSetTextProperty/XSetTextProperty.m @@ -0,0 +1,282 @@ +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/Xlib15/XSetTextProperty/XSetTextProperty.m,v 1.2 2005-11-03 08:42:52 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XSetTextProperty/XSetTextProperty.m +>># +>># Description: +>># Tests for XSetTextProperty() +>># +>># Modifications: +>># $Log: sttxtprprt.m,v $ +>># Revision 1.2 2005-11-03 08:42:52 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:21 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:34:03 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:56:07 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:25 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:57 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:29:05 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:33 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11:37 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 XSetTextProperty Xlib15 +void +XSetTextProperty(display, w, text_prop, property) +Display *display = Dsp; +Window w = DRW(Dsp); +XTextProperty *text_prop = &textprop; +Atom property = XA_WM_NAME; +>>EXTERN +#include "X11/Xatom.h" +static XTextProperty textprop = { (unsigned char *) 0, XA_STRING, 8, (unsigned long) 0 }; +>>ASSERTION Good A +A call to xname sets the property, specified by +the +.A property +argument, for the window +.A w +to be of data, type, format and number of items as specified by the +.M value +field, the +.M encoding +field, the +.M format +field, and the +.M nitems +field of the +.S XTextProperty +structure named by the +.A text_prop +argument. +>>STRATEGY +Create a window using XCreateWindow +Set the property WM_NAME with XSetTextProperty +Verify that the property values were all set correctly with XGetTextProperty +>>CODE +Window win; +char *str[2]; +char *str1 = "Xtest test string1"; +char *str2 = "Xtest test string2"; +int nitems; +Status status; +char **list_return; +int count_return; +XTextProperty rtp, tp; +XVisualInfo *vp; + + str[0] = str1; + str[1] = str2; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + if(XStringListToTextProperty(str, 2, &tp) == False) { + delete("XStringListToTextProperty() Failed."); + return; + } else + CHECK; + + w = win; + text_prop = &tp; + XCALL; + + w = win; + status = XGetTextProperty(display, w, &rtp, property); + + if (status == False) { + delete("Could not retrieve the WM_NAME property with XGetTextProperty."); + return; + } else + CHECK; + + if(rtp.encoding != XA_STRING) { + report("The WM_NAME property was not of type STRING"); + FAIL; + } else + CHECK; + + if(rtp.format != 8) { + report("The WM_NAME property format was %d instead of 8", rtp.format); + FAIL; + } else + CHECK; + + nitems = strlen(str1) + strlen(str2) + 2 - 1; + if(rtp.nitems != nitems) { + report("The nitems component was %lu instead of %d", rtp.nitems, nitems); + FAIL; + } else + CHECK; + + if(XTextPropertyToStringList( &rtp, &list_return, &count_return) == False) { + delete("XTextPropertyToStringList() returned False."); + return; + } else + CHECK; + + if (count_return != 2) { + delete("XTextPropertyToStringList() count_return was %d instead of 2.", count_return); + return; + } else + CHECK; + + if( (strcmp(str1, list_return[0]) != 0) || (strcmp(str2, list_return[1]) != 0) ) { + report("Value strings were:"); + report("\"%s\" and \"%s\"", list_return[0], list_return[1]); + report("Instead of:"); + report("\"%s\" and \"%s\"", str1, str2); + FAIL; + } else + CHECK; + + XFree((char*)rtp.value); + XFreeStringList(list_return); + CHECKPASS(8); + + +>>ASSERTION Bad B 1 +.ER BadAlloc +>>ASSERTION Bad A +.ER BadAtom +>>ASSERTION Bad A +.ER BadWindow +>>ASSERTION Bad A +When the +.M format +component of the +.S XTextProperty +structure named by the +.A text_prop +argument is other than 8, 16 or 32 then a +.S BadValue +error occurs. +>>STRATEGY +Create a window with XCreateWindow. +Create a TextPropertyStructure with format component set to {0,1,7,15,31}. +Set the WM_NAME property with XSetTextProperty. +Verify that a BadValue error occurs each time. +>>EXTERN +static int bad_ones[] = {0, 1, 7, 15, 31}; +>>CODE BadValue +Window win; +char *str1 = "Xtest test string1"; +char *str2 = "Xtest test string2"; +char *str[2]; +XTextProperty tp; +XVisualInfo *vp; +int i; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + str[0] = str1; + str[1] = str2; + + if(XStringListToTextProperty(str, 2, &tp) == False) { + delete("XStringListToTextProperty() Failed."); + return; + } else + CHECK; + + for(i=0; i < NELEM(bad_ones); i++) { + tp.format = bad_ones[i]; + w = win; + text_prop = &tp; + XCALL; + + if(geterr() != BadValue) + FAIL; + else + CHECK; + } + + CHECKPASS(NELEM(bad_ones) + 1); + + +>># What if the encoding or nitems fields are garbage? Servers crash? +>># Yep, seem to. - kieron +>># Completed Kieron Review diff --git a/xts5/Xlib15/XSetTransientForHint/XSetTransientForHint.m b/xts5/Xlib15/XSetTransientForHint/XSetTransientForHint.m new file mode 100644 index 00000000..410dd984 --- /dev/null +++ b/xts5/Xlib15/XSetTransientForHint/XSetTransientForHint.m @@ -0,0 +1,226 @@ +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/Xlib15/XSetTransientForHint/XSetTransientForHint.m,v 1.2 2005-11-03 08:42:51 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XSetTransientForHint/XSetTransientForHint.m +>># +>># Description: +>># Tests for XSetTransientForHint() +>># +>># Modifications: +>># $Log: sttrnsntfr.m,v $ +>># Revision 1.2 2005-11-03 08:42:51 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:21 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:34:03 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:56:06 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:24 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:57 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:29:04 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:31 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11:36 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 XSetTransientForHint Xlib15 + +XSetTransientForHint(display, w, prop_window) +Display *display = Dsp; +Window w = DRW(Dsp); +Window prop_window = DRW(Dsp); +>>EXTERN +#include "X11/Xatom.h" +>>ASSERTION Good A +A call to xname sets the WM_TRANSIENT_FOR property for the window +.A w +to be of type +.S WINDOW , +format 32 and to have value set +to the window specified by the +.A prop_window +argument. +>>STRATEGY +Create a window with XCreateWindow. +Set the WM_TRANSIENT_FOR property using XSetTransientForHint. +Obtain the WM_TRANSIENT_FOR property using XGetWindowProperty. +Verify that the property type is WINDOW. +Verify that the property format is 32. +Verify that the property value was correct. +>>CODE +Window win, pwin; +XVisualInfo *vp; +Window *retwin = (Window *) NULL; +unsigned long leftover, nitems, len; +int actual_format; +Atom actual_type; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + pwin = makewin(display, vp); + + w = win; + prop_window = pwin; + XCALL; + + if (XGetWindowProperty(display, win, XA_WM_TRANSIENT_FOR, 0L, 1L, False, + AnyPropertyType, &actual_type, &actual_format, &nitems, &leftover, (unsigned char **) &retwin) != Success) { + delete("XGetWindowProperty() did not return Success."); + return; + } else + CHECK; + + if(leftover != 0) { + report("The leftover elements numbered %lu instead of 0", leftover); + FAIL; + } else + CHECK; + + if(actual_format != 32) { + report("The format of the WM_TRANSIENT_FOR property was %lu instead of 32", actual_format); + FAIL; + } else + CHECK; + + if(actual_type != XA_WINDOW) { + report("The type of the WM_TRANSIENT_FOR property was %lu instead of WINDOW (%lu)", actual_type, (long) XA_WINDOW); + FAIL; + } else + CHECK; + + if(nitems != 1) { + report("The WM_TRANSIENT_FOR property comprised %ul elements instead of 1", nitems); + FAIL; + } else + CHECK; + + if( retwin == (Window *) NULL) { + report("No value was set for the WM_TRANSIENT_FOR property."); + FAIL; + + } else { + + if(*retwin != pwin) { + report("The WM_TRANSIENT_FOR property had value %lx instead of %lx", (long) *retwin, (long) pwin); + FAIL; + } else + CHECK; + + XFree((char*)retwin); + } + + CHECKPASS(6); + + + +>>ASSERTION Bad B 1 +.ER BadAlloc +>>ASSERTION Good A +When the window specified by the +.A w +argument does not name a +valid window, then a +.S BadWindow +error occurs. +>>STRATEGY +Obtain a bad window ID. +Set the WM_TRANSIENT_FOR property for the bad window using XSetTransientForHint. +Verify that a BadWindow error was generated. +>>CODE BadWindow +XVisualInfo *vp; + + resetvinf(VI_WIN); + nextvinf(&vp); + prop_window = makewin(display, vp); + + w = badwin(display); + + XCALL; + + if (geterr() == BadWindow) + PASS; + else + FAIL; +>># Kieron Completed Review + + + diff --git a/xts5/Xlib15/XSetWMClientMachine/XSetWMClientMachine.m b/xts5/Xlib15/XSetWMClientMachine/XSetWMClientMachine.m new file mode 100644 index 00000000..ac3b4e48 --- /dev/null +++ b/xts5/Xlib15/XSetWMClientMachine/XSetWMClientMachine.m @@ -0,0 +1,329 @@ +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/Xlib15/XSetWMClientMachine/XSetWMClientMachine.m,v 1.2 2005-11-03 08:42:52 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XSetWMClientMachine/XSetWMClientMachine.m +>># +>># Description: +>># Tests for XSetWMClientMachine() +>># +>># Modifications: +>># $Log: stwmclntmc.m,v $ +>># Revision 1.2 2005-11-03 08:42:52 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:21 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:34:04 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:56:08 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:25 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:58 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:29:05 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:34 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11: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 XSetWMClientMachine Xlib15 +void +XSetWMClientMachine(display, w, text_prop) +Display *display = Dsp; +Window w = DRW(Dsp); +XTextProperty *text_prop = &textprop; +>>EXTERN +#include "X11/Xatom.h" +static XTextProperty textprop = { (unsigned char *) 0, XA_STRING, 8, (unsigned long) 0 }; +>>ASSERTION Good A +A call to xname sets +the +.S WM_CLIENT_MACHINE +property for the window +.A w +to be of data, type, format and number of items as specified by the +.M value +field, the +.M encoding +field, the +.M format +field, and the +.M nitems +field of the +.S XTextProperty +structure named by the +.A text_prop +argument. +>>STRATEGY +Create a window with XCreateWindow. +Set the WM_CLIENT_MACHINE property with XSetWMClientMachine. +Verify that the call did not return False. +Obtain the WM_CLIENT_MACHINE text property using XGetTextProperty. +Verify that the encoding component of the text property is correct. +Verify that the format component of the text property is correct. +Verify that the nitems component of the text property is correct. +Verify that the value of the text property is correct using XTextPropertyToStringList. +Release the allocated memory using XFree. +>>CODE +Window win; +char *str1 = "Xtest Client Machine String"; +char *str[1]; +Status status; +char **list_return; +int count_return; +XTextProperty tp, rtp; +XVisualInfo *vp; + + str[0] = str1; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + if(XStringListToTextProperty(str, 1, &tp) == False) { + delete("XStringListToTextProperty() Failed."); + return; + } else + CHECK; + w = win; + text_prop = &tp; + XCALL; + + if(XGetWMClientMachine(display, win, &rtp) == False) { + delete("XGetWMClientMachine() returned False."); + return; + } else + CHECK; + + if(XGetTextProperty(display, win, &rtp, XA_WM_CLIENT_MACHINE) == False) { + delete("XGetTextProperty() returned False."); + return; + } else + CHECK; + + if(tp.encoding != rtp.encoding) { + report("The encoding component of the XTextProperty was incorrect."); + FAIL; + } else + CHECK; + + if(tp.format != rtp.format) { + report("The format component of the XTextProperty was incorrect."); + FAIL; + } else + CHECK; + + if(tp.nitems != rtp.nitems) { + report("The nitems component of the XTextProperty was incorrect."); + FAIL; + } else + CHECK; + + if(XTextPropertyToStringList( &rtp, &list_return, &count_return) == False) { + delete("XTextPropertyToStringList() returned False."); + return; + } else + CHECK; + + if (count_return != 1) { + delete("XTextPropertyToStringList() count_return was %d instead of 1.", count_return); + return; + } else + CHECK; + + if( strcmp(str1, list_return[0] ) != 0 ) { + report("Value string was \"%s\" instead of \"%s\"", list_return[0], str1); + FAIL; + } else + CHECK; + + XFree((char*)tp.value); + XFree((char*)rtp.value); + XFreeStringList(list_return); + + CHECKPASS(9); + +>>ASSERTION Bad B 1 +.ER BadAlloc +>>ASSERTION Good A +When the +.M encoding +component of the +.S XTextProperty +structure named by the +.A text_prop +argument does not name a valid atom, then a +.S BadAtom +error occurs. +>>STRATEGY +Create a window with XCreateWindow. +Create an XTextProperty structure with XStringListToTextProperty. +Set the encoding component of the structure to -1L. +Set the WM_CLIENT_MACHINE property using XSetWMClientMachine. +Verify that a BadAtom error occurred. +>>CODE BadAtom +Window win; +char *str1 = "Xtest Client Machine string1"; +char *str2 = "Xtest Client Machine string_2"; +char *str[2]; +XTextProperty tp; +XVisualInfo *vp; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + str[0] = str1; + str[1] = str2; + + if(XStringListToTextProperty(str, 2, &tp) == False) { + delete("XStringListToTextProperty() Failed."); + return; + } else + CHECK; + + w = win; + tp.encoding = (Atom) -1L; + text_prop = &tp; + + XCALL; + + if(geterr() != BadAtom) + FAIL; + else + CHECK; + + CHECKPASS(2); + +>>ASSERTION Bad A +.ER BadWindow +>>ASSERTION Bad A +When the +.M format +component of the +.S XTextProperty +structure named by the +.A text_prop +argument is other than 8, 16 or 32, then a +.S BadValue +error occurs. +>>STRATEGY +Create a window with XCreateWindow +Create a TextProperty structure with format {0, 1, 7, 15, 31} +with XStringListToTextProperty. +Set the WM_CLIENT_MACHINE property with XSetWMClientMachine. +Verify that a BadValue error occurs. +>>EXTERN +static int bad_ones[] = {0, 1, 7, 15, 31}; +>>CODE BadValue +Window win; +char *str1 = "Xtest test string1"; +char *str2 = "Xtest test string2"; +char *str[2]; +XTextProperty tp; +XVisualInfo *vp; +int i; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + str[0] = str1; + str[1] = str2; + + if(XStringListToTextProperty(str, 2, &tp) == False) { + delete("XStringListToTextProperty() Failed."); + return; + } else + CHECK; + + for(i=0; i < NELEM(bad_ones); i++) { + tp.format = bad_ones[i]; + w = win; + text_prop = &tp; + XCALL; + + if(geterr() != BadValue) + FAIL; + else + CHECK; + } + + CHECKPASS(NELEM(bad_ones) + 1); + +>># Wot no History ? diff --git a/xts5/Xlib15/XSetWMColormapWindows/XSetWMColormapWindows.m b/xts5/Xlib15/XSetWMColormapWindows/XSetWMColormapWindows.m new file mode 100644 index 00000000..a8e7b45c --- /dev/null +++ b/xts5/Xlib15/XSetWMColormapWindows/XSetWMColormapWindows.m @@ -0,0 +1,238 @@ +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/Xlib15/XSetWMColormapWindows/XSetWMColormapWindows.m,v 1.2 2005-11-03 08:42:52 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XSetWMColormapWindows/XSetWMColormapWindows.m +>># +>># Description: +>># Tests for XSetWMColormapWindows() +>># +>># Modifications: +>># $Log: stwmclrmpw.m,v $ +>># Revision 1.2 2005-11-03 08:42:52 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:21 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:34:04 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:56:09 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:26 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:58 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:29:06 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:35 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11:41 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 XSetWMColormapWindows Xlib15 +Status +XSetWMColormapWindows(display, w, colormap_windows, count) +Display *display = Dsp; +Window w = DRW(Dsp); +Window *colormap_windows = &window; +int count = 1; +>>EXTERN +#include "X11/Xatom.h" +Window window; +>>ASSERTION Good A +A call to xname sets the +.S WM_COLORMAP_WINDOWS +property for the window +.A w +to be of type +.S WINDOW , +format 32, and to have value set to the +.A count +windows specified by the +.A colormap_windows +argument +and returns non-zero. +>>STRATEGY +Create a window with XCreateWindow. +Set the WM_COLORMAP_WINDOWS property using XSetWMColormapWindows. +Verify that the call returned non-zero. +Obtain the WM_COLORMAP_WINDOWS atom using XInternAtom. +Obtain the WM_COLORMAP_WINDOWS property using XGetWindowProperty. +Verify that the property type is WINDOW. +Verify that the property format is 32. +Verify that the returned number of elements was correct. +Verify that the property value was correct. +>>CODE +Status status; +Window rwin; +XVisualInfo *vp; +Atom xa_wm_colormap_windows; +Atom actual_type; +int actual_format; +unsigned long nitems; +unsigned long leftover; +int nwins = 7; +Window pwins[7]; +Window *rwins = (Window *) NULL; +Window *wp; +int rcnt = 0; +int i; + + for(i=0; i<nwins; i++) + pwins[i] = (Window) i; + + resetvinf(VI_WIN); + nextvinf(&vp); + w = makewin(display, vp); + + colormap_windows = pwins; + count = nwins; + status = XCALL; + + if(status == 0) { + report("%s() returned zero.", TestName); + FAIL; + } else + CHECK; + + if((xa_wm_colormap_windows = XInternAtom(display, "WM_COLORMAP_WINDOWS", True)) == None) { + delete("The \"WM_COLORMAP_WINDOWS\" string was not interned."); + return; + } else + CHECK; + + if(XGetWindowProperty(display, w, xa_wm_colormap_windows, + 0L, (long) nwins, False, + AnyPropertyType, &actual_type, &actual_format, + &nitems, &leftover, (unsigned char **) &rwins) != Success) { + delete("XGetWindowProperty() did not return Success."); + return; + } else + CHECK; + + if(leftover != 0) { + report("The leftover elements numbered %lu instead of 0", leftover); + FAIL; + } else + CHECK; + + if(actual_format != 32) { + report("The format of the WM_COLORMAP_WINDOWS property was %lu instead of 32", actual_format); + FAIL; + } else + CHECK; + + if(actual_type != XA_WINDOW) { + report("The type of the WM_COLORMAP_WINDOWS property was %lu instead of WINDOW (%lu)", actual_type, (long) XA_WINDOW); + FAIL; + } else + CHECK; + + + if( rwins == (Window *) NULL) { + report("No value was set for the WM_COLORMAP_WINDOWS property."); + FAIL; + } else { + + CHECK; + if(nitems != nwins) { + report("The WM_COLORMAP_WINDOWS property comprised %ul elements instead of %d", nitems, nwins); + FAIL; + } else { + + if(actual_format == 32) { + CHECK; + for(i = 0, wp = rwins; i<nwins; i++, wp++) + if( *wp != pwins[i]) { + report("Element %d of the WM_COLORMAP_WINDOWS value was %lu instead of %lu", + i+1, (long) *wp, (long) pwins[i]); + FAIL; + } else + CHECK; + } + } + XFree((char*)rwins); + } + + CHECKPASS(8 + nwins); + +>>ASSERTION Bad B 1 +When the atom name \(lqWM_COLORMAP_WINDOWS\(rq cannot be interned, then +a call to xname returns zero. +>>ASSERTION Bad B 1 +.ER BadAlloc +>>ASSERTION Good A +.ER BadWindow +>># Kieron Action Review diff --git a/xts5/Xlib15/XSetWMHints/XSetWMHints.m b/xts5/Xlib15/XSetWMHints/XSetWMHints.m new file mode 100644 index 00000000..8cd7a76a --- /dev/null +++ b/xts5/Xlib15/XSetWMHints/XSetWMHints.m @@ -0,0 +1,255 @@ +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/Xlib15/XSetWMHints/XSetWMHints.m,v 1.2 2005-11-03 08:42:53 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XSetWMHints/XSetWMHints.m +>># +>># Description: +>># Tests for XSetWMHints() +>># +>># Modifications: +>># $Log: stwmhnts.m,v $ +>># Revision 1.2 2005-11-03 08:42:53 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:21 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:34:05 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:56:10 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:26 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:59 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:29:07 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:36 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11: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 XSetWMHints Xlib15 + +XSetWmHints(display, w, wmhints) +Display *display = Dsp; +Window w = DRW(Dsp); +XWMHints *wmhints = &dummyhints; +>>EXTERN +#include "X11/Xatom.h" +#define NumPropWMHintsElements 9 +XWMHints dummyhints = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +>>ASSERTION Good A +A call to xname sets the WM_HINTS property +for the window +.A w +to be of type +.S WM_HINTS , +format 32 and to have value set +to the hints specified in the +.S XWMHints +structure named by the +.A wmhints +argument. +>>STRATEGY +Create a window with XCreateWindow. +Set the WM_HINTS property for the window with XSetWMHints. +Verify type and format are XA_WM_HINTS and 32, respectively. +Verify that the property value was correctly set with XGetWindowProperty. +>>CODE +Window win; +XVisualInfo *vp; +XWMHints hints; +long *hints_ret; +unsigned long leftover, nitems; +int actual_format; +Atom actual_type; + + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + hints.flags = AllHints; + hints.input = True; + hints.initial_state = IconicState; + hints.icon_pixmap = 154376L; + hints.icon_window = 197236L; + hints.icon_x = 13; + hints.icon_y = 7; + hints.icon_mask = 146890L; + hints.window_group = 137235L; + + w = win; + wmhints = &hints; + XCALL; + + if (XGetWindowProperty(display, win, XA_WM_HINTS, 0L, (long)NumPropWMHintsElements, + False, AnyPropertyType, &actual_type, &actual_format, &nitems, &leftover, + (unsigned char **)&hints_ret) != Success) { + delete("XGetWindowProperty() did not return Success."); + return; + } else + CHECK; + + if(leftover != 0) { + report("The leftover elements numbered %lu instead of 0", leftover); + FAIL; + } else + CHECK; + + if(actual_format != 32) { + report("The format of the WM_HINTS property was %lu instead of 32", actual_format); + FAIL; + } else + CHECK; + + if(actual_type != XA_WM_HINTS) { + report("The type of the WM_HINTS property was %lu instead of XA_WM_HINTS (%lu)", actual_type, XA_WM_HINTS); + FAIL; + } else + CHECK; + + if(nitems != NumPropWMHintsElements) { + report("The number of elements comprising the WM_HINTS property was %lu instead of %lu.", + nitems, (unsigned long) NumPropWMHintsElements); + FAIL; + } else + CHECK; + + if(hints_ret[0] != hints.flags) { + report("The flags component was %lu instead of %lu.", hints_ret[0], hints.flags); + FAIL; + } else + CHECK; + + if(hints_ret[1] != hints.input) { + report("The hints_ret component of the XWMHints structure was %lu instead of %d.", hints_ret[1], hints.input); + FAIL; + } else + CHECK; + + if(hints_ret[2] != hints.initial_state) { + report("The initial_state component of the XWMHints structure was %lu instead of %d.", + hints_ret[2], hints.initial_state); + FAIL; + } else + CHECK; + + if(hints_ret[3] != hints.icon_pixmap) { + report("The icon_pixmap component of the XWMHints structure was %lu instead of %lu.", hints_ret[3], hints.icon_pixmap); + FAIL; + } else + CHECK; + + if(hints_ret[4] != hints.icon_window) { + report("The icon_window component of the XWMHints structure was %lu instead of %lu.", hints_ret[4], hints.icon_window); + FAIL; + } else + CHECK; + + if(hints_ret[5] != hints.icon_x) { + report("The icon_x component of the XWMHints structure was %ld instead of %d.", hints_ret[5], hints.icon_x); + FAIL; + } else + CHECK; + + if(hints_ret[6] != hints.icon_y) { + report("The icon_y component of the XWMHints structure was %ld instead of %d.", hints_ret[6], hints.icon_y); + FAIL; + } else + CHECK; + + if(hints_ret[7] != hints.icon_mask) { + report("The icon_mask component of the XWMHints structure was %lu instead of %lu.", hints_ret[7], hints.icon_mask); + FAIL; + } else + CHECK; + + if(hints_ret[8] != hints.window_group) { + report("The window_group component of the XWMHints structure was %lu instead of %lu.", hints_ret[8], hints.window_group); + FAIL; + } else + CHECK; + + XFree((char*)hints_ret); + + CHECKPASS(14); + +>>ASSERTION Bad B 1 +.ER BadAlloc +>>ASSERTION Bad A +.ER BadWindow +>># Completed Kieron Review diff --git a/xts5/Xlib15/XSetWMIconName/XSetWMIconName.m b/xts5/Xlib15/XSetWMIconName/XSetWMIconName.m new file mode 100644 index 00000000..4399bbf9 --- /dev/null +++ b/xts5/Xlib15/XSetWMIconName/XSetWMIconName.m @@ -0,0 +1,333 @@ +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/Xlib15/XSetWMIconName/XSetWMIconName.m,v 1.2 2005-11-03 08:42:53 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XSetWMIconName/XSetWMIconName.m +>># +>># Description: +>># Tests for XSetWMIconName() +>># +>># Modifications: +>># $Log: stwmicnnm.m,v $ +>># Revision 1.2 2005-11-03 08:42:53 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:21 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:34:06 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:56:11 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:27 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:59 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:29:08 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:38 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11:44 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 XSetWMIconName Xlib15 +void +XSetWMName(display, w, text_prop) +Display *display = Dsp; +Window w = DRW(Dsp); +XTextProperty *text_prop = &textprop; +>>EXTERN +#include "X11/Xatom.h" +static XTextProperty textprop = { (unsigned char *) 0, XA_STRING, 8, (unsigned long) 0 }; +>>ASSERTION Good A +A call to xname sets the +.S WM_ICON_NAME +property for the window +.A w +to be of data, type, format and number of items as specified by the +.M value +field, the +.M encoding +field, the +.M format +field, and the +.M nitems +field of the +.S XTextProperty +structure named by the +.A text_prop +argument. +>>STRATEGY +Create a window with XCreateWindow. +Set the WM_ICON_NAME property with XSetWMIconName. +Obtain the WM_ICON_NAME property using XGetTextProperty. +Verify that the property format was correct. +Verify that the property type was correct. +Verify that the propery value was correct. +Free allocated property with XFree. +>>CODE +Window win; +char *str1 = "Xtest test string1"; +char *str2 = "Xtest test string2"; +char *str[2]; +Status status; +char **list_return; +int count_return; +XTextProperty tp, rtp; +XVisualInfo *vp; + + str[0] = str1; + str[1] = str2; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + if(XStringListToTextProperty(str, 2, &tp) == False) { + delete("XStringListToTextProperty() Failed."); + return; + } else + CHECK; + w = win; + text_prop = &tp; + XCALL; + + if(XGetWMIconName(display, win, &rtp) == False) { + delete("XGetWMIconName() returned False."); + return; + } else + CHECK; + + if(XGetTextProperty(display, win, &rtp, XA_WM_ICON_NAME) == False) { + delete("XGetTextProperty() returned False."); + return; + } else + CHECK; + + if(tp.encoding != rtp.encoding) { + report("The encoding component of the XTextProperty was incorrect."); + FAIL; + } else + CHECK; + + if(tp.format != rtp.format) { + report("The format component of the XTextProperty was %d instead of %d.", rtp.format, tp.format); + FAIL; + } else + CHECK; + + if(tp.nitems != rtp.nitems) { + report("The nitems component of the XTextProperty was %lu instead of %lu.", rtp.nitems, tp.nitems); + FAIL; + } else + CHECK; + + if(XTextPropertyToStringList( &rtp, &list_return, &count_return) == False) { + delete("XTextPropertyToStringList() returned False."); + return; + } else + CHECK; + + if (count_return != 2) { + delete("XTextPropertyToStringList() count_return was %d instead of 2.", count_return); + return; + } else + CHECK; + + if( (strncmp(str1, list_return[0], strlen(str1)) != 0) || (strncmp(str2, list_return[1], strlen(str2)) != 0) ) { + report("Value strings were:"); + report("\"%s\" and \"%s\"", list_return[0], list_return[1]); + report("Instead of:"); + report("\"%s\" and \"%s\"", str1, str2); + FAIL; + } else + CHECK; + + XFree((char*)tp.value); + XFree((char*)rtp.value); + XFreeStringList(list_return); + + CHECKPASS(9); + +>>ASSERTION Bad A +.ER BadAlloc +>>ASSERTION Bad A +>># Note that 0L is used as the invalid ID. This is not known to be an acceptable strategy. +>># Cal 23/04/91. Use -1L instead, we know the top 3 bits of a valid XID +>># are always 0. Kieron, 30/04/91 +When the +.M encoding +component of the +.S XTextProperty +named by the +.A text_prop +argument does not name a valid atom, then a +.S BadAtom +error occurs. +>>STRATEGY +Create a window with XCreateWindow. +Create an XTextProperty structure with XStringListToTextProperty +Set the encoding component of the structure to -1L. +Set the WM_ICON_NAME property with XSetWMIconName +Verify that a BadAtom error occurred. +>>CODE BadAtom +Window win; +char *str1 = "Xtest test string1"; +char *str2 = "Xtest test string2"; +char *str[2]; +XTextProperty tp; +XVisualInfo *vp; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + str[0] = str1; + str[1] = str2; + + if(XStringListToTextProperty(str, 2, &tp) == False) { + delete("XStringListToTextProperty() Failed."); + return; + } else + CHECK; + + w = win; + tp.encoding = (Atom) -1L; + text_prop = &tp; + + XCALL; + + if(geterr() != BadAtom) + FAIL; + else + CHECK; + + CHECKPASS(2); + +>>ASSERTION Bad A +.ER BadWindow +>>ASSERTION Bad A +When the +.M format +component of the +.S XTextProperty +structure named by the +.A text_prop +argument is other than 8, 16 or 32, then a +.S BadValue +error occurs. +>>STRATEGY +Create a window with XCreateWindow. +Create a TextProperty structure with format {0, 1, 7, 15, 31}. +with XStringListToTextProperty. +Set the WM_ICON_NAME property with XSetWMIconName. +Verify that a BadValue error occurs. +>>EXTERN +static int bad_ones[] = {0, 1, 7, 15, 31}; +>>CODE BadValue +Window win; +char *str1 = "Xtest test string1"; +char *str2 = "Xtest test string2"; +char *str[2]; +XTextProperty tp; +XVisualInfo *vp; +int i; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + str[0] = str1; + str[1] = str2; + + if(XStringListToTextProperty(str, 2, &tp) == False) { + delete("XStringListToTextProperty() Failed."); + return; + } else + CHECK; + + for(i=0; i < NELEM(bad_ones); i++) { + tp.format = bad_ones[i]; + w = win; + text_prop = &tp; + XCALL; + + if(geterr() != BadValue) + FAIL; + else + CHECK; + } + + CHECKPASS(NELEM(bad_ones) + 1); + diff --git a/xts5/Xlib15/XSetWMName/XSetWMName.m b/xts5/Xlib15/XSetWMName/XSetWMName.m new file mode 100644 index 00000000..cf92e84c --- /dev/null +++ b/xts5/Xlib15/XSetWMName/XSetWMName.m @@ -0,0 +1,325 @@ +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/Xlib15/XSetWMName/XSetWMName.m,v 1.2 2005-11-03 08:42:53 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XSetWMName/XSetWMName.m +>># +>># Description: +>># Tests for XSetWMName() +>># +>># Modifications: +>># $Log: stwmnm.m,v $ +>># Revision 1.2 2005-11-03 08:42:53 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:21 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:34:06 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:56:12 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:27 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:22:00 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:29:08 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:39 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11:46 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 XSetWMName Xlib15 +void +XSetWMName(display, w, text_prop) +Display *display = Dsp; +Window w = DRW(display); +XTextProperty *text_prop = &textprop; +>>EXTERN +#include "X11/Xatom.h" +static XTextProperty textprop = { (unsigned char *) 0, XA_STRING, 8, (unsigned long) 0 }; +>>ASSERTION Good A +A call to xname sets the +.S WM_NAME +property for the window +.A w +to be of data, type, format and number of items as specified by the +.M value +field, the +.M encoding +field, the +.M format +field, and the +.M nitems +field of the +.S XTextProperty +structure named by the +.A text_prop +argument. +>>STRATEGY +Create a window with XCreateWindow. +Set the WM_NAME property with XSetWMName. +Obtain the WM_NAME property using XGetTextProperty. +Verify that the format, encoding and value are correct. +>>CODE +Window win; +char *str1 = "Xtest test string1"; +char *str2 = "Xtest test string2"; +char *str[2]; +Status status; +char **list_return; +int count_return; +XTextProperty tp, rtp; +XVisualInfo *vp; + + str[0] = str1; + str[1] = str2; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + if(XStringListToTextProperty(str, 2, &tp) == False) { + delete("XStringListToTextProperty() Failed."); + return; + } else + CHECK; + + w = win; + text_prop = &tp; + XCALL; + + if(XGetTextProperty(display, win, &rtp, XA_WM_NAME) == False) { + delete("XGetTextProperty() returned False."); + return; + } else + CHECK; + + if(tp.encoding != rtp.encoding) { + report("The encoding component of the XTextProperty was incorrect."); + FAIL; + } else + CHECK; + + if(tp.format != rtp.format) { + report("The format component of the XTextProperty was %d instead of %d.", rtp.format, tp.format ); + FAIL; + } else + CHECK; + + if(tp.nitems != rtp.nitems) { + report("The nitems component of the XTextProperty was %lu instead of %lu.", rtp.nitems, tp.nitems); + FAIL; + } else + CHECK; + + if(XTextPropertyToStringList( &rtp, &list_return, &count_return) == False) { + delete("XTextPropertyToStringList() returned False."); + return; + } else + CHECK; + + if (count_return != 2) { + delete("XTextPropertyToStringList() count_return was %d instead of 2.", count_return); + return; + } else + CHECK; + + if( (strncmp(str1, list_return[0], strlen(str1)) != 0) || (strncmp(str2, list_return[1], strlen(str2)) != 0) ) { + report("Value strings were:"); + report("\"%s\" and \"%s\"", list_return[0], list_return[1]); + report("Instead of:"); + report("\"%s\" and \"%s\"", str1, str2); + FAIL; + } else + CHECK; + + XFree((char*)tp.value); + XFree((char*)rtp.value); + XFreeStringList(list_return); + + CHECKPASS(8); + +>>ASSERTION Bad B 1 +.ER BadAlloc +>>ASSERTION Bad A +>># Note that 0L is used as the invalid ID. This is not known to be an acceptable strategy. +>># Cal 23/04/91. Use -1L instead, we know the top 3 bits of a valid XID +>># are always 0. Kieron, 30/04/91 +When the +.M encoding +component of the +.S XTextProperty +named by the +.A text_prop +argument does not name a valid atom, then a +.S BadAtom +error occurs. +>>STRATEGY +Create a window with XCreateWindow. +Create an XTextProperty structure with XStringListToTextProperty +Set the encoding component of the structure to -1L. +Set the WM_NAME property with XSetWMName +Verify that a BadAtom error occurred. +>>CODE BadAtom +Window win; +char *str1 = "Xtest test string1"; +char *str2 = "Xtest test string2"; +char *str[2]; +XTextProperty tp; +XVisualInfo *vp; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + str[0] = str1; + str[1] = str2; + + if(XStringListToTextProperty(str, 2, &tp) == False) { + delete("XStringListToTextProperty() Failed."); + return; + } else + CHECK; + + w = win; + tp.encoding = (Atom) -1L; + text_prop = &tp; + + XCALL; + + if(geterr() != BadAtom) + FAIL; + else + CHECK; + + CHECKPASS(2); + +>>ASSERTION Bad A +.ER BadWindow +>>ASSERTION Bad A +When the +.M format +component of the +.S XTextProperty +structure named by the +.A text_prop +argument is other than 8, 16 or 32, then a +.S BadValue +error occurs. +>>STRATEGY +Create a window with XCreateWindow +Create a XTextProperty structure with format {0, 1, 7, 15, 31} +with XStringListToTextProperty. +Set the WM_NAME property with XSetWMName. +Verify that a BadValue error occurs. +>>EXTERN +static int bad_ones[] = {0, 1, 7, 15, 31}; +>>CODE BadValue +Window win; +char *str1 = "Xtest test string1"; +char *str2 = "Xtest test string2"; +char *str[2]; +XTextProperty tp; +XVisualInfo *vp; +int i; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + str[0] = str1; + str[1] = str2; + + if(XStringListToTextProperty(str, 2, &tp) == False) { + delete("XStringListToTextProperty() Failed."); + return; + } else + CHECK; + + for(i=0; i < NELEM(bad_ones); i++) { + tp.format = bad_ones[i]; + w = win; + text_prop = &tp; + XCALL; + + if(geterr() != BadValue) + FAIL; + else + CHECK; + } + + CHECKPASS(NELEM(bad_ones) + 1); + diff --git a/xts5/Xlib15/XSetWMNormalHints/XSetWMNormalHints.m b/xts5/Xlib15/XSetWMNormalHints/XSetWMNormalHints.m new file mode 100644 index 00000000..2087f2cb --- /dev/null +++ b/xts5/Xlib15/XSetWMNormalHints/XSetWMNormalHints.m @@ -0,0 +1,298 @@ +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/Xlib15/XSetWMNormalHints/XSetWMNormalHints.m,v 1.2 2005-11-03 08:42:53 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XSetWMNormalHints/XSetWMNormalHints.m +>># +>># Description: +>># Tests for XSetWMNormalHints() +>># +>># Modifications: +>># $Log: stwmnrmlhn.m,v $ +>># Revision 1.2 2005-11-03 08:42:53 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:21 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:34:07 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:56:13 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:28 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:22:00 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:29:09 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:40 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11:48 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 XSetWMNormalHints Xlib15 +void +XSetWMNormalHints(display, w, hints) +Display *display = Dsp; +Window w = DRW(display); +XSizeHints *hints = &sizehints_0; +>>EXTERN +#include "X11/Xatom.h" +#define NewNumPropSizeElements 18 /* ICCCM v. 1 */ +static XSizeHints sizehints_0 = { PAllHints,0,0,0,0,0,0,0,0,0,0, {0,0}, {0,0}, 0,0,0}; +static XSizeHints sizehints_1 = { PAllHints,1,2,3,4,5,6,7,8,9,10, {11,12}, {13,14}, 15, 16, 17}; +>>ASSERTION Good A +A call to xname sets the +.S WM_NORMAL_HINTS +property for the window +.A w +to be of type +.S WM_SIZE_HINTS , +format of 32 and to have value set +to the hints in the +.S XSizeHints +structure named by the +.A hints +argument. +>>STRATEGY +Create a window with XCreateWindow. +Set the WM_NORMAL_HINTS property with XSetWMNormalHints. +Obtain the value, type and format of the WM_NORMAL_HINTS property using XGetWindowProperty. +Verify that the type is WM_SIZE_HINTS. +Verify that the format is 32. +Verify that the value is identical to that value set by XSetWMNormalHints. +>>CODE +Window win; +XVisualInfo *vp; +Atom rtype; +int rformat; +unsigned long ritems, rbytes, *uls = NULL; +XSizeHints pp; +int i; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + w = win; + hints = &sizehints_1; + XCALL; + + if( XGetWindowProperty(display, win, XA_WM_NORMAL_HINTS, 0L, + (long) NewNumPropSizeElements, False, + AnyPropertyType, &rtype, &rformat, &ritems, &rbytes, + (unsigned char **) &uls) != Success ) { + delete("XGetWindowProperty() did not return Success."); + return; + } else + CHECK; + + if( rtype != XA_WM_SIZE_HINTS ) { + report("WM_NORMAL_HINTS property was type %lu instead of XA_WM_SIZE_HINTS (%lu)", + (unsigned long) rtype, (unsigned long) XA_WM_SIZE_HINTS); + FAIL; + } else + CHECK; + + if( rformat != 32 ) { + report("WM_NORMAL_HINTS property was format %d instead of 32.", rformat); + FAIL; + } else + CHECK; + + /* unpack from the array of unsigned longs into pp */ + pp.flags = uls[i=0]; + + pp.x = (int)uls[++i]; /* obsolete for new window mgrs, but clients */ + pp.y = (int)uls[++i]; + pp.width = (int)uls[++i]; + pp.height = (int)uls[++i]; /* should set so old wm's don't mess up */ + + pp.min_width = (int)uls[++i]; pp.min_height = (int)uls[++i]; + pp.max_width = (int)uls[++i]; pp.max_height = (int)uls[++i]; + pp.width_inc = (int)uls[++i]; pp.height_inc = (int)uls[++i]; + pp.min_aspect.x = (int)uls[++i]; pp.min_aspect.y = (int)uls[++i]; + pp.max_aspect.x = (int)uls[++i]; pp.max_aspect.y = (int)uls[++i]; + + pp.base_width = (int)uls[++i]; /* added by ICCCM version 1 */ + pp.base_height = (int)uls[++i]; /* added by ICCCM version 1 */ + pp.win_gravity = (int)uls[++i]; /* added by ICCCM version 1 */ + + if(pp.flags != PAllHints) { + report("The flags component of the XSizeHints structure was %lu instead of PAllHints (%ld).", pp.flags, PAllHints); + FAIL; + } else + CHECK; + + if(pp.x != 1) { + report("The x component of the XSizeHints structure was %d instead of 1.", pp.x); + FAIL; + } else + CHECK; + + if(pp.y != 2) { + report("The y component of the XSizeHints structure was %d instead of 2.", pp.y); + FAIL; + } else + CHECK; + + if(pp.width != 3) { + report("The width component of the XSizeHints structure was %d instead of 3.", pp.width); + FAIL; + } else + CHECK; + + if(pp.height != 4) { + report("The height component of the XSizeHints structure was %d instead of 4.", pp.height); + FAIL; + } else + CHECK; + + if(pp.min_width != 5) { + report("The min_width component of the XSizeHints structure was %d instead of 5.", pp.min_width); + FAIL; + } else + CHECK; + + if(pp.min_height != 6) { + report("The min_height component of the XSizeHints structure was %d instead of 6.", pp.min_height); + FAIL; + } else + CHECK; + + if(pp.max_width != 7) { + report("The max_width component of the XSizeHints structure was %d instead of 7.", pp.max_width); + FAIL; + } else + CHECK; + + if(pp.max_height != 8) { + report("The max_height component of the XSizeHints structure was %d instead of 8.", pp.max_height); + FAIL; + } else + CHECK; + + if(pp.width_inc != 9) { + report("The width_inc component of the XSizeHints structure was %d instead of 9.", pp.width_inc); + FAIL; + } else + CHECK; + + if(pp.height_inc != 10) { + report("The height_inc component of the XSizeHints structure was %d instead of 10.", pp.height_inc); + FAIL; + } else + CHECK; + + if((pp.min_aspect.x != 11) || (pp.min_aspect.y != 12)){ + report("The min_aspect components of the XSizeHints structure were %d, %d instead of 11, 12.", + pp.min_aspect.x, pp.min_aspect.y); + FAIL; + } else + CHECK; + + if((pp.max_aspect.x != 13) || (pp.max_aspect.y != 14)){ + report("The max_aspect components of the XSizeHints structure were %d, %d instead of 13, 14.", + pp.max_aspect.x, pp.max_aspect.y); + FAIL; + } else + CHECK; + + if(pp.base_width != 15) { + report("The base_width component of the XSizeHints structure was %d instead of 15.", pp.base_width); + FAIL; + } else + CHECK; + + if(pp.base_height != 16) { + report("The base_height component of the XSizeHints structure was %d instead of 16.", pp.base_height); + FAIL; + } else + CHECK; + + if(pp.win_gravity != 17) { + report("The win_gravity component of the XSizeHints structure was %d instead of 17", pp.win_gravity); + FAIL; + } else + CHECK; + + XFree((char*)uls); + CHECKPASS(19); + + +>>ASSERTION Bad B 1 +.ER BadAlloc +>>ASSERTION Bad A +.ER BadWindow +>># Kieron Completed Reviewed (& mucked up) diff --git a/xts5/Xlib15/XSetWMProperties/Test1.c b/xts5/Xlib15/XSetWMProperties/Test1.c new file mode 100644 index 00000000..305a846e --- /dev/null +++ b/xts5/Xlib15/XSetWMProperties/Test1.c @@ -0,0 +1,195 @@ +/* +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/Xlib15/XSetWMProperties/Test1.c,v 1.5 2005-11-03 08:42:54 jmichael Exp $ +* +* Copyright (c) Applied Testing and Technology, Inc. 1995 +* All Rights Reserved. +* +* Project: VSW5 +* +* File: xts5/tset/Xlib15/XSetWMProperties/Test1.c +* +* Description: +* Tests for XSetWMProperties() +* +* Modifications: +* $Log: Test1.c,v $ +* Revision 1.5 2005-11-03 08:42:54 jmichael +* clean up all vsw5 paths to use xts5 instead. +* +* Revision 1.4 2005/04/21 09:40:42 ajosey +* resync to VSW5.1.5 +* +* Revision 8.1 2000/02/04 15:27:12 vsx +* SR234: remove extra tet_main() argument +* +* Revision 8.0 1998/12/23 23:34:07 mar +* Branch point for Release 5.0.2 +* +* Revision 7.0 1998/10/30 22:56:14 mar +* Branch point for Release 5.0.2b1 +* +* Revision 6.0 1998/03/02 05:25:28 tbr +* Branch point for Release 5.0.1 +* +* Revision 5.0 1998/01/26 03:22:00 tbr +* Branch point for Release 5.0.1b1 +* +* Revision 4.0 1995/12/15 09:09:42 tbr +* Branch point for Release 5.0.0 +* +* Revision 3.1 1995/12/15 01:11:49 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. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include "xtest.h" +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include "tet_api.h" +#include "xtestlib.h" +#include "pixval.h" + + +extern Display *Dsp; + +/* + * Dummy declarations which are normally inserted by mc. + * Needed to prevent linkstart.c being included. + */ +char *TestName = "XSetWMProperties"; +int tet_thistest; +struct tet_testlist tet_testlist[] = { + NULL, 0 +}; +int ntests = sizeof(tet_testlist)/sizeof(struct tet_testlist)-1; + +int +tet_main(argc, argv) +int argc; +char *argv[]; +{ +int pass = 0, fail = 0; +char *res_name; +Window win; +XVisualInfo *vp; +XClassHint class_hints; +XClassHint rclass_hints; + + exec_startup(); + tpstartup(); + + trace("Exec'd file ./Test1."); + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(Dsp, vp); + + class_hints.res_name = NULL; + class_hints.res_class = "XTest_Undefined."; + + if( (res_name = (char *) getenv("RESOURCE_NAME")) == NULL) { + delete("RESOURCE_NAME environment variable is not set."); + return; + } else + CHECK; + + startcall(Dsp); + XSetWMProperties( Dsp, win, (XTextProperty *) NULL, (XTextProperty *) NULL, (char **) NULL, 0, (XSizeHints *) NULL, (XWMHints *) NULL, &class_hints); + endcall(Dsp); + + if (geterr() != Success) { + report("Got %s, Expecting Success", errorname(geterr())); + FAIL; + } else + CHECK; + + if( XGetClassHint(Dsp, win, &rclass_hints) == 0 ) { + delete("XGetClassHints returned zero."); + return; + } else + CHECK; + + if(rclass_hints.res_name == NULL) { + report("The res_name component of the returned XClassHint structure was NULL."); + FAIL; + } else { + CHECK; + if( strcmp(rclass_hints.res_name, res_name) != 0 ) { + report("The res_name component of the returned XClassHint structure was \"%s\" instead of \"%s\".", rclass_hints.res_name, res_name); + FAIL; + } else + CHECK; + } + + CHECKPASS(5); + tpcleanup(); + exec_cleanup(); +} diff --git a/xts5/Xlib15/XSetWMProperties/Test2.c b/xts5/Xlib15/XSetWMProperties/Test2.c new file mode 100644 index 00000000..e1aaf7f3 --- /dev/null +++ b/xts5/Xlib15/XSetWMProperties/Test2.c @@ -0,0 +1,197 @@ +/* +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/Xlib15/XSetWMProperties/Test2.c,v 1.5 2005-11-03 08:42:54 jmichael Exp $ +* +* Copyright (c) Applied Testing and Technology, Inc. 1995 +* All Rights Reserved. +* +* Project: VSW5 +* +* File: xts5/tset/Xlib15/XSetWMProperties/Test2.c +* +* Description: +* Tests for XSetWMProperties() +* +* Modifications: +* $Log: Test2.c,v $ +* Revision 1.5 2005-11-03 08:42:54 jmichael +* clean up all vsw5 paths to use xts5 instead. +* +* Revision 1.4 2005/04/21 09:40:42 ajosey +* resync to VSW5.1.5 +* +* Revision 8.1 2000/02/04 15:27:12 vsx +* SR234: remove extra tet_main() argument +* +* Revision 8.0 1998/12/23 23:34:08 mar +* Branch point for Release 5.0.2 +* +* Revision 7.0 1998/10/30 22:56:16 mar +* Branch point for Release 5.0.2b1 +* +* Revision 6.0 1998/03/02 05:25:28 tbr +* Branch point for Release 5.0.1 +* +* Revision 5.0 1998/01/26 03:22:01 tbr +* Branch point for Release 5.0.1b1 +* +* Revision 4.0 1995/12/15 09:09:43 tbr +* Branch point for Release 5.0.0 +* +* Revision 3.1 1995/12/15 01:11:51 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. +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include "xtest.h" +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include "tet_api.h" +#include "xtestlib.h" +#include "pixval.h" + + +extern Display *Dsp; + +/* + * Dummy declarations which are normally inserted by mc. + * Needed to prevent linkstart.c being included. + */ +char *TestName = "XSetWMProperties"; +int tet_thistest; +struct tet_testlist tet_testlist[] = { + NULL, 0 +}; +int ntests = sizeof(tet_testlist)/sizeof(struct tet_testlist)-1; + +int +tet_main(argc, argv) +int argc; +char *argv[]; +{ +int pass = 0, fail = 0; +char *res_name = "Test2"; +Window win; +XVisualInfo *vp; +XClassHint class_hints; +XClassHint rclass_hints; + + exec_startup(); + tpstartup(); + + trace("Exec'd file ./Test2."); + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(Dsp, vp); + + class_hints.res_name = NULL; + class_hints.res_class = "XTest_Undefined."; + + if( getenv("RESOURCE_NAME") != (char *)NULL) { + delete("RESOURCE_NAME environment variable was set to \"%s\" instead of being undefined."); + return; + } else + CHECK; + + startcall(Dsp); + XSetWMProperties( Dsp, win, (XTextProperty *) NULL, (XTextProperty *) NULL, argv, argc, (XSizeHints *) NULL, (XWMHints *) NULL, &class_hints); + endcall(Dsp); + + if (geterr() != Success) { + report("Got %s, Expecting Success", errorname(geterr())); + FAIL; + } else + CHECK; + + if( XGetClassHint(Dsp, win, &rclass_hints) == 0 ) { + delete("XGetClassHints returned zero."); + return; + } else + CHECK; + + if(rclass_hints.res_name == NULL) { + report("The res_name component of the returned XClassHint structure was NULL."); + FAIL; + } else { + CHECK; + if( strcmp(rclass_hints.res_name, res_name) != 0 ) { + report("The res_name component of the returned XClassHint structure was \"%s\" instead of \"%s\".", rclass_hints.res_name, res_name); + FAIL; + } else + CHECK; + } + + CHECKPASS(5); + tpcleanup(); + exec_cleanup(); + + +} diff --git a/xts5/Xlib15/XSetWMProperties/XSetWMProperties.m b/xts5/Xlib15/XSetWMProperties/XSetWMProperties.m new file mode 100644 index 00000000..cebe0b99 --- /dev/null +++ b/xts5/Xlib15/XSetWMProperties/XSetWMProperties.m @@ -0,0 +1,990 @@ +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/Xlib15/XSetWMProperties/XSetWMProperties.m,v 1.2 2005-11-03 08:42:54 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XSetWMProperties/XSetWMProperties.m +>># +>># Description: +>># Tests for XSetWMProperties() +>># +>># Modifications: +>># $Log: stwmprprts.m,v $ +>># Revision 1.2 2005-11-03 08:42:54 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:21 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:34:08 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:56:17 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:29 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:22:02 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:29:10 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:44 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11:52 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 XSetWMProperties Xlib15 +void +XSetWMProperties(display, w, window_name, icon_name, argv, argc, normal_hints, wm_hints, class_hints) +Display *display = Dsp; +Window w = DRW(Dsp); +XTextProperty *window_name = (XTextProperty *) NULL; +XTextProperty *icon_name = (XTextProperty *) NULL; +char **argv = (char **) NULL; +int argc = 0; +XSizeHints *normal_hints = (XSizeHints *) NULL; +XWMHints *wm_hints = (XWMHints *) NULL; +XClassHint *class_hints = (XClassHint *) NULL; +>>MAKE +>># +>># +>># Plant some rules in the Makefile to construct +>># stand-alone executables Test1 and Test2 to allow the setting +>># of environment variables. +>># +>># Cal 14/6/91 +>># +# +# The following lines are copied from the .m file by mc +# under control of the >>MAKE directive +# to create rules for the executable files Test1 and Test2. +# +AUXFILES=Test1 Test2 +AUXCLEAN=Test1.o Test1 Test2.o Test2 + +all: Test + +Test1 : Test1.o $(LIBS) $(TCMCHILD) + $(CC) $(LDFLAGS) -o $@ Test1.o $(TCMCHILD) $(LIBLOCAL) $(LIBS) $(SYSLIBS) + +Test2 : Test2.o $(LIBS) $(TCMCHILD) + $(CC) $(LDFLAGS) -o $@ Test2.o $(TCMCHILD) $(LIBLOCAL) $(LIBS) $(SYSLIBS) + +# +# End of section copied from the .m file. +# +>># +>># +>># +>>EXTERN +#define NewNumPropSizeElements 18 /* ICCCM v. 1 */ +#define NumPropWMHintsElements 9 +#include "X11/Xatom.h" +static XSizeHints sizehints = { PAllHints,1,2,3,4,5,6,7,8,9,10, {11,12}, {13,14}, 15, 16, 17}; +static XSizeHints sizehints_1 = { PAllHints,1,2,3,4,5,6,7,8,9,10, {11,12}, {13,14}, 15, 16, 17}; +>>ASSERTION Good A +When the +.A window_name +argument is non-NULL, then a call to xname +sets the WM_NAME property for the window +.A w +to be of data, type, format and number of items as specified by the +.M value +field, the +.M encoding +field, the +.M format +field, and the +.M nitems +field of the +.S XTextProperty +structure named by the +.A window_name +argument. +>>STRATEGY +Create a window with XCreateWindow. +Set the WM_NAME property with XSetWMProperties. +Obtain the WM_NAME property using XGetTextProperty. +Verify that the format, encoding and value are correct. +>>CODE +Window win; +char *str1 = "Xtest test string1"; +char *str2 = "Xtest test string2"; +char *str[2]; +Status status; +char **list_return; +int count_return; +XTextProperty tp, rtp; +XVisualInfo *vp; + + str[0] = str1; + str[1] = str2; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + if(XStringListToTextProperty(str, 2, &tp) == False) { + delete("XStringListToTextProperty() Failed."); + return; + } else + CHECK; + + w = win; + window_name = &tp; + XCALL; + + if(XGetTextProperty(display, win, &rtp, XA_WM_NAME) == False) { + delete("XGetTextProperty() returned False."); + return; + } else + CHECK; + + if(tp.encoding != rtp.encoding) { + report("The encoding component of the XTextProperty was incorrect."); + FAIL; + } else + CHECK; + + if(tp.format != rtp.format) { + report("The format component of the XTextProperty was %d instead of %d.", rtp.format, tp.format ); + FAIL; + } else + CHECK; + + if(tp.nitems != rtp.nitems) { + report("The nitems component of the XTextProperty was %lu instead of %lu.", rtp.nitems, tp.nitems); + FAIL; + } else + CHECK; + + if(XTextPropertyToStringList( &rtp, &list_return, &count_return) == False) { + delete("XTextPropertyToStringList() returned False."); + return; + } else + CHECK; + + if (count_return != 2) { + delete("XTextPropertyToStringList() count_return was %d instead of 2.", count_return); + return; + } else + CHECK; + + if( (strncmp(str1, list_return[0], strlen(str1)) != 0) || (strncmp(str2, list_return[1], strlen(str2)) != 0) ) { + report("Value strings were:"); + report("\"%s\" and \"%s\"", list_return[0], list_return[1]); + report("Instead of:"); + report("\"%s\" and \"%s\"", str1, str2); + FAIL; + } else + CHECK; + + XFree((char*)tp.value); + XFree((char*)rtp.value); + XFreeStringList(list_return); + + CHECKPASS(8); + +>>ASSERTION Good A +When the +.A icon_name +argument is non-NULL, then +a call to xname sets the WM_ICON_NAME +property for the window +.A w +to be of data, type, format and number of items as specified by the +.M value +field, the +.M encoding +field, the +.M format +field, and the +.M nitems +field of the +.S XTextProperty +structure named by the +.A icon_name +argument. +>>STRATEGY +Create a window with XCreateWindow. +Set the WM_ICON_NAME property with XSetWMProperties. +Obtain the WM_ICON_NAME property using XGetTextProperty. +Verify that the property format was correct. +Verify that the property type was correct. +Verify that the propery value was correct. +Free allocated property with XFree. +>>CODE +Window win; +char *str1 = "Xtest test string1"; +char *str2 = "Xtest test string2"; +char *str[2]; +Status status; +char **list_return; +int count_return; +XTextProperty tp, rtp; +XVisualInfo *vp; + + str[0] = str1; + str[1] = str2; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + if(XStringListToTextProperty(str, 2, &tp) == False) { + delete("XStringListToTextProperty() Failed."); + return; + } else + CHECK; + w = win; + icon_name = &tp; + XCALL; + + if(XGetWMIconName(display, win, &rtp) == False) { + delete("XGetWMIconName() returned False."); + return; + } else + CHECK; + + if(XGetTextProperty(display, win, &rtp, XA_WM_ICON_NAME) == False) { + delete("XGetTextProperty() returned False."); + return; + } else + CHECK; + + if(tp.encoding != rtp.encoding) { + report("The encoding component of the XTextProperty was incorrect."); + FAIL; + } else + CHECK; + + if(tp.format != rtp.format) { + report("The format component of the XTextProperty was %d instead of %d.", rtp.format, tp.format); + FAIL; + } else + CHECK; + + if(tp.nitems != rtp.nitems) { + report("The nitems component of the XTextProperty was %lu instead of %lu.", rtp.nitems, tp.nitems); + FAIL; + } else + CHECK; + + if(XTextPropertyToStringList( &rtp, &list_return, &count_return) == False) { + delete("XTextPropertyToStringList() returned False."); + return; + } else + CHECK; + + if (count_return != 2) { + delete("XTextPropertyToStringList() count_return was %d instead of 2.", count_return); + return; + } else + CHECK; + + if( (strncmp(str1, list_return[0], strlen(str1)) != 0) || (strncmp(str2, list_return[1], strlen(str2)) != 0) ) { + report("Value strings were:"); + report("\"%s\" and \"%s\"", list_return[0], list_return[1]); + report("Instead of:"); + report("\"%s\" and \"%s\"", str1, str2); + FAIL; + } else + CHECK; + + XFree((char*)tp.value); + XFree((char*)rtp.value); + XFreeStringList(list_return); + + CHECKPASS(9); + +>>ASSERTION Good A +When the +.A argv +argument is non-NULL, then a call to xname +sets the WM_COMMAND property for the window +.A w +to the +.A argv +argument. +>>STRATEGY +Create a window using XCreateWindow. +Set the WM_COMMAND property using XSetWMProperties. +Obtain the value of the WM_COMMAND property using XGetTextProperty. +Verify that the number and value of the returned strings is correct. +Release the allocated memory using XFreeStringList. +>>CODE +XVisualInfo *vp; +char *nullstr = "<NULL>"; +char **strpp, *strp; +char *str1 = "XTest string 1"; +char *str2 = "XTest string 2"; +char *prop[2]; +char **rstrings = (char**) NULL; +int rcount = 0; +int i; +XTextProperty rtp; +Status status; +char **list_return; +int count_return; +int len; + + prop[0] = str1; + prop[1] = str2; + + resetvinf(VI_WIN); + nextvinf(&vp); + w = makewin(display, vp); + argv = prop; + argc = 2; + XCALL; + + if(XGetTextProperty(display, w, &rtp, XA_WM_COMMAND) == False) { + delete("XGetTextProperty() returned False."); + return; + } else + CHECK; + + if(rtp.encoding != XA_STRING ) { + report("The encoding component of the XTextProperty was %lu instead of STRING (%lu).", + (unsigned long)rtp.encoding, (unsigned long)XA_STRING); + FAIL; + } else + CHECK; + + if(rtp.format != 8) { + report("The format component of the XTextProperty was %d instead of %d.", rtp.format, 8 ); + FAIL; + } else + CHECK; + + len = strlen(str1) + 1 + strlen(str2) + 1; + + if(rtp.nitems != len) { + report("The nitems component of the XTextProperty was %lu instead of %lu.", rtp.nitems, len); + FAIL; + } else + CHECK; + + /* + * Ignore final <NUL> if present since UNIX WM_COMMAND is nul-terminated, unlike + * the nul-separated text properties. + * Cal - 7/6/91 + */ + if (rtp.value[rtp.nitems - 1] == '\0') rtp.nitems--; + + + if(XTextPropertyToStringList( &rtp, &list_return, &count_return) == False) { + delete("XTextPropertyToStringList() returned False."); + return; + } else + CHECK; + + if (count_return != argc) { + delete("XTextPropertyToStringList() count_return was %d instead of %d.", count_return, argc); + return; + } else + CHECK; + + if( (strcmp(str1, list_return[0]) != 0) || (strcmp(str2, list_return[1]) != 0) ) { + report("Value strings were:"); + report("\"%s\" and \"%s\"", list_return[0], list_return[1]); + report("Instead of:"); + report("\"%s\" and \"%s\"", str1, str2); + FAIL; + } else + CHECK; + + XFree((char*)rtp.value); + XFreeStringList(list_return); + + CHECKPASS(7); + +>>ASSERTION Good A +When the +.A normal_hints +argument is non-NULL, then a call to xname +sets the WM_NORMAL_HINTS property for the window +.A w +to be of type +.S WM_SIZE_HINTS , +format 32 and to have value set +to the +.A normal_hints +argument. +>>STRATEGY +Create a window with XCreateWindow. +Set the WM_NORMAL_HINTS property with XSetWMProperties. +Obtain the value, type and format of the WM_NORMAL_HINTS property using XGetWindowProperty. +Verify that the type is WM_SIZE_HINTS. +Verify that the format is 32. +Verify that the value is identical to that value set by XSetWMNormalHints. +>>CODE +Window win; +XVisualInfo *vp; +Atom rtype; +int rformat; +unsigned long ritems, rbytes, *uls = NULL; +XSizeHints pp; +int i; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + w = win; + normal_hints = &sizehints_1; + XCALL; + + if( XGetWindowProperty(display, win, XA_WM_NORMAL_HINTS, 0L, + (long) NewNumPropSizeElements, False, + AnyPropertyType, &rtype, &rformat, &ritems, &rbytes, + (unsigned char **) &uls) != Success ) { + delete("XGetWindowProperty() did not return Success."); + return; + } else + CHECK; + + if( rtype != XA_WM_SIZE_HINTS ) { + report("WM_NORMAL_HINTS property was type %lu instead of XA_WM_SIZE_HINTS (%lu)", + (unsigned long) rtype, (unsigned long) XA_WM_SIZE_HINTS); + FAIL; + } else + CHECK; + + if( rformat != 32 ) { + report("WM_NORMAL_HINTS property was format %d instead of 32.", rformat); + FAIL; + } else + CHECK; + + /* unpack from the array of unsigned longs into pp */ + pp.flags = uls[i=0]; + + pp.x = (int)uls[++i]; /* obsolete for new window mgrs, but clients */ + pp.y = (int)uls[++i]; + pp.width = (int)uls[++i]; + pp.height = (int)uls[++i]; /* should set so old wm's don't mess up */ + + pp.min_width = (int)uls[++i]; pp.min_height = (int)uls[++i]; + pp.max_width = (int)uls[++i]; pp.max_height = (int)uls[++i]; + pp.width_inc = (int)uls[++i]; pp.height_inc = (int)uls[++i]; + pp.min_aspect.x = (int)uls[++i]; pp.min_aspect.y = (int)uls[++i]; + pp.max_aspect.x = (int)uls[++i]; pp.max_aspect.y = (int)uls[++i]; + + pp.base_width = (int)uls[++i]; /* added by ICCCM version 1 */ + pp.base_height = (int)uls[++i]; /* added by ICCCM version 1 */ + pp.win_gravity = (int)uls[++i]; /* added by ICCCM version 1 */ + + if(pp.flags != PAllHints) { + report("The flags component of the XSizeHints structure was %lu instead of PAllHints (%ld).", pp.flags, PAllHints); + FAIL; + } else + CHECK; + + if(pp.x != 1) { + report("The x component of the XSizeHints structure was %d instead of 1.", pp.x); + FAIL; + } else + CHECK; + + if(pp.y != 2) { + report("The y component of the XSizeHints structure was %d instead of 2.", pp.y); + FAIL; + } else + CHECK; + + if(pp.width != 3) { + report("The width component of the XSizeHints structure was %d instead of 3.", pp.width); + FAIL; + } else + CHECK; + + if(pp.height != 4) { + report("The height component of the XSizeHints structure was %d instead of 4.", pp.height); + FAIL; + } else + CHECK; + + if(pp.min_width != 5) { + report("The min_width component of the XSizeHints structure was %d instead of 5.", pp.min_width); + FAIL; + } else + CHECK; + + if(pp.min_height != 6) { + report("The min_height component of the XSizeHints structure was %d instead of 6.", pp.min_height); + FAIL; + } else + CHECK; + + if(pp.max_width != 7) { + report("The max_width component of the XSizeHints structure was %d instead of 7.", pp.max_width); + FAIL; + } else + CHECK; + + if(pp.max_height != 8) { + report("The max_height component of the XSizeHints structure was %d instead of 8.", pp.max_height); + FAIL; + } else + CHECK; + + if(pp.width_inc != 9) { + report("The width_inc component of the XSizeHints structure was %d instead of 9.", pp.width_inc); + FAIL; + } else + CHECK; + + if(pp.height_inc != 10) { + report("The height_inc component of the XSizeHints structure was %d instead of 10.", pp.height_inc); + FAIL; + } else + CHECK; + + if((pp.min_aspect.x != 11) || (pp.min_aspect.y != 12)){ + report("The min_aspect components of the XSizeHints structure were %d, %d instead of 11, 12.", + pp.min_aspect.x, pp.min_aspect.y); + FAIL; + } else + CHECK; + + if((pp.max_aspect.x != 13) || (pp.max_aspect.y != 14)){ + report("The max_aspect components of the XSizeHints structure were %d, %d instead of 13, 14.", + pp.max_aspect.x, pp.max_aspect.y); + FAIL; + } else + CHECK; + + if(pp.base_width != 15) { + report("The base_width component of the XSizeHints structure was %d instead of 15.", pp.base_width); + FAIL; + } else + CHECK; + + if(pp.base_height != 16) { + report("The base_height component of the XSizeHints structure was %d instead of 16.", pp.base_height); + FAIL; + } else + CHECK; + + if(pp.win_gravity != 17) { + report("The win_gravity component of the XSizeHints structure was %d instead of 17", pp.win_gravity); + FAIL; + } else + CHECK; + + XFree((char*)uls); + CHECKPASS(19); + +>>ASSERTION Good A +When the +.A wm_hints +argument is non-NULL, then a call to xname +sets the WM_HINTS property for the window +.A w +to be of type +.S WM_HINTS , +format 32 and to have value set +to the +.A wm_hints +argument. +>>STRATEGY +Create a window with XCreateWindow. +Set the WM_HINTS property for the window with XSetWMProperties. +Verify type and format are XA_WM_HINTS and 32, respectively. +Verify that the property value was correctly set with XGetWindowProperty. +>>CODE +Window win; +XVisualInfo *vp; +XWMHints hints; +long *hints_ret; +unsigned long leftover, nitems; +int actual_format; +Atom actual_type; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + hints.flags = AllHints; + hints.input = True; + hints.initial_state = IconicState; + hints.icon_pixmap = 154376L; + hints.icon_window = 197236L; + hints.icon_x = 13; + hints.icon_y = 7; + hints.icon_mask = 146890L; + hints.window_group = 137235L; + + w = win; + wm_hints = &hints; + XCALL; + + if (XGetWindowProperty(display, win, XA_WM_HINTS, 0L, (long)NumPropWMHintsElements, + False, AnyPropertyType, &actual_type, &actual_format, &nitems, &leftover, + (unsigned char **)&hints_ret) != Success) { + delete("XGetWindowProperty() did not return Success."); + return; + } else + CHECK; + + if(leftover != 0) { + report("The leftover elements numbered %lu instead of 0", leftover); + FAIL; + } else + CHECK; + + if(actual_format != 32) { + report("The format of the WM_HINTS property was %lu instead of 32", actual_format); + FAIL; + } else + CHECK; + + if(actual_type != XA_WM_HINTS) { + report("The type of the WM_HINTS property was %lu instead of XA_WM_HINTS (%lu)", actual_type, XA_WM_HINTS); + FAIL; + } else + CHECK; + + if(nitems != NumPropWMHintsElements) { + report("The number of elements comprising the WM_HINTS property was %lu instead of %lu.", + actual_type, (unsigned long) NumPropWMHintsElements); + FAIL; + } else + CHECK; + + if(hints_ret[0] != hints.flags) { + report("The flags component was %lu instead of %lu.", hints_ret[0], hints.flags); + FAIL; + } else + CHECK; + + if(hints_ret[1] != hints.input) { + report("The hints_ret component of the XWMHints structure was %lu instead of %d.", hints_ret[1], hints.input); + FAIL; + } else + CHECK; + + if(hints_ret[2] != hints.initial_state) { + report("The initial_state component of the XWMHints structure was %lu instead of %d.", hints_ret[2], hints.initial_state); + FAIL; + } else + CHECK; + + if(hints_ret[3] != hints.icon_pixmap) { + report("The icon_pixmap component of the XWMHints structure was %lu instead of %lu.", hints_ret[3], hints.icon_pixmap); + FAIL; + } else + CHECK; + + if(hints_ret[4] != hints.icon_window) { + report("The icon_window component of the XWMHints structure was %lu instead of %lu.", hints_ret[4], hints.icon_window); + FAIL; + } else + CHECK; + + if(hints_ret[5] != hints.icon_x) { + report("The icon_x component of the XWMHints structure was %ld instead of %d.", hints_ret[5], hints.icon_x); + FAIL; + } else + CHECK; + + if(hints_ret[6] != hints.icon_y) { + report("The icon_y component of the XWMHints structure was %ld instead of %d.", hints_ret[6], hints.icon_y); + FAIL; + } else + CHECK; + + if(hints_ret[7] != hints.icon_mask) { + report("The icon_mask component of the XWMHints structure was %lu instead of %lu.", hints_ret[7], hints.icon_mask); + FAIL; + } else + CHECK; + + if(hints_ret[8] != hints.window_group) { + report("The window_group component of the XWMHints structure was %lu instead of %lu.", hints_ret[8], hints.window_group); + FAIL; + } else + CHECK; + + XFree((char*)hints_ret); + + CHECKPASS(14); + + +>>ASSERTION Good A +When the +.A class_hints +argument is non-NULL, then a call to xname +sets the WM_CLASS property for the window +.A w +to the +.A class_hints +argument. +>>STRATEGY +Create a window with XCreateWindow. +Set the WM_CLASS property for the window using XSetWMProperites. +Obtain the value type and format of the WM_CLASS property using XGetWindowProperty. +Verify that the format is 8. +Verify that the type is STRING. +Verify that the value is correct. +>>CODE +Window win; +XVisualInfo *vp; +XClassHint classhint, retchint; +int reslen; +char *propp = NULL, *s; +unsigned long leftover, nitems, len; +int actual_format; +Atom actual_type; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + classhint.res_name = "XTestResName"; + classhint.res_class = "XTestClassName"; + + reslen = strlen(classhint.res_name); + len = reslen + 1 + strlen(classhint.res_class) + 1; + + w = win; + class_hints = &classhint; + XCALL; + + if (XGetWindowProperty(display, win, XA_WM_CLASS, 0L, len, False, + AnyPropertyType, &actual_type, &actual_format, &nitems, &leftover, + (unsigned char **)&propp) != Success) { + delete("XGetWindowProperty() did not return Success."); + return; + } else + CHECK; + + if(leftover != 0) { + report("The leftover elements numbered %lu instead of 0", leftover); + FAIL; + } else + CHECK; + + if(actual_format != 8) { + report("The format of the WM_HINTS property was %lu instead of 8", actual_format); + FAIL; + } else + CHECK; + + if(actual_type != XA_STRING) { + report("The type of the WM_CLASS property was %lu instead of STRING (%lu).", actual_type, (unsigned long) XA_STRING); + FAIL; + } else + CHECK; + + if(propp == NULL) { + + report("No value was set for the WM_CLASS property."); + FAIL; + + } else { + + if(strcmp(propp, classhint.res_name) != 0) { + report("The res_name component of the XClassHint structure was \"%s\" instead of \"%s\"", propp, classhint.res_name); + FAIL; + } else + CHECK; + + if(strcmp(s = propp+1+reslen, classhint.res_class) != 0) { + report("The res_class component of the XClassHint structure was \"%s\" instead of \"%s\".", s, classhint.res_class); + FAIL; + } else + CHECK; + XFree(propp); + } + + CHECKPASS(6); + + +>>ASSERTION Good A +When the +.M res_name +component of the +.S XClassHint +structure named by the +.A class_hints +argument is NULL and the RESOURCE_NAME environment variable +is set, then a call to xname sets the WM_CLASS property for +the window +.A w +after substituting the value of the RESOURCE_NAME environment variable +for the NULL +.M res_name +component. +>>STRATEGY +Fork a child process using tet_fork. +Execute the File \"./Test1\" using tet_exec with envp set to \"RESOUCE_NAME=XTest_res_name\" +In child: + Verify the environment variable RESOURCE_NAME is defined in the environment using getenv. + Set the WM_CLASS property using XSetWMProperties with the class_hints structure having NULL as the res_name component. + Obtain the value of the WM_CLASS property using XGetClassHint. + Verify that the value is \"XTest_res_name\". +>>CODE + + tet_fork(t007exec, TET_NULLFP, 0, 0xFF); + +>>EXTERN + +extern char **environ; + +static void +t007exec() +{ +char *argv[4]; +char *envp; + + argv[0] = "Test1"; + argv[1] = NULL; + + envp = "RESOURCE_NAME=XTest_res_name"; + if (xtest_putenv( envp )) { + delete("xtest_putenv failed"); + return; + } + + tet_exec("./Test1", argv, environ); + delete("tet_exec() of \"./Test1\" failed."); +} +>>ASSERTION Bad Good A +When the +.M res_name +component of the +.S XClassHint +structure named by the +.A class_hints +argument is NULL and the RESOURCE_NAME environment variable +is not set and +.A argv +and +.A argv[0] +are non-NULL, then a call to xname sets the WM_CLASS property for the window +.A w +after substituting +.A argv[0] , +stripped of any directory prefixes, for the NULL +.M res_name +component. +>>STRATEGY +Fork a child process using tet_fork. +Execute the File \"./Test2\" using tet_exec with environ without RESOURCE_NAME. +In child: + Verify the environment variable RESOURCE_NAME is not defined in the environment using getenv.. + Set the WM_CLASS property using XSetWMProperties with the class_hints structure having NULL as the res_name component. + Obtain the value of the WM_CLASS property using XGetClassHint. + Verify that the value is \"Test2\". +>>CODE + + tet_fork(t008exec, TET_NULLFP, 0, 0xFF); + +>>EXTERN +static void +t008exec() +{ +char *argv[4]; + + argv[0] = "./Test2"; + argv[1] = NULL; + if (getenv("RESOURCE_NAME") != (char *)NULL) { + char **newenv = environ; /* Remove RESOURCE_NAME */ + + trace("Removing RESOURCE_NAME from the environment"); + + while( strncmp("RESOURCE_NAME=", *newenv, 14) + && *newenv != NULL ) + newenv++; + + if (*newenv == NULL) { + report("could not remove RESOURCE_NAME from the environment"); + UNRESOLVED; + return; + } + + do { + *newenv = *(newenv+1); + newenv++; + } while( *newenv != NULL) ; + } + + tet_exec("./Test2", argv, environ); + delete("tet_exec() of \"./Test2\" failed."); + +} +>>ASSERTION Bad A +.ER BadAlloc +>>ASSERTION Bad A +.ER BadWindow +>># Kieron Completed Review diff --git a/xts5/Xlib15/XSetWMProtocols/XSetWMProtocols.m b/xts5/Xlib15/XSetWMProtocols/XSetWMProtocols.m new file mode 100644 index 00000000..18bd91f4 --- /dev/null +++ b/xts5/Xlib15/XSetWMProtocols/XSetWMProtocols.m @@ -0,0 +1,236 @@ +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/Xlib15/XSetWMProtocols/XSetWMProtocols.m,v 1.2 2005-11-03 08:42:54 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XSetWMProtocols/XSetWMProtocols.m +>># +>># Description: +>># Tests for XSetWMProtocols() +>># +>># Modifications: +>># $Log: stwmprtcls.m,v $ +>># Revision 1.2 2005-11-03 08:42:54 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:21 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:34:09 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:56:18 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:29 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:22:02 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:29:12 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:46 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11:55 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 XSetWMProtocols Xlib15 +Status +XSetWMProtocols(display, w, protocols, count) +Display *display = Dsp; +Window w = DRW(Dsp); +Atom *protocols = &prots; +int count = 1; +>>EXTERN +#include "X11/Xatom.h" +Atom prots; +>>ASSERTION Good A +A call to xname sets the +.S WM_PROTOCOLS +property for the window +.A w , +to be of type +.S ATOM , +format 32 and to have value set +to the list of +.A count +atoms specified by the +.A protocols +argument +and returns non-zero. +>>STRATEGY +Create a window with XCreateWindow. +Set the WM_PROTOCOLS property using XSetWMProtocols. +Verify that the call returned non-zero. +Obtain the WM_PROTOCOLS atom using XInternAtom. +Obtain the WM_PROTOCOLS property using XGetWindowProperty. +Verify that the property type is ATOM +Verify that the property format is 32. +Verify that the returned number of elements is correct. +Verify that the property value is correct. +>>CODE +Status status; +XVisualInfo *vp; +unsigned long leftover, nitems, len; +int actual_format; +Atom actual_type; +int nats = 5; +Atom xa_wm_protocols; +Atom prots[5], *rprots = (Atom *) NULL; +Atom at, *atp; +int i; + + + for(i=0, at = XA_LAST_PREDEFINED; i<nats; i++) + prots[i] = (int) --at; + + resetvinf(VI_WIN); + nextvinf(&vp); + w = makewin(display, vp); + + protocols = prots; + count = nats; + status = XCALL; + + if(status == 0) { + report("%s() returned zero.", TestName); + FAIL; + } else + CHECK; + + if((xa_wm_protocols = XInternAtom(display, "WM_PROTOCOLS", True)) == None) { + delete("The \"WM_PROTOCOLS\" string was not interned."); + return; + } else + CHECK; + + + if (XGetWindowProperty(display, w, xa_wm_protocols, + 0L, (long) nats, False, + AnyPropertyType, &actual_type, &actual_format, + &nitems, &leftover, (unsigned char **) &rprots) != Success) { + delete("XGetWindowProperty() did not return Success."); + return; + } else + CHECK; + + if(leftover != 0) { + report("The leftover elements numbered %lu instead of 0", leftover); + FAIL; + } else + CHECK; + + if(actual_format != 32) { + report("The format of the WM_PROTOCOLS property was %lu instead of 32", actual_format); + FAIL; + } else + CHECK; + + if(actual_type != XA_ATOM) { + report("The type of the WM_PROTOCOLS property was %lu instead of ATOM (%lu)", actual_type, (long) XA_ATOM); + FAIL; + } else + CHECK; + + if( rprots == (Atom *) NULL) { + report("No value was set for the WM_PROTOCOLS property."); + FAIL; + } else { + + CHECK; + if( nitems != nats) { + report("The WM_PROTOCOLS property comprised %ul elements instead of %d", nitems, nats); + FAIL; + } else { + + if(actual_format == 32) { + + CHECK; + for(i = 0, atp = rprots; i<nats; i++, atp++) + if( *atp != prots[i]) { + report("Element %d of the WM_PROTOCOLS value was %lu instead of %lu", i+1, (long) *atp, (long) prots[i]); + FAIL; + } else + CHECK; + } + } + XFree((char*)rprots); + } + + CHECKPASS(8 + nats); + +>>ASSERTION Bad B 1 +When the atom name \(lqWM_PROTOCOLS\(rq cannot be interned, +then a call to xname returns zero. +>>ASSERTION Bad B 1 +.ER BadAlloc +>>ASSERTION Good A +.ER BadWindow +>># Kieron Action Review diff --git a/xts5/Xlib15/XSetWMSizeHints/XSetWMSizeHints.m b/xts5/Xlib15/XSetWMSizeHints/XSetWMSizeHints.m new file mode 100644 index 00000000..4237f8a9 --- /dev/null +++ b/xts5/Xlib15/XSetWMSizeHints/XSetWMSizeHints.m @@ -0,0 +1,301 @@ +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/Xlib15/XSetWMSizeHints/XSetWMSizeHints.m,v 1.2 2005-11-03 08:42:54 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XSetWMSizeHints/XSetWMSizeHints.m +>># +>># Description: +>># Tests for XSetWMSizeHints() +>># +>># Modifications: +>># $Log: stwmszhnts.m,v $ +>># Revision 1.2 2005-11-03 08:42:54 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:21 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:34:09 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:56:19 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:30 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:22:03 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:29:12 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:48 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11:57 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 XSetWMSizeHints Xlib15 +void +XSetWMSizeHints(display, w, hints, property) +Display *display = Dsp; +Window w = DRW(Dsp); +XSizeHints *hints = &sizehints_0; +Atom property = XA_WM_NORMAL_HINTS; +>>EXTERN +#define NumPropSizeElements 18 /* ICCCM v. 1 */ +#include "X11/Xatom.h" +static XSizeHints sizehints_0 = { 0,0,0,0,0,0,0,0,0,0,0, {0,0}, {0,0}, 0,0,0}; +static XSizeHints sizehints_1 = { 0,1,2,3,4,5,6,7,8,9,10, {11,12}, {13,14}, 15, 16, 17}; +>>ASSERTION Good A +A call to xname sets the +property, specified by the +.A property +argument, for the window +.A w , +to be of type +.S WM_SIZE_HINTS , +format 32 and to have value set to +the hints in the +.S XSizeHints +structure named by the +.A hints +argument. +>>STRATEGY +Create a window using XCreateWindow. +Set the property WM_NORMAL_HINTS using XSetWMSizeHints. +Obtain the value of the WM_NORMAL_HINTS property using XGetWindowProperty. +Verify that the property format is 32. +Verify that the property type is WM_SIZE_HINTS. +Verify that the property value is correct. +>>CODE +Window win; +XVisualInfo *vp; +Atom rtype; +int rformat; +unsigned long ritems, rbytes, *uls = NULL; +XSizeHints pp; +int i; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + w = win; + hints = &sizehints_1; + XCALL; + + if( XGetWindowProperty(display, win, XA_WM_NORMAL_HINTS, 0L, + (long) NumPropSizeElements, False, + AnyPropertyType, &rtype, &rformat, &ritems, &rbytes, + (unsigned char **) &uls) != Success ) { + delete("XGetWindowProperty() did not return Success."); + return; + } else + CHECK; + + if( rtype != XA_WM_SIZE_HINTS ) { + report("WM_NORMAL_HINTS property was type %lu instead of WM_SIZE_HINTS (%lu)", + (unsigned long) rtype, (unsigned long) XA_WM_SIZE_HINTS); + FAIL; + } else + CHECK; + + if( rformat != 32 ) { + report("WM_NORMAL_HINTS property was format %d instead of 32.", rformat); + FAIL; + } else + CHECK; + + /* unpack from the array of unsigned longs into pp */ + pp.flags = uls[i=0]; + + pp.x = (int)uls[++i]; /* obsolete for new window mgrs, but clients */ + pp.y = (int)uls[++i]; + pp.width = (int)uls[++i]; + pp.height = (int)uls[++i]; /* should set so old wm's don't mess up */ + + pp.min_width = (int)uls[++i]; pp.min_height = (int)uls[++i]; + pp.max_width = (int)uls[++i]; pp.max_height = (int)uls[++i]; + pp.width_inc = (int)uls[++i]; pp.height_inc = (int)uls[++i]; + pp.min_aspect.x = (int)uls[++i]; pp.min_aspect.y = (int)uls[++i]; + pp.max_aspect.x = (int)uls[++i]; pp.max_aspect.y = (int)uls[++i]; + + pp.base_width = (int)uls[++i]; /* added by ICCCM version 1 */ + pp.base_height = (int)uls[++i]; /* added by ICCCM version 1 */ + pp.win_gravity = (int)uls[++i]; /* added by ICCCM version 1 */ + + if(pp.flags != 0) { + report("The flags component of the XSizeHints structure was %lu instead of 0.", pp.flags); + FAIL; + } else + CHECK; + + if(pp.x != 1) { + report("The x component of the XSizeHints structure was %d instead of 1.", pp.x); + FAIL; + } else + CHECK; + + if(pp.y != 2) { + report("The y component of the XSizeHints structure was %d instead of 2.", pp.y); + FAIL; + } else + CHECK; + + if(pp.width != 3) { + report("The width component of the XSizeHints structure was %d instead of 3.", pp.width); + FAIL; + } else + CHECK; + + if(pp.height != 4) { + report("The height component of the XSizeHints structure was %d instead of 4.", pp.height); + FAIL; + } else + CHECK; + + if(pp.min_width != 5) { + report("The min_width component of the XSizeHints structure was %d instead of 5.", pp.min_width); + FAIL; + } else + CHECK; + + if(pp.min_height != 6) { + report("The min_height component of the XSizeHints structure was %d instead of 6.", pp.min_height); + FAIL; + } else + CHECK; + + if(pp.max_width != 7) { + report("The max_width component of the XSizeHints structure was %d instead of 7.", pp.max_width); + FAIL; + } else + CHECK; + + if(pp.max_height != 8) { + report("The max_height component of the XSizeHints structure was %d instead of 8.", pp.max_height); + FAIL; + } else + CHECK; + + if(pp.width_inc != 9) { + report("The width_inc component of the XSizeHints structure was %d instead of 9.", pp.width_inc); + FAIL; + } else + CHECK; + + if(pp.height_inc != 10) { + report("The height_inc component of the XSizeHints structure was %d instead of 10.", pp.height_inc); + FAIL; + } else + CHECK; + + if((pp.min_aspect.x != 11) || (pp.min_aspect.y != 12)){ + report("The min_aspect components of the XSizeHints structure were %d, %d instead of 11, 12.", + pp.min_aspect.x, pp.min_aspect.y); + FAIL; + } else + CHECK; + + if((pp.max_aspect.x != 13) || (pp.max_aspect.y != 14)){ + report("The max_aspect components of the XSizeHints structure were %d, %d instead of 13, 14.", + pp.max_aspect.x, pp.max_aspect.y); + FAIL; + } else + CHECK; + + if(pp.base_width != 15) { + report("The base_width component of the XSizeHints structure was %d instead of 15.", pp.base_width); + FAIL; + } else + CHECK; + + if(pp.base_height != 16) { + report("The base_height component of the XSizeHints structure was %d instead of 16.", pp.base_height); + FAIL; + } else + CHECK; + + if(pp.win_gravity != 17) { + report("The win_gravity component of the XSizeHints structure was %d instead of 17", pp.win_gravity); + FAIL; + } else + CHECK; + + XFree((char*)uls); + CHECKPASS(19); + +>>ASSERTION Bad B 1 +.ER BadAlloc +>>ASSERTION Bad A +.ER BadAtom +>>ASSERTION Bad A +.ER BadWindow +>># Kieron Action Review diff --git a/xts5/Xlib15/XStoreName/XStoreName.m b/xts5/Xlib15/XStoreName/XStoreName.m new file mode 100644 index 00000000..f4d1f1c1 --- /dev/null +++ b/xts5/Xlib15/XStoreName/XStoreName.m @@ -0,0 +1,206 @@ +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/Xlib15/XStoreName/XStoreName.m,v 1.2 2005-11-03 08:42:51 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XStoreName/XStoreName.m +>># +>># Description: +>># Tests for XStoreName() +>># +>># Modifications: +>># $Log: strnm.m,v $ +>># Revision 1.2 2005-11-03 08:42:51 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:21 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:34:02 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:56:05 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:24 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:56 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:29:03 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:30 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11:34 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 XStoreName Xlib15 +void +XStoreName(display, w, window_name) +Display *display = Dsp; +Window w = DRW(Dsp); +char *window_name = "XTestDummyName"; +>>EXTERN +#include "X11/Xatom.h" +>>ASSERTION Good A +A call to xname sets the WM_NAME property for the window +.A w +to be of +type +.S STRING , +format +8 and to have +.M value +set to the string specified by the +.A window_name +argument. +>>STRATEGY +Create a window with XCreateWindow. +Set the WM_NAME property for the window with XStoreName. +Get the WM_NAME property for the window with XGetTextProperty. +Verify that the type and format of the property are STRING and 8. +Verify that the two names are identical. +>>CODE +Window win; +int count; +char *wname = "XTestWMName"; +XTextProperty tp; +char **wnameret = NULL; +XVisualInfo *vp; +Status status; + + resetvinf(VI_WIN); + nextvinf(&vp); + win = makewin(display, vp); + + w = win; + window_name = wname; + XCALL; + + status = XGetTextProperty(display, win, &tp, XA_WM_NAME); + + if (status == False || tp.value == NULL) { + status = False; + tp.value = NULL; + report("Failed to get WM_NAME."); + FAIL; + } else + CHECK; + + if (status && tp.encoding != XA_STRING) { + status = False; + report("Encoding is \"%s\", not STRING.", XGetAtomName(display, tp.encoding) ); + FAIL; + } else + CHECK; + + if (status && tp.format != 8) { + status = False; + report("Format is %d instead of 8.", tp.format); + FAIL; + } else { + CHECK; + + status = XTextPropertyToStringList(&tp, &wnameret, &count); + + if (status == False) { + wnameret = NULL; + delete("XTextPropertyToStringList returned False."); + return; + } else + CHECK; + + if (count != 1) { + status = False; + report("WM_NAME comprises %d strings instead of 1.", count); + FAIL; + } else + CHECK; + } + + if(status && strcmp(wnameret[0], wname) != 0) { + report("The WM_NAME property had value \"%s\" instead of \"%s\".", wnameret[0], wname); + FAIL; + } else + CHECK; + + if (wnameret != NULL) + XFree((char*)wnameret); + + if (tp.value != NULL) + XFree((char*)tp.value); + + CHECKPASS(6); + +>>ASSERTION Bad B 1 +.ER BadAlloc +>>ASSERTION Bad A +.ER BadWindow +>># Kieron Completed Review diff --git a/xts5/Xlib15/XStringListToTextProperty/XStringListToTextProperty.m b/xts5/Xlib15/XStringListToTextProperty/XStringListToTextProperty.m new file mode 100644 index 00000000..23677ca9 --- /dev/null +++ b/xts5/Xlib15/XStringListToTextProperty/XStringListToTextProperty.m @@ -0,0 +1,342 @@ +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/Xlib15/XStringListToTextProperty/XStringListToTextProperty.m,v 1.2 2005-11-03 08:42:51 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XStringListToTextProperty/XStringListToTextProperty.m +>># +>># Description: +>># Tests for XStringListToTextProperty() +>># +>># Modifications: +>># $Log: strlstttxt.m,v $ +>># Revision 1.2 2005-11-03 08:42:51 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:21 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:34:02 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:56:04 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:23 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:21:56 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:29:03 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:29 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11:32 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 XStringListToTextProperty Xlib15 +Status +XStringListToTextProperty(list, count, text_prop_return) +char **list; +int count; +XTextProperty *text_prop_return; +>>EXTERN +#include "X11/Xatom.h" +>># +>># COMMENT: This assertion is wrong about the nitems component. +>># Its value is the sum of the string lengths plus the +>># null separators. +>># +>># Cal 11/6/91 +>># +>># >>ASSERTION Good A +>># A call to xname sets the +>># .S XTextProperty +>># structure named by the +>># .A text_prop_return +>># argument such that the +>># .M format +>># component is 8, +>># the +>># .M encoding +>># component is STRING, the +>># .M value +>># component is the null-separated concatenation of +>># .A count +>># of the character strings specified by the +>># .A list +>># argument and terminated with an ASCII nul, the +>># .M nitems +>># component is the number of null-terminated character strings +>># and returns non-zero. +>>ASSERTION Good A +A call to xname sets the +.S XTextProperty +structure named by the +.A text_prop_return +argument such that the +.M format +component is 8, +the +.M encoding +component is STRING, the +.M value +component is the null-separated concatenation of +.A count +of the character strings specified by the +.A list +argument and terminated with an ASCII nul, the +.M nitems +component is the total number of characters and +separating nulls +and returns non-zero. +>>STRATEGY +Create a window using XCreateWindow. +Create a XTextPropertyStructure using XStringListToTextProperty with three strings. +Verify that the call did not return zero. +Verify that the format component is 8. +Verify that the encoding component is STRING. +Verify that the value field is correctly set +Verify that the nitems field is correctly set. +Set the property WM_NAME to the returned XTextProperty using XSetTextProperty. +Verify that no error occurred. +Create a XTextPropertyStructure using XStringListToTextProperty no strings. +Verify that the call did not return zero. +Set the property WM_NAME to the returned XTextProperty using XSetTextProperty. +Verify that no error occurred. +>>CODE +Status status; +char *str1 = "XtestString1_._."; +char *str2 = "XtextString2._"; +char *str3 = "XtestString3._.."; +char *argv[3]; +char *value, *vp; +int argc = 3; +int i; +int len; +XTextProperty tp; +Window win; +XVisualInfo *vi; + + resetvinf(VI_WIN); + nextvinf(&vi); + win = makewin(Dsp, vi); + + argv[0] = str1; + argv[1] = str2; + argv[2] = str3; + + len = 0; + for(i=0; i< argc; i++) + len += strlen(argv[i]) + 1; + + if((value = (char *)malloc(len)) == NULL) { + delete("malloc() returned NULL."); + return; + } else + CHECK; + + len--; + vp = value; + for(i=0; i< argc; i++) { + strcpy(vp, argv[i]); + vp += strlen(argv[i]) + 1; + + } + + list = argv; + count = argc; + text_prop_return = &tp; + status = XCALL; + + if(status == 0) { + delete("%s() returned zero.", TestName); + return; + } else + CHECK; + + if( tp.format != 8 ) { + report("The format component of the XTextProperty structure was %d instead of %d.", tp.format, 8); + FAIL; + } else + CHECK; + + if( tp.encoding != XA_STRING) { + report("The encoding component of the XTextProperty structure was %ld instead of %ld.", + (long) tp.encoding, (long) XA_STRING); + FAIL; + } else + CHECK; + + if(tp.nitems != len) { + report("The nitems component of the XTextProperty structure was %ld instead of %ld.", tp.nitems, len); + FAIL; + } else + CHECK; + + if(tp.value == NULL) { + report("The value component of the XTextProperty structure was NULL."); + FAIL; + } else { + CHECK; + + if(memcmp(tp.value, value, len+1) != 0) { + report("The value component of the XTextProperty was not correct."); + FAIL; + } else + CHECK; + + startcall(Dsp); + XSetTextProperty(Dsp, win, &tp, XA_WM_NAME); + endcall(Dsp); + + if(geterr() != Success) { + report("Could not set property WM_NAME with the returned XTextProperty."); + FAIL; + } else + CHECK; + + XFree((char*)tp.value); + } + + + free(value); + + list = (char **) NULL; + count = 0; + text_prop_return = &tp; + status = XCALL; + + if(status == 0) { + delete("%s() returned zero.", TestName); + return; + } else + CHECK; + + startcall(Dsp); + XSetTextProperty(Dsp, win, &tp, XA_WM_NAME); + endcall(Dsp); + + if(geterr() != Success) { + report("Could not set property WM_NAME with the returned XTextProperty."); + FAIL; + } else + CHECK; + + if(tp.value != (unsigned char *) NULL) + XFree((char*)tp.value); + + CHECKPASS(10); + +>>ASSERTION Bad B 1 +When insufficient memory is available for the new value string, then +a call to xname does not set any fields in the +.S XTextProperty +structure and returns zero. +>>ASSERTION Good A +The new value string returned by a call to xname can be freed with XFree. +>>STRATEGY +Create a XTextProperty structure using XStringListToTextProperty. +Verify that the call did not return zero. +Release the allocated memory using XFree. +>>CODE +Status status; +char *str1 = "XtestString1_._."; +char *str2 = "XtextString2._"; +char *str3 = "XtestString3._.."; +char *argv[3]; +int argc = 3; +XTextProperty tp; + + argv[0] = str1; + argv[1] = str2; + argv[2] = str3; + + list = argv; + count = argc; + text_prop_return = &tp; + status = XCALL; + + if(status == 0) { + delete("%s() returned zero.", TestName); + return; + } else + CHECK; + + if(tp.value == NULL) { + report("The value component of the XTextProperty structure was NULL."); + FAIL; + } else { + CHECK; + XFree((char*)tp.value); + } + + CHECKPASS(2); +>># Kieron Completed Review diff --git a/xts5/Xlib15/XTextPropertyToStringList/XTextPropertyToStringList.m b/xts5/Xlib15/XTextPropertyToStringList/XTextPropertyToStringList.m new file mode 100644 index 00000000..c5d679f9 --- /dev/null +++ b/xts5/Xlib15/XTextPropertyToStringList/XTextPropertyToStringList.m @@ -0,0 +1,283 @@ +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/Xlib15/XTextPropertyToStringList/XTextPropertyToStringList.m,v 1.2 2005-11-03 08:42:54 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XTextPropertyToStringList/XTextPropertyToStringList.m +>># +>># Description: +>># Tests for XTextPropertyToStringList() +>># +>># Modifications: +>># $Log: txtprprtyt.m,v $ +>># Revision 1.2 2005-11-03 08:42:54 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:21 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:34:10 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:56:20 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:30 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:22:03 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.1 1996/05/09 00:29:13 andy +>># Corrected Xatom include +>># +>># Revision 4.0 1995/12/15 09:09:49 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:11:59 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 XTextPropertyToStringList Xlib15 +Status +XTextPropertyToStringList(text_prop, list_return, count_return) +XTextProperty *text_prop; +char ***list_return; +int *count_return; +>>EXTERN +#include "X11/Xatom.h" +char *nullstr = "<NULL>"; +char *str1 = "Xtest_._."; +char *str2 = "test._"; +char *str3 = "string._.."; +>>ASSERTION Good A +When the +.M encoding +component of the +.A text_prop +argument is STRING and the +.M format +component is 8, then +a call to xname returns in the +.A list_string +argument the list of strings representing the null-separated +elements of the +.S XTextProperty +structure named by the +.A text_prop +argument, returns in +.A count_return +the number of strings and returns non-zero. +>>STRATEGY +Create an XTextProperty structure. +Extract the strings using XTextPropertyToStringList. +Verify that the call did not return zero. +Verify that the returned string count is correct. +Verify that the returned string list is correct. +>>CODE +Status status; +XTextProperty tp; +char **list; +int count; + + tp.value = (unsigned char *) "Xtest_._.\0test._\0string._.."; + tp.nitems = 27; + tp.format = 8; + tp.encoding = XA_STRING; + text_prop = &tp; + list_return = &list; + count_return = &count; + status = XCALL; + + if(status == 0) { + delete("%s() returned zero.", TestName); + return; + } else + CHECK; + + if(count != 3) { + report("The returned number of strings was %d instead of %d", count, 3); + FAIL; + } else { + CHECK; + + if(strcmp(list[0], str1) != 0 ||strcmp(list[1], str2) != 0 || strcmp(list[2], str3)) { + report("The returned strings were:"); + report("\"%s\"", list[0] == NULL ? nullstr : list[0]); + report("\"%s\"", list[1] == NULL ? nullstr : list[1]); + report("\"%s\"", list[2] == NULL ? nullstr : list[2]); + report("instead of:"); + report("\"%s\"", str1); + report("\"%s\"", str2); + report("\"%s\"", str3); + } else + CHECK; + + } + + XFreeStringList(list); + CHECKPASS(3); + +>>ASSERTION Good A +When the +.M encoding +component of the +.A text_prop +argument is not STRING, then +a call to xname sets no return values and returns zero. +>>STRATEGY +Create an XTextProperty structure with encoding component set to XA_WINDOW. +Call XTextPropertyToStringList. +Verify that the call returned zero. +Verify that the list_return argument was not changed. +Verify that the count_return argument was not changed. +>>CODE +Status status; +XTextProperty tp; +char **list = (char **) -1; +int count = -1; + + tp.value = (unsigned char *) "Xtest_._.\0test._\0string._.."; + tp.nitems = 27; + tp.format = 8; + tp.encoding = XA_WINDOW; + text_prop = &tp; + list_return = &list; + count_return = &count; + status = XCALL; + + if(status != 0) { + report("%s() did not return zero.", TestName); + FAIL; + } else + CHECK; + + if(list != (char**) -1) { + report("The list_return argument was altered."); + FAIL; + } else + CHECK; + + if(count != -1) { + report("The count_return argument was altered."); + FAIL; + } else + CHECK; + + CHECKPASS(3); + +>>ASSERTION Good A +When the +.A format +component of the +.A text_prop +argument is not 8, then +a call to xname sets no return values and returns zero. +>>STRATEGY +Create an XTextProperty structure with format component set to 16. +Call XTextPropertyToStringList. +Verify that the call returned zero. +Verify that the list_return argument was not changed. +Verify that the count_return argument was not changed. +>>CODE +Status status; +XTextProperty tp; +char **list = (char **) -1; +int count = -1; + + tp.value = (unsigned char *) "Xtest_._.\0test._\0string._.."; + tp.nitems = 27; + tp.format = 16; + tp.encoding = XA_STRING; + text_prop = &tp; + list_return = &list; + count_return = &count; + status = XCALL; + + if(status != 0) { + report("%s() did not return zero.", TestName); + FAIL; + } else + CHECK; + + if(list != (char**) -1) { + report("The list_return argument was altered."); + FAIL; + } else + CHECK; + + if(count != -1) { + report("The count_return argument was altered."); + FAIL; + } else + CHECK; + + CHECKPASS(3); + +>>ASSERTION Bad B 1 +When insufficient memory is available for the list and its elements, +then a call to xname sets no return values and returns zero. +>># Kieron Completed Review diff --git a/xts5/Xlib15/XWithdrawWindow/XWithdrawWindow.m b/xts5/Xlib15/XWithdrawWindow/XWithdrawWindow.m new file mode 100644 index 00000000..36d6d870 --- /dev/null +++ b/xts5/Xlib15/XWithdrawWindow/XWithdrawWindow.m @@ -0,0 +1,266 @@ +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/Xlib15/XWithdrawWindow/XWithdrawWindow.m,v 1.2 2005-11-03 08:42:55 jmichael Exp $ + +Copyright (c) Applied Testing and Technology, Inc. 1995 +All Rights Reserved. + +>># Project: VSW5 +>># +>># File: xts5/tset/Xlib15/XWithdrawWindow/XWithdrawWindow.m +>># +>># Description: +>># Tests for XWithdrawWindow() +>># +>># Modifications: +>># $Log: wthdrwwdw.m,v $ +>># Revision 1.2 2005-11-03 08:42:55 jmichael +>># clean up all vsw5 paths to use xts5 instead. +>># +>># Revision 1.1.1.2 2005/04/15 14:05:21 anderson +>># Reimport of the base with the legal name in the copyright fixed. +>># +>># Revision 8.0 1998/12/23 23:34:10 mar +>># Branch point for Release 5.0.2 +>># +>># Revision 7.0 1998/10/30 22:56:21 mar +>># Branch point for Release 5.0.2b1 +>># +>># Revision 6.0 1998/03/02 05:25:31 tbr +>># Branch point for Release 5.0.1 +>># +>># Revision 5.0 1998/01/26 03:22:03 tbr +>># Branch point for Release 5.0.1b1 +>># +>># Revision 4.0 1995/12/15 09:09:50 tbr +>># Branch point for Release 5.0.0 +>># +>># Revision 3.1 1995/12/15 01:12:00 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 XWithdrawWindow Xlib15 +Status +XWidthdrawWindow(display, w, screen_number) +Display *display = Dsp; +Window w = DRW(Dsp); +int screen_number = DefaultScreen(Dsp); +>>ASSERTION Good A +A call to xname unmaps the window +specified by the +.A w +argument +and sends, +to the root window of the screen specified by the +.A screen_number +argument, a synthetic +.S UnmapNotify +event with a +.M window +of +.A w , +an +.M event +equal to the receiving root window and a +.M from_configure +element of +.S False +using an event mask of +.S SubstructureRedirectMask | +.S SubstructureNotifyMask +and returns non-zero. +>>STRATEGY +Create a window using XCreateWindow. +Select UnmapNotify events on the root using XSelectInput with SubstructureNotifyMask. +Unmap the window using XWithdrawWindow. +Verify that the window is unmapped using XGetWindowAttributes. +Verify that a non-synthetic UnmapNotify event is generated. +Verify that a synthetic UnmapNotify event is generated. + +Create a window using XCreateWindow. +Select UnmapNotify events on the root using XSelectInput with SubstructureRedirectMask. +Unmap the window using XWithdrawWindow. +Verify that the window is unmapped using XGetWindowAttributes. +Verify that a non-synthetic UnmapNotify event is generated. +>>CODE +int nevents; +XVisualInfo *vp; +XWindowAttributes atts; +XEvent ev; +XEvent rev; + + + resetvinf(VI_WIN); + nextvinf(&vp); + + ev.type = UnmapNotify; + ev.xany.display = display; + ev.xunmap.type = UnmapNotify; + ev.xunmap.send_event = False; + ev.xunmap.display = display; + ev.xunmap.event = DRW(display); + ev.xunmap.from_configure = False; + + CATCH_ERROR(display); + XSelectInput(display, DRW(display), SubstructureNotifyMask); + RESTORE_ERROR(display); + + if(GET_ERROR(display) != Success) { + delete("XSelectInput() failed with an event mask of 0x%lx.", SubstructureNotifyMask); + return; + } else + CHECK; + + w = makewin(display, vp); + XCALL; + + if(XGetWindowAttributes(display, w, &atts) == False){ + delete("XGetWindowAttributes Failed on window id %lx.", (long) w); + return; + } else + CHECK; + + if(atts.map_state != IsUnmapped) { + report("Window ID %lx was not unmapped", (long) w); + FAIL; + } else + CHECK; + + ev.xunmap.window = w; + ev.xunmap.send_event = False; + rev.type = -1; + if( (nevents = getevent(display, &rev)) == 0 ) { + report("No event was generated."); + FAIL; + } else { + CHECK; + if( checkevent(&ev, &rev) != 0 ) + FAIL; + else + CHECK; + } + + ev.xunmap.send_event = True; + rev.type = -1; + + if( (nevents = getevent(display, &rev)) == 0 ) { + report("No event was generated."); + FAIL; + } else { + CHECK; + if( checkevent(&ev, &rev) != 0 ) + FAIL; + else + CHECK; + } + + CATCH_ERROR(display); + XSelectInput(display, DRW(display), SubstructureRedirectMask); + RESTORE_ERROR(display); + + if(GET_ERROR(display) != Success) { + delete("XSelectInput() failed with an event mask of 0x%lx.",SubstructureRedirectMask); + return; + } else + CHECK; + + w = makewin(display, vp); + XCALL; + + if(XGetWindowAttributes(display, w, &atts) == False){ + delete("XGetWindowAttributes Failed on window id %lx.", (long) w); + return; + } else + CHECK; + + if(atts.map_state != IsUnmapped) { + report("Window ID %lx was not unmapped", (long) w); + FAIL; + } else + CHECK; + + ev.xunmap.window = w; + ev.xunmap.send_event = False; + rev.type = -1; + if( (nevents = getevent(display, &rev)) == 0 ) { + report("No event was generated."); + FAIL; + } else { + CHECK; + if( checkevent(&ev, &rev) != 0 ) + FAIL; + else + CHECK; + } + + CHECKPASS(12); + +>>ASSERTION Bad B 1 +>># Untestable, and not worth the effort of adding XTest extension facilities +>># to provoke the error. +When the +.S UnmapNotify +event is not successfully sent, then +xname returns zero. +>>ASSERTION Good A +.ER BadWindow +>># Completed Kieron Review |