summaryrefslogtreecommitdiff
path: root/xts5/Xt11
diff options
context:
space:
mode:
authorDan Nicholson <dbn.lists@gmail.com>2009-09-16 12:20:41 -0700
committerDan Nicholson <dbn.lists@gmail.com>2009-09-16 12:20:41 -0700
commit704eb8d4cbfa2f8c47882a8ea6c7732cf5fa20d1 (patch)
tree1f48212ecf5556fbff17172c6904e525481e8653 /xts5/Xt11
parent5d01bd434ff7186701c931883b110c179d4fa8b8 (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/Xt11')
-rw-r--r--xts5/Xt11/XtAppReleaseCacheRefs/XtAppReleaseCacheRefs.m246
-rw-r--r--xts5/Xt11/XtAppSetTypeConverter/XtAppSetTypeConverter.m992
-rw-r--r--xts5/Xt11/XtCallConverter/XtCallConverter.m1072
-rw-r--r--xts5/Xt11/XtCallbackReleaseCacheRef/XtCallbackReleaseCacheRef.m151
-rw-r--r--xts5/Xt11/XtCallbackReleaseCacheRefList/XtCallbackReleaseCacheRefList.m166
-rw-r--r--xts5/Xt11/XtConvertAndStore/XtConvertAndStore.m1182
-rw-r--r--xts5/Xt11/XtCvtColorToPixel/XtCvtColorToPixel.m332
-rw-r--r--xts5/Xt11/XtCvtIntToBool/XtCvtIntToBool.m258
-rw-r--r--xts5/Xt11/XtCvtIntToBoolean/XtCvtIntToBoolean.m258
-rw-r--r--xts5/Xt11/XtCvtIntToColor/XtCvtIntToColor.m343
-rw-r--r--xts5/Xt11/XtCvtIntToDimension/XtCvtIntToDimension.m258
-rw-r--r--xts5/Xt11/XtCvtIntToFloat/XtCvtIntToFloat.m257
-rw-r--r--xts5/Xt11/XtCvtIntToFont/XtCvtIntToFont.m257
-rw-r--r--xts5/Xt11/XtCvtIntToPixel/XtCvtIntToPixel.m257
-rw-r--r--xts5/Xt11/XtCvtIntToPixmap/XtCvtIntToPixmap.m257
-rw-r--r--xts5/Xt11/XtCvtIntToPosition/XtCvtIntToPosition.m258
-rw-r--r--xts5/Xt11/XtCvtIntToShort/XtCvtIntToShort.m258
-rw-r--r--xts5/Xt11/XtCvtIntToUnsignedChar/XtCvtIntToUnsignedChar.m257
-rw-r--r--xts5/Xt11/XtCvtPixelToColor/XtCvtPixelToColor.m280
-rw-r--r--xts5/Xt11/XtCvtStringToAcceleratorTable/XtCvtStringToAcceleratorTable.m343
-rw-r--r--xts5/Xt11/XtCvtStringToAtom/XtCvtStringToAtom.m331
-rw-r--r--xts5/Xt11/XtCvtStringToBool/XtCvtStringToBool.m327
-rw-r--r--xts5/Xt11/XtCvtStringToBoolean/XtCvtStringToBoolean.m330
-rw-r--r--xts5/Xt11/XtCvtStringToCursor/XtCvtStringToCursor.m389
-rw-r--r--xts5/Xt11/XtCvtStringToDimension/XtCvtStringToDimension.m327
-rw-r--r--xts5/Xt11/XtCvtStringToDisplay/XtCvtStringToDisplay.m327
-rw-r--r--xts5/Xt11/XtCvtStringToFile/XtCvtStringToFile.m327
-rw-r--r--xts5/Xt11/XtCvtStringToFloat/XtCvtStringToFloat.m343
-rw-r--r--xts5/Xt11/XtCvtStringToFont/XtCvtStringToFont.m420
-rw-r--r--xts5/Xt11/XtCvtStringToFontSet/XtCvtStringToFontSet.m465
-rw-r--r--xts5/Xt11/XtCvtStringToFontStruct/XtCvtStringToFontStruct.m419
-rw-r--r--xts5/Xt11/XtCvtStringToInitialState/XtCvtStringToInitialState.m430
-rw-r--r--xts5/Xt11/XtCvtStringToInt/XtCvtStringToInt.m327
-rw-r--r--xts5/Xt11/XtCvtStringToPixel/XtCvtStringToPixel.m699
-rw-r--r--xts5/Xt11/XtCvtStringToPosition/XtCvtStringToPosition.m327
-rw-r--r--xts5/Xt11/XtCvtStringToShort/XtCvtStringToShort.m331
-rw-r--r--xts5/Xt11/XtCvtStringToTranslationTable/XtCvtStringToTranslationTable.m337
-rw-r--r--xts5/Xt11/XtCvtStringToUnsignedChar/XtCvtStringToUnsignedChar.m327
-rw-r--r--xts5/Xt11/XtCvtStringToVisual/XtCvtStringToVisual.m506
-rw-r--r--xts5/Xt11/XtDisplayStringConversionWarning/XtDisplayStringConversionWarning.m275
-rw-r--r--xts5/Xt11/XtDisplayToApplicationContext/XtDisplayToApplicationContext.m139
-rw-r--r--xts5/Xt11/XtGetApplicationResources/XtGetApplicationResources.m254
-rw-r--r--xts5/Xt11/XtGetConstraintResourceList/XtGetConstraintResourceList.m239
-rw-r--r--xts5/Xt11/XtGetResourceList/XtGetResourceList.m785
-rw-r--r--xts5/Xt11/XtGetSubresources/XtGetSubresources.m235
-rw-r--r--xts5/Xt11/XtGetSubvalues/XtGetSubvalues.m171
-rw-r--r--xts5/Xt11/XtGetValues/XtGetValues.m886
-rw-r--r--xts5/Xt11/XtOffset/XtOffset.m96
-rw-r--r--xts5/Xt11/XtOffsetOf/XtOffsetOf.m96
-rw-r--r--xts5/Xt11/XtSetSubvalues/XtSetSubvalues.m170
-rw-r--r--xts5/Xt11/XtSetTypeConverter/XtSetTypeConverter.m1039
-rw-r--r--xts5/Xt11/XtSetValues/XtSetValues.m1168
-rw-r--r--xts5/Xt11/XtVaGetApplicationResources/XtVaGetApplicationResources.m298
-rw-r--r--xts5/Xt11/XtVaGetSubresources/XtVaGetSubresources.m309
-rw-r--r--xts5/Xt11/XtVaGetSubvalues/XtVaGetSubvalues.m218
-rw-r--r--xts5/Xt11/XtVaGetValues/XtVaGetValues.m926
-rw-r--r--xts5/Xt11/XtVaSetSubvalues/XtVaSetSubvalues.m254
-rw-r--r--xts5/Xt11/XtVaSetValues/XtVaSetValues.m1199
58 files changed, 23728 insertions, 0 deletions
diff --git a/xts5/Xt11/XtAppReleaseCacheRefs/XtAppReleaseCacheRefs.m b/xts5/Xt11/XtAppReleaseCacheRefs/XtAppReleaseCacheRefs.m
new file mode 100644
index 00000000..73cd8bed
--- /dev/null
+++ b/xts5/Xt11/XtAppReleaseCacheRefs/XtAppReleaseCacheRefs.m
@@ -0,0 +1,246 @@
+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/Xt11/XtAppReleaseCacheRefs/XtAppReleaseCacheRefs.m,v 1.2 2005-04-21 09:40:42 ajosey 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/Xt11/XtAppReleaseCacheRefs/XtAppReleaseCacheRefs.m
+>>#
+>># Description:
+>># Tests for XtAppReleaseCacheRefs()
+>>#
+>># Modifications:
+>># $Log: taprelcre.m,v $
+>># Revision 1.2 2005-04-21 09:40:42 ajosey
+>># resync to VSW5.1.5
+>>#
+>># Revision 8.1 1999/04/05 22:28:03 mar
+>># req.4.W.00138: tp2 - destructor should not free to_val. The Intrinsics handle
+>># it internally (it happens to be a stack variable).
+>>#
+>># Revision 8.0 1998/12/23 23:37:36 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:33 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:40 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:15 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:19:59 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:49 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+XrmValue from;
+XrmValue to_in_out;
+
+unsigned char tochar;
+
+char buf[32];
+
+void init_args()
+{
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr)+1;
+ to_in_out.addr = (XtPointer)&tochar;
+ to_in_out.size = sizeof(unsigned char);
+}
+
+#ifndef XavsRChar
+#define XavsRChar "Char"
+#endif
+Boolean XtCVT_Proc(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValuePtr args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+ /*
+ ** Conveter to convert String to Char
+ */
+ char *str = (char *) (from_val->addr);
+ static unsigned char i;
+ avs_set_event(1,avs_get_event(1)+1);
+ to_val->size = sizeof (unsigned char);
+ to_val->addr = (XtPointer) &i;
+ i = *str;
+ return True;
+}
+void XtDES_Proc(app_ctext, to_val, converter_data, args, num_args )
+XtAppContext app_ctext;
+XrmValue *to_val;
+XtPointer converter_data;
+XrmValue *args;
+Cardinal *num_args;
+{
+ avs_set_event(2,avs_get_event(2)+1);
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtAppReleaseCacheRefs Xt11
+void
+XtAppReleaseCacheRefs(app_context, refs)
+>>ASSERTION Good A
+A successful call to
+void XtAppReleaseCacheRefs(app_context, refs)
+shall decrement the
+reference count for each conversion entry in the list specified by
+.A refs.
+>>CODE
+XtCacheRef cache_ref_return1[2], cache_ref_return2[2];
+int status1, status2;
+Boolean flag;
+Display *display_good;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Taprelcre1", "XtSetTypeConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter and destructor");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_Proc,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheAll|XtCacheRefCount,
+ XtDES_Proc);
+ tet_infoline("TEST: Invoke resource converter twice");
+ display_good = XtDisplay(topLevel);
+ init_args();
+ flag = XtCallConverter(display_good,
+ XtCVT_Proc,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &(cache_ref_return1[0])
+ );
+ check_dec(True, flag, "return value");
+ flag = XtCallConverter(display_good,
+ XtCVT_Proc,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &(cache_ref_return2[0])
+ );
+ cache_ref_return1[1] = 0;
+ cache_ref_return2[1] = 0;
+ check_dec(True, flag, "return value");
+ tet_infoline("TEST: Resource converter was invoked");
+ status1 = avs_get_event(1);
+ check_dec(1, status1, "Resource converter invoked count");
+ tet_infoline("TEST: Release the cached resource value");
+ XtAppReleaseCacheRefs(app_ctext, cache_ref_return1);
+ tet_infoline("TEST: Resource destructor was not invoked");
+ status2 = avs_get_event(2);
+ check_dec(0, status2, "Resource destructor invoked count");
+ tet_infoline("TEST: Release the cached resource value again");
+ XtAppReleaseCacheRefs(app_ctext, cache_ref_return2);
+ tet_infoline("TEST: Resource destructor was invoked");
+ status2 = avs_get_event(2);
+ check_dec(1, status2, "Resource destructor invoked count");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+void XtAppReleaseCacheRefs(app_context, refs)
+shall call the destructor procedure and remove the resource
+from the conversion cache for any conversion entry in
+.A refs
+that reaches a conversion count of zero.
+>>CODE
+XtCacheRef cache_ref_return1[2], cache_ref_return2[2];
+int status1, status2;
+Boolean flag;
+Display *display_good;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Taprelcre1", "XtSetTypeConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter and destructor");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_Proc,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheAll|XtCacheRefCount,
+ XtDES_Proc);
+ tet_infoline("TEST: Invoke resource converter twice");
+ display_good = XtDisplay(topLevel);
+ init_args();
+ flag = XtCallConverter(display_good,
+ XtCVT_Proc,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &(cache_ref_return1[0])
+ );
+ check_dec(True, flag, "return value");
+ flag = XtCallConverter(display_good,
+ XtCVT_Proc,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &(cache_ref_return2[0])
+ );
+ cache_ref_return1[1] = 0;
+ cache_ref_return2[1] = 0;
+ check_dec(True, flag, "return value");
+ tet_infoline("TEST: Resource converter was invoked");
+ status1 = avs_get_event(1);
+ check_dec(1, status1, "Resource converter invoked count");
+ tet_infoline("TEST: Release the cached resource value");
+ XtAppReleaseCacheRefs(app_ctext, cache_ref_return1);
+ tet_infoline("TEST: Release the cached resource value again");
+ XtAppReleaseCacheRefs(app_ctext, cache_ref_return2);
+ tet_infoline("TEST: Resource destructor was invoked");
+ status2 = avs_get_event(2);
+ check_dec(1, status2, "Resource destructor invoked count");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
diff --git a/xts5/Xt11/XtAppSetTypeConverter/XtAppSetTypeConverter.m b/xts5/Xt11/XtAppSetTypeConverter/XtAppSetTypeConverter.m
new file mode 100644
index 00000000..0fdaba38
--- /dev/null
+++ b/xts5/Xt11/XtAppSetTypeConverter/XtAppSetTypeConverter.m
@@ -0,0 +1,992 @@
+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/Xt11/XtAppSetTypeConverter/XtAppSetTypeConverter.m,v 1.1 2005-02-12 14:37:51 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/Xt11/XtAppSetTypeConverter/XtAppSetTypeConverter.m
+>>#
+>># Description:
+>># Tests for XtAppSetTypeConverter()
+>>#
+>># Modifications:
+>># $Log: tapsttpec.m,v $
+>># Revision 1.1 2005-02-12 14:37:51 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:46 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:43 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.1 1998/08/07 19:35:32 andy
+>># Adjusted casts for argument data retrieval to handle 64-bit implementations.
+>>#
+>># Revision 6.0 1998/03/02 05:28:50 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:24 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.1 1998/01/13 02:48:59 andy
+>># Changed XtCVT_ProcA to set the to_val->size and to_val->addr fields
+>># before returning (SR 131).
+>>#
+>># Revision 4.0 1995/12/15 09:20:24 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:15:23 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+#include <AvsRectObj.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+#ifndef XavsRChar
+#define XavsRChar "Char"
+#endif
+
+Boolean XtCVT_Proc(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValuePtr args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+ char *str = (char *) (from_val->addr);
+ static unsigned char i;
+ /*
+ ** Convert string to char
+ */
+ avs_set_event(1, avs_get_event(1)+1);
+ to_val->size = sizeof (unsigned char);
+ to_val->addr = (XtPointer) &i;
+ i = *str;
+ return True;
+}
+void XtDES_Proc(app_ctext, to_val, converter_data, args, num_args )
+XtAppContext app_ctext;
+XrmValue *to_val;
+XtPointer converter_data;
+XrmValuePtr args;
+Cardinal *num_args;
+{
+ avs_set_event(2,1);
+}
+Boolean XtCVT_2StringToInt(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValuePtr args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+ char *str = (char *) (from_val->addr);
+ static unsigned int i;
+ sprintf(ebuf, "ERROR: Invoked converter XtCVT_2StringToInt");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ to_val->size = sizeof (unsigned int);
+ to_val->addr = (XtPointer) &i;
+ i = *str;
+ return True;
+}
+Boolean XtCVT_2StringToChar(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValuePtr args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+ char *str = (char *) (from_val->addr);
+ static unsigned char i;
+ avs_set_event(1, avs_get_event(1)+1);
+ to_val->size = sizeof (unsigned char);
+ to_val->addr = (XtPointer) &i;
+ i = *str;
+ return True;
+}
+void XtDES2_FreeInt(app_ctext, to_val, converter_data, args, num_args )
+XtAppContext app_ctext;
+XrmValue *to_val;
+XtPointer converter_data;
+XrmValuePtr args;
+Cardinal *num_args;
+{
+ sprintf(ebuf, "ERROR: Invoked destructor XtDES2_FreeInt");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+}
+void XtDES2_FreeChar(app_ctext, to_val, converter_data, args, num_args )
+XtAppContext app_ctext;
+XrmValue *to_val;
+XtPointer converter_data;
+XrmValuePtr args;
+Cardinal *num_args;
+{
+ avs_set_event(2, 1);
+}
+
+#define NUMARGS 8
+XtConvertArgRec cargs[NUMARGS];
+int argdata[NUMARGS] = {
+ 0, /*don't care*/
+ 2002,
+ 0,
+ 4004,
+ 0,
+ 0,
+ 0,
+ 8008
+};
+
+void xcap(w, size, value)
+Widget w;
+Cardinal *size;
+XrmValue *value;
+{
+ avs_set_event(2, avs_get_event(2)+1);
+ value->addr = (XtPointer)&argdata[7];
+ value->size = sizeof(argdata[7]);
+}
+
+void init_args(checknum)
+int checknum;
+{
+ cargs[0].address_mode = XtImmediate;
+ cargs[0].address_id = (XtPointer)checknum;
+ cargs[0].size = sizeof(XtPointer);
+
+/*XtAddress*/
+ cargs[1].address_mode = XtAddress;
+ cargs[1].address_id = (XtPointer)&argdata[1];
+ cargs[1].size = sizeof(XtPointer);
+
+/*XtBaseOffset*/
+ cargs[2].address_mode = XtBaseOffset;
+ cargs[2].address_id = (XtPointer)XtOffset(Widget, core.screen);
+ cargs[2].size = sizeof(Screen*);
+
+/*XtImmediate*/
+ cargs[3].address_mode = XtImmediate;
+ cargs[3].address_id = (XtPointer)argdata[3];
+ cargs[3].size = sizeof(XtPointer);
+
+/*XtResourceString*/
+ cargs[4].address_mode = XtImmediate;
+ cargs[4].address_id = (XtPointer)argdata[4];
+ cargs[4].size = sizeof(XtPointer);
+
+/*XtResourceQuark*/
+ cargs[5].address_mode = XtImmediate;
+ cargs[5].address_id = (XtPointer)argdata[5];
+ cargs[5].size = sizeof(XtPointer);
+
+/*XtWidgetBaseOffset*/
+ cargs[6].address_mode = XtWidgetBaseOffset;
+ cargs[6].address_id = (XtPointer)XtOffset(Widget, core.self);
+ cargs[6].size = sizeof(Widget);
+
+/*XtProcedureArg*/
+ cargs[7].address_mode = XtProcedureArg;
+ cargs[7].address_id = (XtPointer)xcap;
+ cargs[7].size = sizeof(XtPointer);
+}
+
+Boolean XtCVT_ProcA(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValuePtr args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+int checknum;
+
+ char *str = (char *) (from_val->addr);
+ static unsigned char i;
+
+ to_val->size = sizeof (unsigned char);
+ to_val->addr = (XtPointer) &i;
+ i = *str;
+
+ avs_set_event(1, avs_get_event(1)+1);
+ tet_infoline("TEST: Additional arguments passed to converter");
+ if (*num_args != NUMARGS) {
+ sprintf(ebuf, "ERROR: expected %d arguments, received %d", NUMARGS, *num_args);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ return False;
+ }
+
+ checknum = (int)(*(XPointer *)args[0].addr);
+
+ if (checknum == 0) {
+ tet_infoline("ERROR: args[0].addr = 0");
+ tet_result(TET_FAIL);
+ return False;
+ }
+ if (checknum > NUMARGS) {
+ sprintf(ebuf, "ERROR: args[0].addr = %d, should be < %d", checknum, NUMARGS);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ return False;
+ }
+
+ if (args[checknum].addr == NULL) {
+ sprintf(ebuf, "ERROR: args[%d].addr = NULL", checknum);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ return False;
+ }
+
+ switch (checknum) {
+ case 1:
+ case 7:
+ if (((int)*(int *)args[checknum].addr) != argdata[checknum]) {
+ sprintf(ebuf, "ERROR: expected args[%d].addr to point to %d points to %d", checknum, argdata[checknum], ((int)*(int *)args[checknum].addr));
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ return False;
+ }
+ break;
+ case 2:
+ if (((Screen*)*(Screen**)args[checknum].addr) != topLevel->core.screen) {
+ sprintf(ebuf, "ERROR: expected args[%d].addr to point to %p points to %p", checknum, topLevel->core.screen, ((Screen*)*(Screen**)args[checknum].addr));
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ return False;
+ }
+ break;
+ case 3:
+ if (((int)*(XPointer *)args[checknum].addr) != argdata[checknum]) {
+ sprintf(ebuf, "ERROR: expected args[%d].addr to point to %d points to %d", checknum, argdata[checknum], ((int)*(XPointer *)args[checknum].addr));
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ return False;
+ }
+ break;
+ case 6:
+ if (((Widget)*(Widget*)args[checknum].addr) != topLevel->core.self) {
+ sprintf(ebuf, "ERROR: expected args[%d].addr to point to %p points to %p", checknum, topLevel->core.self, ((Widget)*(Widget*)args[checknum].addr));
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ return False;
+ }
+ break;
+ default:
+ sprintf(ebuf, "ERROR: Unknown argument type %d", checknum);
+ tet_infoline(ebuf);
+ tet_result(TET_UNRESOLVED);
+ return False;
+ }
+
+ return True;
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtAppSetTypeConverter Xt11
+void
+XtAppSetTypeConverter(app_context, from_type, to_type, converter, convert_args, num_args, cache_type, destructor)
+>>ASSERTION Good A
+A successful call to
+void XtAppSetTypeConverter(app_context, from_type, to_type,
+converter, convert_args, num_args, cache_type, destructor)
+shall register
+.A converter
+as the procedure that will be called by the Intrinsics
+to convert a resource value from the representation type
+.A from_type
+to the type
+.A to_type
+in the application context
+.A app_context
+of the calling process.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int status1, status2;
+int pid2;
+
+ FORK( pid2 );
+ avs_set_event(1,0);
+ avs_set_event(2,0);
+ avs_xt_hier("Tapsttpec1", "XtAppSetTypeConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT_Proc");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_Proc,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheByDisplay,
+ XtDES_Proc);
+ tet_infoline("TEST: Invoke resource converter XtCVT_Proc");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtConvertAndStore(
+ topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Procedure XtCVT_Proc was invoked");
+ status1 = avs_get_event(1);
+ check_dec(1, status1, "XtCVT_Proc invocation count");
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ XtCloseDisplay(display_good);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When
+.A destructor
+is not NULL
+a successful call to
+void XtAppSetTypeConverter(app_context, from_type, to_type, converter,
+convert_args, num_args, cache_type, destructor)
+shall register
+.A destructor
+as the procedure that shall be called by the Intrinsics functions to
+deallocate the resources produced by the corresponding converter.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int status1, status2;
+int pid2;
+
+ FORK( pid2 );
+ avs_set_event(1,0);
+ avs_set_event(2,0);
+ avs_xt_hier("Tapsttpec1", "XtAppSetTypeConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT_Proc");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_Proc,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheByDisplay,
+ XtDES_Proc);
+ tet_infoline("TEST: Invoke resource converter XtCVT_Proc");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtConvertAndStore(
+ topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Procedure XtCVT_Proc was invoked");
+ status1 = avs_get_event(1);
+ check_dec(1, status1, "XtCVT_Proc invocation count");
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ tet_infoline("TEST: Close display shall invoke destructor");
+ XtCloseDisplay(display_good);
+ status2 = avs_get_event(2);
+ check_dec(1, status2, "destructor invocation count");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When more than one converter is registered for the same
+.A from_type
+and
+.A to_type
+by multiple calls to
+void XtAppSetTypeConverter(app_context, from_type, to_type, converter,
+convert_args, num_args, cache_type, destructor)
+the most recently registered converter shall override the previous ones.
+>>CODE
+ Display *display_good;
+ XrmValue from;
+ XrmValue to_in_out;
+ XtCacheRef cache_ref_return;
+ int status1, status2;
+ pid_t pid2;
+
+ FORK(pid2);
+ avs_set_event(1,0);
+ avs_set_event(2,0);
+ avs_xt_hier("Tapsttpec2", "XtAppSetTypeConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register converter XtCVT_2StringToInt");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_2StringToInt,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheByDisplay,
+ XtDES2_FreeInt);
+ tet_infoline("TEST: Register converter XtCVT_2StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_2StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheByDisplay,
+ XtDES2_FreeChar);
+ tet_infoline("TEST: Invoke recently added converter XtCVT_2StringToChar");
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtConvertAndStore(rowcolw,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Procedure XtCVT_2StringToChar was invoked");
+ status1 = avs_get_event(1);
+ check_dec(1, status1, "XtCVT_2StringToChar invocation count");
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ XtCloseDisplay(XtDisplay(topLevel));
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+On a call to
+void XtAppSetTypeConverter(app_context, from_type, to_type,
+converter, convert_args, num_args, cache_type, destructor)
+when
+.A cache_type
+is XtCacheNone the converter procedure shall be registered such that
+the results of a previous conversion will not be reused for subsequent
+resource requests.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int status1, status2;
+int pid2;
+
+ FORK( pid2 );
+ avs_set_event(1,0);
+ avs_set_event(2,0);
+ avs_xt_hier("Tapsttpec1", "XtAppSetTypeConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT_Proc");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_Proc,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheNone,
+ XtDES_Proc);
+ tet_infoline("TEST: Invoke resource converter XtCVT_Proc");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtConvertAndStore(
+ topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Invoke it again");
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtConvertAndStore(
+ topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Procedure XtCVT_Proc was invoked twice");
+ status1 = avs_get_event(1);
+ check_dec(2, status1, "XtCVT_Proc invocations count");
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ XtCloseDisplay(display_good);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+On a call to
+void XtAppSetTypeConverter(app_context, from_type, to_type,
+converter, convert_args, num_args, cache_type, destructor)
+when
+.A cache_type
+is XtCacheAll the converter procedure shall be registered such that
+the results of a a previous conversion will be reused for subsequent
+resource requests with the same source value and conversion arguments.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int status1, status2;
+int pid2;
+
+ FORK( pid2 );
+ avs_set_event(1,0);
+ avs_set_event(2,0);
+ avs_xt_hier("Tapsttpec1", "XtAppSetTypeConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT_Proc");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_Proc,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheAll,
+ XtDES_Proc);
+ tet_infoline("TEST: Invoke resource converter XtCVT_Proc");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtConvertAndStore(
+ topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Invoke it again");
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtConvertAndStore(
+ topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Procedure XtCVT_Proc was invoked once");
+ status1 = avs_get_event(1);
+ check_dec(1, status1, "XtCVT_Proc invocations count");
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ XtCloseDisplay(display_good);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+On a call to
+void XtAppSetTypeConverter(app_context, from_type, to_type,
+converter, convert_args, num_args, cache_type, destructor)
+when
+.A cache_type
+is XtCacheByDisplay the converter procedure shall be registered such that
+the results of a previous conversion will be reused for subsequent
+resource requests with the same source value and conversion arguments
+until the display connection associated with the converted value is
+closed, at which time the values stored in the cache shall be
+removed and the destructor procedure shall be called.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int status1, status2;
+int pid2;
+
+ FORK( pid2 );
+ avs_set_event(1,0);
+ avs_set_event(2,0);
+ avs_xt_hier("Tapsttpec1", "XtAppSetTypeConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT_Proc");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_Proc,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheByDisplay,
+ XtDES_Proc);
+ tet_infoline("TEST: Invoke resource converter XtCVT_Proc");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtConvertAndStore(
+ topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Invoke it again");
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtConvertAndStore(
+ topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Procedure XtCVT_Proc was invoked once");
+ status1 = avs_get_event(1);
+ check_dec(1, status1, "XtCVT_Proc invocations count");
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ tet_infoline("TEST: Close display shall invoke destructor");
+ XtCloseDisplay(display_good);
+ status2 = avs_get_event(2);
+ check_dec(1, status2, "destructor invocation count");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good B 0
+On a call to
+void XtAppSetTypeConverter(app_context, from_type, to_type,
+converter, convert_args, num_args, cache_type, destructor)
+when XtCacheRefCount and XtCacheAll are set in
+.A cache_type
+the converter procedure shall be
+registered such that a count of every call to XtCreateWidget,
+XtCreateManagedWidget, XtGetApplicationResources
+and XtGetSubresources that use the converted value will be made,
+the count decremented when a widget using the converted
+value is destroyed, the destructor procedure called when the
+count reaches zero, and the converted value removed from the
+conversion cache.
+>>ASSERTION Good B 0
+On a call to
+void XtAppSetTypeConverter(app_context, from_type, to_type,
+converter, convert_args, num_args, cache_type, destructor)
+when XtCacheRefCount and XtCacheByDisplay are set in
+.A cache_type
+the converter procedure shall be
+registered such that a count of every call to XtCreateWidget,
+XtCreateManagedWidget, XtGetApplicationResources
+and XtGetSubresources that use the converted value will be made,
+the count decremented when a widget using the converted
+value is destroyed, the destructor procedure called when the
+count reaches zero, and the converted value removed from the
+conversion cache.
+>>ASSERTION Good A
+When a coverter is registered by a call to
+void XtAppSetTypeConverter(app_context, from_type, to_type,
+converter, convert_args, num_args, cache_type, destructor)
+with the address_mode
+member of an XtConvertArgRec structure in the list pointed to by
+.A convert_args
+set to XtAddress it shall be called by the Intrinsics with the
+data pointed to by the address_id field passed as a conversion
+argument.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int status1, status2;
+int pid2;
+
+ FORK( pid2 );
+ avs_set_event(1,0);
+ avs_set_event(2,0);
+ avs_xt_hier("Tapsttpec1", "XtAppSetTypeConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter");
+ init_args(1);
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_ProcA,
+ (XtConvertArgList)cargs,
+ (Cardinal)NUMARGS,
+ XtCacheByDisplay,
+ XtDES_Proc);
+ tet_infoline("TEST: Invoke conversion");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtConvertAndStore(
+ topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ XtCloseDisplay(display_good);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Converter was invoked");
+ status1 = avs_get_event(1);
+ check_dec(1, status1, "converter invocation count");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When a coverter is registered by a call to
+void XtAppSetTypeConverter(app_context, from_type, to_type,
+converter, convert_args, num_args, cache_type, destructor)
+with the address_mode
+member of an XtConvertArgRec structure pointed to by
+.A convert_args
+set to XtBaseOffset it shall be called by the Intrinsics with the
+data at an offset of address_id from the base of the widget for
+which the converter is invoked passed as a conversion argument.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int status1, status2;
+int pid2;
+
+ FORK( pid2 );
+ avs_set_event(1,0);
+ avs_set_event(2,0);
+ avs_xt_hier("Tapsttpec1", "XtAppSetTypeConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter");
+ init_args(2);
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_ProcA,
+ (XtConvertArgList)cargs,
+ (Cardinal)NUMARGS,
+ XtCacheByDisplay,
+ XtDES_Proc);
+ tet_infoline("TEST: Invoke conversion");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtConvertAndStore(
+ topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ XtCloseDisplay(display_good);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Converter was invoked");
+ status1 = avs_get_event(1);
+ check_dec(1, status1, "converter invocation count");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When a coverter is registered by a call to
+void XtAppSetTypeConverter(app_context, from_type, to_type,
+converter, convert_args, num_args, cache_type, destructor)
+with the address_mode
+member of an XtConvertArgRec structure pointed to by
+.A convert_args
+set to XtImmediate it shall be called by the Intrinsics with
+the data in the address_id field passed as a conversion
+argument.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int status1, status2;
+int pid2;
+
+ FORK( pid2 );
+ avs_set_event(1,0);
+ avs_set_event(2,0);
+ avs_xt_hier("Tapsttpec1", "XtAppSetTypeConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter");
+ init_args(3);
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_ProcA,
+ (XtConvertArgList)cargs,
+ (Cardinal)NUMARGS,
+ XtCacheByDisplay,
+ XtDES_Proc);
+ tet_infoline("TEST: Invoke conversion");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtConvertAndStore(
+ topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ XtCloseDisplay(display_good);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Converter was invoked");
+ status1 = avs_get_event(1);
+ check_dec(1, status1, "converter invocation count");
+ tet_result(TET_PASS);
+>>ASSERTION Good B 0
+When a coverter is registered by a call to
+void XtAppSetTypeConverter(app_context, from_type, to_type,
+converter, convert_args, num_args, cache_type, destructor)
+with the address_mode
+member of an XtConvertArgRec structure pointed to by
+.A convert_args
+set to XtResourceString it shall be called by the Intrinsics with the
+offset of the resource from the base of the widget, in whose context the
+converter is invoked, for the resource string pointed to by address_id
+passed as a conversion argument.
+>>ASSERTION Good B 0
+When a coverter is registered by a call to
+void XtAppSetTypeConverter(app_context, from_type, to_type,
+converter, convert_args, num_args, cache_type, destructor)
+with the address_mode
+member of an XtConvertArgRec structure pointed to by
+.A convert_args
+set to XtResourceQuark it shall be called by the Intrinsics with the
+offset of the resource from the base of the widget, in whose context
+the converter is invoked, for the resource string specified by the
+quark value in the address_id field passed as a conversion argument.
+>>ASSERTION Good A
+When a coverter is registered by a call to
+void XtAppSetTypeConverter(app_context, from_type, to_type,
+converter, convert_args, num_args, cache_type, destructor)
+with the address_mode
+member of an XtConvertArgRec structure pointed to by
+.A convert_args
+set to XtWidgetBaseOffset it shall be called by the Intrinsics with
+the data at an offset of address_id in the closest windowed
+ancestor of the widget in whose context the converter is called,
+when the widget is not of a subclass of Core, passed as a conversion
+argument.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int status1, status2;
+int pid2;
+Widget test_widget;
+
+ FORK( pid2 );
+ avs_set_event(1,0);
+ avs_set_event(2,0);
+ avs_xt_hier("Tapsttpec1", "XtAppSetTypeConverter");
+ tet_infoline("PREP: Create AVS RectObj widget");
+ test_widget = XtVaCreateManagedWidget("avsro", avsrectObjClass, topLevel, NULL);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter");
+ init_args(6);
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_ProcA,
+ (XtConvertArgList)cargs,
+ (Cardinal)NUMARGS,
+ XtCacheByDisplay,
+ XtDES_Proc);
+ tet_infoline("TEST: Invoke conversion");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtConvertAndStore(
+ test_widget,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ XtCloseDisplay(display_good);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Converter was invoked");
+ status1 = avs_get_event(1);
+ check_dec(1, status1, "converter invocation count");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When a coverter is registered by a call to
+void XtAppSetTypeConverter(app_context, from_type, to_type,
+converter, convert_args, num_args, cache_type, destructor)
+with the address_mode
+member of an XtConvertArgRec structure pointed to by
+.A convert_args
+set to XtProcedureArg it shall be called by the Intrinsics with the
+value returned by the function pointed to by the address_id field
+passed as a conversion argument.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int status1, status2;
+int pid2;
+
+ FORK( pid2 );
+ avs_set_event(1,0);
+ avs_set_event(2,0);
+ avs_xt_hier("Tapsttpec1", "XtAppSetTypeConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter");
+ init_args(7);
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_ProcA,
+ (XtConvertArgList)cargs,
+ (Cardinal)NUMARGS,
+ XtCacheByDisplay,
+ XtDES_Proc);
+ tet_infoline("TEST: Invoke conversion");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtConvertAndStore(
+ topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ XtCloseDisplay(display_good);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Converter was invoked");
+ status1 = avs_get_event(1);
+ check_dec(1, status1, "converter invocation count");
+ tet_infoline("TEST: function was invoked");
+ status1 = avs_get_event(2);
+ check_dec(1, status1, "function invocation count");
+ tet_result(TET_PASS);
diff --git a/xts5/Xt11/XtCallConverter/XtCallConverter.m b/xts5/Xt11/XtCallConverter/XtCallConverter.m
new file mode 100644
index 00000000..8b2bccf4
--- /dev/null
+++ b/xts5/Xt11/XtCallConverter/XtCallConverter.m
@@ -0,0 +1,1072 @@
+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/Xt11/XtCallConverter/XtCallConverter.m,v 1.1 2005-02-12 14:37:51 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/Xt11/XtCallConverter/XtCallConverter.m
+>>#
+>># Description:
+>># Tests for XtCallConverter()
+>>#
+>># Modifications:
+>># $Log: tcalcnvtr.m,v $
+>># Revision 1.1 2005-02-12 14:37:51 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:47 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:44 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:50 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:24 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:20:27 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:15:26 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+/*conversion results go here*/
+unsigned char tochar;
+
+XtAppContext app_ctext, app_ctext2;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+pid_t pid2;
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+Boolean status;
+char fromdata[128];
+void init_args()
+{
+pid_t thepid;
+
+ display_good = XtDisplay(topLevel);
+ strcpy(fromdata, "Hello");
+ thepid = getpid();
+ sprintf(&fromdata[strlen(fromdata)], "%d", thepid);
+ from.addr = (XPointer) fromdata;
+ from.size = strlen(from.addr) + 1;
+ to_in_out.size = sizeof(unsigned char);
+ to_in_out.addr = (XtPointer)&tochar;
+ tochar = 0;
+ invoked = 0;
+}
+
+#ifndef XavsRChar
+#define XavsRChar "Char"
+#endif
+Boolean XtCVT1_StringToChar(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValue *args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+ char *str = (char *) (from_val->addr);
+ static unsigned char i;
+ to_val->size = sizeof (unsigned char);
+ to_val->addr = (XPointer) &i;
+ i = *str;
+ avs_set_event(1, avs_get_event(1)+1);
+ return True;
+}
+#define XavsRUnknown "UnknownRes"
+Boolean XtCVT2_StringToChar(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValuePtr args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+ avs_set_event(1, avs_get_event(1)+1);
+ /* Force false value as if conversion failed */
+ return (False);
+}
+Boolean XtCVT3_StringToChar(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValue *args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+
+ return (XtCVT1_StringToChar(display, args, num_args, from_val, to_val, converter_data));
+}
+Boolean XtCVT4_StringToChar(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValue *args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+ return (XtCVT1_StringToChar(display, args, num_args, from_val, to_val, converter_data));
+}
+Boolean XtCVT1a_StringToChar(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValue *args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+ return (XtCVT1_StringToChar(display, args, num_args, from_val, to_val, converter_data));
+}
+Boolean XtCVT2a_StringToChar(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValuePtr args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+ return (XtCVT2_StringToChar(display, args, num_args, from_val, to_val, converter_data));
+}
+Boolean XtCVT3a_StringToChar(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValue *args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+
+ return (XtCVT1_StringToChar(display, args, num_args, from_val, to_val, converter_data));
+}
+Boolean XtCVT4a_StringToChar(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValue *args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+ return (XtCVT1_StringToChar(display, args, num_args, from_val, to_val, converter_data));
+}
+Boolean XtCVT1b_StringToChar(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValue *args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+ return (XtCVT1_StringToChar(display, args, num_args, from_val, to_val, converter_data));
+}
+Boolean XtCVT2b_StringToChar(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValuePtr args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+ return (XtCVT2_StringToChar(display, args, num_args, from_val, to_val, converter_data));
+}
+Boolean XtCVT3b_StringToChar(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValue *args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+
+ return (XtCVT1_StringToChar(display, args, num_args, from_val, to_val, converter_data));
+}
+Boolean XtCVT4b_StringToChar(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValue *args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+ return (XtCVT1_StringToChar(display, args, num_args, from_val, to_val, converter_data));
+}
+Boolean XtCVT1c_StringToChar(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValue *args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+ return (XtCVT1_StringToChar(display, args, num_args, from_val, to_val, converter_data));
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtCallConverter Xt11
+Boolean
+XtCallConverter(display, converter, args, num_args, from, to_in_out, cache_ref_return)
+>>ASSERTION Good A
+When the converter
+.A converter
+has been registered with the conversion cache type specified
+as XtCacheNone
+a call to
+Boolean XtCallConverter(display, converter, conversion_args,
+num_args, from, to_in_out, cache_ref_return)
+shall call the converter, store the converted value returned into
+the location specified by to_in_out->addr, and return what the
+converter returns.
+>>CODE
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcalcnvtr13", "XtCallConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Register resource converter XtCVT1c_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT1c_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheNone|XtCacheRefCount,
+ (XtDestructor)NULL);
+ tet_infoline("TEST: Invoke resource converter XtCVT1c_StringToChar");
+ init_args();
+ status = XtCallConverter(display_good,
+ XtCVT1c_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Return value");
+ check_dec(True, status, "XtCallConverter return value");
+ tet_infoline("TEST: Procedure XtCVT1c_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT1c_StringToChar invoked count");
+ tet_infoline("TEST: Result returned");
+ check_dec((long) 'H', (long) *(unsigned char*)to_in_out.addr, "Character");
+ tet_infoline("TEST: Re-Invoke resource converter with same values");
+ display_good = XtDisplay(topLevel);
+ init_args();
+ status = XtCallConverter(display_good,
+ XtCVT1c_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Return value");
+ check_dec(True, status, "XtCallConverter return value");
+ tet_infoline("TEST: Procedure XtCVT1c_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ check_dec(2, invoked, "XtCVT1c_StringToChar invoked count");
+ tet_infoline("TEST: Result returned");
+ check_dec((long) 'H', (long) *(unsigned char*)to_in_out.addr, "Character");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When the type converter
+.A converter
+has been registered for the application context associated with
+.A display
+with the conversion cache type specified as XtCacheAll and the
+converter has not been previously called with the specified
+arguments a call to
+Boolean XtCallConverter(display, converter, args, num_args,
+from, to_in_out, cache_ref_return)
+shall call the converter, enter the result into the conversion cache,
+store the converted value into the location specified by
+to_in_out->addr, and return what the converter returns.
+>>CODE
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcalcnvtr1", "XtCallConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Register resource converter XtCVT1_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT1_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheAll|XtCacheRefCount,
+ (XtDestructor)NULL);
+ tet_infoline("TEST: Invoke resource converter XtCVT1_StringToChar");
+ init_args();
+ status = XtCallConverter(display_good,
+ XtCVT1_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Return value");
+ check_dec(True, status, "XtCallConverter return value");
+ tet_infoline("TEST: Procedure XtCVT1_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT1_StringToChar invoked count");
+ tet_infoline("TEST: Result returned");
+ check_dec((long) 'H', (long) *(unsigned char*)to_in_out.addr, "Character");
+ tet_infoline("TEST: Re-Invoke resource converter with same values");
+ init_args();
+ status = XtCallConverter(display_good,
+ XtCVT1_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Return value");
+ check_dec(True, status, "XtCallConverter return value");
+ tet_infoline("TEST: Procedure XtCVT1_StringToChar was not invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT1_StringToChar invoked count");
+ tet_infoline("TEST: Result returned");
+ check_dec((long) 'H', (long) *(unsigned char*)to_in_out.addr, "Character");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When the type converter
+.A converter
+has been registered for the application context associated with
+.A display
+with the conversion cache type specified as XtCacheAll, the converter has
+been previously called with the specified arguments, and the conversion
+failed a call to
+Boolean XtCallConverter(display, converter, args, num_args,
+from, to_in_out, cache_ref_return)
+shall return False immediately.
+>>CODE
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcalcnvtr2", "XtCallConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT2_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRUnknown,
+ XtCVT2_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheByDisplay|XtCacheRefCount,
+ (XtDestructor)NULL);
+ tet_infoline("TEST: Invoke resource converter XtCVT2_StringToChar");
+ init_args();
+ status = XtCallConverter(display_good,
+ XtCVT2_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Return value was false");
+ check_dec(False, status, "XtCallConverter return value");
+ tet_infoline("TEST: Convertor was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT2_StringToChar invoked count");
+ tet_infoline("TEST: Re-Invoke resource converter with same values");
+ init_args();
+ status = XtCallConverter(display_good,
+ XtCVT2_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Return value was false");
+ check_dec(False, status, "XtCallConverter return value");
+ tet_infoline("TEST: Convertor was not invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT2_StringToChar invoked count");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When the type converter
+.A converter
+has been registered for the application context associated with
+.A display
+with the conversion cache type specified as XtCacheAll, the converter has
+been previously called with the specified arguments, the conversion
+succeeded, and the size specified by the to_in_out argument is greater
+than or equal to the size stored in the conversion cache a call to
+Boolean XtCallConverter(display, converter, args, num_args,
+from, to_in_out, cache_ref_return)
+shall copy the information stored in the conversion cache into the
+location specified by to_in_out->addr, copy the size specified in the
+conversion cache into to_in_out->size, and return True.
+>>CODE
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcalcnvtr3", "XtCallConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT3_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT3_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheAll|XtCacheRefCount,
+ (XtDestructor)NULL);
+ tet_infoline("TEST: Invoke resource converter XtCVT3_StringToChar");
+ init_args();
+ status = XtCallConverter(display_good,
+ XtCVT3_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Procedure XtCVT3_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT3_StringToChar invoked count");
+ tet_infoline("TEST: Result returned first time");
+ check_dec((long) 'H', (long) *(unsigned char*)to_in_out.addr,
+ "Character");
+ tet_infoline("TEST: Re-invoke with same arguments");
+ init_args();
+ to_in_out.size = sizeof(unsigned char)+1;
+ status = XtCallConverter(display_good,
+ XtCVT3_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Return value");
+ check_dec(True, status, "XtCallConverter return value");
+ tet_infoline("TEST: Convertor was not invoked");
+ invoked = avs_get_event(1);
+ tet_infoline("TEST: Result returned second time");
+ check_dec((long) 'H', (long) *(unsigned char*)to_in_out.addr, "Character");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When the type converter
+.A converter
+has been registered for the application context associated with
+.A display
+with the conversion cache type specified as XtCacheAll, the converter has
+been previously called with the specified arguments, the conversion
+succeeded, and the size specified by the to_in_out argument is less
+than the size stored in the conversion cache a call to
+Boolean XtCallConverter(display, converter, args, num_args,
+from, to_in_out, cache_ref_return)
+shall copy the size specified in the conversion cache into
+to_in_out->size and return False.
+>>CODE
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcalcnvtr4", "XtCallConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT4_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT4_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheAll|XtCacheRefCount,
+ (XtDestructor)NULL);
+ tet_infoline("TEST: Invoke resource converter XtCVT4_StringToChar");
+ init_args();
+ status = XtCallConverter(display_good,
+ XtCVT4_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Procedure XtCVT4_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT4_StringToChar invoked count");
+ tet_infoline("TEST: Result returned first time");
+ check_dec((long) 'H', (long) *(unsigned char*)to_in_out.addr,
+ "Character");
+ tet_infoline("TEST: Re-invoke with short size");
+ init_args();
+ to_in_out.size = 0;
+ status = XtCallConverter(display_good,
+ XtCVT4_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Return value");
+ check_dec(False, status, "XtCallConverter return value");
+ tet_infoline("TEST: Convertor was not invoked");
+ invoked = avs_get_event(1);
+ tet_infoline("TEST: Size returned");
+ check_dec((long)sizeof(unsigned char), (long)to_in_out.size, "to_in_out.size");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When the type converter
+.A converter
+has been registered for the application context associated with
+.A display
+with the conversion cache type specified as XtCacheByDisplay and the
+converter has not been previously called with the specified arguments
+a call to
+Boolean XtCallConverter(display, converter, args, num_args,
+from, to_in_out, cache_ref_return)
+shall call the converter, enter the result into the conversion cache,
+store the converted value into the location specified by
+to_in_out->addr, and return what the converter returns.
+>>CODE
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcalcnvtr9", "XtCallConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Register resource converter XtCVT1b_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT1b_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheByDisplay|XtCacheRefCount,
+ (XtDestructor)NULL);
+ tet_infoline("TEST: Invoke resource converter XtCVT1b_StringToChar");
+ init_args();
+ status = XtCallConverter(display_good,
+ XtCVT1b_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Return value");
+ check_dec(True, status, "XtCallConverter return value");
+ tet_infoline("TEST: Procedure XtCVT1b_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT1b_StringToChar invoked count");
+ tet_infoline("TEST: Result returned");
+ check_dec((long) 'H', (long) *(unsigned char*)to_in_out.addr, "Character");
+ tet_infoline("TEST: Re-Invoke resource converter with same values");
+ init_args();
+ status = XtCallConverter(display_good,
+ XtCVT1b_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Return value");
+ check_dec(True, status, "XtCallConverter return value");
+ tet_infoline("TEST: Procedure XtCVT1b_StringToChar was not invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT1b_StringToChar invoked count");
+ tet_infoline("TEST: Result returned");
+ check_dec((long) 'H', (long) *(unsigned char*)to_in_out.addr, "Character");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+
+>>ASSERTION Good A
+When the type converter
+.A converter
+has been registered for the application context associated with
+.A display
+with the conversion cache type specified as XtCacheByDisplay, the converter
+has been previously called with the specified arguments, and the
+conversion failed a call to
+Boolean XtCallConverter(display, converter, args, num_args,
+from, to_in_out, cache_ref_return)
+shall return False immediately.
+>>CODE
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcalcnvtr10", "XtCallConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT2b_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRUnknown,
+ XtCVT2b_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheByDisplay|XtCacheRefCount,
+ (XtDestructor)NULL);
+ tet_infoline("TEST: Invoke resource converter XtCVT2b_StringToChar");
+ init_args();
+ status = XtCallConverter(display_good,
+ XtCVT2b_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Return value was false");
+ check_dec(False, status, "XtCallConverter return value");
+ tet_infoline("TEST: Convertor was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT2b_StringToChar invoked count");
+ tet_infoline("TEST: Re-Invoke resource converter with same values");
+ init_args();
+ status = XtCallConverter(display_good,
+ XtCVT2b_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Return value was false");
+ check_dec(False, status, "XtCallConverter return value");
+ tet_infoline("TEST: Convertor was not invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT2b_StringToChar invoked count");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When the type converter
+.A converter
+has been registered for the application context associated with
+.A display
+with the conversion cache type specified as XtCacheByDisplay, the converter
+has been previously called with the specified arguments, the conversion
+succeeded, and the size specified by the to_in_out argument is greater
+than or equal to the size stored in the conversion cache a call to
+Boolean XtCallConverter(display, converter, args, num_args,
+from, to_in_out, cache_ref_return)
+shall copy the information stored in the conversion cache into the
+location specified by to_in_out->addr, copy the size specified in the
+conversion cache into to_in_out->size, and return True.
+>>CODE
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcalcnvtr11", "XtCallConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT3b_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT3b_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheByDisplay|XtCacheRefCount,
+ (XtDestructor)NULL);
+ tet_infoline("TEST: Invoke resource converter XtCVT3b_StringToChar");
+ init_args();
+ status = XtCallConverter(display_good,
+ XtCVT3b_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Procedure XtCVT3b_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT3b_StringToChar invoked count");
+ tet_infoline("TEST: Result returned first time");
+ check_dec((long) 'H', (long) *(unsigned char*)to_in_out.addr,
+ "Character");
+ tet_infoline("TEST: Re-invoke with same arguments");
+ init_args();
+ to_in_out.size = sizeof(unsigned char) +1;
+ status = XtCallConverter(display_good,
+ XtCVT3b_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Return value");
+ check_dec(True, status, "XtCallConverter return value");
+ tet_infoline("TEST: Convertor was not invoked");
+ invoked = avs_get_event(1);
+ tet_infoline("TEST: Result returned second time");
+ check_dec((long) 'H', (long) *(unsigned char*)to_in_out.addr, "Character");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When the type converter
+.A converter
+has been registered for the application context associated with
+.A display
+with the conversion cache type specified as XtCacheByDisplay, the
+converter has been previously called with the specified arguments,
+the conversion succeeded, and the size specified by the to_in_out
+argument is less than the size stored in the conversion cache a call to
+Boolean XtCallConverter(display, converter, args, num_args,
+from, to_in_out, cache_ref_return)
+shall copy the size specified in the conversion cache into
+to_in_out->size and return False.
+>>CODE
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcalcnvtr12", "XtCallConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT4b_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT4b_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheByDisplay|XtCacheRefCount,
+ (XtDestructor)NULL);
+ tet_infoline("TEST: Invoke resource converter XtCVT4b_StringToChar");
+ init_args();
+ status = XtCallConverter(display_good,
+ XtCVT4b_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Procedure XtCVT4b_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT4b_StringToChar invoked count");
+ tet_infoline("TEST: Result returned first time");
+ check_dec((long) 'H', (long) *(unsigned char*)to_in_out.addr,
+ "Character");
+ tet_infoline("TEST: Re-invoke with short size");
+ init_args();
+ to_in_out.size = 0;
+ status = XtCallConverter(display_good,
+ XtCVT4b_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Return value");
+ check_dec(False, status, "XtCallConverter return value");
+ tet_infoline("TEST: Convertor was not invoked");
+ invoked = avs_get_event(1);
+ tet_infoline("TEST: Size returned");
+ check_dec((long)sizeof(unsigned char), (long)to_in_out.size, "to_in_out.size");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When the type converter
+.A converter
+has not been registered for the application context associated with
+.A display
+and the converter has not been previously called with the specified
+arguments a call to
+Boolean XtCallConverter(display, converter, args, num_args,
+from, to_in_out, cache_ref_return)
+shall call the converter, enter the result into the conversion cache,
+store the converted value into the location specified by
+to_in_out->addr, and return what the converter returns.
+>>CODE
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcalcnvtr5", "XtCallConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Invoke resource converter XtCVT1a_StringToChar");
+ init_args();
+ status = XtCallConverter(display_good,
+ XtCVT1a_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Return value");
+ check_dec(True, status, "XtCallConverter return value");
+ tet_infoline("TEST: Procedure XtCVT1a_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT1a_StringToChar invoked count");
+ tet_infoline("TEST: Result returned");
+ check_dec((long) 'H', (long) *(unsigned char*)to_in_out.addr, "Character");
+ tet_infoline("TEST: Re-Invoke resource converter with same values");
+ init_args();
+ status = XtCallConverter(display_good,
+ XtCVT1a_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Return value");
+ check_dec(True, status, "XtCallConverter return value");
+ tet_infoline("TEST: Procedure XtCVT1a_StringToChar was not invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT1a_StringToChar invoked count");
+ tet_infoline("TEST: Result returned");
+ check_dec((long) 'H', (long) *(unsigned char*)to_in_out.addr, "Character");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When the type converter
+.A converter
+has not been registered for the application context associated with
+.A display,
+the converter has been previously called with the specified arguments,
+and the conversion failed a call to
+Boolean XtCallConverter(display, converter, args, num_args,
+from, to_in_out, cache_ref_return)
+shall return False immediately.
+>>CODE
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcalcnvtr6", "XtCallConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Invoke resource converter XtCVT2a_StringToChar");
+ init_args();
+ status = XtCallConverter(display_good,
+ XtCVT2a_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Return value was false");
+ check_dec(False, status, "XtCallConverter return value");
+ tet_infoline("TEST: Convertor was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT2a_StringToChar invoked count");
+ tet_infoline("TEST: Re-Invoke resource converter with same values");
+ init_args();
+ status = XtCallConverter(display_good,
+ XtCVT2a_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Return value was false");
+ check_dec(False, status, "XtCallConverter return value");
+ tet_infoline("TEST: Convertor was not invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT2a_StringToChar invoked count");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When the type converter
+.A converter
+has not been registered for the application context associated with
+.A display,
+the converter has been previously called with the specified arguments,
+the conversion succeeded, and the size specified by the to_in_out
+argument is greater than or equal to the size stored in the conversion
+cache a call to
+Boolean XtCallConverter(display, converter, args, num_args,
+from, to_in_out, cache_ref_return)
+shall copy the information stored in the conversion cache into the
+location specified by to_in_out->addr, copy the size specified in the
+conversion cache into to_in_out->size, and return True.
+>>CODE
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcalcnvtr7", "XtCallConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Invoke resource converter XtCVT3a_StringToChar");
+ display_good = XtDisplay(topLevel);
+ init_args();
+ status = XtCallConverter(display_good,
+ XtCVT3a_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Return value");
+ check_dec(True, status, "XtCallConverter return value");
+ tet_infoline("TEST: Procedure XtCVT3a_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT3a_StringToChar invoked count");
+ tet_infoline("TEST: Result returned");
+ check_dec((long) 'H', (long) *(unsigned char*)to_in_out.addr, "Character");
+ tet_infoline("TEST: Re-Invoke resource converter with same values");
+ init_args();
+ to_in_out.size = sizeof(unsigned char) +1;
+ status = XtCallConverter(display_good,
+ XtCVT3a_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Return value");
+ check_dec(True, status, "XtCallConverter return value");
+ tet_infoline("TEST: Procedure XtCVT3a_StringToChar was not invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT3a_StringToChar invoked count");
+ tet_infoline("TEST: Result returned");
+ check_dec((long) 'H', (long) *(unsigned char*)to_in_out.addr, "Character");
+ tet_infoline("TEST: Size returned");
+ check_dec((long)sizeof(unsigned char), (long)to_in_out.size, "to_in_out.size");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When the type converter
+.A converter
+has not been registered for the application context associated with
+.A display,
+the converter has been previously called with the specified arguments,
+the conversion succeeded, and the size specified by the to_in_out
+argument is less than the size stored in the conversion cache
+a call to
+Boolean XtCallConverter(display, converter, args, num_args,
+from, to_in_out, cache_ref_return)
+shall copy the size specified in the conversion cache into
+to_in_out->size and return False.
+>>CODE
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcalcnvtr8", "XtCallConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Invoke resource converter XtCVT4a_StringToChar");
+ init_args();
+ status = XtCallConverter(display_good,
+ XtCVT4a_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Return value");
+ check_dec(True, status, "XtCallConverter return value");
+ tet_infoline("TEST: Procedure XtCVT4a_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT4a_StringToChar invoked count");
+ tet_infoline("TEST: Result returned");
+ check_dec((long) 'H', (long) *(unsigned char*)to_in_out.addr, "Character");
+ tet_infoline("TEST: Re-Invoke resource converter with short size");
+ init_args();
+ to_in_out.size = 0;
+ status = XtCallConverter(display_good,
+ XtCVT4a_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Return value");
+ check_dec(False, status, "XtCallConverter return value");
+ tet_infoline("TEST: Procedure XtCVT4a_StringToChar was not invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT4a_StringToChar invoked count");
+ tet_infoline("TEST: Size returned");
+ check_dec((long)sizeof(unsigned char), (long)to_in_out.size, "to_in_out.size");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good B 1
+When the type converter
+.A converter
+has been registered for the application context associated with
+.A display
+with the cache type set to XtCacheAll and XtCacheRefCount and
+.A cache_ref_return
+is not NULL a call to
+Boolean XtCallConverter(display, converter, args, num_args,
+from, to_in_out, cache_ref_return)
+shall store a conversion cache id into the location specified by
+.A cache_ref_return.
+>>ASSERTION Good B 1
+When the type converter
+.A converter
+has been registered for the application context associated with
+.A display
+with the cache type set to XtCacheByDisplay and XtCacheRefCount and
+.A cache_ref_return
+is not NULL a call to
+Boolean XtCallConverter(display, converter, args, num_args,
+from, to_in_out, cache_ref_return)
+shall store a conversion cache id into the location specified by
+.A cache_ref_return.
diff --git a/xts5/Xt11/XtCallbackReleaseCacheRef/XtCallbackReleaseCacheRef.m b/xts5/Xt11/XtCallbackReleaseCacheRef/XtCallbackReleaseCacheRef.m
new file mode 100644
index 00000000..0d9ef6c9
--- /dev/null
+++ b/xts5/Xt11/XtCallbackReleaseCacheRef/XtCallbackReleaseCacheRef.m
@@ -0,0 +1,151 @@
+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/Xt11/XtCallbackReleaseCacheRef/XtCallbackReleaseCacheRef.m,v 1.1 2005-02-12 14:37:51 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/Xt11/XtCallbackReleaseCacheRef/XtCallbackReleaseCacheRef.m
+>>#
+>># Description:
+>># Tests for XtCallbackReleaseCacheRef()
+>>#
+>># Modifications:
+>># $Log: tcalbkrlc.m,v $
+>># Revision 1.1 2005-02-12 14:37:51 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:48 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:45 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:51 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:25 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:20:29 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:15:29 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+#ifndef XavsRChar
+#define XavsRChar "Char"
+#endif
+
+Boolean XtCVT_StringToChar(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValuePtr args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+ char *str = (char *) (from_val->addr);
+ static unsigned char i;
+ to_val->size = sizeof (unsigned char);
+ to_val->addr = (XtPointer) &i;
+ i = *str;
+ return(True);
+}
+
+void XtDES_Proc(app_ctext, to_val, converter_data, args, num_args )
+XtAppContext app_ctext;
+XrmValue *to_val;
+XtPointer converter_data;
+XrmValuePtr args;
+Cardinal *num_args;
+{
+ avs_set_event(1,avs_get_event(1)+1);
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtCallbackReleaseCacheRef Xt11
+void XtCallbackReleaseCacheRef(object, client_data, call_data)
+>>ASSERTION Good A
+When added to a callback list with
+.A client_data
+specified as an XtCacheRef value and later invoked,
+void XtCallbackReleaseCacheRef(object, client_data, call_data)
+shall decrement the reference count for the conversion entry
+specified by
+.A client_data.
+>>CODE
+Display *display_good;
+XrmValue from, from_val;
+XrmValue to_in_out;
+XrmValue to_return;
+XtCacheRef cache_ref_return;
+Boolean status;
+pid_t pid2;
+unsigned char tchar;
+
+ FORK(pid2);
+ avs_xt_hier("Tcalbkrlc1", "XtCallbackReleaseCacheRef");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Register resource converter XtCVT_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheAll|XtCacheRefCount,
+ XtDES_Proc);
+ tet_infoline("PREP: Invoke converter XtCVT_StringToChar and cache resources");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer)"Hello";
+ from.size = sizeof(unsigned char);
+ to_in_out.size = sizeof(unsigned char);
+ to_in_out.addr = (XtPointer)&tchar;
+ status = XtCallConverter(display_good,
+ XtCVT_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: Invoke XtCallbackReleaseCacheRef callback");
+ XtAddCallback(topLevel, XtNdestroyCallback, XtCallbackReleaseCacheRef, (XtPointer)cache_ref_return);
+ XtCallCallbacks(topLevel, XtNdestroyCallback, (XtPointer)NULL);
+ tet_infoline("TEST: Destructor was called");
+ status = avs_get_event(1);
+ check_dec(1, status, "destructor invocation count");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
diff --git a/xts5/Xt11/XtCallbackReleaseCacheRefList/XtCallbackReleaseCacheRefList.m b/xts5/Xt11/XtCallbackReleaseCacheRefList/XtCallbackReleaseCacheRefList.m
new file mode 100644
index 00000000..40215bb8
--- /dev/null
+++ b/xts5/Xt11/XtCallbackReleaseCacheRefList/XtCallbackReleaseCacheRefList.m
@@ -0,0 +1,166 @@
+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/Xt11/XtCallbackReleaseCacheRefList/XtCallbackReleaseCacheRefList.m,v 1.1 2005-02-12 14:37:51 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/Xt11/XtCallbackReleaseCacheRefList/XtCallbackReleaseCacheRefList.m
+>>#
+>># Description:
+>># Tests for XtCallbackReleaseCacheRefList()
+>>#
+>># Modifications:
+>># $Log: tcalbrcrl.m,v $
+>># Revision 1.1 2005-02-12 14:37:51 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:48 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:45 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:51 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:25 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:20:30 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:15:31 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+#ifndef XavsRChar
+#define XavsRChar "Char"
+#endif
+
+Boolean XtCVT_StringToChar(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValuePtr args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+ char *str = (char *) (from_val->addr);
+ static unsigned char i;
+ if (!to_val->addr) {
+ to_val->size = sizeof (unsigned char);
+ to_val->addr = (XtPointer) &i;
+ }
+ if (to_val->size < sizeof(unsigned char))
+ return False;
+ *((unsigned char *)to_val->addr) = (unsigned char) *str;
+ return True;
+}
+
+void XtDES_Proc(app_ctext, to_val, converter_data, args, num_args )
+XtAppContext app_ctext;
+XrmValue *to_val;
+XtPointer converter_data;
+XrmValuePtr args;
+Cardinal *num_args;
+{
+ avs_set_event(1,avs_get_event(1)+1);
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtCallbackReleaseCacheRefList Xt11
+void
+XtCallbackReleaseCacheRefList(object, client_data, call_data)
+>>ASSERTION Good A
+When added to a callback list with
+.A client_data
+specified as a pointer to a NULL-terminated list of XtCacheRef values
+and later invoked,
+void XtCallbackReleaseCacheRefList(object, client_data, call_data)
+shall decrement the reference counts for the conversion entries
+specified by
+.A client_data.
+>>CODE
+Display *display_good;
+XrmValue from, from_val;
+XrmValue to_in_out;
+XrmValue to_return;
+XtCacheRef cache_ref_return[3], cache_ref;
+Boolean status;
+XtPointer client_data;
+pid_t pid2;
+unsigned char tchar;
+
+ FORK(pid2);
+ avs_xt_hier("Tcalbrcrl1", "XtCallbackReleaseCacheRefList");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Register resource converter");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheRefCount,
+ XtDES_Proc);
+ tet_infoline("PREP: Invoke converter twice to cache resources");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer)"Hello";
+ from.size = strlen(from.addr) + 1;
+ to_in_out.size = sizeof(unsigned char);
+ to_in_out.addr = (XtPointer)&tchar;
+ status = XtCallConverter(display_good,
+ XtCVT_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return[0]
+ );
+ status = XtCallConverter(display_good,
+ XtCVT_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return[1]
+ );
+ cache_ref_return[2] = (XtCacheRef) NULL;
+ tet_infoline("TEST: Invoke XtCallbackReleaseCacheRefList callback");
+ XtAddCallback(topLevel, XtNdestroyCallback, XtCallbackReleaseCacheRefList, (XtPointer)cache_ref_return);
+ XtCallCallbacks(topLevel, XtNdestroyCallback, (XtPointer)NULL);
+ tet_infoline("TEST: Destructor is invoked once");
+ check_dec(1, status, "destructor invocation count");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
diff --git a/xts5/Xt11/XtConvertAndStore/XtConvertAndStore.m b/xts5/Xt11/XtConvertAndStore/XtConvertAndStore.m
new file mode 100644
index 00000000..a8bd4c5d
--- /dev/null
+++ b/xts5/Xt11/XtConvertAndStore/XtConvertAndStore.m
@@ -0,0 +1,1182 @@
+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/Xt11/XtConvertAndStore/XtConvertAndStore.m,v 1.1 2005-02-12 14:37:51 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/Xt11/XtConvertAndStore/XtConvertAndStore.m
+>>#
+>># Description:
+>># Tests for XtConvertAndStore()
+>>#
+>># Modifications:
+>># $Log: tcnvrtast.m,v $
+>># Revision 1.1 2005-02-12 14:37:51 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:49 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:46 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:52 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:26 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:20:32 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:15:33 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+unsigned char tchar[2] = {0,0};
+
+#ifndef XavsRChar
+#define XavsRChar "Char"
+#endif
+Boolean XtCVT_StringToChar(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValuePtr args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+ char *str = (char *) (from_val->addr);
+ static unsigned char i;
+ to_val->size = sizeof (unsigned char);
+ to_val->addr = (XtPointer) &i;
+ i = *str;
+ avs_set_event(1, avs_get_event(1)+1);
+ return True;
+}
+Boolean XtCVT2_StringToChar(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValuePtr args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+ avs_set_event(1, avs_get_event(1)+1);
+ return False;
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtConvertAndStore Xt11
+Boolean
+XtConvertAndStore(object, from_type, from, to_type, to_in_out )
+>>ASSERTION Good A
+When a converter has been registered for a conversion from
+.A from_type
+to
+.A to_type
+for the application context associated with
+.A object
+with the conversion cache type specified as XtCacheNone
+a successful call to
+Boolean XtConvertAndStore(object, from_type, from, to_type, to_in_out)
+shall compute the additional arguments needed, call the converter,
+store the converted value returned into the location specified by
+to_in_out->addr, and return True.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+int status;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcnvrtast1", "XtConvertAndStore");
+ (void) ConfigureDimension(topLevel, boxw2);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheNone,
+ (XtDestructor)NULL);
+ tet_infoline("TEST: Call XtConvertAnd Store to invoke resource converter");
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ to_in_out.addr = (XtPointer) tchar;
+ to_in_out.size = sizeof(unsigned char);
+ status = XtConvertAndStore(topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Return status");
+ check_dec(True, status, "return value");
+ tet_infoline("TEST: XtCVT_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT_StringToChar invoked status");
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When a converter has been registered for a conversion from
+.A from_type
+to
+.A to_type
+for the application context associated with
+.A object
+with the conversion cache type specified as XtCacheNone
+a call to
+Boolean XtConvertAndStore(object, from_type, from, to_type, to_in_out)
+shall not reuse the results of a previous conversion.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+int status;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcnvrtast1", "XtConvertAndStore");
+ (void) ConfigureDimension(topLevel, boxw2);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheNone,
+ (XtDestructor)NULL);
+ tet_infoline("TEST: Call XtConvertAnd Store to invoke resource converter");
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ to_in_out.addr = (XtPointer) tchar;
+ to_in_out.size = sizeof(unsigned char);
+ status = XtConvertAndStore(topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Return status");
+ check_dec(True, status, "return value");
+ tet_infoline("TEST: XtCVT_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT_StringToChar invoked status");
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ tet_infoline("TEST: Call XtConvertAnd Store again");
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ to_in_out.addr = (XtPointer) tchar;
+ to_in_out.size = sizeof(unsigned char);
+ status = XtConvertAndStore(topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Return status");
+ check_dec(True, status, "return value");
+ tet_infoline("TEST: XtCVT_StringToChar was invoked again");
+ invoked = avs_get_event(1);
+ check_dec(2, invoked, "XtCVT_StringToChar invocation count");
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When a converter has been registered for a conversion from
+.A from_type
+to
+.A to_type
+for the application context associated with
+.A object
+with the conversion cache type specified as XtCacheNone
+a call to
+Boolean XtConvertAndStore(object, from_type, from, to_type, to_in_out)
+shall return False if the conversion fails.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+int status;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcnvrtast2", "XtConvertAndStore");
+ (void) ConfigureDimension(topLevel, boxw2);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT2_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT2_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheNone,
+ (XtDestructor)NULL);
+ tet_infoline("TEST: Call XtConvertAnd Store to invoke resource converter");
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ status = XtConvertAndStore(topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Return status");
+ check_dec(False, status, "return value");
+ tet_infoline("TEST: XtCVT2_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT_StringToChar invocation count");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When a converter has been registered for a conversion from
+.A from_type
+to
+.A to_type
+for the application context associated with
+.A object
+with conversion cache type specified as XtCacheAll and the converter has
+not been previously called with the specified arguments a call to
+Boolean XtConvertAndStore(object, from_type, from, to_type, to_in_out)
+shall compute the additional arguments needed, call the converter, enter
+the result into the conversion cache, store the converted value into
+the location specified by to_in_out->addr, and return True.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+int status;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcnvrtast1", "XtConvertAndStore");
+ (void) ConfigureDimension(topLevel, boxw2);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheAll,
+ (XtDestructor)NULL);
+ tet_infoline("TEST: Call XtConvertAnd Store to invoke resource converter");
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ to_in_out.addr = (XtPointer) tchar;
+ to_in_out.size = sizeof(unsigned char);
+ status = XtConvertAndStore(topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Return status");
+ check_dec(True, status, "return value");
+ tet_infoline("TEST: XtCVT_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT_StringToChar invoked status");
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When a converter has been registered for a conversion from
+.A from_type
+to
+.A to_type
+for the application context associated with
+.A object
+with conversion cache type specified as XtCacheAll and the converter has
+been previously called with the specified arguments a call to
+Boolean XtConvertAndStore(object, from_type, from, to_type, to_in_out)
+shall reuse the results of the previous conversion.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+int status;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcnvrtast1", "XtConvertAndStore");
+ (void) ConfigureDimension(topLevel, boxw2);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheAll,
+ (XtDestructor)NULL);
+ tet_infoline("TEST: Call XtConvertAnd Store to invoke resource converter");
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ to_in_out.addr = (XtPointer) tchar;
+ to_in_out.size = sizeof(unsigned char);
+ status = XtConvertAndStore(topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Return status");
+ check_dec(True, status, "return value");
+ tet_infoline("TEST: XtCVT_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT_StringToChar invoked status");
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ tet_infoline("TEST: Invoke resource converter again");
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ to_in_out.addr = (XtPointer) tchar;
+ to_in_out.size = sizeof(unsigned char);
+ status = XtConvertAndStore(topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Return status");
+ check_dec(True, status, "return value");
+ tet_infoline("TEST: XtCVT_StringToChar was not invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT_StringToChar invoked status");
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When a converter has been registered for a conversion from
+.A from_type
+to
+.A to_type
+for the application context associated with
+.A object
+with conversion cache type specified as XtCacheAll and the converter has
+not been previously called with the specified arguments a call to
+Boolean XtConvertAndStore(object, from_type, from, to_type, to_in_out)
+shall return False if the conversion fails.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+int status;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcnvrtast2", "XtConvertAndStore");
+ (void) ConfigureDimension(topLevel, boxw2);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT2_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT2_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheAll|XtCacheRefCount,
+ (XtDestructor)NULL);
+ tet_infoline("TEST: Call XtConvertAnd Store to invoke resource converter");
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ status = XtConvertAndStore(topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Return status");
+ check_dec(False, status, "return value");
+ tet_infoline("TEST: XtCVT2_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT_StringToChar invocation count");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When a converter has been registered for a conversion from
+.A from_type
+to
+.A to_type
+for the application context associated with
+.A object
+with conversion cache type specified as XtCacheAll, the converter has
+been previously called with the specified arguments, and the conversion
+failed a call to
+Boolean XtConvertAndStore(object, from_type, from, to_type, to_in_out)
+shall not perform the conversion and shall return False.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+int status;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcnvrtast2", "XtConvertAndStore");
+ (void) ConfigureDimension(topLevel, boxw2);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT2_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT2_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheAll|XtCacheRefCount,
+ (XtDestructor)NULL);
+ tet_infoline("TEST: Call XtConvertAnd Store to invoke resource converter");
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ status = XtConvertAndStore(topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Return status");
+ check_dec(False, status, "return value");
+ tet_infoline("TEST: XtCVT2_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT_StringToChar invocation count");
+ tet_infoline("TEST: Invoke resource converter again");
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ status = XtConvertAndStore(topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Return status");
+ check_dec(False, status, "return value");
+ tet_infoline("TEST: XtCVT2_StringToChar was not invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT_StringToChar invocation count");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When a converter has been registered for a conversion from
+.A from_type
+to
+.A to_type
+for the application context associated with
+.A object
+with conversion cache type specified as XtCacheAll, the converter has
+been previously called with the specified arguments, the conversion
+succeeded, and the size specified by
+.A to_in_out
+is greater
+than or equal to the size stored in the conversion cache a call to
+Boolean XtConvertAndStore(object, from_type, from, to_type, to_in_out)
+shall copy the information stored in the conversion cache into the
+location specified by to_in_out->addr, copy the size specified in the
+conversion cache into to_in_out->size, and return True.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+int status;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcnvrtast1", "XtConvertAndStore");
+ (void) ConfigureDimension(topLevel, boxw2);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheAll,
+ (XtDestructor)NULL);
+ tet_infoline("TEST: Call XtConvertAnd Store to invoke resource converter");
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ to_in_out.addr = (XtPointer) tchar;
+ to_in_out.size = sizeof(unsigned char);
+ status = XtConvertAndStore(topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Return status");
+ check_dec(True, status, "return value");
+ tet_infoline("TEST: XtCVT_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT_StringToChar invoked status");
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ tet_infoline("TEST: Call XtConvertAnd Store again with larger size");
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ to_in_out.addr = (XtPointer) tchar;
+ to_in_out.size = sizeof(unsigned char)+1;
+ status = XtConvertAndStore(topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Return status");
+ check_dec(True, status, "return value");
+ tet_infoline("TEST: XtCVT_StringToChar was invoked again");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT_StringToChar invocation count");
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ tet_infoline("TEST: Size returned");
+ check_dec((long)sizeof(unsigned char), (long)to_in_out.size, "to_in_out.size");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When a converter has been registered for a conversion from
+.A from_type
+to
+.A to_type
+for the application context associated with
+.A object
+with conversion cache type specified as XtCacheAll, the converter has
+been previously called with the specified arguments, the conversion
+succeeded, and the size specified by the to_in_out argument is less
+than the size stored in the conversion cache a call to
+Boolean XtCallConverter(display, converter, args, num_args, from, to_in_out, cache_ref_return)
+shall copy the size specified in the conversion cache into
+to_in_out->size and shall return False.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+int status;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcnvrtast1", "XtConvertAndStore");
+ (void) ConfigureDimension(topLevel, boxw2);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheAll,
+ (XtDestructor)NULL);
+ tet_infoline("TEST: Call XtConvertAnd Store to invoke resource converter");
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ to_in_out.addr = (XtPointer) tchar;
+ to_in_out.size = sizeof(unsigned char);
+ status = XtConvertAndStore(topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Return status");
+ check_dec(True, status, "return value");
+ tet_infoline("TEST: XtCVT_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT_StringToChar invoked status");
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ tet_infoline("TEST: Call XtConvertAnd Store again with short size");
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ to_in_out.addr = (XtPointer) tchar;
+ to_in_out.size = sizeof(unsigned char)-1;
+ status = XtConvertAndStore(topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Return status");
+ check_dec(False, status, "return value");
+ tet_infoline("TEST: XtCVT_StringToChar was not invoked again");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT_StringToChar invocation count");
+ tet_infoline("TEST: Size returned");
+ check_dec((long)sizeof(unsigned char), (long)to_in_out.size, "to_in_out.size");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When a converter has been registered for a conversion from
+.A from_type
+to
+.A to_type
+for the application context associated with
+.A object
+with conversion cache type specified as XtCacheByDisplay and the
+converter has not been previously called with the specified arguments
+a call to
+Boolean XtConvertAndStore(object, from_type, from, to_type, to_in_out)
+shall compute the additional arguments, call the converter, enter
+the result into the conversion cache, store the converted value
+into the location specified by to_in_out->addr, and return True.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+int status;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcnvrtast1", "XtConvertAndStore");
+ (void) ConfigureDimension(topLevel, boxw2);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheByDisplay,
+ (XtDestructor)NULL);
+ tet_infoline("TEST: Call XtConvertAnd Store to invoke resource converter");
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ to_in_out.addr = (XtPointer) tchar;
+ to_in_out.size = sizeof(unsigned char);
+ status = XtConvertAndStore(topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Return status");
+ check_dec(True, status, "return value");
+ tet_infoline("TEST: XtCVT_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT_StringToChar invoked status");
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When a converter has been registered for a conversion from
+.A from_type
+to
+.A to_type
+for the application context associated with
+.A object
+with conversion cache type specified as XtCacheByDisplay and the
+converter has been previously called with the specified arguments
+a call to
+Boolean XtConvertAndStore(object, from_type, from, to_type, to_in_out)
+shall reuse the the previous conversion.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+int status;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcnvrtast1", "XtConvertAndStore");
+ (void) ConfigureDimension(topLevel, boxw2);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheByDisplay,
+ (XtDestructor)NULL);
+ tet_infoline("TEST: Call XtConvertAnd Store to invoke resource converter");
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ to_in_out.addr = (XtPointer) tchar;
+ to_in_out.size = sizeof(unsigned char);
+ status = XtConvertAndStore(topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Return status");
+ check_dec(True, status, "return value");
+ tet_infoline("TEST: XtCVT_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT_StringToChar invoked status");
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ tet_infoline("TEST: Invoke resource conversion again");
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ to_in_out.addr = (XtPointer) tchar;
+ to_in_out.size = sizeof(unsigned char);
+ status = XtConvertAndStore(topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Return status");
+ check_dec(True, status, "return value");
+ tet_infoline("TEST: XtCVT_StringToChar was not invoked again");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT_StringToChar invoked status");
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When a converter has been registered for a conversion from
+.A from_type
+to
+.A to_type
+for the application context associated with
+.A object
+with conversion cache type specified as XtCacheByDisplay and the
+converter has not been previously called with the specified arguments
+a call to
+Boolean XtConvertAndStore(object, from_type, from, to_type, to_in_out)
+shall return False if the conversion fails.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+int status;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcnvrtast2", "XtConvertAndStore");
+ (void) ConfigureDimension(topLevel, boxw2);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT2_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT2_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheByDisplay|XtCacheRefCount,
+ (XtDestructor)NULL);
+ tet_infoline("TEST: Call XtConvertAnd Store to invoke resource converter");
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ status = XtConvertAndStore(topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Return status");
+ check_dec(False, status, "return value");
+ tet_infoline("TEST: XtCVT2_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT_StringToChar invocation count");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When a converter has been registered for a conversion from
+.A from_type
+to
+.A to_type
+for the application context associated with
+.A object
+with conversion cache type specified as XtCacheByDisplay, the converter
+has been previously called with the specified arguments, and the
+conversion failed a call to
+Boolean XtConvertAndStore(object, from_type, from, to_type, to_in_out)
+shall not perform the conversion and shall return False.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+int status;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcnvrtast2", "XtConvertAndStore");
+ (void) ConfigureDimension(topLevel, boxw2);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT2_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT2_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheByDisplay|XtCacheRefCount,
+ (XtDestructor)NULL);
+ tet_infoline("TEST: Call XtConvertAnd Store to invoke resource converter");
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ status = XtConvertAndStore(topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Return status");
+ check_dec(False, status, "return value");
+ tet_infoline("TEST: XtCVT2_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT_StringToChar invocation count");
+ tet_infoline("TEST: Call XtConvertAnd Store again");
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ status = XtConvertAndStore(topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Return status");
+ check_dec(False, status, "return value");
+ tet_infoline("TEST: XtCVT2_StringToChar was not invoked again");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT_StringToChar invocation count");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When a converter has been registered for a conversion from
+.A from_type
+to
+.A to_type
+for the application context associated with
+.A object
+with conversion cache type specified as XtCacheByDisplay, the converter
+has been previously called with the specified arguments, the conversion
+succeeded, and the size specified by the to_in_out argument is greater
+than or equal to the size stored in the conversion cache a call to
+Boolean XtConvertAndStore(object, from_type, from, to_type, to_in_out)
+shall copy the information stored in the conversion cache into the
+location specified by to_in_out->addr, copy the size specified in the
+conversion cache into to_in_out->size, and return True.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+int status;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcnvrtast1", "XtConvertAndStore");
+ (void) ConfigureDimension(topLevel, boxw2);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheByDisplay,
+ (XtDestructor)NULL);
+ tet_infoline("TEST: Call XtConvertAnd Store to invoke resource converter");
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ to_in_out.addr = (XtPointer) tchar;
+ to_in_out.size = sizeof(unsigned char);
+ status = XtConvertAndStore(topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Return status");
+ check_dec(True, status, "return value");
+ tet_infoline("TEST: XtCVT_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT_StringToChar invoked status");
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ tet_infoline("TEST: Call XtConvertAnd Store again with larger size");
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ to_in_out.addr = (XtPointer) tchar;
+ to_in_out.size = sizeof(unsigned char)+1;
+ status = XtConvertAndStore(topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Return status");
+ check_dec(True, status, "return value");
+ tet_infoline("TEST: XtCVT_StringToChar was not invoked again");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT_StringToChar invocation count");
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ tet_infoline("TEST: Size returned");
+ check_dec((long)sizeof(unsigned char), (long)to_in_out.size, "to_in_out.size");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When a converter has been registered for a conversion from
+.A from_type
+to
+.A to_type
+for the application context associated with
+.A object
+with conversion cache type specified as XtCacheByDisplay, the converter
+has been previously called with the specified arguments, the conversion
+succeeded, and the size specified by the to_in_out argument is less
+than the size stored in the conversion cache a call to
+Boolean XtConvertAndStore(object, from_type, from, to_type, to_in_out)
+shall copy the size specified in the conversion cache into to_in_out->size
+and shall return False.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+int status;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcnvrtast1", "XtConvertAndStore");
+ (void) ConfigureDimension(topLevel, boxw2);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheByDisplay,
+ (XtDestructor)NULL);
+ tet_infoline("TEST: Call XtConvertAnd Store to invoke resource converter");
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ to_in_out.addr = (XtPointer) tchar;
+ to_in_out.size = sizeof(unsigned char);
+ status = XtConvertAndStore(topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Return status");
+ check_dec(True, status, "return value");
+ tet_infoline("TEST: XtCVT_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT_StringToChar invoked status");
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ tet_infoline("TEST: Call XtConvertAnd Store again with shorter size");
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ to_in_out.addr = (XtPointer) tchar;
+ to_in_out.size = sizeof(unsigned char)-1;
+ status = XtConvertAndStore(topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Return status");
+ check_dec(False, status, "return value");
+ tet_infoline("TEST: XtCVT_StringToChar was not invoked again");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtCVT_StringToChar invocation count");
+ tet_infoline("TEST: Size returned");
+ check_dec((long)sizeof(unsigned char), (long)to_in_out.size, "to_in_out.size");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+Boolean XtConvertAndStore(object, from_type, from, to_type, to_in_out)
+when to_in_out.addr is NULL shall replace it with a pointer to a
+private storage in which the conversion results are stored and return
+the size in to_in_out->size.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+int status;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcnvrtast4", "XtConvertAndStore");
+ (void) ConfigureDimension(topLevel, boxw2);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Register resource converter XtCVT_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheAll|XtCacheRefCount,
+ (XtDestructor)NULL);
+ tet_infoline("TEST: Call XtConvertAnd Store to invoke resource converter");
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ tchar[0] = 0;
+ to_in_out.addr = NULL;
+ to_in_out.size = 0;
+ status = XtConvertAndStore(topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Return status");
+ check_dec(True, status, "return value");
+ tet_infoline("TEST: Result returned");
+ if (to_in_out.addr == NULL) {
+ tet_infoline("ERROR: to_in_out.addr remained NULL");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ tet_infoline("TEST: Size returned");
+ check_dec(sizeof(unsigned char), to_in_out.size, "size");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good B 1
+When a converter has been registered for a conversion from
+.A from_type
+to
+.A to_type
+for the application context associated with
+.A object
+with the cache type set to XtCacheRefCount and XtCacheAll or
+XtCacheByDisplay and a XtCacheRef value is returned from the
+converter on a call to
+Boolean XtConvertAndStore(object, from_type, from, to_type, to_in_out)
+the XtCallbackReleaseCacheRef function shall be added to the
+destroyCallback list of the specified object.
+>>ASSERTION Good B 2
+The behavior of a call to
+Boolean XtConvertAndStore(object, from_type, from, to_type, to_in_out)
+when
+.A object
+is not of class Object or any subclass thereof.
diff --git a/xts5/Xt11/XtCvtColorToPixel/XtCvtColorToPixel.m b/xts5/Xt11/XtCvtColorToPixel/XtCvtColorToPixel.m
new file mode 100644
index 00000000..2b7211cb
--- /dev/null
+++ b/xts5/Xt11/XtCvtColorToPixel/XtCvtColorToPixel.m
@@ -0,0 +1,332 @@
+Copyright (c) 2005 X.Org Foundation LLC
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+$Header: /cvs/xtest/xtest/xts5/tset/Xt11/XtCvtColorToPixel/XtCvtColorToPixel.m,v 1.1 2005-02-12 14:37:51 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/Xt11/XtCvtColorToPixel/XtCvtColorToPixel.m
+>>#
+>># Description:
+>># Tests for XtCvtColorToPixel()
+>>#
+>># Modifications:
+>># $Log: tccolpix.m,v $
+>># Revision 1.1 2005-02-12 14:37:51 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:37 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:34 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:41 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:16 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:20:01 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:53 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+>>TITLE XtCvtColorToPixel Xt11
+Boolean
+XtCvtColorToPixel(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtColorToPixel(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRPixel type shall convert the XtRColor value specified in
+.A from
+to an XtRPixel type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+/* Conversion arguments and results */
+#if XT_X_RELEASE > 4
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Color to Pixel specific */
+Screen *screen;
+Colormap colormap;
+int colnum = 0;
+XColor color;
+Pixel res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tccolpix1", "XtCvtColorToPixel");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Get a valid Color");
+ screen = DefaultScreenOfDisplay(display);
+ args[0].addr = (XtPointer )&screen;
+ args[0].size = sizeof(Screen*);
+ colormap = DefaultColormapOfScreen(screen);
+ args[1].addr = (XtPointer) &colormap;
+ args[1].size = sizeof(Colormap);
+ num_args = 2;
+ fromVal.addr = (XtPointer) &colnum;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &color;
+ toVal.size = sizeof(XColor);
+ status = XtCvtIntToColor(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ if (!status) {
+ sprintf(ebuf, "ERROR: Could not get a Color");
+ tet_infoline(ebuf);
+ tet_result(TET_UNRESOLVED);
+ exit(0);
+ }
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = (XtPointer) &color;
+ fromVal.size = sizeof(XColor);
+ toVal.addr = (XtPointer) &res;
+ toVal.size = sizeof(Pixel);
+ status = XtCvtColorToPixel(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtColorToPixel return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtColorToPixel(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRPixel type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Color to Pixel specific */
+Screen *screen;
+Colormap colormap;
+int colnum = 0;
+XColor color;
+Pixel res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tccolpix3", "XtCvtColorToPixel");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Get a valid Color");
+ screen = DefaultScreenOfDisplay(display);
+ args[0].addr = (XtPointer )&screen;
+ args[0].size = sizeof(Screen*);
+ colormap = DefaultColormapOfScreen(screen);
+ args[1].addr = (XtPointer) &colormap;
+ args[1].size = sizeof(Colormap);
+ num_args = 2;
+ fromVal.addr = (XtPointer) &colnum;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &color;
+ toVal.size = sizeof(XColor);
+ status = XtCvtIntToColor(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ if (!status) {
+ sprintf(ebuf, "ERROR: Could not get a Color");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = (XtPointer) &color;
+ fromVal.size = sizeof(XColor);
+ toVal.addr = (XtPointer) &res;
+ toVal.size = 0;
+ status = XtCvtColorToPixel(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtColorToPixel return valueconversion status");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(Pixel)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Pixel), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtColorToPixel(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the XtRColor value specified in
+.A from
+to an XtRPixel type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Color to Pixel specific */
+Screen *screen;
+Colormap colormap;
+int colnum = 0;
+XColor color;
+Pixel res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tccolpix2", "XtCvtColorToPixel");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Get a valid Color");
+ screen = DefaultScreenOfDisplay(display);
+ args[0].addr = (XtPointer )&screen;
+ args[0].size = sizeof(Screen*);
+ colormap = DefaultColormapOfScreen(screen);
+ args[1].addr = (XtPointer) &colormap;
+ args[1].size = sizeof(Colormap);
+ num_args = 2;
+ fromVal.addr = (XtPointer) &colnum;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &color;
+ toVal.size = sizeof(XColor);
+ status = XtCvtIntToColor(display, &args[0], &num_args, &fromVal, &toVal, closure_ret);
+ if (!status) {
+ sprintf(ebuf, "ERROR: Could not get a Color");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = (XtPointer) &color;
+ fromVal.size = sizeof(XColor);
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtColorToPixel(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtColorToPixel return valueconversion status");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(Pixel)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Pixel), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtIntToBool/XtCvtIntToBool.m b/xts5/Xt11/XtCvtIntToBool/XtCvtIntToBool.m
new file mode 100644
index 00000000..153d3edb
--- /dev/null
+++ b/xts5/Xt11/XtCvtIntToBool/XtCvtIntToBool.m
@@ -0,0 +1,258 @@
+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/Xt11/XtCvtIntToBool/XtCvtIntToBool.m,v 1.1 2005-02-12 14:37:51 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/Xt11/XtCvtIntToBool/XtCvtIntToBool.m
+>>#
+>># Description:
+>># Tests for XtCvtIntToBool()
+>>#
+>># Modifications:
+>># $Log: tcinbool.m,v $
+>># Revision 1.1 2005-02-12 14:37:51 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:38 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:34 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:41 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:16 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:20:03 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:55 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+>>TITLE XtCvtIntToBool Xt11
+Boolean
+XtCvtIntToBool(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtIntToBool(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRBool type shall convert the XtRInt value specified in
+.A from
+to an XtRBool type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to Bool specific */
+int num = 7;
+Bool res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln1", "XtCvtIntToBool");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &res;
+ toVal.size = sizeof(Bool);
+ status = XtCvtIntToBool(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtIntToBool return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtIntToBool(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRBool type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to Bool specific */
+int num = 1;
+Bool res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboon3", "XtCvtIntToBool");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &res;
+ toVal.size = 0;
+ status = XtCvtIntToBool(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtIntToBool return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(Bool)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Bool), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtIntToBool(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the XtRInt value specified in
+.A from
+to an XtRBool type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to Bool specific */
+int num = 1;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln2", "XtCvtIntToBool");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtIntToBool(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtIntToBool return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(Bool)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Bool), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtIntToBoolean/XtCvtIntToBoolean.m b/xts5/Xt11/XtCvtIntToBoolean/XtCvtIntToBoolean.m
new file mode 100644
index 00000000..c0d9106a
--- /dev/null
+++ b/xts5/Xt11/XtCvtIntToBoolean/XtCvtIntToBoolean.m
@@ -0,0 +1,258 @@
+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/Xt11/XtCvtIntToBoolean/XtCvtIntToBoolean.m,v 1.1 2005-02-12 14:37:51 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/Xt11/XtCvtIntToBoolean/XtCvtIntToBoolean.m
+>>#
+>># Description:
+>># Tests for XtCvtIntToBoolean()
+>>#
+>># Modifications:
+>># $Log: tcinboln.m,v $
+>># Revision 1.1 2005-02-12 14:37:51 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:37 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:33 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:40 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:15 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:20:00 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:51 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+>>TITLE XtCvtIntToBoolean Xt11
+Boolean
+XtCvtIntToBoolean(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtIntToBoolean(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRBoolean type shall convert the XtRInt value specified in
+.A from
+to an XtRBoolean type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to Boolean specific */
+int num = 7;
+Boolean res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln1", "XtCvtIntToBoolean");
+ (void) ConfigureDimension(topLevel, boxw2);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &res;
+ toVal.size = sizeof(Boolean);
+ status = XtCvtIntToBoolean(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtIntToBoolean return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtIntToBoolean(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRBoolean type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to Boolean specific */
+int num = 1;
+Boolean res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln3", "XtCvtIntToBoolean");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &res;
+ toVal.size = 0;
+ status = XtCvtIntToBoolean(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtIntToBoolean return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(Boolean)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Boolean), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtIntToBoolean(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the XtRInt value specified in
+.A from
+to an XtRBoolean type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to Boolean specific */
+int num = 1;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln2", "XtCvtIntToBoolean");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtIntToBoolean(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtIntToBoolean return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(Boolean)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Boolean), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtIntToColor/XtCvtIntToColor.m b/xts5/Xt11/XtCvtIntToColor/XtCvtIntToColor.m
new file mode 100644
index 00000000..d2d65bd5
--- /dev/null
+++ b/xts5/Xt11/XtCvtIntToColor/XtCvtIntToColor.m
@@ -0,0 +1,343 @@
+Copyright (c) 2005 X.Org Foundation LLC
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+$Header: /cvs/xtest/xtest/xts5/tset/Xt11/XtCvtIntToColor/XtCvtIntToColor.m,v 1.1 2005-02-12 14:37:51 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/Xt11/XtCvtIntToColor/XtCvtIntToColor.m
+>>#
+>># Description:
+>># Tests for XtCvtIntToColor()
+>>#
+>># Modifications:
+>># $Log: tcincolr.m,v $
+>># Revision 1.1 2005-02-12 14:37:51 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:38 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:35 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:42 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:17 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:20:04 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:57 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+void XtWMH_Proc(str1, str2, str3, str4, str5, car)
+String str1, str2, str3, str4, *str5;
+Cardinal *car;
+{
+ avs_set_event(1,1);
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtCvtIntToColor Xt11
+Boolean XtCvtIntToColor(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtIntToColor(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRColor type shall convert the XtRInt value specified in
+.A from
+to an XtRColor type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to Color specific */
+Screen *screen;
+Colormap colormap;
+int num = 0;
+XColor res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln1", "XtCvtIntToColor");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ screen = DefaultScreenOfDisplay(display);
+ args[0].addr = (XtPointer )&screen;
+ args[0].size = sizeof(Screen*);
+ colormap = DefaultColormapOfScreen(screen);
+ args[1].addr = (XtPointer) &colormap;
+ args[1].size = sizeof(Colormap);
+ num_args = 2;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &res;
+ toVal.size = sizeof(XColor);
+ status = XtCvtIntToColor(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtIntToColor return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtIntToColor(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRColor type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to XColor specific */
+Screen *screen;
+Colormap colormap;
+int num = 1;
+XColor res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln3", "XtCvtIntToColor");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ screen = DefaultScreenOfDisplay(display);
+ args[0].addr = (XtPointer )&screen;
+ args[0].size = sizeof(Screen*);
+ colormap = DefaultColormapOfScreen(screen);
+ args[1].addr = (XtPointer) &colormap;
+ args[1].size = sizeof(Colormap);
+ num_args = 2;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &res;
+ toVal.size = 0;
+ status = XtCvtIntToColor(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtIntToColor return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(XColor)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(XColor), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtIntToColor(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the XtRInt value specified in
+.A from
+to an XtRColor type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to XColor specific */
+Screen *screen;
+Colormap colormap;
+int num = 1;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln2", "XtCvtIntToColor");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ screen = DefaultScreenOfDisplay(display);
+ args[0].addr = (XtPointer )&screen;
+ args[0].size = sizeof(Screen*);
+ colormap = DefaultColormapOfScreen(screen);
+ args[1].addr = (XtPointer) &colormap;
+ args[1].size = sizeof(Colormap);
+ num_args = 2;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtIntToColor(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtIntToColor return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(XColor)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(XColor), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtIntToColor(display, args, num_args, from, to, converter_data)
+when
+.A args
+specifies an improper value shall not perform a conversion,
+issue a warning message, and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to Color specific */
+int num = 1;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcincolr4", "XtCvtIntToColor");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args incorrectly");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtIntToColor(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "conversion status");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Warning handler is called");
+ status = avs_get_event(1);
+ check_dec(1, status, "calls to warning handler count");
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtIntToDimension/XtCvtIntToDimension.m b/xts5/Xt11/XtCvtIntToDimension/XtCvtIntToDimension.m
new file mode 100644
index 00000000..51aaa43b
--- /dev/null
+++ b/xts5/Xt11/XtCvtIntToDimension/XtCvtIntToDimension.m
@@ -0,0 +1,258 @@
+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/Xt11/XtCvtIntToDimension/XtCvtIntToDimension.m,v 1.1 2005-02-12 14:37:51 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/Xt11/XtCvtIntToDimension/XtCvtIntToDimension.m
+>>#
+>># Description:
+>># Tests for XtCvtIntToDimension()
+>>#
+>># Modifications:
+>># $Log: tcindim.m,v $
+>># Revision 1.1 2005-02-12 14:37:51 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:39 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:36 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:42 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:17 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:20:06 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:58 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+>>TITLE XtCvtIntToDimension Xt11
+Boolean
+XtCvtIntToDimension(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtIntToDimension(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRDimension type shall convert the XtRInt value specified in
+.A from
+to an XtRDimension type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to Dimension specific */
+int num = 7;
+Dimension res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln1", "XtCvtIntToDimension");
+ (void) ConfigureDimension(topLevel, boxw2);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &res;
+ toVal.size = sizeof(Dimension);
+ status = XtCvtIntToDimension(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtIntToDimension return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtIntToDimension(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRDimension type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to Dimension specific */
+int num = 1;
+Dimension res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln3", "XtCvtIntToDimension");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &res;
+ toVal.size = 0;
+ status = XtCvtIntToDimension(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtIntToDimension return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(Dimension)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Dimension), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtIntToDimension(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the XtRInt value specified in
+.A from
+to an XtRDimension type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to Dimension specific */
+int num = 1;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln2", "XtCvtIntToDimension");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtIntToDimension(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtIntToDimension return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(Dimension)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Dimension), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtIntToFloat/XtCvtIntToFloat.m b/xts5/Xt11/XtCvtIntToFloat/XtCvtIntToFloat.m
new file mode 100644
index 00000000..33d88d1c
--- /dev/null
+++ b/xts5/Xt11/XtCvtIntToFloat/XtCvtIntToFloat.m
@@ -0,0 +1,257 @@
+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/Xt11/XtCvtIntToFloat/XtCvtIntToFloat.m,v 1.1 2005-02-12 14:37:51 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/Xt11/XtCvtIntToFloat/XtCvtIntToFloat.m
+>>#
+>># Description:
+>># Tests for XtCvtIntToFloat()
+>>#
+>># Modifications:
+>># $Log: tcinflt.m,v $
+>># Revision 1.1 2005-02-12 14:37:51 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:40 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:36 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:43 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:18 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:20:07 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:15:00 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+>>TITLE XtCvtIntToFloat Xt11
+Boolean
+XtCvtIntToFloat(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtIntToFloat(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRFloat type shall convert the XtRInt value specified in
+.A from
+to an XtRFloat type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to float specific */
+int num = 7;
+float res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln1", "XtCvtIntToFloat");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &res;
+ toVal.size = sizeof(float);
+ status = XtCvtIntToFloat(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtIntToFloat return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtIntToFloat(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRFloat type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to float specific */
+int num = 1;
+float res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln3", "XtCvtIntToFloat");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &res;
+ toVal.size = 0;
+ status = XtCvtIntToFloat(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtIntToFloat return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(float)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(float), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtIntToFloat(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the XtRInt value specified in
+.A from
+to an XtRFloat type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to float specific */
+int num = 1;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln2", "XtCvtIntToFloat");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtIntToFloat(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtIntToFloat return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(float)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(float), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtIntToFont/XtCvtIntToFont.m b/xts5/Xt11/XtCvtIntToFont/XtCvtIntToFont.m
new file mode 100644
index 00000000..495dfb18
--- /dev/null
+++ b/xts5/Xt11/XtCvtIntToFont/XtCvtIntToFont.m
@@ -0,0 +1,257 @@
+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/Xt11/XtCvtIntToFont/XtCvtIntToFont.m,v 1.1 2005-02-12 14:37:51 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/Xt11/XtCvtIntToFont/XtCvtIntToFont.m
+>>#
+>># Description:
+>># Tests for XtCvtIntToFont()
+>>#
+>># Modifications:
+>># $Log: tcinfont.m,v $
+>># Revision 1.1 2005-02-12 14:37:51 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:40 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:37 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:44 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:18 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:20:09 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:15:02 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+>>TITLE XtCvtIntToFont Xt11
+Boolean
+XtCvtIntToFont(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtIntToFont(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRFont type shall convert the XtRInt value specified in
+.A from
+to an XtRFont type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to Font specific */
+int num = 7;
+Font res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln1", "XtCvtIntToFont");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &res;
+ toVal.size = sizeof(Font);
+ status = XtCvtIntToFont(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtIntToFont return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtIntToFont(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRFont type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to Font specific */
+int num = 1;
+Font res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln3", "XtCvtIntToFont");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &res;
+ toVal.size = 0;
+ status = XtCvtIntToFont(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtIntToFont return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(Font)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Font), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtIntToFont(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the XtRInt value specified in
+.A from
+to an XtRFont type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to Font specific */
+int num = 1;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln2", "XtCvtIntToFont");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtIntToFont(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtIntToFont return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(Font)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Font), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtIntToPixel/XtCvtIntToPixel.m b/xts5/Xt11/XtCvtIntToPixel/XtCvtIntToPixel.m
new file mode 100644
index 00000000..68a34033
--- /dev/null
+++ b/xts5/Xt11/XtCvtIntToPixel/XtCvtIntToPixel.m
@@ -0,0 +1,257 @@
+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/Xt11/XtCvtIntToPixel/XtCvtIntToPixel.m,v 1.1 2005-02-12 14:37:51 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/Xt11/XtCvtIntToPixel/XtCvtIntToPixel.m
+>>#
+>># Description:
+>># Tests for XtCvtIntToPixel()
+>>#
+>># Modifications:
+>># $Log: tcinpix.m,v $
+>># Revision 1.1 2005-02-12 14:37:51 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:41 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:37 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:44 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:19 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:20:10 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:15:04 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+>>TITLE XtCvtIntToPixel Xt11
+Boolean
+XtCvtIntToPixel(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtIntToPixel(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRPixel type shall convert the XtRInt value specified in
+.A from
+to an XtRPixel type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to Pixel specific */
+int num = 7;
+Pixel res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln1", "XtCvtIntToPixel");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &res;
+ toVal.size = sizeof(Pixel);
+ status = XtCvtIntToPixel(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtIntToPixel return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtIntToPixel(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRPixel type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to Pixel specific */
+int num = 1;
+pid_t pid2;
+Pixel res;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln3", "XtCvtIntToPixel");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &res;
+ toVal.size = 0;
+ status = XtCvtIntToPixel(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtIntToPixel return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(Pixel)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Pixel), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtIntToPixel(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the XtRInt value specified in
+.A from
+to an XtRPixel type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to Pixel specific */
+int num = 1;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln2", "XtCvtIntToPixel");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtIntToPixel(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtIntToPixel return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(Pixel)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Pixel), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtIntToPixmap/XtCvtIntToPixmap.m b/xts5/Xt11/XtCvtIntToPixmap/XtCvtIntToPixmap.m
new file mode 100644
index 00000000..ef6e1231
--- /dev/null
+++ b/xts5/Xt11/XtCvtIntToPixmap/XtCvtIntToPixmap.m
@@ -0,0 +1,257 @@
+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/Xt11/XtCvtIntToPixmap/XtCvtIntToPixmap.m,v 1.1 2005-02-12 14:37:51 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/Xt11/XtCvtIntToPixmap/XtCvtIntToPixmap.m
+>>#
+>># Description:
+>># Tests for XtCvtIntToPixmap()
+>>#
+>># Modifications:
+>># $Log: tcinpixm.m,v $
+>># Revision 1.1 2005-02-12 14:37:51 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:41 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:38 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:45 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:19 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:20:11 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:15:06 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+>>TITLE XtCvtIntToPixmap Xt11
+Boolean
+XtCvtIntToPixmap(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtIntToPixmap(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRPixmap type shall convert the XtRInt value specified in
+.A from
+to an XtRPixmap type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to Pixmap specific */
+int num = 7;
+Pixmap res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln1", "XtCvtIntToPixmap");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &res;
+ toVal.size = sizeof(Pixmap);
+ status = XtCvtIntToPixmap(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtIntToPixmap return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtIntToPixmap(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRPixmap type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to Pixmap specific */
+int num = 1;
+Pixmap res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln3", "XtCvtIntToPixmap");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &res;
+ toVal.size = 0;
+ status = XtCvtIntToPixmap(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtIntToPixmap return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(Pixmap)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Pixmap), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtIntToPixmap(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the XtRInt value specified in
+.A from
+to an XtRPixmap type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to Pixmap specific */
+int num = 1;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln2", "XtCvtIntToPixmap");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtIntToPixmap(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtIntToPixmap return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(Pixmap)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Pixmap), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtIntToPosition/XtCvtIntToPosition.m b/xts5/Xt11/XtCvtIntToPosition/XtCvtIntToPosition.m
new file mode 100644
index 00000000..e93cb630
--- /dev/null
+++ b/xts5/Xt11/XtCvtIntToPosition/XtCvtIntToPosition.m
@@ -0,0 +1,258 @@
+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/Xt11/XtCvtIntToPosition/XtCvtIntToPosition.m,v 1.1 2005-02-12 14:37:51 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/Xt11/XtCvtIntToPosition/XtCvtIntToPosition.m
+>>#
+>># Description:
+>># Tests for XtCvtIntToPosition()
+>>#
+>># Modifications:
+>># $Log: tcinpos.m,v $
+>># Revision 1.1 2005-02-12 14:37:51 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:42 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:39 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:45 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:20 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:20:13 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:15:08 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+>>TITLE XtCvtIntToPosition Xt11
+Boolean
+XtCvtIntToPosition(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtIntToPosition(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRPosition type shall convert the XtRInt value specified in
+.A from
+to an XtRPosition type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to Position specific */
+int num = 7;
+Position res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln1", "XtCvtIntToPosition");
+ (void) ConfigureDimension(topLevel, boxw2);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &res;
+ toVal.size = sizeof(Position);
+ status = XtCvtIntToPosition(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtIntToPosition return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtIntToPosition(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRPosition type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to Position specific */
+int num = 1;
+Position res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln3", "XtCvtIntToPosition");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &res;
+ toVal.size = 0;
+ status = XtCvtIntToPosition(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtIntToPosition return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(Position)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Position), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtIntToPosition(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the XtRInt value specified in
+.A from
+to an XtRPosition type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to Position specific */
+int num = 1;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln2", "XtCvtIntToPosition");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtIntToPosition(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtIntToPosition return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(Position)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Position), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtIntToShort/XtCvtIntToShort.m b/xts5/Xt11/XtCvtIntToShort/XtCvtIntToShort.m
new file mode 100644
index 00000000..5b213ab3
--- /dev/null
+++ b/xts5/Xt11/XtCvtIntToShort/XtCvtIntToShort.m
@@ -0,0 +1,258 @@
+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/Xt11/XtCvtIntToShort/XtCvtIntToShort.m,v 1.1 2005-02-12 14:37:51 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/Xt11/XtCvtIntToShort/XtCvtIntToShort.m
+>>#
+>># Description:
+>># Tests for XtCvtIntToShort()
+>>#
+>># Modifications:
+>># $Log: tcinshrt.m,v $
+>># Revision 1.1 2005-02-12 14:37:51 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:43 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:39 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:46 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:20 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:20:14 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:15:10 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+>>TITLE XtCvtIntToShort Xt11
+Boolean
+XtCvtIntToShort(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtIntToShort(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRShort type shall convert the XtRInt value specified in
+.A from
+to an XtRShort type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to Short specific */
+int num = 7;
+short res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln1", "XtCvtIntToShort");
+ (void) ConfigureDimension(topLevel, boxw2);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &res;
+ toVal.size = sizeof(short);
+ status = XtCvtIntToShort(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtIntToShort return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtIntToShort(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRShort type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to Short specific */
+int num = 1;
+short res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln3", "XtCvtIntToShort");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &res;
+ toVal.size = 0;
+ status = XtCvtIntToShort(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtIntToShort return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(short)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(short), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtIntToShort(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the XtRInt value specified in
+.A from
+to an XtRShort type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to Short specific */
+int num = 1;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln2", "XtCvtIntToShort");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtIntToShort(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtIntToShort return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(short)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(short), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtIntToUnsignedChar/XtCvtIntToUnsignedChar.m b/xts5/Xt11/XtCvtIntToUnsignedChar/XtCvtIntToUnsignedChar.m
new file mode 100644
index 00000000..4bac7202
--- /dev/null
+++ b/xts5/Xt11/XtCvtIntToUnsignedChar/XtCvtIntToUnsignedChar.m
@@ -0,0 +1,257 @@
+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/Xt11/XtCvtIntToUnsignedChar/XtCvtIntToUnsignedChar.m,v 1.1 2005-02-12 14:37:51 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/Xt11/XtCvtIntToUnsignedChar/XtCvtIntToUnsignedChar.m
+>>#
+>># Description:
+>># Tests for XtCvtIntToUnsignedChar()
+>>#
+>># Modifications:
+>># $Log: tcinuchr.m,v $
+>># Revision 1.1 2005-02-12 14:37:51 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:43 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:40 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:47 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:21 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:20:15 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:15:12 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+>>TITLE XtCvtIntToUnsignedChar Xt11
+Boolean
+XtCvtIntToUnsignedChar(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtIntToUnsignedChar(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRUnsignedChar type shall convert the XtRInt value specified in
+.A from
+to an XtRUnsignedChar type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to unsigned char specific */
+int num = 7;
+unsigned char res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln1", "XtCvtIntToUnsignedChar");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &res;
+ toVal.size = sizeof(unsigned char);
+ status = XtCvtIntToUnsignedChar(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtIntToUnsignedChar return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtIntToUnsignedChar(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRUnsignedChar type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to unsigned char specific */
+int num = 1;
+unsigned char res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln3", "XtCvtIntToUnsignedChar");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &res;
+ toVal.size = 0;
+ status = XtCvtIntToUnsignedChar(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtIntToUnsignedChar return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(unsigned char)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(unsigned char), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtIntToUnsignedChar(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the XtRInt value specified in
+.A from
+to an XtRUnsignedChar type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Int to unsigned char specific */
+int num = 1;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln2", "XtCvtIntToUnsignedChar");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtIntToUnsignedChar(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtIntToUnsignedChar return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(unsigned char)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(unsigned char), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtPixelToColor/XtCvtPixelToColor.m b/xts5/Xt11/XtCvtPixelToColor/XtCvtPixelToColor.m
new file mode 100644
index 00000000..144a5cbf
--- /dev/null
+++ b/xts5/Xt11/XtCvtPixelToColor/XtCvtPixelToColor.m
@@ -0,0 +1,280 @@
+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/Xt11/XtCvtPixelToColor/XtCvtPixelToColor.m,v 1.1 2005-02-12 14:37:51 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/Xt11/XtCvtPixelToColor/tpixcol.m
+>>#
+>># Description:
+>># Tests for XtCvtPixelToColor()
+>>#
+>># Modifications:
+>># $Log: tcpixcol.m,v $
+>># Revision 1.1 2005-02-12 14:37:51 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:44 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:41 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:47 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:21 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:20:17 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:15:13 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+>>TITLE XtCvtPixelToColor Xt11
+Boolean XtCvtPixelToColor(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtPixelToColor(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRColor type shall convert the XtRPixel value specified in
+.A from
+to an XtRColor type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Pixel to Color specific */
+Screen *screen;
+Colormap colormap;
+Pixel num = 0;
+XColor res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln1", "XtCvtPixelToColor");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ screen = DefaultScreenOfDisplay(display);
+ args[0].addr = (XtPointer )&screen;
+ args[0].size = sizeof(Screen*);
+ colormap = DefaultColormapOfScreen(screen);
+ args[1].addr = (XtPointer) &colormap;
+ args[1].size = sizeof(Colormap);
+ num_args = 2;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &res;
+ toVal.size = sizeof(XColor);
+ status = XtCvtPixelToColor(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtPixelToColor return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtPixelToColor(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRColor type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Pixel to XColor specific */
+Screen *screen;
+Colormap colormap;
+Pixel num = 1;
+XColor res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln3", "XtCvtPixelToColor");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ screen = DefaultScreenOfDisplay(display);
+ args[0].addr = (XtPointer )&screen;
+ args[0].size = sizeof(Screen*);
+ colormap = DefaultColormapOfScreen(screen);
+ args[1].addr = (XtPointer) &colormap;
+ args[1].size = sizeof(Colormap);
+ num_args = 2;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer) &res;
+ toVal.size = 0;
+ status = XtCvtPixelToColor(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtPixelToColor return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(XColor)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(XColor), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtPixelToColor(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the XtRPixel value specified in
+.A from
+to an XtRColor type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* Pixel to XColor specific */
+Screen *screen;
+Colormap colormap;
+Pixel num = 1;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcinboln2", "XtCvtPixelToColor");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ screen = DefaultScreenOfDisplay(display);
+ args[0].addr = (XtPointer )&screen;
+ args[0].size = sizeof(Screen*);
+ colormap = DefaultColormapOfScreen(screen);
+ args[1].addr = (XtPointer) &colormap;
+ args[1].size = sizeof(Colormap);
+ num_args = 2;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = (XtPointer) &num;
+ fromVal.size = sizeof(int);
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtPixelToColor(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtPixelToColor return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(XColor)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(XColor), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtStringToAcceleratorTable/XtCvtStringToAcceleratorTable.m b/xts5/Xt11/XtCvtStringToAcceleratorTable/XtCvtStringToAcceleratorTable.m
new file mode 100644
index 00000000..f692fdd1
--- /dev/null
+++ b/xts5/Xt11/XtCvtStringToAcceleratorTable/XtCvtStringToAcceleratorTable.m
@@ -0,0 +1,343 @@
+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/Xt11/XtCvtStringToAcceleratorTable/XtCvtStringToAcceleratorTable.m,v 1.2 2005-04-21 09:40:42 ajosey 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/Xt11/XtCvtStringToAcceleratorTable/XtCvtStringToAcceleratorTable.m
+>>#
+>># Description:
+>># Tests for XtCvtStringToAcceleratorTable()
+>>#
+>># Modifications:
+>># $Log: tcstatbl.m,v $
+>># Revision 1.2 2005-04-21 09:40:42 ajosey
+>># resync to VSW5.1.5
+>>#
+>># Revision 8.1 1999/12/06 14:19:52 vsx
+>># fixed CVS header
+>>#
+>># Revision 8.0 1998/12/23 23:37:26 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:21 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:30 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.2 1998/02/24 03:24:28 andy
+>># Made test 4 contingent on coverage
+>>#
+>># Revision 5.1 1998/02/03 22:17:43 andy
+>># Added warning handler install to test 2 (SR 160).
+>>#
+>># Revision 5.0 1998/01/26 03:25:05 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:19:26 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:07 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+#include <locale.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+void XtWMH3_Proc(str1, str2, str3, str4, str5, car)
+String str1, str2, str3, str4, *str5;
+Cardinal *car;
+{
+ avs_set_event(2,1);
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtCvtStringToAcceleratorTable Xt11
+Boolean
+XtCvtStringToAcceleratorTable(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToAcceleratorTable(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRAcceleratorTable type shall convert the string specified in
+.A from
+to an XtRAcceleratorTable type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to AcceleratorTable specific */
+char *accstr = "";
+XtAccelerators acctbl;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstatbl1", "XtCvtStringToAcceleratorTable");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = accstr;
+ fromVal.size = strlen(accstr)+1;
+ toVal.addr = (XtPointer) &acctbl;
+ toVal.size = sizeof(XtAccelerators);
+ status = XtCvtStringToAcceleratorTable(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToAcceleratorTable return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or later");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToAcceleratorTable(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtAcceleratorTable type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to AccerlatorTable specific */
+char *accstr = "";
+XtAccelerators acctbl;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstatbl2", "XtCvtStringToAcceleratorTable");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH3_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = accstr;
+ fromVal.size = strlen(accstr)+1;
+ toVal.addr = (XtPointer) &acctbl;
+ toVal.size = 0;
+ status = XtCvtStringToAcceleratorTable(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToAcceleratorTable return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size == 0) {
+ tet_infoline("ERROR: toVal.size not set");
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or later");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToAcceleratorTable(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the string specified in
+.A from
+to an XtRAcceleratorTable type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to AcceleratorTable specific */
+char *accstr = "";
+XtAccelerators acctbl;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstatbl3", "XtCvtStringToAcceleratorTable");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = accstr;
+ fromVal.size = strlen(accstr)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToAcceleratorTable(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ tet_infoline("TEST: Return status is True");
+ check_dec(True, status, "XtCvtStringToAcceleratorTable return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (!toVal.size) {
+ sprintf(ebuf, "ERROR: to->size was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or later");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good A
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToAcceleratorTable(display, args, num_args, from, to, converter_data)
+when the conversion is not performed due to an improper value
+specified in
+.A from
+shall issue a warning message and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to AcceleratorTable specific */
+char *accstr = "";
+XtAccelerators acctbl;
+pid_t pid2;
+int status2;
+#endif
+
+#if XT_X_RELEASE > 4
+/*this test does not pass prior do R6.4gamma due to issues with
+consistency of the spec, test suite, and sample code*/
+if (config.coverage < 2) {
+ FORK(pid2);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcstatbl4", "XtCvtStringToAcceleratorTable");
+ tet_infoline("PREP: Set Warning Message Handler");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH3_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = NULL;
+ fromVal.size = 0;
+ toVal.addr = (XtPointer) &acctbl;
+ toVal.size = sizeof(XtAccelerators);
+ status = XtCvtStringToAcceleratorTable(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToAcceleratorTable return value");
+ tet_infoline("TEST: Warning message was generated");
+ status2 = avs_get_event(2);
+ check_dec(1, status2, "warning handler called");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+} else {
+ tet_infoline("INFO: Test surpressed due to XT_COVERAGE value");
+ tet_result(TET_UNTESTED);
+}
+#else
+ tet_infoline("INFO: Implementation not X11R5 or later");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtStringToAtom/XtCvtStringToAtom.m b/xts5/Xt11/XtCvtStringToAtom/XtCvtStringToAtom.m
new file mode 100644
index 00000000..595ad9d6
--- /dev/null
+++ b/xts5/Xt11/XtCvtStringToAtom/XtCvtStringToAtom.m
@@ -0,0 +1,331 @@
+Copyright (c) 2005 X.Org Foundation LLC
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+$Header: /cvs/xtest/xtest/xts5/tset/Xt11/XtCvtStringToAtom/XtCvtStringToAtom.m,v 1.1 2005-02-12 14:37:52 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/Xt11/XtCvtStringToAtom/XtCvtStringToAtom.m
+>>#
+>># Description:
+>># Tests for XtCvtStringToAtom()
+>>#
+>># Modifications:
+>># $Log: tcstatom.m,v $
+>># Revision 1.1 2005-02-12 14:37:52 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:26 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:22 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:31 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.1 1998/02/03 22:17:45 andy
+>># Added warning handler install to test 2 (SR 160).
+>>#
+>># Revision 5.0 1998/01/26 03:25:05 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:19:27 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:09 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+void XtWMH_Proc(str1, str2, str3, str4, str5, car)
+String str1, str2, str3, str4, *str5;
+Cardinal *car;
+{
+ avs_set_event(1,1);
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtCvtStringToAtom Xt11
+Boolean
+XtCvtStringToAtom(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToAtom(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRAtom type shall convert the string specified in
+.A from
+to an XtRAtom type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Atom specific */
+char *atomstr = "WM_COMMAND";
+Atom atom;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstatom1", "XtCvtStringToAtom");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ args[0].addr = (XtPointer )&display;
+ args[0].size = sizeof(Display*);
+ num_args = 1;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = atomstr;
+ fromVal.size = strlen(atomstr)+1;
+ toVal.addr = (XtPointer) &atom;
+ toVal.size = sizeof(Atom);
+ status = XtCvtStringToAtom(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToAtom return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToAtom(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRAtom type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Atom specific */
+char *atomstr = "WM_COMMAND";
+Atom atom;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstatom2", "XtCvtStringToAtom");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ args[0].addr = (XtPointer )&display;
+ args[0].size = sizeof(Display*);
+ num_args = 1;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = atomstr;
+ fromVal.size = strlen(atomstr)+1;
+ toVal.addr = (XtPointer) &atom;
+ toVal.size = 0;
+ status = XtCvtStringToAtom(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToAtom return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(Atom)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Atom), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToAtom(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the string specified in
+.A from
+to an XtRAtom type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Atom specific */
+char *atomstr = "WM_COMMAND";
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstatom3", "XtCvtStringToAtom");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ args[0].addr = (XtPointer )&display;
+ args[0].size = sizeof(Display*);
+ num_args = 1;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = atomstr;
+ fromVal.size = strlen(atomstr)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToAtom(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToAtom return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(Atom)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Atom), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToAtom(display, args, num_args, from, to, converter_data)
+when
+.A args
+specifies an improper value shall not perform a conversion,
+issue a warning message, and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Atom specific */
+char *atomstr = "WM_COMMAND";
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstatom4", "XtCvtStringToAtom");
+ avs_set_event(2,0);
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args incorrectly");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = atomstr;
+ fromVal.size = strlen(atomstr)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToAtom(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToAtom return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Warning handler is called");
+ status = avs_get_event(1);
+ check_dec(1, status, "calls to warning handler count");
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtStringToBool/XtCvtStringToBool.m b/xts5/Xt11/XtCvtStringToBool/XtCvtStringToBool.m
new file mode 100644
index 00000000..55dc1fd0
--- /dev/null
+++ b/xts5/Xt11/XtCvtStringToBool/XtCvtStringToBool.m
@@ -0,0 +1,327 @@
+Copyright (c) 2005 X.Org Foundation LLC
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+$Header: /cvs/xtest/xtest/xts5/tset/Xt11/XtCvtStringToBool/XtCvtStringToBool.m,v 1.1 2005-02-12 14:37:52 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/Xt11/XtCvtStringToBool/XtCvtStringToBool.m
+>>#
+>># Description:
+>># Tests for XtCvtStringToBool()
+>>#
+>># Modifications:
+>># $Log: tcstbool.m,v $
+>># Revision 1.1 2005-02-12 14:37:52 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:27 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:23 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:32 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.1 1998/02/03 22:17:46 andy
+>># Added warning handler install to test 2 (SR 160).
+>>#
+>># Revision 5.0 1998/01/26 03:25:06 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:19:31 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:13 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+void XtWMH_Proc(str1, str2, str3, str4, str5, car)
+String str1, str2, str3, str4, *str5;
+Cardinal *car;
+{
+ avs_set_event(2,1);
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtCvtStringToBool Xt11
+Bool
+XtCvtStringToBool(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Bool XtCvtStringToBool(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRBool type shall convert the string specified in
+.A from
+to an XtRBool type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Bool status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Bool specific */
+char *boolstr = "true";
+Bool boolean;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstboln1", "XtCvtStringToBool");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = boolstr;
+ fromVal.size = strlen(boolstr)+1;
+ toVal.addr = (XtPointer) &boolean;
+ toVal.size = sizeof(Bool);
+ status = XtCvtStringToBool(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToBool return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Bool XtCvtStringToBool(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRBool type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Bool status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Bool specific */
+char *boolstr = "true";
+Bool boolean;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstboln2", "XtCvtStringToBool");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = boolstr;
+ fromVal.size = strlen(boolstr)+1;
+ toVal.addr = (XtPointer) &boolean;
+ toVal.size = 0;
+ status = XtCvtStringToBool(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToBool return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(Bool)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Bool), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Bool XtCvtStringToBool(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the string specified in
+.A from
+to an XtRBool type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Bool status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Bool specific */
+char *boolstr = "true";
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstboln3", "XtCvtStringToBool");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = boolstr;
+ fromVal.size = strlen(boolstr)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToBool(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToBool return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(Bool)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Bool), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good A
+If the implementation is X11R5 or later:
+A call to
+Bool XtCvtStringToBool(display, args, num_args, from, to, converter_data)
+when the conversion is not performed due to an improper value
+specified in
+.A from
+shall issue a warning message and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Bool status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Bool specific */
+char *boolstr = "not a boolean value";
+Bool boolean;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcstboln4", "XtCvtStringToBool");
+ tet_infoline("PREP: Set Warning Message Handler");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = boolstr;
+ fromVal.size = strlen(boolstr)+1;
+ toVal.addr = (XtPointer) &boolean;
+ toVal.size = sizeof(Bool);
+ status = XtCvtStringToBool(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToBool return value");
+ tet_infoline("TEST: Warning message was generated");
+ status = avs_get_event(2);
+ check_dec(1, status, "warning handler called");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtStringToBoolean/XtCvtStringToBoolean.m b/xts5/Xt11/XtCvtStringToBoolean/XtCvtStringToBoolean.m
new file mode 100644
index 00000000..1a9202a7
--- /dev/null
+++ b/xts5/Xt11/XtCvtStringToBoolean/XtCvtStringToBoolean.m
@@ -0,0 +1,330 @@
+Copyright (c) 2005 X.Org Foundation LLC
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+$Header: /cvs/xtest/xtest/xts5/tset/Xt11/XtCvtStringToBoolean/XtCvtStringToBoolean.m,v 1.1 2005-02-12 14:37:52 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/Xt11/XtCvtStringToBoolean/XtCvtStringToBoolean.m
+>>#
+>># Description:
+>># Tests for XtCvtStringToBoolean()
+>>#
+>># Modifications:
+>># $Log: tcstboln.m,v $
+>># Revision 1.1 2005-02-12 14:37:52 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:27 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:23 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:31 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.1 1998/02/03 21:58:05 andy
+>># Editorial.
+>>#
+>># Revision 5.0 1998/01/26 03:25:06 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:19:29 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:11 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+void XtWMH3_Proc(str1, str2, str3, str4, str5, car)
+String str1, str2, str3, str4, *str5;
+Cardinal *car;
+{
+ avs_set_event(2,1);
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtCvtStringToBoolean Xt11
+Boolean
+XtCvtStringToBoolean(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToBoolean(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRBoolean type shall convert the string specified in
+.A from
+to an XtRBoolean type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Boolean specific */
+char *boolstr = "true";
+Boolean boolean;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstboln1", "XtCvtStringToBoolean");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = boolstr;
+ fromVal.size = strlen(boolstr)+1;
+ toVal.addr = (XtPointer) &boolean;
+ toVal.size = sizeof(Boolean);
+ status = XtCvtStringToBoolean(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToBoolean return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToBoolean(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRBoolean type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Boolean specific */
+char *boolstr = "true";
+Boolean boolean;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcstboln2", "XtCvtStringToBoolean");
+ tet_infoline("PREP: Set Warning Message Handler");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH3_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = boolstr;
+ fromVal.size = strlen(boolstr)+1;
+ toVal.addr = (XtPointer) &boolean;
+ toVal.size = 0;
+ status = XtCvtStringToBoolean(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToBoolean return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(Boolean)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Boolean), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToBoolean(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the string specified in
+.A from
+to an XtRBoolean type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Boolean specific */
+char *boolstr = "true";
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstboln3", "XtCvtStringToBoolean");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = boolstr;
+ fromVal.size = strlen(boolstr)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToBoolean(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToBoolean return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(Boolean)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Boolean), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good A
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToBoolean(display, args, num_args, from, to, converter_data)
+when the conversion is not performed due to an improper value
+specified in
+.A from
+shall issue a warning message and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Boolean specific */
+char *boolstr = "not a boolean value";
+Boolean boolean;
+pid_t pid2;
+int status2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcstboln4", "XtCvtStringToBoolean");
+ tet_infoline("PREP: Set Warning Message Handler");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH3_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = boolstr;
+ fromVal.size = strlen(boolstr)+1;
+ toVal.addr = (XtPointer) &boolean;
+ toVal.size = sizeof(Boolean);
+ status = XtCvtStringToBoolean(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToBoolean return value");
+ tet_infoline("TEST: Warning message was generated");
+ status2 = avs_get_event(2);
+ check_dec(1, status2, "warning handler called");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtStringToCursor/XtCvtStringToCursor.m b/xts5/Xt11/XtCvtStringToCursor/XtCvtStringToCursor.m
new file mode 100644
index 00000000..6fa7e318
--- /dev/null
+++ b/xts5/Xt11/XtCvtStringToCursor/XtCvtStringToCursor.m
@@ -0,0 +1,389 @@
+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/Xt11/XtCvtStringToCursor/XtCvtStringToCursor.m,v 1.1 2005-02-12 14:37:52 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/Xt11/XtCvtStringToCursor/XtCvtStringToCursor.m
+>>#
+>># Description:
+>># Tests for XtCvtStringToCursor()
+>>#
+>># Modifications:
+>># $Log: tcstcurs.m,v $
+>># Revision 1.1 2005-02-12 14:37:52 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:28 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:24 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:32 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.1 1998/02/03 22:17:47 andy
+>># Added warning handler install to test 2 (SR 160).
+>>#
+>># Revision 5.0 1998/01/26 03:25:07 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:19:32 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:15 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+void XtWMH_Proc(str1, str2, str3, str4, str5, car)
+String str1, str2, str3, str4, *str5;
+Cardinal *car;
+{
+ avs_set_event(1,1);
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtCvtStringToCursor Xt11
+Boolean
+XtCvtStringToCursor(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToCursor(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRCursor type shall convert the string specified in
+.A from
+to an XtRCursor type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Cursor specific */
+char *curstr = "X_cursor";
+Cursor res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstcurs1", "XtCvtStringToCursor");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ args[0].addr = (XtPointer )&display;
+ args[0].size = sizeof(Display*);
+ num_args = 1;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = curstr;
+ fromVal.size = strlen(curstr)+1;
+ toVal.addr = (XtPointer) &res;
+ toVal.size = sizeof(Cursor);
+ status = XtCvtStringToCursor(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToCursor return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToCursor(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRCursor type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Cursor specific */
+char *curstr = "X_cursor";
+Cursor res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstcurs2", "XtCvtStringToCursor");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ args[0].addr = (XtPointer )&display;
+ args[0].size = sizeof(Display*);
+ num_args = 1;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = curstr;
+ fromVal.size = strlen(curstr)+1;
+ toVal.addr = (XtPointer) &res;
+ toVal.size = 0;
+ status = XtCvtStringToCursor(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "conversion status");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(Cursor)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Cursor), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToCursor(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the string specified in
+.A from
+to an XtRCursor type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Cursor specific */
+char *curstr = "X_cursor";
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstcurs3", "XtCvtStringToCursor");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ args[0].addr = (XtPointer )&display;
+ args[0].size = sizeof(Display*);
+ num_args = 1;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = curstr;
+ fromVal.size = strlen(curstr)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToCursor(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "conversion status");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(Cursor)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Cursor), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToCursor(display, args, num_args, from, to, converter_data)
+when
+.A args
+specifies an improper value shall not perform a conversion,
+issue a warning message, and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Cursor specific */
+char *curstr = "X_cursor";
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_xt_hier("Tcstcurs4", "XtCvtStringToCursor");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args incorrectly");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = curstr;
+ fromVal.size = strlen(curstr)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToCursor(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "conversion status");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Warning handler is called");
+ status = avs_get_event(1);
+ check_dec(1, status, "calls to warning handler count");
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good A
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToCursor(display, args, num_args, from, to, converter_data)
+when the conversion is not performed due to an improper value
+specified in
+.A from
+shall issue a warning message and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Cursor specific */
+char *curstr = "Not even close to a valid cursor";
+Cursor res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_xt_hier("Tcstcurs5", "XtCvtStringToCursor");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ args[0].addr = (XtPointer )&display;
+ args[0].size = sizeof(Display*);
+ num_args = 1;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = curstr;
+ fromVal.size = strlen(curstr)+1;
+ toVal.addr = (XtPointer) &res;
+ toVal.size = sizeof(Cursor);
+ status = XtCvtStringToCursor(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToCursor return value");
+ tet_infoline("TEST: Warning handler is called");
+ status = avs_get_event(1);
+ check_dec(1, status, "calls to warning handler count");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtStringToDimension/XtCvtStringToDimension.m b/xts5/Xt11/XtCvtStringToDimension/XtCvtStringToDimension.m
new file mode 100644
index 00000000..272d61f1
--- /dev/null
+++ b/xts5/Xt11/XtCvtStringToDimension/XtCvtStringToDimension.m
@@ -0,0 +1,327 @@
+Copyright (c) 2005 X.Org Foundation LLC
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+$Header: /cvs/xtest/xtest/xts5/tset/Xt11/XtCvtStringToDimension/XtCvtStringToDimension.m,v 1.1 2005-02-12 14:37:52 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/Xt11/XtCvtStringToDimension/XtCvtStringToDimension.m
+>>#
+>># Description:
+>># Tests for XtCvtStringToDimension()
+>>#
+>># Modifications:
+>># $Log: tcstdim.m,v $
+>># Revision 1.1 2005-02-12 14:37:52 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:28 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:25 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:33 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.1 1998/02/03 22:17:49 andy
+>># Added warning handler install to test 2 (SR 160).
+>>#
+>># Revision 5.0 1998/01/26 03:25:07 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:19:34 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:17 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+void XtWMH3_Proc(str1, str2, str3, str4, str5, car)
+String str1, str2, str3, str4, *str5;
+Cardinal *car;
+{
+ avs_set_event(2,1);
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtCvtStringToDimension Xt11
+Boolean
+XtCvtStringToDimension(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToDimension(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRDimension type shall convert the string specified in
+.A from
+to an XtRDimension type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Dimension specific */
+char *dimstr = "7";
+Dimension dim;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstdim1", "XtCvtStringToDimension");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = dimstr;
+ fromVal.size = strlen(dimstr)+1;
+ toVal.addr = (XtPointer) &dim;
+ toVal.size = sizeof(XtPointer);
+ status = XtCvtStringToDimension(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToDimension return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToDimension(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRDimension type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Dimension specific */
+char *dimstr = "7";
+Dimension dim;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstdim2", "XtCvtStringToDimension");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH3_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = dimstr;
+ fromVal.size = strlen(dimstr)+1;
+ toVal.addr = (XtPointer) &dim;
+ toVal.size = 0;
+ status = XtCvtStringToDimension(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToDimension return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(Dimension)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Dimension), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToDimension(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the string specified in
+.A from
+to an XtRDimension type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Dimension specific */
+char *dimstr = "7";
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstdim3", "XtCvtStringToDimension");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = dimstr;
+ fromVal.size = strlen(dimstr)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToDimension(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToDimension return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(Dimension)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Dimension), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good A
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToDimension(display, args, num_args, from, to, converter_data)
+when the conversion is not performed due to an improper value
+specified in
+.A from
+shall issue a warning message and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Dimension specific */
+char *dimstr = "this is not a number";
+Dimension dim;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcstdim4", "XtCvtStringToDimension");
+ tet_infoline("PREP: Set Warning Message Handler");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH3_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = dimstr;
+ fromVal.size = strlen(dimstr)+1;
+ toVal.addr = (XtPointer) &dim;
+ toVal.size = sizeof(XtPointer);
+ status = XtCvtStringToDimension(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToDimension return value");
+ tet_infoline("TEST: Warning message was generated");
+ status = avs_get_event(2);
+ check_dec(1, status, "warning handler called");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtStringToDisplay/XtCvtStringToDisplay.m b/xts5/Xt11/XtCvtStringToDisplay/XtCvtStringToDisplay.m
new file mode 100644
index 00000000..d35e752f
--- /dev/null
+++ b/xts5/Xt11/XtCvtStringToDisplay/XtCvtStringToDisplay.m
@@ -0,0 +1,327 @@
+Copyright (c) 2005 X.Org Foundation LLC
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+$Header: /cvs/xtest/xtest/xts5/tset/Xt11/XtCvtStringToDisplay/XtCvtStringToDisplay.m,v 1.1 2005-02-12 14:37:52 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/Xt11/XtCvtStringToDisplay/XtCvtStringToDisplay.m
+>>#
+>># Description:
+>># Tests for XtCvtStringToDisplay()
+>>#
+>># Modifications:
+>># $Log: tcstdisp.m,v $
+>># Revision 1.1 2005-02-12 14:37:52 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:29 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:25 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.1 1998/04/11 03:40:50 andy
+>># In tests 1-3 use config.display as the string to convert. req.4.W.00092.
+>>#
+>># Revision 6.0 1998/03/02 05:28:33 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.1 1998/02/03 22:17:50 andy
+>># Added warning handler install to test 2 (SR 160).
+>>#
+>># Revision 5.0 1998/01/26 03:25:08 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:19:35 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:19 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+void XtWMH3_Proc(str1, str2, str3, str4, str5, car)
+String str1, str2, str3, str4, *str5;
+Cardinal *car;
+{
+ avs_set_event(2,1);
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtCvtStringToDisplay Xt11
+Boolean
+XtCvtStringToDisplay(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToDisplay(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRDisplay type shall convert the string specified in
+.A from
+to an XtRDisplay type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Display specific */
+Display *dispres;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstdisp1", "XtCvtStringToDisplay");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = config.display;
+ fromVal.size = strlen(config.display)+1;
+ toVal.addr = (XtPointer) &dispres;
+ toVal.size = sizeof(Display *);
+ status = XtCvtStringToDisplay(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToDisplay return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToDisplay(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRDisplay type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Display specific */
+Display *dispres;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstdisp2", "XtCvtStringToDisplay");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH3_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = config.display;
+ fromVal.size = strlen(config.display)+1;
+ toVal.addr = (XtPointer) &dispres;
+ toVal.size = 0;
+ status = XtCvtStringToDisplay(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToDisplay return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(Display *)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Display *), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToDisplay(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the string specified in
+.A from
+to an XtRDisplay type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Display specific */
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstdisp3", "XtCvtStringToDisplay");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = config.display;
+ fromVal.size = strlen(config.display)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToDisplay(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToDisplay return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(Display *)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Display *), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good A
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToDisplay(display, args, num_args, from, to, converter_data)
+when the conversion is not performed due to an improper value
+specified in
+.A from
+shall issue a warning message and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Display specific */
+char *dispstr = "not a valid address to open";
+Display *dispres;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcstdisp4", "XtCvtStringToDisplay");
+ tet_infoline("PREP: Set Warning Message Handler");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH3_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = dispstr;
+ fromVal.size = strlen(dispstr)+1;
+ toVal.addr = (XtPointer) &dispres;
+ toVal.size = sizeof(Display *);
+ status = XtCvtStringToDisplay(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToDisplay return value");
+ tet_infoline("TEST: Warning message was generated");
+ status = avs_get_event(2);
+ check_dec(1, status, "warning handler called");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtStringToFile/XtCvtStringToFile.m b/xts5/Xt11/XtCvtStringToFile/XtCvtStringToFile.m
new file mode 100644
index 00000000..ae8d1e60
--- /dev/null
+++ b/xts5/Xt11/XtCvtStringToFile/XtCvtStringToFile.m
@@ -0,0 +1,327 @@
+Copyright (c) 2005 X.Org Foundation LLC
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+$Header: /cvs/xtest/xtest/xts5/tset/Xt11/XtCvtStringToFile/XtCvtStringToFile.m,v 1.1 2005-02-12 14:37:52 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/Xt11/XtCvtStringToFile/XtCvtStringToFile.m
+>>#
+>># Description:
+>># Tests for XtCvtStringToFile()
+>>#
+>># Modifications:
+>># $Log: tcstfile.m,v $
+>># Revision 1.1 2005-02-12 14:37:52 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:29 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:26 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:34 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.1 1998/02/03 22:17:51 andy
+>># Added warning handler install to test 2 (SR 160).
+>>#
+>># Revision 5.0 1998/01/26 03:25:08 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:19:37 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:21 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+void XtWMH3_Proc(str1, str2, str3, str4, str5, car)
+String str1, str2, str3, str4, *str5;
+Cardinal *car;
+{
+ avs_set_event(2,1);
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtCvtStringToFile Xt11
+Boolean
+XtCvtStringToFile(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToFile(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRFile type shall convert the string specified in
+.A from
+to an XtRFile type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to FILE specific */
+char *filename = "/dev/null";
+FILE *fptr;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstfile1", "XtCvtStringToFile");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = filename;
+ fromVal.size = strlen(filename)+1;
+ toVal.addr = (XtPointer) &fptr;
+ toVal.size = sizeof(FILE *);
+ status = XtCvtStringToFile(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToFile return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToFile(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRFile type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to File specific */
+char *filename = "/dev/null";
+FILE *fptr;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstfile2", "XtCvtStringToFile");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH3_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = filename;
+ fromVal.size = strlen(filename)+1;
+ toVal.addr = (XtPointer) &fptr;
+ toVal.size = 0;
+ status = XtCvtStringToFile(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToFile return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(FILE *)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(FILE *), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToFile(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the string specified in
+.A from
+to an XtRFile type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to File specific */
+char *filename = "/dev/null";
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstfile3", "XtCvtStringToFile");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = filename;
+ fromVal.size = strlen(filename)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToFile(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToFile return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(FILE *)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(FILE *), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good A
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToFile(display, args, num_args, from, to, converter_data)
+when the conversion is not performed due to an improper value
+specified in
+.A from
+shall issue a warning message and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to FILE specific */
+char *filename = "";
+FILE *fptr;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_set_event(2,0);
+ avs_xt_hier("Tcstfile4", "XtCvtStringToFile");
+ tet_infoline("PREP: Set Warning Message Handler");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH3_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = filename;
+ fromVal.size = strlen(filename)+1;
+ toVal.addr = (XtPointer) &fptr;
+ toVal.size = sizeof(FILE *);
+ status = XtCvtStringToFile(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToFile return value");
+ tet_infoline("TEST: Warning message was generated");
+ status = avs_get_event(2);
+ check_dec(1, status, "warning handler called");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtStringToFloat/XtCvtStringToFloat.m b/xts5/Xt11/XtCvtStringToFloat/XtCvtStringToFloat.m
new file mode 100644
index 00000000..afb20ef2
--- /dev/null
+++ b/xts5/Xt11/XtCvtStringToFloat/XtCvtStringToFloat.m
@@ -0,0 +1,343 @@
+Copyright (c) 2005 X.Org Foundation LLC
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+$Header: /cvs/xtest/xtest/xts5/tset/Xt11/XtCvtStringToFloat/XtCvtStringToFloat.m,v 1.1 2005-02-12 14:37:52 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/Xt11/XtCvtStringToFloat/XtCvtStringToFloat.m
+>>#
+>># Description:
+>># Tests for XtCvtStringToFloat()
+>>#
+>># Modifications:
+>># $Log: tcstflt.m,v $
+>># Revision 1.1 2005-02-12 14:37:52 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:30 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:26 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:34 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.2 1998/02/24 03:22:53 andy
+>># Made tests 3 and 4 contingent on coverage
+>>#
+>># Revision 5.1 1998/02/03 22:17:52 andy
+>># Added warning handler install to test 2 (SR 160).
+>>#
+>># Revision 5.0 1998/01/26 03:25:09 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:19:39 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:23 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+void XtWMH_Proc(str1, str2, str3, str4, str5, car)
+String str1, str2, str3, str4, *str5;
+Cardinal *car;
+{
+ avs_set_event(1,1);
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtCvtStringToFloat Xt11
+Boolean
+XtCvtStringToFloat(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToFloat(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRFloat type shall convert the string specified in
+.A from
+to an XtRFloat type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Float specific */
+char *fltstr = "10.3";
+float fltval;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstflt1", "XtCvtStringToFloat");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = fltstr;
+ fromVal.size = strlen(fltstr)+1;
+ toVal.addr = (XtPointer) &fltval;
+ toVal.size = sizeof(float);
+ status = XtCvtStringToFloat(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToFloat return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToFloat(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRFloat type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Float specific */
+char *fltstr = "10.3";
+float fltval;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstflt2", "XtCvtStringToFloat");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = fltstr;
+ fromVal.size = strlen(fltstr)+1;
+ toVal.addr = (XtPointer) &fltval;
+ toVal.size = 0;
+ status = XtCvtStringToFloat(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToFloat return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(float)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(float), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToFloat(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the string specified in
+.A from
+to an XtRFloat type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Float specific */
+char *fltstr = "10.3";
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+/*this test does not pass prior do R6.4gamma due to issues with
+consistency of the spec, test suite, and sample code*/
+if (config.coverage < 2) {
+ FORK(pid2);
+ avs_xt_hier("Tcstflt3", "XtCvtStringToFloat");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = fltstr;
+ fromVal.size = strlen(fltstr)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToFloat(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToFloat return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(float)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(float), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+} else {
+ tet_infoline("INFO: Test surpressed due to XT_COVERAGE value");
+ tet_result(TET_UNTESTED);
+}
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good A
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToFloat(display, args, num_args, from, to, converter_data)
+when the conversion is not performed due to an improper value
+specified in
+.A from
+shall issue a warning message and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Float specific */
+char *fltstr = "this is not even close to being a valid floating point number";
+float fltval;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+/*this test does not pass prior do R6.4gamma due to issues with
+consistency of the spec, test suite, and sample code*/
+if (config.coverage < 2) {
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_xt_hier("Tcstflt4", "XtCvtStringToFloat");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = fltstr;
+ fromVal.size = strlen(fltstr)+1;
+ toVal.addr = (XtPointer) &fltval;
+ toVal.size = sizeof(float);
+ status = XtCvtStringToFloat(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToFloat return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Warning handler is called");
+ status = avs_get_event(1);
+ check_dec(1, status, "calls to warning handler count");
+ tet_result(TET_PASS);
+} else {
+ tet_infoline("INFO: Test surpressed due to XT_COVERAGE value");
+ tet_result(TET_UNTESTED);
+}
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtStringToFont/XtCvtStringToFont.m b/xts5/Xt11/XtCvtStringToFont/XtCvtStringToFont.m
new file mode 100644
index 00000000..756dc773
--- /dev/null
+++ b/xts5/Xt11/XtCvtStringToFont/XtCvtStringToFont.m
@@ -0,0 +1,420 @@
+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/Xt11/XtCvtStringToFont/XtCvtStringToFont.m,v 1.1 2005-02-12 14:37:53 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/Xt11/XtCvtStringToFont/XtCvtStringToFont.m
+>>#
+>># Description:
+>># Tests for XtCvtStringToFont()
+>>#
+>># Modifications:
+>># $Log: tcstfont.m,v $
+>># Revision 1.1 2005-02-12 14:37:53 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:30 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:27 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:35 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.1 1998/02/03 22:17:54 andy
+>># Added warning handler install to test 2 (SR 160).
+>>#
+>># Revision 5.0 1998/01/26 03:25:09 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:19:40 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:25 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+static void XtWMH_Proc(name_good, type_good, class_good, defaultp, params, num_params)
+String name_good;
+String type_good;
+String class_good;
+String defaultp;
+String *params;
+Cardinal *num_params;
+{
+ avs_set_event(1,1);
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtCvtStringToFont Xt11
+Boolean
+XtCvtStringToFont(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToFont(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRFont type shall convert the string specified in
+.A from
+to an XtRFont type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Font specific */
+char *fontName = "fixed";
+Font font;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstfont1", "XtCvtStringToFont");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ args[0].addr = (XtPointer )&display;
+ args[0].size = sizeof(Display*);
+ num_args = 1;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = fontName;
+ fromVal.size = strlen(fontName)+1;
+ toVal.addr = (XtPointer) &font;
+ toVal.size = sizeof(Font);
+ status = XtCvtStringToFont(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToFont return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToFont(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRFont type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Font specific */
+char *fontName = "fixed";
+Font font;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstfont2", "XtCvtStringToFont");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ args[0].addr = (XtPointer )&display;
+ args[0].size = sizeof(Display*);
+ num_args = 1;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = fontName;
+ fromVal.size = strlen(fontName)+1;
+ toVal.addr = (XtPointer) &font;
+ toVal.size = 0;
+ status = XtCvtStringToFont(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToFont return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(Font)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Font), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToFont(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the string specified in
+.A from
+to an XtRFont type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Font specific */
+char *fontName = "fixed";
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstfont3", "XtCvtStringToFont");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ args[0].addr = (XtPointer )&display;
+ args[0].size = sizeof(Display*);
+ num_args = 1;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = fontName;
+ fromVal.size = strlen(fontName)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToFont(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToFont return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(Font)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Font), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToFont(display, args, num_args, from, to, converter_data)
+when
+.A args
+specifies an improper value shall not perform a conversion,
+issue a warning message, and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Font specific */
+char *fontName = "fixed";
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstfont4", "XtCvtStringToFont");
+ avs_set_event(1,0);
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args incorrectly");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = fontName;
+ fromVal.size = strlen(fontName)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToFont(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "conversion status");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Warning handler is called");
+ status = avs_get_event(1);
+ check_dec(1, status, "calls to warning handler count");
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+On a successful call to
+Boolean XtCvtStringToFont(display, args, num_args, from, to, converter_data)
+when
+.A from
+specifies the constant XtDefaultFont and the application resource
+database contains the resource name "xtDefaultFont", class
+"XtDefaultFont" the converted data shall specify the value of this resource.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Font specific */
+char *fontName = XtDefaultFont;
+Font font;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstfont5", "XtCvtStringToFont");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ args[0].addr = (XtPointer )&display;
+ args[0].size = sizeof(Display*);
+ num_args = 1;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = fontName;
+ fromVal.size = strlen(fontName)+1;
+ toVal.addr = (XtPointer) &font;
+ toVal.size = sizeof(Font);
+ status = XtCvtStringToFont(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToFont return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good D 2
+If the implementation is X11R5 or later:
+On a successful call to
+Boolean XtCvtStringToFont(display, args, num_args, from, to, converter_data)
+when
+.A from
+specifies the constant XtDefaultFont, the application resource
+database does not contain the resource name "xtDefaultFont", class
+"XtDefaultFont" the converted data shall specify a font in an
+implementation-defined ISO 8859-1 character set encoding.
+>>ASSERTION Good D 2
+If the implementation is X11R5 or later:
+On a successful call to
+Boolean XtCvtStringToFont(display, args, num_args, from, to, converter_data)
+when
+.A from
+specifies the constant XtDefaultFont, the application resource
+database contains the resource name "xtDefaultFont", class
+"XtDefaultFont", and the font name specified in this resource cannot be
+successfully opened the converted data shall specify a font in an
+implementation-defined ISO 8859-1 character set encoding.
+>>ASSERTION Good D 2
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToFont(display, args, num_args, from, to, converter_data)
+when
+.A from
+specifies the constant XtDefaultFont, the application resource
+database contains the resource name "xtDefaultFont", class
+"XtDefaultFont", the font name specified in this resource cannot be
+successfully opened, and a font in an implementation-defined
+ISO 8859-1 character set encoding is not found shall issue a
+warning message and return False.
diff --git a/xts5/Xt11/XtCvtStringToFontSet/XtCvtStringToFontSet.m b/xts5/Xt11/XtCvtStringToFontSet/XtCvtStringToFontSet.m
new file mode 100644
index 00000000..4c3cd72c
--- /dev/null
+++ b/xts5/Xt11/XtCvtStringToFontSet/XtCvtStringToFontSet.m
@@ -0,0 +1,465 @@
+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/Xt11/XtCvtStringToFontSet/XtCvtStringToFontSet.m,v 1.1 2005-02-12 14:37:53 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/Xt11/XtCvtStringToFontSet/XtCvtStringToFontSet.m
+>>#
+>># Description:
+>># Tests for XtCvtStringToFontSet()
+>>#
+>># Modifications:
+>># $Log: tcstfset.m,v $
+>># Revision 1.1 2005-02-12 14:37:53 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:31 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:28 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:35 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.1 1998/02/03 22:17:55 andy
+>># Added warning handler install to test 2 (SR 160).
+>>#
+>># Revision 5.0 1998/01/26 03:25:10 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:19:42 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:28 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+#include <locale.h>
+
+void XtWMH_Proc(str1, str2, str3, str4, str5, car)
+String str1, str2, str3, str4, *str5;
+Cardinal *car;
+{
+ avs_set_event(1,1);
+}
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtCvtStringToFontSet Xt11
+Boolean
+XtCvtStringToFontSet(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToFontSet(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRFontSet type shall convert the string specified in
+.A from
+to an XtRFontSet type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to FontSet specific */
+char *locale;
+char *fontName = "fixed";
+XFontSet fontset;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstfset1", "XtCvtStringToFontSet");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ args[0].addr = (XtPointer )&display;
+ args[0].size = sizeof(Display*);
+ locale = (char *)setlocale(LC_ALL, "C");
+ args[1].addr = (XtPointer )&locale;
+ args[1].size = sizeof(char*);
+ num_args = 2;
+ tet_infoline("TEST: Check conversion succeeds");
+ fromVal.addr = ximconfig.fontsets;
+ fromVal.size = strlen(ximconfig.fontsets)+1;
+ toVal.addr = (XtPointer) &fontset;
+ toVal.size = sizeof(XFontSet);
+ status = XtCvtStringToFontSet(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToFontSet return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToFontSet(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRFontSet type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to FontSet specific */
+char *locale;
+char *fontName = "fixed";
+XFontSet fontset;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstfset2", "XtCvtStringToFontSet");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ args[0].addr = (XtPointer )&display;
+ args[0].size = sizeof(Display*);
+ locale = (char *)setlocale(LC_ALL, "C");
+ args[1].addr = (XtPointer )&locale;
+ args[1].size = sizeof(char*);
+ num_args = 2;
+ tet_infoline("TEST: Check conversion fails");
+ fromVal.addr = ximconfig.fontsets;
+ fromVal.size = strlen(ximconfig.fontsets)+1;
+ toVal.addr = (XtPointer) &fontset;
+ toVal.size = 0;
+ status = XtCvtStringToFontSet(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToFontSet return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(XFontSet)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(XFontSet), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToFontSet(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the string specified in
+.A from
+to an XtRFontSet type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to FontSet specific */
+char *locale;
+char *fontName = "fixed";
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstfset3", "XtCvtStringToFontSet");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ args[0].addr = (XtPointer )&display;
+ args[0].size = sizeof(Display*);
+ locale = (char *)setlocale(LC_ALL, "C");
+ args[1].addr = (XtPointer )&locale;
+ args[1].size = sizeof(char*);
+ num_args = 2;
+ tet_infoline("TEST: Check conversion succeeds");
+ fromVal.addr = ximconfig.fontsets;
+ fromVal.size = strlen(ximconfig.fontsets)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToFontSet(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToFontSet return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(XFontSet)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(XFontSet), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToFontSet(display, args, num_args, from, to, converter_data)
+when
+.A args
+specifies an improper value shall not perform a conversion,
+issue a warning message, and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to FontSet specific */
+char *locale;
+char *fontName = "fixed";
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstfset4", "XtCvtStringToFontSet");
+ avs_set_event(1,0);
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args incorrectly");
+ num_args = 0;
+ tet_infoline("TEST: Check conversion fails");
+ fromVal.addr = ximconfig.fontsets;
+ fromVal.size = strlen(ximconfig.fontsets)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToFontSet(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "conversion status");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Warning handler is called");
+ status = avs_get_event(1);
+ check_dec(1, status, "calls to warning handler count");
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good B 0
+If the implementation is X11R5 or later:
+On a successful call to
+Boolean XtCvtStringToFontSet(display, args, num_args, from, to, converter_data)
+when
+.A from
+specifies the constant XtDefaultFontSet and the application resource
+database contains the resource name "xtDefaultFontSet", class
+"XtDefaultFontSet" the converted value shall specify this
+resource value.
+>>ASSERTION Good D 2
+If the implementation is X11R5 or later:
+On a successful call to
+Boolean XtCvtStringToFontSet(display, args, num_args, from, to, converter_data)
+when
+.A from
+specifies the constant XtDefaultFontSet and the application resource
+database does not contain the resource name "xtDefaultFontSet", class
+"XtDefaultFontSet" the converted data shall specify an
+implementation-defined font set.
+>>ASSERTION Good D 2
+If the implementation is X11R5 or later:
+On a successful call to
+Boolean XtCvtStringToFontSet(display, args, num_args, from, to, converter_data)
+when
+.A from
+specifies the constant XtDefaultFontSet, the application resource
+database contains the resource name "xtDefaultFontSet", class
+"XtDefaultFontSet", and a font set could not be created from the base
+font name list specified by this resource the converted data shall
+specify an implementation-defined font set.
+>>ASSERTION Good D 2
+If the implementation is X11R5 or later:
+On a call to
+Boolean XtCvtStringToFontSet(display, args, num_args, from, to, converter_data)
+when
+.A from
+specifies the constant XtDefaultFontSet, the application resource
+database contains the resource name "xtDefaultFontSet", class
+"XtDefaultFontSet", a font set cannot be created from the base font
+name list specified by this resource, and an implementation-defined
+font set could not be created it shall issue a warning message and
+return False.
+>>ASSERTION Good D 2
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToFontSet(display, args, num_args, from, to, converter_data)
+when
+.A from
+specifies the constant XtDefaultFontSet and a font set could
+be created that has missing character sets shall return the
+partial font set in and issue a warning message.
+>>ASSERTION Good B 0
+If the implementation is X11R5 or later:
+On a call to
+Boolean XtCvtStringToFontSet(display, args, num_args, from, to, converter_data)
+the resource type conversion performed shall be locale specific.
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToFontSet(display, args, num_args, from, to, converter_data)
+when the conversion is not performed due to an improper value
+specified in
+.A from
+shall issue a warning message and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to FontSet specific */
+char *locale;
+char *fontName = "-1";
+XFontSet fontset;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_xt_hier("Tcstfset5", "XtCvtStringToFontSet");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ args[0].addr = (XtPointer )&display;
+ args[0].size = sizeof(Display*);
+ locale = (char *)setlocale(LC_ALL, "C");
+ args[1].addr = (XtPointer )&locale;
+ args[1].size = sizeof(char*);
+ num_args = 2;
+ tet_infoline("TEST: Check conversion fails");
+ fromVal.addr = fontName;
+ fromVal.size = strlen(fontName)+1;
+ toVal.addr = (XtPointer) &fontset;
+ toVal.size = sizeof(XFontSet);
+ status = XtCvtStringToFontSet(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToFontSet return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Warning handler is called");
+ status = avs_get_event(1);
+ check_dec(1, status, "calls to warning handler count");
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtStringToFontStruct/XtCvtStringToFontStruct.m b/xts5/Xt11/XtCvtStringToFontStruct/XtCvtStringToFontStruct.m
new file mode 100644
index 00000000..7015ae0a
--- /dev/null
+++ b/xts5/Xt11/XtCvtStringToFontStruct/XtCvtStringToFontStruct.m
@@ -0,0 +1,419 @@
+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/Xt11/XtCvtStringToFontStruct/XtCvtStringToFontStruct.m,v 1.1 2005-02-12 14:37:53 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/Xt11/XtCvtStringToFontStruct/XtCvtStringToFontStruct.m
+>>#
+>># Description:
+>># Tests for XtCvtStringToFontStruct()
+>>#
+>># Modifications:
+>># $Log: tcstfstr.m,v $
+>># Revision 1.1 2005-02-12 14:37:53 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:31 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:28 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:36 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.1 1998/02/03 22:17:58 andy
+>># Added warning handler install to test 2 (SR 160).
+>>#
+>># Revision 5.0 1998/01/26 03:25:10 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:19:44 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:30 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+void XtWMH_Proc(str1, str2, str3, str4, str5, car)
+String str1, str2, str3, str4, *str5;
+Cardinal *car;
+{
+ avs_set_event(1,1);
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtCvtStringToFontStruct Xt11
+Boolean
+XtCvtStringToFontStruct(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToFontStruct(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRFontStruct type shall convert the string specified in
+.A from
+to an XtRFontStruct type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to FontStruct specific */
+char *fontName = "fixed";
+XFontStruct *fontstr;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstfstr1", "XtCvtStringToFontStruct");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ args[0].addr = (XtPointer )&display;
+ args[0].size = sizeof(Display*);
+ num_args = 1;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = fontName;
+ fromVal.size = strlen(fontName)+1;
+ toVal.addr = (XtPointer) &fontstr;
+ toVal.size = sizeof(XFontStruct*);
+ status = XtCvtStringToFontStruct(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToFontStruct return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToFontStruct(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRFontStruct type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to FontStruct specific */
+char *fontName = "fixed";
+XFontStruct *fontstr;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstfstr2", "XtCvtStringToFontStruct");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ args[0].addr = (XtPointer )&display;
+ args[0].size = sizeof(Display*);
+ num_args = 1;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = fontName;
+ fromVal.size = strlen(fontName)+1;
+ toVal.addr = (XtPointer) &fontstr;
+ toVal.size = 0;
+ status = XtCvtStringToFontStruct(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToFontStruct return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(XFontStruct *)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(XFontStruct *), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToFontStruct(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the string specified in
+.A from
+to an XtRFontStruct type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to FontStruct specific */
+char *fontName = "fixed";
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstfstr3", "XtCvtStringToFontStruct");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ args[0].addr = (XtPointer )&display;
+ args[0].size = sizeof(Display*);
+ num_args = 1;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = fontName;
+ fromVal.size = strlen(fontName)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToFontStruct(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToFontStruct return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(XFontStruct *)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(XFontStruct *), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToFontStruct(display, args, num_args, from, to, converter_data)
+when
+.A args
+specifies an improper value shall not perform a conversion,
+issue a warning message, and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to FontStruct specific */
+char *fontName = "fixed";
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_xt_hier("Tcstfstr4", "XtCvtStringToFontStruct");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args incorrectly");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = fontName;
+ fromVal.size = strlen(fontName)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToFontStruct(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "conversion status");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Warning handler is called");
+ status = avs_get_event(1);
+ check_dec(1, status, "calls to warning handler count");
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+On a successful call to
+Boolean XtCvtStringToFontStruct(display, args, num_args, from, to, converter_data)
+when
+.A from
+specifies the constant XtDefaultFont and the application resource
+database contains the resource name "xtDefaultFont", class
+"XtDefaultFont" the converted data shall specify this resource
+value.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to FontStruct specific */
+char *fontName = XtDefaultFont;
+XFontStruct *fontstr;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstfstr5", "XtCvtStringToFontStruct");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ args[0].addr = (XtPointer )&display;
+ args[0].size = sizeof(Display*);
+ num_args = 1;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = fontName;
+ fromVal.size = strlen(fontName)+1;
+ toVal.addr = (XtPointer) &fontstr;
+ toVal.size = sizeof(XFontStruct*);
+ status = XtCvtStringToFontStruct(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToFontStruct return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good D 2
+If the implementation is X11R5 or later:
+On a successful call to
+Boolean XtCvtStringToFontStruct(display, args, num_args, from, to, converter_data)
+when
+.A from
+specifies the constant XtDefaultFont, the application resource
+database does not contain the resource name "xtDefaultFont", class
+"XtDefaultFont" the converted data shall specify a font in an
+implementation-defined ISO 8859-1 character set encoding.
+>>ASSERTION Good D 2
+If the implementation is X11R5 or later:
+On a successful call to
+Boolean XtCvtStringToFontStruct(display, args, num_args, from, to, converter_data)
+when
+.A from
+specifies the constant XtDefaultFont, the application resource
+database contains the resource name "xtDefaultFont", class
+"XtDefaultFont", and the font specified in this resource cannot be
+successfully opened the converted data shall specify a font in an
+implementation-defined ISO 8859-1 character set encoding.
+>>ASSERTION Good D 2
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToFontStruct(display, args, num_args, from, to, converter_data)
+when
+.A from
+specifies the constant XtDefaultFont, the application resource
+database contains the resource name "xtDefaultFont", class
+"XtDefaultFont", the font specified in this resource cannot be
+successfully opened, and the font in an implementation-defined
+ISO 8859-1 character set encoding is not found shall issue a
+warning message and return False.
diff --git a/xts5/Xt11/XtCvtStringToInitialState/XtCvtStringToInitialState.m b/xts5/Xt11/XtCvtStringToInitialState/XtCvtStringToInitialState.m
new file mode 100644
index 00000000..681d2e49
--- /dev/null
+++ b/xts5/Xt11/XtCvtStringToInitialState/XtCvtStringToInitialState.m
@@ -0,0 +1,430 @@
+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/Xt11/XtCvtStringToInitialState/XtCvtStringToInitialState.m,v 1.1 2005-02-12 14:37:53 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/Xt11/XtCvtStringToInitialState/XtCvtStringToInitialState.m
+>>#
+>># Description:
+>># Tests for XtCvtStringToInitialState()
+>>#
+>># Modifications:
+>># $Log: tcstinit.m,v $
+>># Revision 1.1 2005-02-12 14:37:53 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:32 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:29 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:36 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.1 1998/02/03 22:18:00 andy
+>># Added warning handler install to test 2 (SR 160).
+>>#
+>># Revision 5.0 1998/01/26 03:25:11 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:19:46 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:32 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+void XtWMH_Proc(str1, str2, str3, str4, str5, car)
+String str1, str2, str3, str4, *str5;
+Cardinal *car;
+{
+ avs_set_event(1,1);
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtCvtStringToInitialState Xt11
+Boolean
+XtCvtStringToInitialState(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToInitialState(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRInitialState type shall convert the string specified in
+.A from
+to an XtRInitialState type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to InitialState specific */
+char *statestr = "IconicState";
+int initstate;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstinit1", "XtCvtStringToInitialState");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Check conversion succeeds");
+ fromVal.addr = statestr;
+ fromVal.size = strlen(statestr)+1;
+ toVal.addr = (XtPointer) &initstate;
+ toVal.size = sizeof(int);
+ status = XtCvtStringToInitialState(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToInitialState return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToInitialState(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRInitialState type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to InitialState specific */
+char *statestr = "NormalState";
+int initstate;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstinit2", "XtCvtStringToInitialState");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Check conversion fails");
+ fromVal.addr = statestr;
+ fromVal.size = strlen(statestr)+1;
+ toVal.addr = (XtPointer) &initstate;
+ toVal.size = 0;
+ status = XtCvtStringToInitialState(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToInitialState return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size == 0) {
+ tet_infoline("ERROR: toVal.size not set");
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToInitialState(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the string specified in
+.A from
+to an XtRInitialState type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to InitialState specific */
+char *statestr = "NormalState";
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstinit3", "XtCvtStringToInitialState");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Check conversion succeeds");
+ fromVal.addr = statestr;
+ fromVal.size = strlen(statestr)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToInitialState(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ tet_infoline("TEST: Check return status is True");
+ check_dec(True, status, "XtCvtStringToInitialState return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (!toVal.size) {
+ sprintf(ebuf, "ERROR: to->size was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good A
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToInitialState(display, args, num_args, from, to, converter_data)
+when the conversion is not performed due to an improper value
+specified in
+.A from
+shall issue a warning message and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to InitialState specific */
+char *statestr = "This should not be valid as a state";
+int initstate;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_xt_hier("Tcstinit4", "XtCvtStringToInitialState");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Check conversion fails");
+ fromVal.addr = statestr;
+ fromVal.size = strlen(statestr)+1;
+ toVal.addr = (XtPointer) &initstate;
+ toVal.size = sizeof(int);
+ status = XtCvtStringToInitialState(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToInitialState return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Warning handler is called");
+ status = avs_get_event(1);
+ check_dec(1, status, "calls to warning handler count");
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good A
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToInitialState(display, args, num_args, from, to, converter_data)
+when
+.A from
+specifies the string NormalState shall convert it to an XtRInitialState
+value as specified by the X Window System File Formats and Application
+Conventions specification.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to InitialState specific */
+char *statestr = "NormalState";
+int initstate;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstinit5", "XtCvtStringToInitialState");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Check conversion succeeds");
+ fromVal.addr = statestr;
+ fromVal.size = strlen(statestr)+1;
+ toVal.addr = (XtPointer) &initstate;
+ toVal.size = sizeof(int);
+ status = XtCvtStringToInitialState(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToInitialState return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good A
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToInitialState(display, args, num_args, from, to, converter_data)
+when
+.A from
+specifies the string IconicState shall convert it to an XtRInitialState
+value as specified by the X Window System File Formats and Application
+Conventions specification.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to InitialState specific */
+char *statestr = "IconicState";
+int initstate;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstinit1", "XtCvtStringToInitialState");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Check conversion succeeds");
+ fromVal.addr = statestr;
+ fromVal.size = strlen(statestr)+1;
+ toVal.addr = (XtPointer) &initstate;
+ toVal.size = sizeof(int);
+ status = XtCvtStringToInitialState(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToInitialState return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtStringToInt/XtCvtStringToInt.m b/xts5/Xt11/XtCvtStringToInt/XtCvtStringToInt.m
new file mode 100644
index 00000000..048f821c
--- /dev/null
+++ b/xts5/Xt11/XtCvtStringToInt/XtCvtStringToInt.m
@@ -0,0 +1,327 @@
+Copyright (c) 2005 X.Org Foundation LLC
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+$Header: /cvs/xtest/xtest/xts5/tset/Xt11/XtCvtStringToInt/XtCvtStringToInt.m,v 1.1 2005-02-12 14:37:53 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/Xt11/XtCvtStringToInt/XtCvtStringToInt.m
+>>#
+>># Description:
+>># Tests for XtCvtStringToInt()
+>>#
+>># Modifications:
+>># $Log: tcstint.m,v $
+>># Revision 1.1 2005-02-12 14:37:53 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:32 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:29 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:37 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.1 1998/02/03 22:18:02 andy
+>># Added warning handler install to test 2 (SR 160).
+>>#
+>># Revision 5.0 1998/01/26 03:25:11 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:19:48 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:35 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+void XtWMH_Proc(str1, str2, str3, str4, str5, car)
+String str1, str2, str3, str4, *str5;
+Cardinal *car;
+{
+ avs_set_event(1,1);
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtCvtStringToInt Xt11
+Boolean
+XtCvtStringToInt(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToInt(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRInt type shall convert the string specified in
+.A from
+to an XtRInt type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Int specific */
+char *intstr = "1";
+int num;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstint1", "XtCvtStringToInt");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = intstr;
+ fromVal.size = strlen(intstr)+1;
+ toVal.addr = (XtPointer) &num;
+ toVal.size = sizeof(int);
+ status = XtCvtStringToInt(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToInt return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToInt(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRInt type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Int specific */
+char *intstr = "15";
+int num;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstint2", "XtCvtStringToInt");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = intstr;
+ fromVal.size = strlen(intstr)+1;
+ toVal.addr = (XtPointer) &num;
+ toVal.size = 0;
+ status = XtCvtStringToInt(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToInt return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(int)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(int), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToInt(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the string specified in
+.A from
+to an XtRInt type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Int specific */
+char *intstr = "1";
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstint3", "XtCvtStringToInt");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = intstr;
+ fromVal.size = strlen(intstr)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToInt(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ tet_infoline("TEST: Return status is True");
+ check_dec(True, status, "XtCvtStringToInt return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(int)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(int), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good A
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToInt(display, args, num_args, from, to, converter_data)
+when the conversion is not performed due to an improper value
+specified in
+.A from
+shall issue a warning message and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Int specific */
+char *intstr = "not a number at all";
+int num;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_xt_hier("Tcstint4", "XtCvtStringToInt");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = intstr;
+ fromVal.size = strlen(intstr)+1;
+ toVal.addr = (XtPointer) &num;
+ toVal.size = sizeof(int);
+ status = XtCvtStringToInt(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToInt return value");
+ tet_infoline("TEST: Warning handler is called");
+ status = avs_get_event(1);
+ check_dec(1, status, "calls to warning handler count");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtStringToPixel/XtCvtStringToPixel.m b/xts5/Xt11/XtCvtStringToPixel/XtCvtStringToPixel.m
new file mode 100644
index 00000000..0c6c9886
--- /dev/null
+++ b/xts5/Xt11/XtCvtStringToPixel/XtCvtStringToPixel.m
@@ -0,0 +1,699 @@
+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/Xt11/XtCvtStringToPixel/XtCvtStringToPixel.m,v 1.1 2005-02-12 14:37:53 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/Xt11/XtCvtStringToPixel/XtCvtStringToPixel.m
+>>#
+>># Description:
+>># Tests for XtCvtStringToPixel()
+>>#
+>># Modifications:
+>># $Log: tcstpix.m,v $
+>># Revision 1.1 2005-02-12 14:37:53 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:33 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:30 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:37 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.1 1998/02/03 22:18:04 andy
+>># Added warning handler install to test 2 (SR 160).
+>>#
+>># Revision 5.0 1998/01/26 03:25:12 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.2 1998/01/13 04:43:01 andy
+>># Changed closure_ret from XtPointer * to XtPointer (SR 139).
+>>#
+>># Revision 4.0 1995/12/15 09:19:49 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:37 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+void XtWMH_Proc(str1, str2, str3, str4, str5, car)
+String str1, str2, str3, str4, *str5;
+Cardinal *car;
+{
+ avs_set_event(1,1);
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtCvtStringToPixel Xt11
+Boolean
+XtCvtStringToPixel(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToPixel(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRPixel type shall convert the string specified in
+.A from
+to an XtRPixel type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+Boolean closure;
+XtPointer closure_ret = (XtPointer *) &closure;
+/* String to Pixel specific */
+Screen *screen;
+Colormap colormap;
+char *pixstr = "black";
+Pixel res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstpix1", "XtCvtStringToPixel");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ screen = DefaultScreenOfDisplay(display);
+ args[0].addr = (XtPointer )&screen;
+ args[0].size = sizeof(Screen*);
+ colormap = DefaultColormapOfScreen(screen);
+ args[1].addr = (XtPointer) &colormap;
+ args[1].size = sizeof(Colormap);
+ num_args = 2;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = pixstr;
+ fromVal.size = strlen(pixstr)+1;
+ toVal.addr = (XtPointer)&res;
+ toVal.size = sizeof(Pixel);
+ res = 0;
+ status = XtCvtStringToPixel(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ &closure_ret);
+ tet_infoline("TEST: Return value");
+ check_dec(True, status, "XtCvtStringToPixel return value");
+ check_dec(XBlackPixelOfScreen(DefaultScreenOfDisplay(display)), res, "returned pixel");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToPixel(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRPixel type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+Boolean closure;
+XtPointer closure_ret = (XtPointer *) &closure;
+/* String to Pixel specific */
+Screen *screen;
+Colormap colormap;
+char *pixstr = "XtDefaultBackground";
+Pixel res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstpix2", "XtCvtStringToPixel");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ screen = DefaultScreenOfDisplay(display);
+ args[0].addr = (XtPointer )&screen;
+ args[0].size = sizeof(Screen*);
+ colormap = DefaultColormapOfScreen(screen);
+ args[1].addr = (XtPointer) &colormap;
+ args[1].size = sizeof(Colormap);
+ num_args = 2;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = pixstr;
+ fromVal.size = strlen(pixstr)+1;
+ toVal.addr = (XtPointer) &res;
+ toVal.size = 0;
+ status = XtCvtStringToPixel(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ &closure_ret);
+ check_dec(False, status, "XtCvtStringToPixel return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(Pixel)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Pixel), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToPixel(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the string specified in
+.A from
+to an XtRPixel type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+Boolean closure;
+XtPointer closure_ret = (XtPointer *) &closure;
+/* String to Pixel specific */
+Screen *screen;
+Colormap colormap;
+char *pixstr = "XtDefaultBackground";
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstpix3", "XtCvtStringToPixel");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ screen = DefaultScreenOfDisplay(display);
+ args[0].addr = (XtPointer )&screen;
+ args[0].size = sizeof(Screen*);
+ colormap = DefaultColormapOfScreen(screen);
+ args[1].addr = (XtPointer) &colormap;
+ args[1].size = sizeof(Colormap);
+ num_args = 2;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = pixstr;
+ fromVal.size = strlen(pixstr)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToPixel(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ &closure_ret);
+ check_dec(True, status, "XtCvtStringToPixel return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(Pixel)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Pixel), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good A
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToPixel(display, args, num_args, from, to, converter_data)
+when the conversion is not performed due to an improper value
+specified in
+.A from
+shall issue a warning message and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+Boolean closure;
+XtPointer closure_ret = (XtPointer *) &closure;
+/* String to Pixel specific */
+Screen *screen;
+Colormap colormap;
+char *pixstr = "not a real color name";
+Pixel res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_xt_hier("Tcstpix4", "XtCvtStringToPixel");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ screen = DefaultScreenOfDisplay(display);
+ args[0].addr = (XtPointer )&screen;
+ args[0].size = sizeof(Screen*);
+ colormap = DefaultColormapOfScreen(screen);
+ args[1].addr = (XtPointer) &colormap;
+ args[1].size = sizeof(Colormap);
+ num_args = 2;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = pixstr;
+ fromVal.size = strlen(pixstr)+1;
+ toVal.addr = (XtPointer) &res;
+ toVal.size = sizeof(Pixel);
+ status = XtCvtStringToPixel(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ &closure_ret);
+ check_dec(False, status, "XtCvtStringToPixel return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Warning handler is called");
+ status = avs_get_event(1);
+ check_dec(1, status, "calls to warning handler count");
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToPixel(display, args, num_args, from, to, converter_data)
+when
+.A args
+specifies an improper value shall not perform a conversion,
+issue a warning message, and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+Boolean closure;
+XtPointer closure_ret = (XtPointer *) &closure;
+/* String to Pixel specific */
+char *pixstr = "XtDefaultBackground";
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_xt_hier("Tcstpix5", "XtCvtStringToPixel");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args incorrectly");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = pixstr;
+ fromVal.size = strlen(pixstr)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToPixel(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ &closure_ret);
+ check_dec(False, status, "conversion status");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Warning handler is called");
+ status = avs_get_event(1);
+ check_dec(1, status, "calls to warning handler count");
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+On a successful call to
+Boolean XtCvtStringToPixel(display, args, num_args, from, to, converter_data)
+when
+.A from
+specifies the constant XtDefaultForeground and the resource
+.S reverseVideo
+is not True the converted data shall specify the black pixel value
+of the widget screen specified in
+.A args.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+Boolean closure;
+XtPointer closure_ret = (XtPointer *) &closure;
+/* String to Pixel specific */
+Screen *screen;
+Colormap colormap;
+char *pixstr = XtDefaultBackground;
+Pixel res;
+pid_t pid2;
+int argcount = 2;
+char *cargs[] = {NULL, "-rv", NULL};
+char **arg_string;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ arg_string = &cargs[0];
+ avs_xt_hier_args("Tcstpix6", "XtCvtStringToPixel", arg_string, argcount);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ screen = DefaultScreenOfDisplay(display);
+ args[0].addr = (XtPointer )&screen;
+ args[0].size = sizeof(Screen*);
+ colormap = DefaultColormapOfScreen(screen);
+ args[1].addr = (XtPointer) &colormap;
+ args[1].size = sizeof(Colormap);
+ num_args = 2;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = pixstr;
+ fromVal.size = strlen(pixstr)+1;
+ toVal.addr = (XtPointer) &res;
+ toVal.size = sizeof(Pixel);
+ status = XtCvtStringToPixel(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ &closure_ret);
+ check_dec(True, status, "XtCvtStringToPixel return value");
+ tet_infoline("TEST: Conversion result");
+ check_dec(XBlackPixelOfScreen(DefaultScreenOfDisplay(display)), res, "returned pixel");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+On a successful call to
+Boolean XtCvtStringToPixel(display, args, num_args, from, to, converter_data)
+when
+.A from
+specifies the constant XtDefaultForeground and the resource
+.S reverseVideo
+is True the converted data shall specify the white pixel value of the
+widget screen specified in
+.A args.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+Boolean closure;
+XtPointer closure_ret = (XtPointer *) &closure;
+/* String to Pixel specific */
+Screen *screen;
+Colormap colormap;
+char *pixstr = XtDefaultForeground;
+Pixel res;
+pid_t pid2;
+int argcount = 2;
+char *cargs[] = {NULL, "-rv", NULL};
+char **arg_string;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ arg_string = &cargs[0];
+ avs_xt_hier_args("Tcstpix7", "XtCvtStringToPixel", arg_string, argcount);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ screen = DefaultScreenOfDisplay(display);
+ args[0].addr = (XtPointer )&screen;
+ args[0].size = sizeof(Screen*);
+ colormap = DefaultColormapOfScreen(screen);
+ args[1].addr = (XtPointer) &colormap;
+ args[1].size = sizeof(Colormap);
+ num_args = 2;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = pixstr;
+ fromVal.size = strlen(pixstr)+1;
+ toVal.addr = (XtPointer) &res;
+ toVal.size = sizeof(Pixel);
+ status = XtCvtStringToPixel(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ &closure_ret);
+ check_dec(True, status, "XtCvtStringToPixel return value");
+ tet_infoline("TEST: Conversion result");
+ check_dec(XWhitePixelOfScreen(DefaultScreenOfDisplay(display)), res, "returned pixel");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+On a successful call to
+Boolean XtCvtStringToPixel(display, args, num_args, from, to, converter_data)
+when
+.A from
+specifies the constant XtDefaultBackground and the resource
+.S reverseVideo
+is not True the converted data shall specify the white pixel value
+of the widget screen specified in
+.A args.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+Boolean closure;
+XtPointer closure_ret = (XtPointer *) &closure;
+/* String to Pixel specific */
+Screen *screen;
+Colormap colormap;
+char *pixstr = "XtDefaultBackground";
+Pixel res;
+pid_t pid2;
+int argcount = 2;
+char *cargs[] = {NULL, "+rv", NULL};
+char **arg_string;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ arg_string = &cargs[0];
+ avs_xt_hier_args("Tcstpix8", "XtCvtStringToPixel", arg_string, argcount);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ screen = DefaultScreenOfDisplay(display);
+ args[0].addr = (XtPointer )&screen;
+ args[0].size = sizeof(Screen*);
+ colormap = DefaultColormapOfScreen(screen);
+ args[1].addr = (XtPointer) &colormap;
+ args[1].size = sizeof(Colormap);
+ num_args = 2;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = pixstr;
+ fromVal.size = strlen(pixstr)+1;
+ toVal.addr = (XtPointer) &res;
+ toVal.size = sizeof(Pixel);
+ status = XtCvtStringToPixel(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ &closure_ret);
+ check_dec(True, status, "XtCvtStringToPixel return value");
+ tet_infoline("TEST: Conversion result");
+ check_dec(XWhitePixelOfScreen(DefaultScreenOfDisplay(display)), res, "returned pixel");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+On a successful call to
+Boolean XtCvtStringToPixel(display, args, num_args, from, to, converter_data)
+when
+.A from
+specifies the constant XtDefaultForeground and the resource
+.S reverseVideo
+is True the converted data shall specify the black pixel value
+of the widget screen specified in
+.A args.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+Boolean closure;
+XtPointer closure_ret = (XtPointer *) &closure;
+/* String to Pixel specific */
+Screen *screen;
+Colormap colormap;
+char *pixstr = XtDefaultForeground;
+Pixel res;
+pid_t pid2;
+int argcount = 2;
+char *cargs[] = {NULL, "+rv", NULL};
+char **arg_string;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ arg_string = &cargs[0];
+ avs_xt_hier_args("Tcstpix9", "XtCvtStringToPixel", arg_string, argcount);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ screen = DefaultScreenOfDisplay(display);
+ args[0].addr = (XtPointer )&screen;
+ args[0].size = sizeof(Screen*);
+ colormap = DefaultColormapOfScreen(screen);
+ args[1].addr = (XtPointer) &colormap;
+ args[1].size = sizeof(Colormap);
+ num_args = 2;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = pixstr;
+ fromVal.size = strlen(pixstr)+1;
+ toVal.addr = (XtPointer) &res;
+ toVal.size = sizeof(Pixel);
+ status = XtCvtStringToPixel(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ &closure_ret);
+ check_dec(True, status, "XtCvtStringToPixel return value");
+ tet_infoline("TEST: Conversion result");
+ check_dec(XBlackPixelOfScreen(DefaultScreenOfDisplay(display)), res, "returned pixel");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtStringToPosition/XtCvtStringToPosition.m b/xts5/Xt11/XtCvtStringToPosition/XtCvtStringToPosition.m
new file mode 100644
index 00000000..9658f50a
--- /dev/null
+++ b/xts5/Xt11/XtCvtStringToPosition/XtCvtStringToPosition.m
@@ -0,0 +1,327 @@
+Copyright (c) 2005 X.Org Foundation LLC
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+$Header: /cvs/xtest/xtest/xts5/tset/Xt11/XtCvtStringToPosition/XtCvtStringToPosition.m,v 1.1 2005-02-12 14:37:53 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/Xt11/XtCvtStringToShort/XtCvtStringToShort.m
+>>#
+>># Description:
+>># Tests for XtCvtStringToPosition()
+>>#
+>># Modifications:
+>># $Log: tcstpos.m,v $
+>># Revision 1.1 2005-02-12 14:37:53 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:34 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:31 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:38 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.1 1998/02/03 22:18:06 andy
+>># Added warning handler install to test 2 (SR 160).
+>>#
+>># Revision 5.0 1998/01/26 03:25:13 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:19:54 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:43 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+void XtWMH3_Proc(str1, str2, str3, str4, str5, car)
+String str1, str2, str3, str4, *str5;
+Cardinal *car;
+{
+ avs_set_event(2,1);
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtCvtStringToPosition Xt11
+Boolean
+XtCvtStringToPosition(display, args, num_args, from, to, closure_ret)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToPosition(display, args, num_args, from, to, closure_ret)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRPosition type shall convert the string specified in
+.A from
+to an XtRPosition type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Position specific */
+char *posstr = "13";
+Position num;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstpos1", "XtCvtStringToPosition");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Check conversion succeeds");
+ fromVal.addr = posstr;
+ fromVal.size = strlen(posstr)+1;
+ toVal.addr = (XtPointer) &num;
+ toVal.size = sizeof(short);
+ status = XtCvtStringToPosition(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToPosition return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToPosition(display, args, num_args, from, to, closure_ret)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRPosition type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Position specific */
+char *posstr = "42";
+Position num;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstpos2", "XtCvtStringToPosition");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH3_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Check conversion fails");
+ fromVal.addr = posstr;
+ fromVal.size = strlen(posstr)+1;
+ toVal.addr = (XtPointer) &num;
+ toVal.size = 0;
+ status = XtCvtStringToPosition(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToPosition return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(Position)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Position), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToPosition(display, args, num_args, from, to, closure_ret)
+when
+.A to->addr
+is NULL shall convert the string specified in
+.A from
+to an XtRPosition type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Position specific */
+char *posstr = "17";
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstpos3", "XtCvtStringToPosition");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Check conversion succeeds");
+ fromVal.addr = posstr;
+ fromVal.size = strlen(posstr)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToPosition(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToPosition return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(Position)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Position), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good A
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToPosition(display, args, num_args, from, to, closure_ret)
+when the conversion is not performed due to an improper value
+specified in
+.A from
+shall issue a warning message and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Position specific */
+char *posstr = "This is not a number";
+Position num;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcstpos4", "XtCvtStringToPosition");
+ tet_infoline("PREP: Set Warning Message Handler");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH3_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Check conversion fails");
+ fromVal.addr = posstr;
+ fromVal.size = strlen(posstr)+1;
+ toVal.addr = (XtPointer) &num;
+ toVal.size = sizeof(short);
+ status = XtCvtStringToPosition(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToPosition return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Warning message was generated");
+ status = avs_get_event(2);
+ check_dec(1, status, "warning handler called");
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtStringToShort/XtCvtStringToShort.m b/xts5/Xt11/XtCvtStringToShort/XtCvtStringToShort.m
new file mode 100644
index 00000000..d3e59498
--- /dev/null
+++ b/xts5/Xt11/XtCvtStringToShort/XtCvtStringToShort.m
@@ -0,0 +1,331 @@
+Copyright (c) 2005 X.Org Foundation LLC
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+$Header: /cvs/xtest/xtest/xts5/tset/Xt11/XtCvtStringToShort/XtCvtStringToShort.m,v 1.1 2005-02-12 14:37:53 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/Xt11/XtCvtStringToShort/XtCvtStringToShort.m
+>>#
+>># Description:
+>># Tests for XtCvtStringToShort()
+>>#
+>># Modifications:
+>># $Log: tcstshrt.m,v $
+>># Revision 1.1 2005-02-12 14:37:53 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:33 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:30 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:38 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.1 1998/02/03 21:53:57 andy
+>># Editorial
+>>#
+>># Revision 5.0 1998/01/26 03:25:12 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.1 1997/10/26 22:39:49 andy
+>># Changed value used for bad data
+>>#
+>># Revision 4.0 1995/12/15 09:19:51 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:39 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+void XtWMH3_Proc(str1, str2, str3, str4, str5, car)
+String str1, str2, str3, str4, *str5;
+Cardinal *car;
+{
+ avs_set_event(2,1);
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtCvtStringToShort Xt11
+Boolean
+XtCvtStringToShort(display, args, num_args, from, to, closure_ret)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToShort(display, args, num_args, from, to, closure_ret)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRShort type shall convert the string specified in
+.A from
+to an XtRShort type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Short specific */
+char *shrtstr = "13";
+short num;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstshrt1", "XtCvtStringToShort");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = shrtstr;
+ fromVal.size = strlen(shrtstr)+1;
+ toVal.addr = (XtPointer) &num;
+ toVal.size = sizeof(short);
+ status = XtCvtStringToShort(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToShort return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToShort(display, args, num_args, from, to, closure_ret)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRShort type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Short specific */
+char *shrtstr = "42";
+short num;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstshrt2", "XtCvtStringToShort");
+ tet_infoline("PREP: Set Warning Message Handler");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH3_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = shrtstr;
+ fromVal.size = strlen(shrtstr)+1;
+ toVal.addr = (XtPointer) &num;
+ toVal.size = 0;
+ status = XtCvtStringToShort(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToShort return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(short)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(short), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToShort(display, args, num_args, from, to, closure_ret)
+when
+.A to->addr
+is NULL shall convert the string specified in
+.A from
+to an XtRShort type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Short specific */
+char *shrtstr = "17";
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstshrt3", "XtCvtStringToShort");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = shrtstr;
+ fromVal.size = strlen(shrtstr)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToShort(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToShort return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(short)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(short), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good A
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToShort(display, args, num_args, from, to, closure_ret)
+when the conversion is not performed due to an improper value
+specified in
+.A from
+shall issue a warning message and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Short specific */
+char *shrtstr = "This is not representable in a short";
+short num;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcstshrt4", "XtCvtStringToShort");
+ tet_infoline("PREP: Set Warning Message Handler");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH3_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = shrtstr;
+ fromVal.size = 4;
+ toVal.addr = (XtPointer) &num;
+ toVal.size = sizeof(short);
+ status = XtCvtStringToShort(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToShort return value");
+ tet_infoline("TEST: Warning message was generated");
+ status = avs_get_event(2);
+ check_dec(1, status, "warning handler called");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtStringToTranslationTable/XtCvtStringToTranslationTable.m b/xts5/Xt11/XtCvtStringToTranslationTable/XtCvtStringToTranslationTable.m
new file mode 100644
index 00000000..be3d8aa0
--- /dev/null
+++ b/xts5/Xt11/XtCvtStringToTranslationTable/XtCvtStringToTranslationTable.m
@@ -0,0 +1,337 @@
+Copyright (c) 2005 X.Org Foundation LLC
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+$Header: /cvs/xtest/xtest/xts5/tset/Xt11/XtCvtStringToTranslationTable/XtCvtStringToTranslationTable.m,v 1.1 2005-02-12 14:37:53 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/Xt11/XtCvtStringToTranslationTable/XtCvtStringToTranslationTable.m
+>>#
+>># Description:
+>># Tests for XtCvtStringToTranslationTable()
+>>#
+>># Modifications:
+>># $Log: tcstttbl.m,v $
+>># Revision 1.1 2005-02-12 14:37:53 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:34 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:31 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:38 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.2 1998/02/24 03:26:14 andy
+>># Made test 4 contingent on coverage
+>>#
+>># Revision 5.1 1998/02/03 22:18:09 andy
+>># Added warning handler install to test 2 (SR 160).
+>>#
+>># Revision 5.0 1998/01/26 03:25:13 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:19:53 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:41 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+void XtWMH3_Proc(str1, str2, str3, str4, str5, car)
+String str1, str2, str3, str4, *str5;
+Cardinal *car;
+{
+ avs_set_event(2,1);
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtCvtStringToTranslationTable Xt11
+Boolean
+XtCvtStringToTranslationTable(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToTranslationTable(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRTranslationTable type shall convert the string specified in
+.A from
+to an XtRTranslationTable type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to TranlationTable specific */
+char *ttstr = "";
+XtTranslations ttbl;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstttbl1", "XtCvtStringToTranslationTable");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = ttstr;
+ fromVal.size = strlen(ttstr)+1;
+ toVal.addr = (XtPointer) &ttbl;
+ toVal.size = sizeof(XtTranslations);
+ status = XtCvtStringToTranslationTable(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToTranslationTable return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToTranslationTable(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRTranslationTable type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to TranslationTable specific */
+char *ttstr = "";
+XtTranslations ttbl;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstttbl2", "XtCvtStringToTranslationTable");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH3_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = ttstr;
+ fromVal.size = strlen(ttstr)+1;
+ toVal.addr = (XtPointer) &ttbl;
+ toVal.size = 0;
+ status = XtCvtStringToTranslationTable(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToTranslationTable return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(XtAccelerators)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(XtAccelerators), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToTranslationTable(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the string specified in
+.A from
+to an XtRTranslationTable type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to TranslationTable specific */
+char *ttstr = "";
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstttbl3", "XtCvtStringToTranslationTable");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = ttstr;
+ fromVal.size = strlen(ttstr)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToTranslationTable(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToTranslationTable return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(XtAccelerators)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(XtAccelerators), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good A
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToTranslationTable(display, args, num_args, from, to, converter_data)
+when the conversion is not performed due to an improper value
+specified in
+.A from
+shall issue a warning message and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to TranlationTable specific */
+char *ttstr = "surely you jest";
+XtTranslations ttbl;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+/*this test does not pass prior do R6.4gamma due to issues with
+consistency of the spec, test suite, and sample code*/
+if (config.coverage < 2) {
+ FORK(pid2);
+ avs_set_event(2,0);
+ avs_xt_hier("Tcstttbl4", "XtCvtStringToTranslationTable");
+ tet_infoline("PREP: Set Warning Message Handler");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH3_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = ttstr;
+ fromVal.size = strlen(ttstr)+1;
+ toVal.addr = (XtPointer) &ttbl;
+ toVal.size = sizeof(XtTranslations);
+ status = XtCvtStringToTranslationTable(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToTranslationTable return value");
+ tet_infoline("TEST: Warning message was generated");
+ status = avs_get_event(2);
+ check_dec(1, status, "warning handler called");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+} else {
+ tet_infoline("INFO: Test surpressed due to XT_COVERAGE value");
+ tet_result(TET_UNTESTED);
+}
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtStringToUnsignedChar/XtCvtStringToUnsignedChar.m b/xts5/Xt11/XtCvtStringToUnsignedChar/XtCvtStringToUnsignedChar.m
new file mode 100644
index 00000000..949b934a
--- /dev/null
+++ b/xts5/Xt11/XtCvtStringToUnsignedChar/XtCvtStringToUnsignedChar.m
@@ -0,0 +1,327 @@
+Copyright (c) 2005 X.Org Foundation LLC
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+$Header: /cvs/xtest/xtest/xts5/tset/Xt11/XtCvtStringToUnsignedChar/XtCvtStringToUnsignedChar.m,v 1.1 2005-02-12 14:37:53 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/Xt11/XtCvtStringToUnsignedChar/XtCvtStringToUnsignedChar.m
+>>#
+>># Description:
+>># Tests for XtCvtStringToUnsignedChar()
+>>#
+>># Modifications:
+>># $Log: tcstuchr.m,v $
+>># Revision 1.1 2005-02-12 14:37:53 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:35 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:32 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:39 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.1 1998/02/03 22:18:11 andy
+>># Added warning handler install to test 2 (SR 160).
+>>#
+>># Revision 5.0 1998/01/26 03:25:14 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:19:56 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:45 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+void XtWMH3_Proc(str1, str2, str3, str4, str5, car)
+String str1, str2, str3, str4, *str5;
+Cardinal *car;
+{
+ avs_set_event(2,1);
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtCvtStringToUnsignedChar Xt11
+Boolean
+XtCvtStringToUnsignedChar(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToUnsignedChar(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRUnsignedChar type shall convert the string specified in
+.A from
+to an XtRUnsignedChar type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to UnsignedChar specific */
+char *uchrstr = "3";
+unsigned char uchr;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstuchr1", "XtCvtStringToUnsignedChar");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = uchrstr;
+ fromVal.size = strlen(uchrstr)+1;
+ toVal.addr = (XtPointer) &uchr;
+ toVal.size = sizeof(unsigned char);
+ status = XtCvtStringToUnsignedChar(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToUnsignedChar return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToUnsignedChar(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRUnsignedChar type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to UnsignedChar specific */
+char *uchrstr = "9";
+unsigned char num;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstuchr2", "XtCvtStringToUnsignedChar");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH3_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = uchrstr;
+ fromVal.size = strlen(uchrstr)+1;
+ toVal.addr = (XtPointer) &num;
+ toVal.size = 0;
+ status = XtCvtStringToUnsignedChar(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToUnsignedChar return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(unsigned char)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(unsigned char), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToUnsignedChar(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the string specified in
+.A from
+to an XtRUnsignedChar type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to UnsignedChar specific */
+char *uchrstr = "7";
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstuchr3", "XtCvtStringToUnsignedChar");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion succeeds");
+ fromVal.addr = uchrstr;
+ fromVal.size = strlen(uchrstr)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToUnsignedChar(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToUnsignedChar return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(unsigned char)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(unsigned char), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good A
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToUnsignedChar(display, args, num_args, from, to, converter_data)
+when the conversion is not performed due to an improper value
+specified in
+.A from
+shall issue a warning message and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to UnsignedChar specific */
+char *uchrstr = "This is not a valid number";
+unsigned char uchr;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_set_event(2,0);
+ avs_xt_hier("Tcstuchr4", "XtCvtStringToUnsignedChar");
+ tet_infoline("PREP: Set Warning Message Handler");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH3_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ num_args = 0;
+ tet_infoline("TEST: Conversion fails");
+ fromVal.addr = uchrstr;
+ fromVal.size = strlen(uchrstr)+1;
+ toVal.addr = (XtPointer) &uchr;
+ toVal.size = sizeof(unsigned char);
+ status = XtCvtStringToUnsignedChar(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToUnsignedChar return value");
+ tet_infoline("TEST: Warning message was generated");
+ status = avs_get_event(2);
+ check_dec(1, status, "warning handler called");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtCvtStringToVisual/XtCvtStringToVisual.m b/xts5/Xt11/XtCvtStringToVisual/XtCvtStringToVisual.m
new file mode 100644
index 00000000..55711245
--- /dev/null
+++ b/xts5/Xt11/XtCvtStringToVisual/XtCvtStringToVisual.m
@@ -0,0 +1,506 @@
+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/Xt11/XtCvtStringToVisual/XtCvtStringToVisual.m,v 1.1 2005-02-12 14:37:53 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/Xt11/XtCvtStringToVisual/XtCvtStringToVisual.m
+>>#
+>># Description:
+>># Tests for XtCvtStringToVisual()
+>>#
+>># Modifications:
+>># $Log: tcstvis.m,v $
+>># Revision 1.1 2005-02-12 14:37:53 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:35 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:32 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:39 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.1 1998/02/03 22:18:13 andy
+>># Added warning handler install to test 2 (SR 160).
+>>#
+>># Revision 5.0 1998/01/26 03:25:14 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:19:57 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:47 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+void XtWMH_Proc(str1, str2, str3, str4, str5, car)
+String str1, str2, str3, str4, *str5;
+Cardinal *car;
+{
+ avs_set_event(1,1);
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtCvtStringToVisual Xt11
+Boolean
+XtCvtStringToVisual(display, args, num_args, from, to, converter_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToVisual(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is large enough to store
+an XtRVisual type shall convert the string specified in
+.A from
+to an XtRVisual type, store it at the location specified by
+.A to->addr,
+set
+.A to->size
+to the actual size of the converted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Visual specific */
+Screen *screen;
+Cardinal depth;
+char *visstr;
+Visual *res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstvis1", "XtCvtStringToVisual");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ screen = DefaultScreenOfDisplay(display);
+ args[0].addr = (XtPointer )&screen;
+ args[0].size = sizeof(Screen*);
+ depth = DefaultDepthOfScreen(screen);
+ args[1].addr = (XtPointer) &depth;
+ args[1].size = sizeof(Cardinal);
+ num_args = 2;
+ tet_infoline("PREP: Choose a visual that exists");
+ res = DefaultVisualOfScreen(screen);
+ switch(res->class) {
+ case StaticGray:
+ visstr = "StaticGray";
+ break;
+ case GrayScale:
+ visstr = "GrayScale";
+ break;
+ case StaticColor:
+ visstr = "StaticColor";
+ break;
+ case PseudoColor:
+ visstr = "PseudoColor";
+ break;
+ case TrueColor:
+ visstr = "TrueColor";
+ break;
+ case DirectColor:
+ visstr = "DirectColor";
+ break;
+ }
+ tet_infoline("TEST: Check conversion succeeds");
+ fromVal.addr = visstr;
+ fromVal.size = strlen(visstr)+1;
+ toVal.addr = (XtPointer) &res;
+ toVal.size = sizeof(XtPointer);
+ status = XtCvtStringToVisual(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToVisual return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToVisual(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is not NULL and
+.A to->size
+is too small for an
+XtRVisual type shall not perform a
+conversion, set the
+.A to->size
+field to the number of bytes required to store the converted data,
+and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Visual specific */
+Screen *screen;
+Cardinal depth;
+char *visstr = "fixed";
+Visual *res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstvis2", "XtCvtStringToVisual");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ screen = DefaultScreenOfDisplay(display);
+ args[0].addr = (XtPointer )&screen;
+ args[0].size = sizeof(Screen*);
+ depth = DefaultDepthOfScreen(screen);
+ args[1].addr = (XtPointer) &depth;
+ args[1].size = sizeof(Cardinal);
+ num_args = 2;
+ tet_infoline("PREP: Choose a visual that exists");
+ res = DefaultVisualOfScreen(screen);
+ switch(res->class) {
+ case StaticGray:
+ visstr = "StaticGray";
+ break;
+ case GrayScale:
+ visstr = "GrayScale";
+ break;
+ case StaticColor:
+ visstr = "StaticColor";
+ break;
+ case PseudoColor:
+ visstr = "PseudoColor";
+ break;
+ case TrueColor:
+ visstr = "TrueColor";
+ break;
+ case DirectColor:
+ visstr = "DirectColor";
+ break;
+ }
+ tet_infoline("TEST: Check conversion fails");
+ fromVal.addr = visstr;
+ fromVal.size = strlen(visstr)+1;
+ toVal.addr = (XtPointer) &res;
+ toVal.size = 0;
+ status = XtCvtStringToVisual(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToVisual return value");
+ tet_infoline("TEST: to_size");
+ if (toVal.size != sizeof(Visual *)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Visual *), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A successful call to
+Boolean XtCvtStringToVisual(display, args, num_args, from, to, converter_data)
+when
+.A to->addr
+is NULL shall convert the string specified in
+.A from
+to an XtRVisual type, allocate space for the converted data,
+set
+.A to->addr
+to specify the location of the data,
+set
+.A to->size
+to the size of the coverted data, and return True.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Visual specific */
+Screen *screen;
+Cardinal depth;
+char *visstr = "fixed";
+Visual *res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_xt_hier("Tcstvis3", "XtCvtStringToVisual");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ screen = DefaultScreenOfDisplay(display);
+ args[0].addr = (XtPointer )&screen;
+ args[0].size = sizeof(Screen*);
+ depth = DefaultDepthOfScreen(screen);
+ args[1].addr = (XtPointer) &depth;
+ args[1].size = sizeof(Cardinal);
+ num_args = 2;
+ tet_infoline("PREP: Choose a visual that exists");
+ res = DefaultVisualOfScreen(screen);
+ switch(res->class) {
+ case StaticGray:
+ visstr = "StaticGray";
+ break;
+ case GrayScale:
+ visstr = "GrayScale";
+ break;
+ case StaticColor:
+ visstr = "StaticColor";
+ break;
+ case PseudoColor:
+ visstr = "PseudoColor";
+ break;
+ case TrueColor:
+ visstr = "TrueColor";
+ break;
+ case DirectColor:
+ visstr = "DirectColor";
+ break;
+ }
+ tet_infoline("TEST: Check conversion succeeds");
+ fromVal.addr = visstr;
+ fromVal.size = strlen(visstr)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToVisual(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(True, status, "XtCvtStringToVisual return value");
+ tet_infoline("TEST: to->addr and to->size are set");
+ if (!toVal.addr) {
+ sprintf(ebuf, "ERROR: to->addr was not set");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (toVal.size != sizeof(Visual *)) {
+ sprintf(ebuf, "ERROR: to_size not set correctly, expected %d, received %d", sizeof(Visual *), toVal.size);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToVisual(display, args, num_args, from, to, converter_data)
+when
+.A args
+specifies an improper value shall not perform a conversion,
+issue a warning message, and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Visual specific */
+Screen *screen;
+char *visstr = "fixed";
+Visual *res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ avs_set_event(1,0);
+ FORK(pid2);
+ avs_xt_hier("Tcstvis4", "XtCvtStringToVisual");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args incorrectly");
+ num_args = 0;
+ tet_infoline("PREP: Choose a visual that exists");
+ screen = DefaultScreenOfDisplay(display);
+ res = DefaultVisualOfScreen(screen);
+ switch(res->class) {
+ case StaticGray:
+ visstr = "StaticGray";
+ break;
+ case GrayScale:
+ visstr = "GrayScale";
+ break;
+ case StaticColor:
+ visstr = "StaticColor";
+ break;
+ case PseudoColor:
+ visstr = "PseudoColor";
+ break;
+ case TrueColor:
+ visstr = "TrueColor";
+ break;
+ case DirectColor:
+ visstr = "DirectColor";
+ break;
+ }
+ tet_infoline("TEST: Check conversion fails");
+ fromVal.addr = visstr;
+ fromVal.size = strlen(visstr)+1;
+ toVal.addr = (XtPointer)0;
+ toVal.size = 0;
+ status = XtCvtStringToVisual(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToVisual return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Warning handler is called");
+ status = avs_get_event(1);
+ check_dec(1, status, "calls to warning handler count");
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good A
+If the implementation is X11R5 or later:
+A call to
+Boolean XtCvtStringToVisual(display, args, num_args, from, to,
+converter_data)
+when the string specified by
+.A from
+is not StaticGray, StaticColor, TrueColor, GrayScale, PseudoColor or
+DirectColor shall issue a warning message and return False.
+>>CODE
+#if XT_X_RELEASE > 4
+/* Conversion arguments and results */
+Boolean status;
+Display *display;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+XtPointer *closure_ret = (XtPointer *) 0;
+/* String to Visual specific */
+Screen *screen;
+Cardinal depth;
+char *visstr="Visual from mars";
+Visual *res;
+pid_t pid2;
+#endif
+
+#if XT_X_RELEASE > 4
+ FORK(pid2);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tcstvis5", "XtCvtStringToVisual");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get display");
+ display = XtDisplay(topLevel);
+ tet_infoline("PREP: Set up required conversion args");
+ screen = DefaultScreenOfDisplay(display);
+ args[0].addr = (XtPointer )&screen;
+ args[0].size = sizeof(Screen*);
+ depth = DefaultDepthOfScreen(screen);
+ args[1].addr = (XtPointer) &depth;
+ args[1].size = sizeof(Cardinal);
+ num_args = 2;
+ tet_infoline("TEST: Check conversion fails");
+ fromVal.addr = visstr;
+ fromVal.size = strlen(visstr)+1;
+ toVal.addr = (XtPointer) &res;
+ toVal.size = sizeof(XtPointer);
+ status = XtCvtStringToVisual(display,
+ &args[0],
+ &num_args,
+ &fromVal,
+ &toVal,
+ closure_ret);
+ check_dec(False, status, "XtCvtStringToVisual return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Warning handler is called");
+ status = avs_get_event(1);
+ check_dec(1, status, "calls to warning handler count");
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt11/XtDisplayStringConversionWarning/XtDisplayStringConversionWarning.m b/xts5/Xt11/XtDisplayStringConversionWarning/XtDisplayStringConversionWarning.m
new file mode 100644
index 00000000..afa5099a
--- /dev/null
+++ b/xts5/Xt11/XtDisplayStringConversionWarning/XtDisplayStringConversionWarning.m
@@ -0,0 +1,275 @@
+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/Xt11/XtDisplayStringConversionWarning/XtDisplayStringConversionWarning.m,v 1.1 2005-02-12 14:37:53 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/Xt11/XtDisplayStringConversionWarning/XtDisplayStringConversionWarning.m
+>>#
+>># Description:
+>># Tests for XtDisplayStringConversionWarning()
+>>#
+>># Modifications:
+>># $Log: tdisplscw.m,v $
+>># Revision 1.1 2005-02-12 14:37:53 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:45 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:41 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:48 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:22 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:20:18 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:15:15 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+#ifndef XavsRChar
+#define XavsRChar "Char"
+#endif
+
+void XTWHMProc(name, type, class, defaultp, params, num_params)
+String name;
+String type;
+String class;
+String defaultp ;
+String *params ;
+Cardinal *num_params ;
+{
+String par[10];
+int i;
+char buffer[1000];
+
+ avs_set_event(1,1);
+ tet_infoline("TEST: Warning message contents");
+ XtGetErrorDatabaseText(name, type, class, defaultp, buffer, 1000);
+ if (params == NULL || num_params == NULL || *num_params == 0) {
+ sprintf(ebuf, "%s", buffer);
+ }
+ else {
+ i = *num_params;
+ if (i > 10)
+ i = 10;
+ memcpy((char *)par, (char *)params, i*sizeof(String));
+ memset(&par[i], 0, (10-i)*sizeof(String));
+ sprintf(ebuf, buffer, par[0], par[1], par[2], par[3], par[4], par[5], par[6], par[7], par[8],par[9]);
+ }
+ check_str(ebuf, "Cannot convert string \"String\" to type Int", "Warning message");
+}
+void XTEHMProc(name, type, class, defaultp, params, num_params)
+String name;
+String type;
+String class;
+String defaultp ;
+String *params ;
+Cardinal *num_params ;
+{
+String par[10];
+int i;
+char buffer[1000];
+
+ avs_set_event(2,1);
+ tet_infoline("TEST: Warning message contents");
+ XtGetErrorDatabaseText(name, type, class, defaultp, buffer, 1000);
+ if (params == NULL || num_params == NULL || *num_params == 0) {
+ sprintf(ebuf, "%s", buffer);
+ }
+ else {
+ i = *num_params;
+ if (i > 10)
+ i = 10;
+ memcpy((char *)par, (char *)params, i*sizeof(String));
+ memset(&par[i], 0, (10-i)*sizeof(String));
+ sprintf(ebuf, buffer, par[0], par[1], par[2], par[3], par[4], par[5], par[6], par[7], par[8],par[9]);
+ }
+ check_str(ebuf, "Cannot convert string \"Not a real type\" to type Int", "Warning message");
+}
+
+
+Boolean XtCVT_StringToChar(display, args, num_args, from_val, to_val, convertor_data)
+Display *display;
+XrmValue *args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *convertor_data;
+{
+ char *str = (char *) (from_val->addr);
+ static unsigned char i;
+ to_val->size = sizeof (unsigned char);
+ to_val->addr = (XtPointer) &i;
+ i = *str;
+ /*
+ ** Force a warning message
+ */
+ XtDisplayStringConversionWarning(display, "String", "Int");
+}
+
+Boolean XtCVT_StringToChar2(display, args, num_args, from_val, to_val, convertor_data)
+Display *display;
+XrmValue *args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *convertor_data;
+{
+ char *str = (char *) (from_val->addr);
+ static unsigned char i;
+ to_val->size = sizeof (unsigned char);
+ to_val->addr = (XtPointer) &i;
+ i = *str;
+ /*
+ ** Force an error message
+ */
+ XtDisplayStringConversionWarning(display, "Not a real type", "Int");
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtDisplayStringConversionWarning Xt11
+void
+XtDisplayStringConversionWarning(display, from_value, to_type );
+>>ASSERTION Good A
+A call to
+void XtDisplayStringConversionWarning(display, from_value, to_type)
+when an entry exists in the error database for the error name
+.S conversionError,
+type
+.S string,
+and class
+.S XtToolkitError
+shall display the error message text associated with that entry.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+char line[80], buf[80];
+FILE *stream;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tdisplscw1", "XtDisplayStringConversionWarning");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Catch warning messages");
+ XtAppSetWarningMsgHandler(app_ctext, XTWHMProc);
+ tet_infoline("PREP: Register resource converter XtCVT_StringToChar");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheAll,
+ (XtDestructor)NULL);
+ tet_infoline("PREP: Invoke resource converter XtCVT_StringToChar");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ XtCallConverter(display_good,
+ XtCVT_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Warning handler was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "Warning handler invocations count");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+On a call to
+void XtDisplayStringConversionWarning(display, from_value, to_type)
+when an entry does not exist in the error database for the error name
+.S conversionError,
+type
+.S string,
+and class
+.S XtToolkitError
+it shall display the error message: "Cannot convert
+.A from_value
+to type
+.A to_type".
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+char line[80], buf[80];
+FILE *stream;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tdisplscw1", "XtDisplayStringConversionWarning");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Catch warning messages");
+ XtAppSetWarningMsgHandler(app_ctext, XTEHMProc);
+ tet_infoline("PREP: Register resource converter XtCVT_StringToChar2");
+ XtAppSetTypeConverter(app_ctext,
+ XtRString,
+ XavsRChar,
+ XtCVT_StringToChar2,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheAll,
+ (XtDestructor)NULL);
+ tet_infoline("PREP: Invoke resource converter XtCVT_StringToChar2");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer) "Hello";
+ from.size = sizeof(unsigned char);
+ XtCallConverter(display_good,
+ XtCVT_StringToChar2,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Warning handler was invoked");
+ invoked = avs_get_event(2);
+ check_dec(1, invoked, "Warning handler invocations count");
+ tet_result(TET_PASS);
diff --git a/xts5/Xt11/XtDisplayToApplicationContext/XtDisplayToApplicationContext.m b/xts5/Xt11/XtDisplayToApplicationContext/XtDisplayToApplicationContext.m
new file mode 100644
index 00000000..e57c7c92
--- /dev/null
+++ b/xts5/Xt11/XtDisplayToApplicationContext/XtDisplayToApplicationContext.m
@@ -0,0 +1,139 @@
+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/Xt11/XtDisplayToApplicationContext/XtDisplayToApplicationContext.m,v 1.1 2005-02-12 14:37:53 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/Xt11/XtDisplayToApplicationContext/XtDisplayToApplicationContext.m
+>>#
+>># Description:
+>># Tests for XtDisplayToApplicationContext()
+>>#
+>># Modifications:
+>># $Log: tdispltac.m,v $
+>># Revision 1.1 2005-02-12 14:37:53 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:45 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:42 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:48 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:22 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:20:20 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:15:17 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+/*
+** XtEMH_Proc
+*/
+void XtEMH_Proc(str, str2, str3, str4, str5, car)
+String str, str2, str3, str4, *str5;
+Cardinal *car;
+{
+ avs_set_event(1, 1);
+ exit(0);
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtDisplayToApplicationContext Xt11
+XtAppContext
+XtDisplayToApplicationContext(display)
+>>ASSERTION Good A
+A successful call to
+XtAppContext XtDisplayToApplicationContext(display)
+shall return the application context in which the display
+.A display
+was initialized.
+>>CODE
+XtAppContext app_ctext_good;
+Display *display_good;
+Widget labelw_good;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tdispltac1", "XtDisplayToApplicationContext");
+ tet_infoline("PREP: Create label widget `Hello' in boxw1 widget");
+ labelw_good = (Widget) CreateLabelWidget("Hello", boxw1);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get the display pointer for label widget `Hello' ");
+ if ( ( display_good = XtDisplay(labelw_good) ) == NULL ) {
+ sprintf(ebuf, "ERROR: Expected valid display pointer returned NULL");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: Check the application context is valid");
+ app_ctext_good = XtDisplayToApplicationContext(display_good);
+ if (app_ctext_good == NULL) {
+ sprintf(ebuf, "ERROR: Expected valid application context Received NULL");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A call to
+XtAppContext XtDisplayToApplicationContext(display)
+when
+.A display
+is not an Intrinsics initialized display shall issue
+an error message.
+>>CODE
+Display *display;
+pid_t pid2;
+int invoked = 0;
+
+ FORK(pid2);
+ avs_xt_hier("Tdispltac1", "XtDisplayToApplicationContext");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Register XtEMH_Proc to be called on error");
+ tet_infoline("PREP: conditions");
+ XtAppSetErrorMsgHandler(app_ctext, XtEMH_Proc);
+ tet_infoline("TEST: Display unknown returns error");
+ XtDisplayToApplicationContext(display);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Error handler was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "XtEMH_Proc invoked status");
+ tet_result(TET_PASS);
diff --git a/xts5/Xt11/XtGetApplicationResources/XtGetApplicationResources.m b/xts5/Xt11/XtGetApplicationResources/XtGetApplicationResources.m
new file mode 100644
index 00000000..6ee11a05
--- /dev/null
+++ b/xts5/Xt11/XtGetApplicationResources/XtGetApplicationResources.m
@@ -0,0 +1,254 @@
+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/Xt11/XtGetApplicationResources/XtGetApplicationResources.m,v 1.1 2005-02-12 14:37:53 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/Xt11/XtGetApplicationResources/XtGetApplicationResources.m
+>>#
+>># Description:
+>># Tests for XtGetApplicationResources()
+>>#
+>># Modifications:
+>># $Log: tgtapres.m,v $
+>># Revision 1.1 2005-02-12 14:37:53 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:24 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:20 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:29 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:04 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:19:23 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:03 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+typedef struct _instance_variables {
+ long foreground;
+ String label;
+} instance_variable_rec;
+
+static XtResource resources[] = {
+ {
+ XtNforeground,
+ XtCForeground,
+ XtRPixel, sizeof(Pixel),
+ XtOffsetOf(instance_variable_rec, foreground),
+ XtRString, "XtDefaultForeground"
+ },
+ {
+ XtNlabel,
+ XtCLabel,
+ XtRString, sizeof(String),
+ XtOffsetOf(instance_variable_rec, label),
+ XtRString, "XtDefaultLabel"
+ },
+};
+
+int def = 2002;
+
+static XtResource resources2[] = {
+ {
+ XtNforeground,
+ XtCForeground,
+ XtRPixel, sizeof(Pixel),
+ XtOffsetOf(instance_variable_rec, foreground),
+ XtRString, "XtDefaultForeground"
+ },
+ {
+ XtNlabel,
+ XtCLabel,
+ XtRString, sizeof(String),
+ XtOffsetOf(instance_variable_rec, label),
+ XtRInt, &def
+ },
+};
+
+char whereitsat[64];
+char *huh;
+
+Boolean XtCVT_Proc(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValuePtr args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+ sprintf(whereitsat, "%d", *(int *)from_val->addr);
+ *(String*)to_val->addr = whereitsat;
+ to_val->size = sizeof(XtPointer);
+ avs_set_event(2, avs_get_event(2)+1);
+ return True;
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtGetApplicationResources Xt11
+void
+XtGetApplicationResources(w, base, resources, num_resources, args, num_args)
+>>ASSERTION Good A
+A call to
+void XtGetApplicationResources(w, base, resources, num_resources, args, num_args)
+shall retrieve the resource value for each resource
+specified in the resource list
+.A resources
+from the resource values specified in
+.A args,
+or if no value for the resource is found in the argument list,
+from the resource database associated with the widget
+.A w,
+matching the resource identified by the
+the names and classes of all ancestors of
+.A w,
+the name and class of
+.A w,
+and the resource name and class,
+or if no value is found in the database, from the
+resource list default values and copy the resource value at an offset
+specified by the corresponding resource_offset field from the address
+.A base.
+>>CODE
+instance_variable_rec base;
+pid_t pid2;
+struct {
+ String name;
+ XtArgVal value;
+} args;
+
+ FORK(pid2);
+ avs_xt_hier("Tgtapres1", "XtGetApplicationResources");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ base.foreground = -1;
+ tet_infoline("TEST: Retrieve resource values from resource database");
+ XtGetApplicationResources(topLevel,
+ &base,
+ resources,
+ 2,
+ (ArgList)NULL,
+ (Cardinal)0);
+ tet_infoline("TEST: Retrieved resource value");
+ if ((base.foreground != 0) && (base.foreground != 1)) {
+ sprintf(ebuf, "ERROR: expected 0 or 1, received %d", base.foreground);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: Retrieve resource values from arg list");
+ XtSetArg(args, XtNlabel, "label value");
+ XtGetApplicationResources(topLevel,
+ &base,
+ resources,
+ 2,
+ (ArgList)&args,
+ (Cardinal)1);
+ tet_infoline("TEST: Retrieved resource value");
+ if (strcmp(base.label, "label value") != 0) {
+ sprintf(ebuf, "ERROR: expected \"label value\", received %s", base.label);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: Retrieve resource values from defaults");
+ XtGetApplicationResources(topLevel,
+ &base,
+ resources,
+ 2,
+ (ArgList)NULL,
+ (Cardinal)0);
+ tet_infoline("TEST: Retrieved resource value");
+ if (strcmp(base.label, "XtDefaultLabel") != 0) {
+ sprintf(ebuf, "ERROR: expected \"XtDefaultLabel\", received %s", base.label);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+On a call to
+void XtGetApplicationResources(w, base, resources, num_resources,
+args, num_args)
+when a resource specified in the resource database or a default
+resource value is in a different representation from the representation
+type specified in the resource_type field of the resource list
+the appropriate type converter shall be called to perform the conversion
+and store the converted value in the subpart data structure.
+>>CODE
+instance_variable_rec base;
+pid_t pid2;
+struct {
+ String name;
+ XtArgVal value;
+} args;
+int status;
+
+ FORK(pid2);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tgtapres1", "XtGetApplicationResources");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ XtAppSetTypeConverter(app_ctext,
+ XtRInt,
+ XtRString,
+ XtCVT_Proc,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheNone,
+ NULL);
+ tet_infoline("TEST: Retrieve resource value needing conversion");
+ XtGetApplicationResources(topLevel,
+ &base,
+ resources2,
+ 2,
+ (ArgList)NULL,
+ (Cardinal)0);
+ tet_infoline("TEST: Retreived resource value");
+ if (strcmp(base.label, "2002") != 0) {
+ sprintf(ebuf, "ERROR: expected \"2002\", received \"%s\"", base.label);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: convertor was invoked");
+ status = avs_get_event(2);
+ check_dec(1, status, "XtCVT_Proc invoked status");
+ tet_result(TET_PASS);
diff --git a/xts5/Xt11/XtGetConstraintResourceList/XtGetConstraintResourceList.m b/xts5/Xt11/XtGetConstraintResourceList/XtGetConstraintResourceList.m
new file mode 100644
index 00000000..50eb14c0
--- /dev/null
+++ b/xts5/Xt11/XtGetConstraintResourceList/XtGetConstraintResourceList.m
@@ -0,0 +1,239 @@
+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/Xt11/XtGetConstraintResourceList/XtGetConstraintResourceList.m,v 1.1 2005-02-12 14:37:53 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/Xt11/XtGetConstraintResourceList/XtGetConstraintResourceList.m
+>>#
+>># Description:
+>># Tests for XtGetConstraintResourceList()
+>>#
+>># Modifications:
+>># $Log: tgtconrsl.m,v $
+>># Revision 1.1 2005-02-12 14:37:53 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:22 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:18 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:27 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:01 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:19:17 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:13:55 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+#include <X11/Xaw/Form.h>
+#include <X11/Xaw/Label.h>
+#include <AvsForm.h>
+#include <AvsForm2.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+void XtWMH_Proc(str1, str2, str3, str4, str5, car)
+String str1, str2, str3, str4, *str5;
+Cardinal *car;
+{
+}
+
+>>TITLE XtGetConstraintResourceList Xt11
+void
+XtGetConstraintResourceList(class, resources_return, num_resources_return)
+>>ASSERTION Good A
+When the widget class
+.A class
+is not initialized a successful call to
+void XtGetConstraintResourceList(class, resources_return, num_resources_return)
+shall return a pointer to the resource list as
+specified in the widget class Constraint part in
+.A resources_return
+and the number of resources in this list in
+.A num_resources_return.
+>>CODE
+Widget formw_good, labelw_good;
+XtResourceList resources_return;
+Cardinal num_resources_return;
+Boolean resize_value;
+int i;
+int found;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tgtconrsl1", "XtGetConstraintResourceList");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get avsform2 class resource list");
+ XtGetConstraintResourceList(avsform2WidgetClass, &resources_return, &num_resources_return);
+ tet_infoline("TEST: Resource count does not include superclass'");
+ if (num_resources_return != 1) {
+ sprintf(ebuf, "ERROR: Number of resources returned %d, should be 1", num_resources_return);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+
+ tet_infoline("TEST: avsform2's XtNresizable resource in list");
+ found = 0;
+ for ( i = 0; i < num_resources_return; i++ ) {
+ if (strcmp(XtNresizable, resources_return[i].resource_name) == 0 ) {
+ found = 1;
+ check_dec(FALSE, (long)resources_return[i].default_addr, XtNresizable);
+ } /* end if */
+ } /* end for */
+ if (!found) {
+ sprintf(ebuf, "ERROR: Did not find XtNresizable resource value");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+
+ tet_infoline("TEST: Superclass' XtNfromVert resource not in list");
+ found = 0;
+ for ( i = 0; i < num_resources_return; i++ ) {
+ if (strcmp(XtNfromVert, (char *)resources_return[i].resource_name) == 0 ) {
+ sprintf(ebuf, "ERROR: Found XtNfromVert resource");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ }
+ tet_infoline("CLEANUP: Free the resource list.");
+ XtFree((void *)resources_return);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When the widget class
+.A class
+is initialized a successful call to
+void XtGetConstraintResourceList(class, resources_return, num_resources_return)
+shall return a pointer to the merged resource list that
+includes the resources as specified in the widget class Constraint
+part and for all Constraint superclasses in
+.A resources_return
+and the number of resources in this list in
+.A num_resources_return.
+>>CODE
+XtResourceList resources_return;
+Cardinal num_resources_return;
+int i , value;
+Widget formw_good, labelw_msg;
+int found;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tgtconrsl2", "XtGetConstraintResourceList");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Create avs2form widget in boxw1 widget");
+ formw_good = XtCreateManagedWidget("avsform2",
+ avsform2WidgetClass,
+ boxw1,
+ NULL,
+ 0);
+ labelw_msg = (Widget) CreateLabelWidget("ApTest", formw_good);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get avsform2 class resource list");
+ XtGetConstraintResourceList(avsform2WidgetClass, &resources_return, &num_resources_return);
+ tet_infoline("TEST: Resource count includes superclass'");
+ if (num_resources_return != 9 ) {
+ sprintf(ebuf, "ERROR: Resource list size was %d, expected 9 - did not include superclass resource.", num_resources_return);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: Superclass' XtNfromVert resource in list");
+ found = 0;
+ for ( i = 0; i < num_resources_return; i++ ) {
+ if (strcmp(XtNfromVert, resources_return[i].resource_name) == 0 ) {
+ found = 1;
+ check_dec(0, (long)resources_return[i].default_addr, "XtNfromVert value");
+ } /* end if */
+ } /* end for */
+ if (!found) {
+ sprintf(ebuf, "ERROR: Could not find XtNfromVert resource value");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: avsform2's XtNresizable resource in list");
+ found = 0;
+ for ( i = 0; i < num_resources_return; i++ ) {
+ if (strcmp(XtNresizable, resources_return[i].resource_name) == 0 ) {
+ found = 1;
+ check_dec(FALSE, (long)resources_return[i].default_addr, "XtNresizable value");
+ } /* end if */
+ } /* end for */
+ if (!found) {
+ sprintf(ebuf, "ERROR: Could not find XtNresizable resource value");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A call to
+void XtGetConstraintResourceList(class, resources_return, num_resources_return)
+when
+.A class
+is not a subclass of
+constraintWidgetClass
+shall set
+.A resources_return
+to NULL and
+.A num_resources_return
+to zero.
+>>CODE
+Widget labelw_good;
+XtResourceList resources_return;
+Cardinal num_resources_return;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tgtconrsl3", "XtGetConstraintResourceList");
+ tet_infoline("PREP: Create label widget");
+ labelw_good = (Widget) CreateLabelWidget("ApTest", boxw1);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get label widget resource list");
+ XtGetConstraintResourceList(labelWidgetClass, &resources_return, &num_resources_return);
+ tet_infoline("TEST: Resources_return and num_resources_return values");
+ if (resources_return != NULL) {
+ sprintf(ebuf, "ERROR: Expected resources_return NULL");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ check_dec(0, (long)num_resources_return, "Number of Resources");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
diff --git a/xts5/Xt11/XtGetResourceList/XtGetResourceList.m b/xts5/Xt11/XtGetResourceList/XtGetResourceList.m
new file mode 100644
index 00000000..2ef9094b
--- /dev/null
+++ b/xts5/Xt11/XtGetResourceList/XtGetResourceList.m
@@ -0,0 +1,785 @@
+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/Xt11/XtGetResourceList/XtGetResourceList.m,v 1.1 2005-02-12 14:37:53 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/Xt11/XtGetResourceList/XtGetResourceList.m
+>>#
+>># Description:
+>># Tests for XtGetResourceList()
+>>#
+>># Modifications:
+>># $Log: tgtreslst.m,v $
+>># Revision 1.1 2005-02-12 14:37:53 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:21 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:17 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:27 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:01 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:19:14 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:13:53 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+#include <xt/SquareCelP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+
+/*
+ * SquareCell.c - Square Widget
+ */
+#define INTERNAL_WIDTH 2
+#define INTERNAL_HEIGHT 4
+#define DEFAULT_PIXMAP_WIDTH 1 /* in cells */
+#define DEFAULT_PIXMAP_HEIGHT 1 /* in cells */
+#define DEFAULT_CELL_SIE 20 /* in pixels */
+/* values for instance variable is_drawn */
+#define DRAWN 1
+#define UNDRAWN 0
+/* modes for drawing */
+#define DRAW 1
+#define UNDRAW 0
+#define MAXLINES 10 /* max of horiz or vertical cells */
+#define SCROLLBARWIDTH 15
+#define DEFAULTWIDTH 300 /* widget size when show_all is False */
+#define offset(field) XtOffsetOf(SquareCellRec, field)
+#define NUM_RESOURCES XtNumber(resources)
+static XtResource resources[] = {
+ {
+ XtNforeground,
+ XtCForeground,
+ XtRPixel,
+ sizeof(Pixel),
+ offset(squareCell.foreground),
+ XtRString,
+ XtDefaultForeground
+ },
+ {
+ XavsNtoggleCallback,
+ XavsCToggleCallback,
+ XtRCallback,
+ sizeof(XtPointer),
+ offset(squareCell.callback),
+ XtRCallback,
+ NULL
+ },
+ {
+ XavsNcellSizeInPixels,
+ XavsCCellSizeInPixels,
+ XtRInt, sizeof(int),
+ offset(squareCell.cell_size_in_pixels),
+ XtRImmediate,
+ (XtPointer)DEFAULT_CELL_SIE
+ },
+ {
+ XavsNpixmapWidthInCells,
+ XavsCPixmapWidthInCells,
+ XtRDimension,
+ sizeof(Dimension),
+ offset(squareCell.pixmap_width_in_cells),
+ XtRImmediate,
+ (XtPointer)DEFAULT_PIXMAP_WIDTH
+ },
+ {
+ XavsNpixmapHeightInCells,
+ XavsCPixmapHeightInCells,
+ XtRDimension,
+ sizeof(Dimension),
+ offset(squareCell.pixmap_height_in_cells),
+ XtRImmediate,
+ (XtPointer)DEFAULT_PIXMAP_HEIGHT
+ },
+ {
+ XavsNcurX,
+ XavsCCurX,
+ XtRInt,
+ sizeof(int),
+ offset(squareCell.cur_x),
+ XtRImmediate,
+ (XtPointer) 0
+ },
+ {
+ XavsNcurY,
+ XavsCCurY,
+ XtRInt,
+ sizeof(int),
+ offset(squareCell.cur_y),
+ XtRImmediate,
+ (XtPointer) 0
+ },
+ {
+ XavsNcellArray,
+ XavsCCellArray,
+ XtRString,
+ sizeof(String),
+ offset(squareCell.cell),
+ XtRImmediate,
+ (XtPointer) 0
+ },
+ {
+ XavsNshowEntireBitmap,
+ XavsCShowEntireBitmap,
+ XtRBoolean,
+ sizeof(Boolean),
+ offset(squareCell.show_all),
+ XtRImmediate,
+ (XtPointer) TRUE
+ },
+};
+/* Declaration of methods */
+static void Initialize();
+static void Redisplay();
+static void Destroy();
+static void Resize();
+static Boolean SetValues();
+static XtGeometryResult QueryGeometry();
+/* these Core methods not needed by SquareCell:
+ *
+ * static void ClassInitialize();
+ * static void Realize();
+ */
+/* the following are private functions unique to SquareCell */
+static void DrawPixmaps(), DoCell(), ChangeCellSize();
+/* the following are actions of SquareCell */
+static void DrawCell(), UndrawCell(), ToggleCell();
+/* The following are public functions of SquareCell, declared extern
+ * in the public include file: */
+char *SquareCellGetArray();
+static char defaultTranslations[] =
+ "<Btn1Down>: DrawCell() \n\
+ <Btn2Down>: UndrawCell() \n\
+ <Btn3Down>: ToggleCell() \n\
+ <Btn1Motion>: DrawCell() \n\
+ <Btn2Motion>: UndrawCell() \n\
+ <Btn3Motion>: ToggleCell()";
+static XtActionsRec actions[] = {
+ {"DrawCell", DrawCell},
+ {"UndrawCell", UndrawCell},
+ {"ToggleCell", ToggleCell},
+};
+/* definition in SquareCell.h */
+static SquareCellPointInfo info;
+SquareCellClassRec squareCellClassRec = {
+ {
+ /* core_class fields */
+ /* superclass */ (WidgetClass) &coreClassRec,
+ /* class_name */ "SquareCell",
+ /* widget_size */ sizeof(SquareCellRec),
+ /* class_initialize */ NULL,
+ /* class_part_initialize */ NULL,
+ /* class_inited */ FALSE,
+ /* initialize */ Initialize,
+ /* initialize_hook */ NULL,
+ /* realize */ XtInheritRealize,
+ /* actions */ actions,
+ /* num_actions */ XtNumber(actions),
+ /* resources */ resources,
+ /* num_resources */ XtNumber(resources),
+ /* xrm_class */ NULLQUARK,
+ /* compress_motion */ TRUE,
+ /* compress_exposure */ XtExposeCompressMultiple,
+ /* compress_enterleave */ TRUE,
+ /* visible_interest */ FALSE,
+ /* destroy */ Destroy,
+ /* resize */ Resize,
+ /* expose */ Redisplay,
+ /* set_values */ SetValues,
+ /* set_values_hook */ NULL,
+ /* set_values_almost */ XtInheritSetValuesAlmost,
+ /* get_values_hook */ NULL,
+ /* accept_focus */ NULL,
+ /* version */ XtVersion,
+ /* callback_private */ NULL,
+ /* tm_table */ defaultTranslations,
+ /* query_geometry */ QueryGeometry,
+ /* display_accelerator */ XtInheritDisplayAccelerator,
+ /* extension */ NULL
+ },
+ {/* simple_class fields */
+ /* change_sensitive */ XtInheritChangeSensitive,
+ },
+ {
+ /* extension */ 0,
+ },
+};
+WidgetClass squareCellWidgetClass = (WidgetClass) & squareCellClassRec;
+static void
+GetDrawGC(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ XGCValues values;
+ XtGCMask mask = GCForeground | GCBackground | GCDashOffset |
+ GCDashList | GCLineStyle;
+ /*
+ * Setting foreground and background to 1 and 0 looks like a
+ * kludge but isn't. This GC is used for drawing
+ * into a pixmap of depth one. Real colors are applied with a
+ * separate GC when the pixmap is copied into the window.
+ */
+ values.foreground = 1;
+ values.background = 0;
+ values.dashes = 1;
+ values.dash_offset = 0;
+ values.line_style = LineOnOffDash;
+ cw->squareCell.draw_gc = XCreateGC(XtDisplay((Widget)cw),
+ cw->squareCell.big_picture, mask, &values);
+}
+static void
+GetUndrawGC(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ XGCValues values;
+ XtGCMask mask = GCForeground | GCBackground;
+ /* this looks like a kludge but isn't. This GC is used for drawing
+ * into a pixmap of depth one. Real colors are applied as the
+ * pixmap is copied into the window.
+ */
+ values.foreground = 0;
+ values.background = 1;
+ cw->squareCell.undraw_gc = XCreateGC(XtDisplay((Widget)cw),
+ cw->squareCell.big_picture, mask, &values);
+}
+static void
+GetCopyGC(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ XGCValues values;
+ XtGCMask mask = GCForeground | GCBackground;
+ values.foreground = cw->squareCell.foreground;
+ values.background = cw->core.background_pixel;
+ cw->squareCell.copy_gc = XtGetGC((Widget)cw, mask, &values);
+}
+static void
+Initialize(treq, tnew, args, num_args)
+Widget treq, tnew;
+ArgList args;
+Cardinal *num_args;
+{
+ SquareCellWidget new = (SquareCellWidget) tnew;
+ new->squareCell.cur_x = 0;
+ new->squareCell.cur_y = 0;
+ /*
+ * Check instance values set by resources that may be invalid.
+ */
+ if ((new->squareCell.pixmap_width_in_cells < 1) ||
+ (new->squareCell.pixmap_height_in_cells < 1)) {
+ XtWarning("SquareCell: pixmapWidth and/or pixmapHeight is too small (using 10 x 10).");
+ new->squareCell.pixmap_width_in_cells = 10;
+ new->squareCell.pixmap_height_in_cells = 10;
+ }
+ if (new->squareCell.cell_size_in_pixels < 5) {
+ XtWarning("SquareCell: cellSize is too small (using 5).");
+ new->squareCell.cell_size_in_pixels = 5;
+ }
+ if ((new->squareCell.cur_x < 0) || (new->squareCell.cur_y < 0)) {
+ XtWarning("SquareCell: cur_x and cur_y must be non-negative (using 0, 0).");
+ new->squareCell.cur_x = 0;
+ new->squareCell.cur_y = 0;
+ }
+ if (new->squareCell.cell == NULL)
+ new->squareCell.cell = XtCalloc(
+ new->squareCell.pixmap_width_in_cells *
+ new->squareCell.pixmap_height_in_cells, sizeof(char));
+ else
+ new->squareCell.user_allocated = True; /* user supplied cell array */
+ new->squareCell.pixmap_width_in_pixels =
+ new->squareCell.pixmap_width_in_cells *
+ new->squareCell.cell_size_in_pixels;
+ new->squareCell.pixmap_height_in_pixels =
+ new->squareCell.pixmap_height_in_cells *
+ new->squareCell.cell_size_in_pixels;
+ if (new->core.width == 0) {
+ if (new->squareCell.show_all == False)
+ new->core.width = (new->squareCell.pixmap_width_in_pixels
+ > DEFAULTWIDTH) ? DEFAULTWIDTH :
+ (new->squareCell.pixmap_width_in_pixels);
+ else
+ new->core.width = new->squareCell.pixmap_width_in_pixels;
+ }
+ if (new->core.height == 0) {
+ if (new->squareCell.show_all == False)
+ new->core.height =
+ (new->squareCell.pixmap_height_in_pixels >
+ DEFAULTWIDTH) ? DEFAULTWIDTH :
+ (new->squareCell.pixmap_height_in_pixels);
+ else
+ new->core.height = new->squareCell.pixmap_height_in_pixels;
+ }
+ CreateBigPixmap(new);
+ GetDrawGC(new);
+ GetUndrawGC(new);
+ GetCopyGC(new);
+ DrawIntoBigPixmap(new);
+}
+static void
+Redisplay(w, event)
+Widget w;
+XExposeEvent *event;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ register int x, y;
+ unsigned int width, height;
+ if (!XtIsRealized((Widget)cw))
+ return;
+ if (event) { /* called from btn-event or expose */
+ x = event->x;
+ y = event->y;
+ width = event->width;
+ height = event->height;
+ }
+ else { /* called because complete redraw */
+ x = 0;
+ y = 0;
+ width = cw->squareCell.pixmap_width_in_pixels;
+ height = cw->squareCell.pixmap_height_in_pixels;
+ }
+ if (DefaultDepthOfScreen(XtScreen((Widget)cw)) == 1)
+ XCopyArea(XtDisplay((Widget)cw), cw->squareCell.big_picture,
+ XtWindow((Widget)cw), cw->squareCell.copy_gc, x +
+ cw->squareCell.cur_x, y + cw->squareCell.cur_y,
+ width, height, x, y);
+ else
+ XCopyPlane(XtDisplay((Widget)cw), cw->squareCell.big_picture,
+ XtWindow((Widget)cw), cw->squareCell.copy_gc, x +
+ cw->squareCell.cur_x, y + cw->squareCell.cur_y,
+ width, height, x, y, 1);
+}
+static Boolean
+SetValues(current, request, new, args, num_args)
+Widget current, request, new;
+ArgList args;
+Cardinal *num_args;
+{
+ SquareCellWidget curcw = (SquareCellWidget) current;
+ SquareCellWidget newcw = (SquareCellWidget) new;
+ Boolean do_redisplay = False;
+ /*
+ ** XtSetValues invoked procedure SetValues
+ */
+ if (curcw->squareCell.foreground != newcw->squareCell.foreground) {
+ XtReleaseGC((Widget)curcw, curcw->squareCell.copy_gc);
+ GetCopyGC(newcw);
+ do_redisplay = True;
+ }
+ if ((curcw->squareCell.cur_x != newcw->squareCell.cur_x) ||
+ (curcw->squareCell.cur_y != newcw->squareCell.cur_y))
+ do_redisplay = True;
+ if (curcw->squareCell.cell_size_in_pixels !=
+ newcw->squareCell.cell_size_in_pixels) {
+ ChangeCellSize(curcw, newcw->squareCell.cell_size_in_pixels);
+ do_redisplay = True;
+ }
+ if (curcw->squareCell.pixmap_width_in_cells !=
+ newcw->squareCell.pixmap_width_in_cells) {
+ newcw->squareCell.pixmap_width_in_cells =
+ curcw->squareCell.pixmap_width_in_cells;
+ XtWarning("SquareCell: pixmap_width_in_cells cannot be set by XtSetValues.\n");
+ }
+ if (curcw->squareCell.pixmap_height_in_cells !=
+ newcw->squareCell.pixmap_height_in_cells) {
+ newcw->squareCell.pixmap_height_in_cells =
+ curcw->squareCell.pixmap_height_in_cells;
+ XtWarning("SquareCell: pixmap_height_in_cells cannot be set by XtSetValues.\n");
+ }
+ return do_redisplay;
+}
+static void
+Destroy(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ if (cw->squareCell.big_picture)
+ XFreePixmap(XtDisplay(cw), cw->squareCell.big_picture);
+ if (cw->squareCell.draw_gc)
+ XFreeGC(XtDisplay(cw), cw->squareCell.draw_gc);
+ if (cw->squareCell.undraw_gc)
+ XFreeGC(XtDisplay(cw), cw->squareCell.undraw_gc);
+ if (cw->squareCell.copy_gc)
+ XFreeGC(XtDisplay(cw), cw->squareCell.copy_gc);
+ /* Free memory allocated with Calloc. This was done
+ * only if application didn't supply cell array.
+ */
+ if (!cw->squareCell.user_allocated)
+ XtFree(cw->squareCell.cell);
+}
+static void
+DrawCell(w, event)
+Widget w;
+XEvent *event;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ DrawPixmaps(cw->squareCell.draw_gc, DRAW, cw, event);
+}
+static void
+UndrawCell(w, event)
+Widget w;
+XEvent *event;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ DrawPixmaps(cw->squareCell.undraw_gc, UNDRAW, cw, event);
+}
+static void
+ToggleCell(w, event)
+Widget w;
+XEvent *event;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ static int oldx = -1, oldy = -1;
+ GC gc;
+ int mode;
+ int newx, newy;
+ /* This is strictly correct, but doesn't
+ * seem to be necessary */
+ if (event->type == ButtonPress) {
+ newx = (cw->squareCell.cur_x + ((XButtonEvent *)event)->x) /
+ cw->squareCell.cell_size_in_pixels;
+ newy = (cw->squareCell.cur_y + ((XButtonEvent *)event)->y) /
+ cw->squareCell.cell_size_in_pixels;
+ }
+ else {
+ newx = (cw->squareCell.cur_x + ((XMotionEvent *)event)->x) /
+ cw->squareCell.cell_size_in_pixels;
+ newy = (cw->squareCell.cur_y + ((XMotionEvent *)event)->y) /
+ cw->squareCell.cell_size_in_pixels;
+ }
+ if ((mode = cw->squareCell.cell[newx + newy * cw->squareCell.pixmap_width_in_cells]) == DRAWN) {
+ gc = cw->squareCell.undraw_gc;
+ mode = UNDRAW;
+ }
+ else {
+ gc = cw->squareCell.draw_gc;
+ mode = DRAW;
+ }
+ if (oldx != newx || oldy != newy) {
+ oldx = newx;
+ oldy = newy;
+ DrawPixmaps(gc, mode, cw, event);
+ }
+}
+static void
+DrawPixmaps(gc, mode, w, event)
+GC gc;
+int mode;
+Widget w;
+XButtonEvent *event;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ int newx = (cw->squareCell.cur_x + event->x) /
+ cw->squareCell.cell_size_in_pixels;
+ int newy = (cw->squareCell.cur_y + event->y) /
+ cw->squareCell.cell_size_in_pixels;
+ XExposeEvent fake_event;
+ /* if already done, return */
+ if (cw->squareCell.cell[newx + newy * cw->squareCell.pixmap_width_in_cells] == mode)
+ return;
+ /* otherwise, draw or undraw */
+ XFillRectangle(XtDisplay((Widget)cw), cw->squareCell.big_picture, gc,
+ cw->squareCell.cell_size_in_pixels*newx + 2,
+ cw->squareCell.cell_size_in_pixels*newy + 2,
+ (unsigned int)cw->squareCell.cell_size_in_pixels - 3,
+ (unsigned int)cw->squareCell.cell_size_in_pixels - 3);
+ cw->squareCell.cell[newx + newy * cw->squareCell.pixmap_width_in_cells] = mode;
+ info.mode = mode;
+ info.newx = newx;
+ info.newy = newy;
+ fake_event.x = cw->squareCell.cell_size_in_pixels * newx - cw->squareCell.cur_x;
+ fake_event.y = cw->squareCell.cell_size_in_pixels * newy - cw->squareCell.cur_y;
+ fake_event.width = cw->squareCell.cell_size_in_pixels;
+ fake_event.height = cw->squareCell.cell_size_in_pixels;
+ Redisplay(cw, &fake_event);
+ XtCallCallbacks((Widget)cw, XavsNtoggleCallback, &info);
+}
+CreateBigPixmap(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ /* always a 1 bit deep pixmap, regardless of screen depth */
+ cw->squareCell.big_picture = XCreatePixmap(XtDisplay((Widget)cw),
+ RootWindow(XtDisplay((Widget)cw), DefaultScreen(XtDisplay((Widget)cw))),
+ cw->squareCell.pixmap_width_in_pixels + 2,
+ cw->squareCell.pixmap_height_in_pixels + 2, 1);
+}
+DrawIntoBigPixmap(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ int n_horiz_segments, n_vert_segments;
+ XSegment segment[MAXLINES];
+ register int x, y;
+ XFillRectangle(XtDisplay((Widget)cw), cw->squareCell.big_picture,
+ cw->squareCell.undraw_gc, 0, 0,
+ cw->squareCell.pixmap_width_in_pixels
+ + 2, cw->squareCell.pixmap_height_in_pixels + 2);
+ n_horiz_segments = cw->squareCell.pixmap_height_in_cells + 1;
+ n_vert_segments = cw->squareCell.pixmap_width_in_cells + 1;
+ for (x = 0; x < n_horiz_segments; x++) {
+ segment[x].x1 = 0;
+ segment[x].x2 = (short) cw->squareCell.pixmap_width_in_pixels;
+ segment[x].y1 = (short) cw->squareCell.cell_size_in_pixels * x;
+ segment[x].y2 = (short) cw->squareCell.cell_size_in_pixels * x;
+ }
+ XDrawSegments(XtDisplay((Widget)cw), cw->squareCell.big_picture, cw->squareCell.draw_gc, segment, n_horiz_segments);
+ for (y = 0; y < n_vert_segments; y++) {
+ segment[y].x1 = (short) y * cw->squareCell.cell_size_in_pixels;
+ segment[y].x2 = (short) y * cw->squareCell.cell_size_in_pixels;
+ segment[y].y1 = 0;
+ segment[y].y2 = (short) cw->squareCell.pixmap_height_in_pixels;
+ }
+ XDrawSegments(XtDisplay((Widget)cw), cw->squareCell.big_picture, cw->squareCell.draw_gc, segment, n_vert_segments);
+ /* draw current cell array into pixmap */
+ for (x = 0; x < cw->squareCell.pixmap_width_in_cells; x++) {
+ for (y = 0; y < cw->squareCell.pixmap_height_in_cells; y++) {
+ if (cw->squareCell.cell[x + (y * cw->squareCell.pixmap_width_in_cells)] == DRAWN)
+ DoCell(cw, x, y, cw->squareCell.draw_gc);
+ else
+ DoCell(cw, x, y, cw->squareCell.undraw_gc);
+ }
+ }
+}
+/* A Public function, not static */
+char *
+SquareCellGetArray(w, width_in_cells, height_in_cells)
+Widget w;
+int *width_in_cells, *height_in_cells;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ *width_in_cells = cw->squareCell.pixmap_width_in_cells;
+ *height_in_cells = cw->squareCell.pixmap_height_in_cells;
+ return (cw->squareCell.cell);
+}
+static void
+Resize(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ /* resize does nothing unless new size is bigger than entire pixmap */
+ if ((cw->core.width > cw->squareCell.pixmap_width_in_pixels) &&
+ (cw->core.height > cw->squareCell.pixmap_height_in_pixels)) {
+ /*
+ * Calculate the maximum cell size that will allow the
+ * entire bitmap to be displayed.
+ */
+ Dimension w_temp_cell_size_in_pixels, h_temp_cell_size_in_pixels;
+ Dimension new_cell_size_in_pixels;
+
+ w_temp_cell_size_in_pixels = cw->core.width / cw->squareCell.pixmap_width_in_cells;
+ h_temp_cell_size_in_pixels = cw->core.height / cw->squareCell.pixmap_height_in_cells;
+
+ if (w_temp_cell_size_in_pixels < h_temp_cell_size_in_pixels)
+ new_cell_size_in_pixels = w_temp_cell_size_in_pixels;
+ else
+ new_cell_size_in_pixels = h_temp_cell_size_in_pixels;
+
+ /* if size change mandates a new pixmap, make one */
+ if (new_cell_size_in_pixels != cw->squareCell.cell_size_in_pixels)
+ ChangeCellSize(cw, new_cell_size_in_pixels);
+ }
+}
+static void
+ChangeCellSize(w, new_cell_size)
+Widget w;
+int new_cell_size;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ int x, y;
+ cw->squareCell.cell_size_in_pixels = new_cell_size;
+ /* recalculate variables based on cell size */
+ cw->squareCell.pixmap_width_in_pixels =
+ cw->squareCell.pixmap_width_in_cells *
+ cw->squareCell.cell_size_in_pixels;
+ cw->squareCell.pixmap_height_in_pixels =
+ cw->squareCell.pixmap_height_in_cells *
+ cw->squareCell.cell_size_in_pixels;
+
+ /* destroy old and create new pixmap of correct size */
+ XFreePixmap(XtDisplay(cw), cw->squareCell.big_picture);
+ CreateBigPixmap(cw);
+
+ /* draw lines into new pixmap */
+ DrawIntoBigPixmap(cw);
+
+ /* draw current cell array into pixmap */
+ for (x = 0; x < cw->squareCell.pixmap_width_in_cells; x++) {
+ for (y = 0; y < cw->squareCell.pixmap_height_in_cells; y++) {
+ if (cw->squareCell.cell[x + (y * cw->squareCell.pixmap_width_in_cells)] == DRAWN)
+ DoCell(cw, x, y, cw->squareCell.draw_gc);
+ else
+ DoCell(cw, x, y, cw->squareCell.undraw_gc);
+ }
+ }
+}
+static void
+DoCell(w, x, y, gc)
+Widget w;
+int x, y;
+GC gc;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ /* otherwise, draw or undraw */
+ XFillRectangle(XtDisplay(cw), cw->squareCell.big_picture, gc,
+ cw->squareCell.cell_size_in_pixels * x + 2,
+ cw->squareCell.cell_size_in_pixels * y + 2,
+ (unsigned int)cw->squareCell.cell_size_in_pixels - 3,
+ (unsigned int)cw->squareCell.cell_size_in_pixels - 3);
+}
+static XtGeometryResult QueryGeometry(w, proposed, answer)
+Widget w;
+XtWidgetGeometry *proposed, *answer;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ /* set fields we care about */
+ answer->request_mode = CWWidth | CWHeight;
+ /* initial width and height */
+ if (cw->squareCell.show_all == True)
+ answer->width = cw->squareCell.pixmap_width_in_pixels;
+ else
+ answer->width = (cw->squareCell.pixmap_width_in_pixels >
+ DEFAULTWIDTH) ? DEFAULTWIDTH :
+ cw->squareCell.pixmap_width_in_pixels;
+ if (cw->squareCell.show_all == True)
+ answer->height = cw->squareCell.pixmap_height_in_pixels;
+ else
+ answer->height = (cw->squareCell.pixmap_height_in_pixels >
+ DEFAULTWIDTH) ? DEFAULTWIDTH :
+ cw->squareCell.pixmap_height_in_pixels;
+ if ( ((proposed->request_mode & (CWWidth | CWHeight))
+ == (CWWidth | CWHeight)) &&
+ proposed->width == answer->width &&
+ proposed->height == answer->height)
+ return XtGeometryYes;
+ else if (answer->width == cw->core.width &&
+ answer->height == cw->core.height)
+ return XtGeometryNo;
+ else
+ return XtGeometryAlmost;
+}
+>>TITLE XtGetResourceList Xt11
+void
+XtGetResourceList(class, resources_return, num_resources_return)
+>>ASSERTION Good A
+When the widget class
+.A class
+is not initialized a successful call to
+void XtGetResourceList(class, resources_return, num_resources_return)
+shall return a pointer to the resource list structure as specified
+in the class record of the specified class in
+.A resources_return
+and the number of resources in the list in
+.A num_resources_return.
+>>CODE
+Display *display;
+XtResourceList resources_return;
+Cardinal num_resources_return;
+int i;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tgtreslst1", "XtGetResourceList");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get squarew widget resource list");
+ XtGetResourceList(squareCellWidgetClass,
+ &resources_return, &num_resources_return);
+ tet_infoline("TEST: Check number of resources");
+ check_dec(NUM_RESOURCES, (long)num_resources_return,
+ "Number of Resources");
+ tet_infoline("TEST: Check squarew widget XavsNcellSizeInPixels resource value");
+ for ( i = 0; i < num_resources_return; i++ ) {
+ if (strcmp(XavsNcellSizeInPixels,
+ resources_return[i].resource_name) == 0 ) {
+ check_dec(DEFAULT_CELL_SIE, (long)resources_return[i].default_addr,
+ XavsNcellSizeInPixels);
+ } /* end if */
+ } /* end for */
+
+ tet_infoline("CLEANUP: Free the resource list.");
+ XtFree((void *)resources_return);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When the widget class
+.A class
+is initialized a successful call to
+void XtGetResourceList(class, resources_return, num_resources_return)
+shall return a pointer to the merged resource list structure that
+includes resources for the specified widget class and all its
+superclasses in
+.A resources_return
+and the number of resources in this list in
+.A num_resources_return.
+>>CODE
+XtResourceList resources_return;
+Cardinal num_resources_return;
+int i , value;
+Arg getargs[1];
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tgtreslst2", "XtGetResourceList");
+ tet_infoline("PREP: Initialize squareCellWidgetClass");
+ XtInitializeWidgetClass(squareCellWidgetClass);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Get resource list");
+ XtGetResourceList(squareCellWidgetClass, &resources_return, &num_resources_return);
+ tet_infoline("TEST: Check number of resources");
+ if (num_resources_return <= 8 ) {
+ sprintf(ebuf, "ERROR: Resource list did not include superclass resource");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: Check XavsNcellSizeInPixels resource value");
+ for ( i = 0; i < num_resources_return; i++ ) {
+ if (strcmp(XavsNcellSizeInPixels,
+ resources_return[i].resource_name) == 0 ) {
+ check_dec(DEFAULT_CELL_SIE, (long)resources_return[i].default_addr,
+ XavsNcellSizeInPixels);
+ } /* end if */
+ } /* end for */
+ tet_infoline("CLEANUP: Free the resource list");
+ XtFree((void *)resources_return);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
diff --git a/xts5/Xt11/XtGetSubresources/XtGetSubresources.m b/xts5/Xt11/XtGetSubresources/XtGetSubresources.m
new file mode 100644
index 00000000..d1cb0ece
--- /dev/null
+++ b/xts5/Xt11/XtGetSubresources/XtGetSubresources.m
@@ -0,0 +1,235 @@
+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/Xt11/XtGetSubresources/XtGetSubresources.m,v 1.1 2005-02-12 14:37:54 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/Xt11/XtGetSubresources/XtGetSubresources.m
+>>#
+>># Description:
+>># Tests for XtGetSubresources()
+>>#
+>># Modifications:
+>># $Log: tgtsubres.m,v $
+>># Revision 1.1 2005-02-12 14:37:54 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:23 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:19 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:28 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:03 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:19:20 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:00 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+typedef struct _instance_variables {
+ long foreground;
+ String label;
+} instance_variable_rec;
+static XtResource resources[] = {
+ {
+ XtNforeground,
+ XtCForeground,
+ XtRPixel, sizeof(Pixel),
+ XtOffsetOf(instance_variable_rec, foreground),
+ XtRString, "XtDefaultforeground"
+ },
+ {
+ XtNlabel,
+ XtCLabel,
+ XtRString, sizeof(String),
+ XtOffsetOf(instance_variable_rec, label),
+ XtRString, "XtDefaultLabel"
+ },
+};
+int def = 2002;
+
+static XtResource resources2[] = {
+ {
+ XtNforeground,
+ XtCForeground,
+ XtRPixel, sizeof(Pixel),
+ XtOffsetOf(instance_variable_rec, foreground),
+ XtRString, "XtDefaultForeground"
+ },
+ {
+ XtNlabel,
+ XtCLabel,
+ XtRString, sizeof(String),
+ XtOffsetOf(instance_variable_rec, label),
+ XtRInt, &def
+ },
+};
+
+char whereitsat[64];
+
+Boolean XtCVT_Proc(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValuePtr args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+ sprintf(whereitsat, "%d", *(int *)from_val->addr);
+ *(String*)to_val->addr = whereitsat;
+ to_val->size = sizeof(XtPointer);
+ avs_set_event(2, avs_get_event(2)+1);
+ return True;
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtGetSubresources Xt11
+void
+XtGetSubresources(w, base, name, class, resources, num_resources, args, num_args)
+>>ASSERTION Good A
+A call to
+void XtGetSubresources(w, base, name, class, resources,
+num_resources, args, num_args)
+shall retrieve the resource value for each resource
+specified in the resource list
+.A resources
+from the resource values specified in
+.A args,
+or if no value for the resource is found in the argument list,
+from the resource database associated with the widget
+.A w,
+matching the resource identified by the
+calling application's name and class, the names and classes of all
+ancestors of
+.A w,
+the name and class of
+.A w,
+the subpart name
+.A name
+and class
+.A class,
+and the resource name and class,
+or if no value is found in the database, from the default_addr
+field of the resource list and copy the resource at an offset
+specified by the corresponding resource_offset field from the address
+.A base.
+>>CODE
+instance_variable_rec base;
+Cardinal num_resources;
+Arg setargs[2], getargs[2];
+Cardinal num_args;
+Pixel integer;
+char *string;
+pid_t pid2;
+
+ FORK(pid2);
+ /*this test needs work LATER*/
+ avs_xt_hier("Tgtsubres1", "XtGetSubresources");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Initialize the base address");
+ XtGetApplicationResources(topLevel, &base, resources,2,
+ (ArgList)NULL,(Cardinal)0);
+ tet_infoline("PREP: Update subpart resource list");
+ setargs[0].name = XtNforeground;
+ setargs[0].value = (XtArgVal)1;
+ setargs[1].name = XtNlabel;
+ setargs[1].value = (XtArgVal)"Hello World";
+ XtGetSubresources(topLevel, &base, (String)NULL, (String)NULL,
+ resources, 2, &setargs[0], 2 );
+ tet_infoline("PREP: Get subvalues");
+ XtVaGetSubvalues(&base, resources, 2, XtNforeground, &integer,
+ XtNlabel, &string, (char *)NULL);
+ tet_infoline("TEST: Retrieved subvalues");
+ check_dec(1, integer , XtNforeground);
+ check_str("Hello World", string , XtNlabel);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+On a call to
+void XtGetSubresources(w, base, name, class, resources,
+num_resources, args, num_args)
+when a resource specified in the resource database or a default
+resource value is in a different representation from the representation
+type specified in the resource_type field of the resource list it
+shall call the appropriate type converter to perform the conversion
+and store the converted value in the subpart data structure.
+>>CODE
+instance_variable_rec base;
+Cardinal num_resources;
+Arg setargs[2], getargs[2];
+Cardinal num_args;
+Pixel integer;
+char *string;
+pid_t pid2;
+int status;
+
+ FORK(pid2);
+ avs_xt_hier("Tgtsubres1", "XtGetSubresources");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ XtAppSetTypeConverter(app_ctext,
+ XtRInt,
+ XtRString,
+ XtCVT_Proc,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheNone,
+ NULL);
+ tet_infoline("PREP: Initialize the base address");
+ XtGetApplicationResources(topLevel, &base, resources,2,
+ (ArgList)NULL,(Cardinal)0);
+ tet_infoline("PREP: Update subpart resource list");
+ setargs[0].name = XtNforeground;
+ setargs[0].value = (XtArgVal)1;
+ XtGetSubresources(topLevel, &base, (String)NULL, (String)NULL,
+ resources2, 2, &setargs[0], 1 );
+ tet_infoline("PREP: Get subvalues");
+ XtVaGetSubvalues(&base, resources2, 2, XtNforeground, &integer,
+ XtNlabel, &string, (char *)NULL);
+ tet_infoline("TEST: Retrieved subvalues");
+ check_dec(1, integer , XtNforeground);
+ check_str("2002", string , XtNlabel);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: convertor was invoked");
+ status = avs_get_event(2);
+ check_dec(1, status, "XtCVT_Proc invoked status");
+
+ tet_result(TET_PASS);
diff --git a/xts5/Xt11/XtGetSubvalues/XtGetSubvalues.m b/xts5/Xt11/XtGetSubvalues/XtGetSubvalues.m
new file mode 100644
index 00000000..05de4b3a
--- /dev/null
+++ b/xts5/Xt11/XtGetSubvalues/XtGetSubvalues.m
@@ -0,0 +1,171 @@
+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/Xt11/XtGetSubvalues/XtGetSubvalues.m,v 1.1 2005-02-12 14:37:54 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/Xt11/XtGetSubvalues/XtGetSubvalues.m
+>>#
+>># Description:
+>># Tests for XtGetSubvalues()
+>>#
+>># Modifications:
+>># $Log: tgtsubval.m,v $
+>># Revision 1.1 2005-02-12 14:37:54 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:50 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:48 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:54 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:28 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:20:40 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:15:44 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+typedef struct _instance_variables {
+ long foreground;
+ String label;
+} instance_variable_rec;
+static XtResource resources[] = {
+ {
+ XtNforeground,
+ XtCForeground,
+ XtRPixel, sizeof(Pixel),
+ XtOffsetOf(instance_variable_rec, foreground),
+ XtRString, "XtDefaultforeground"
+ },
+ {
+ XtNlabel,
+ XtCLabel,
+ XtRString, sizeof(String),
+ XtOffsetOf(instance_variable_rec, label),
+ XtRString, "XtDefaultLabel"
+ },
+};
+>>TITLE XtGetSubvalues Xt11
+void
+XtGetSubvalues(base, resources, num_resources, args, num_args)
+>>ASSERTION Good A
+A call to
+void XtGetSubvalues(base, resources, num_resources, args, num_args)
+shall copy the resource value from the structure pointed to by
+.A base
+for the resource specified in the name field of each member of
+the argument list
+.A args
+that is present in the resource list specified by
+.A resources
+to the location specified by the corresponding value field.
+>>CODE
+instance_variable_rec base;
+Cardinal num_resources;
+Arg setargs[2], getargs[2];
+Cardinal num_args;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tgtsubval1", "XtGetSubvalues");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Initialize the base address");
+ XtGetApplicationResources(topLevel, &base, resources,2,
+ (ArgList)NULL,(Cardinal)0);
+ tet_infoline("PREP: Set subvalues");
+ setargs[0].name = XtNforeground;
+ setargs[0].value = (XtArgVal)1;
+ setargs[1].name = XtNlabel;
+ setargs[1].value = (XtArgVal)"Hello World";
+ XtSetSubvalues(&base, resources, 2, &setargs[0], 2 );
+ tet_infoline("PREP: Get subvalues");
+ getargs[0].name = XtNforeground;
+ getargs[0].value = (XtArgVal)malloc(sizeof(Pixel));
+ getargs[1].name = XtNlabel;
+ getargs[1].value = (XtArgVal)malloc(strlen("Hello World")+1);
+ XtGetSubvalues(&base, resources, 2, getargs, 2);
+ tet_infoline("TEST: Retrieved subvalues");
+ check_dec(1, *((Pixel *)getargs[0].value) , XtNforeground);
+ check_str("Hello World", *(char**)getargs[1].value, XtNlabel);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A call to
+void XtGetSubvalues(base, resources, num_resources, args, num_args)
+when a resource specified in the argument list
+.A args
+is not present in the resource list specified by
+.A resources
+shall not modify the value at the location specified by the
+corresponding value field.
+>>CODE
+instance_variable_rec base;
+Cardinal num_resources;
+Arg setargs[2], getargs[2];
+Cardinal num_args;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tgtsubval1", "XtGetSubvalues");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Initialize the base address");
+ XtGetApplicationResources(topLevel, &base, resources,2,
+ (ArgList)NULL,(Cardinal)0);
+ tet_infoline("PREP: Set subvalues");
+ setargs[0].name = XtNforeground;
+ setargs[0].value = (XtArgVal)1;
+ setargs[1].name = XtNlabel;
+ setargs[1].value = (XtArgVal)"Hello World";
+ XtSetSubvalues(&base, resources, 2, &setargs[0], 2 );
+ tet_infoline("PREP: Get subvalues");
+ getargs[0].name = "missing 1";
+ getargs[0].value = (XtArgVal)malloc(sizeof(Pixel));
+ getargs[1].name = XtNlabel;
+ getargs[1].value = (XtArgVal)malloc(strlen("Hello World")+1);
+ *(Pixel *) getargs[0].value = 0xAA;
+ XtGetSubvalues(&base, resources, 2, getargs, 2);
+ tet_infoline("TEST: Value was not changed");
+ check_dec(0xAA, *((Pixel *)getargs[0].value), "value");
+ check_str("Hello World", *(char**)getargs[1].value, XtNlabel);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
diff --git a/xts5/Xt11/XtGetValues/XtGetValues.m b/xts5/Xt11/XtGetValues/XtGetValues.m
new file mode 100644
index 00000000..b57cdf54
--- /dev/null
+++ b/xts5/Xt11/XtGetValues/XtGetValues.m
@@ -0,0 +1,886 @@
+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/Xt11/XtGetValues/XtGetValues.m,v 1.1 2005-02-12 14:37:54 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/Xt11/XtGetValues/XtGetValues.m
+>>#
+>># Description:
+>># Tests for XtGetValues()
+>>#
+>># Modifications:
+>># $Log: tgtvalues.m,v $
+>># Revision 1.1 2005-02-12 14:37:54 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:49 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:47 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:53 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:26 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:20:35 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:15:37 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+#include <X11/Xaw/Form.h>
+#include <xt/SquareCelP.h>
+#include <AvsForm.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+
+/*
+ * SquareCell.c - Square Widget
+ */
+#define INTERNAL_WIDTH 2
+#define INTERNAL_HEIGHT 4
+#define DEFAULT_PIXMAP_WIDTH 1 /* in cells */
+#define DEFAULT_PIXMAP_HEIGHT 1 /* in cells */
+#define DEFAULT_CELL_SIE 20 /* in pixels */
+/* values for instance variable is_drawn */
+#define DRAWN 1
+#define UNDRAWN 0
+/* modes for drawing */
+#define DRAW 1
+#define UNDRAW 0
+#define MAXLINES 10 /* max of horiz or vertical cells */
+#define SCROLLBARWIDTH 15
+#define DEFAULTWIDTH 300 /* widget size when show_all is False */
+#define offset(field) XtOffsetOf(SquareCellRec, field)
+static XtResource resources[] = {
+ {
+ XtNforeground,
+ XtCForeground,
+ XtRPixel,
+ sizeof(Pixel),
+ offset(squareCell.foreground),
+ XtRString,
+ XtDefaultForeground
+ },
+ {
+ XavsNtoggleCallback,
+ XavsCToggleCallback,
+ XtRCallback,
+ sizeof(XtPointer),
+ offset(squareCell.callback),
+ XtRCallback,
+ NULL
+ },
+ {
+ XavsNcellSizeInPixels,
+ XavsCCellSizeInPixels,
+ XtRInt, sizeof(int),
+ offset(squareCell.cell_size_in_pixels),
+ XtRImmediate,
+ (XtPointer)DEFAULT_CELL_SIE
+ },
+ {
+ XavsNpixmapWidthInCells,
+ XavsCPixmapWidthInCells,
+ XtRDimension,
+ sizeof(Dimension),
+ offset(squareCell.pixmap_width_in_cells),
+ XtRImmediate,
+ (XtPointer)DEFAULT_PIXMAP_WIDTH
+ },
+ {
+ XavsNpixmapHeightInCells,
+ XavsCPixmapHeightInCells,
+ XtRDimension,
+ sizeof(Dimension),
+ offset(squareCell.pixmap_height_in_cells),
+ XtRImmediate,
+ (XtPointer)DEFAULT_PIXMAP_HEIGHT
+ },
+ {
+ XavsNcurX,
+ XavsCCurX,
+ XtRInt,
+ sizeof(int),
+ offset(squareCell.cur_x),
+ XtRImmediate,
+ (XtPointer) 0
+ },
+ {
+ XavsNcurY,
+ XavsCCurY,
+ XtRInt,
+ sizeof(int),
+ offset(squareCell.cur_y),
+ XtRImmediate,
+ (XtPointer) 0
+ },
+ {
+ XavsNcellArray,
+ XavsCCellArray,
+ XtRString,
+ sizeof(String),
+ offset(squareCell.cell),
+ XtRImmediate,
+ (XtPointer) 0
+ },
+ {
+ XavsNshowEntireBitmap,
+ XavsCShowEntireBitmap,
+ XtRBoolean,
+ sizeof(Boolean),
+ offset(squareCell.show_all),
+ XtRImmediate,
+ (XtPointer) TRUE
+ },
+};
+/* Declaration of methods */
+static void Initialize();
+static void Redisplay();
+static void Destroy();
+static void Resize();
+static void GetValuesHook();
+static Boolean SetValues();
+static XtGeometryResult QueryGeometry();
+/* these Core methods not needed by SquareCell:
+ *
+ * static void ClassInitialize();
+ * static void Realize();
+ */
+/* the following are private functions unique to SquareCell */
+static void DrawPixmaps(), DoCell(), ChangeCellSize();
+/* the following are actions of SquareCell */
+static void DrawCell(), UndrawCell(), ToggleCell();
+/* The following are public functions of SquareCell, declared extern
+ * in the public include file: */
+char *SquareCellGetArray();
+static char defaultTranslations[] =
+ "<Btn1Down>: DrawCell() \n\
+ <Btn2Down>: UndrawCell() \n\
+ <Btn3Down>: ToggleCell() \n\
+ <Btn1Motion>: DrawCell() \n\
+ <Btn2Motion>: UndrawCell() \n\
+ <Btn3Motion>: ToggleCell()";
+static XtActionsRec actions[] = {
+ {"DrawCell", DrawCell},
+ {"UndrawCell", UndrawCell},
+ {"ToggleCell", ToggleCell},
+};
+/* definition in SquareCell.h */
+static SquareCellPointInfo info;
+SquareCellClassRec squareCellClassRec = {
+ {
+ /* core_class fields */
+ /* superclass */ (WidgetClass) &coreClassRec,
+ /* class_name */ "SquareCell",
+ /* widget_size */ sizeof(SquareCellRec),
+ /* class_initialize */ NULL,
+ /* class_part_initialize */ NULL,
+ /* class_inited */ FALSE,
+ /* initialize */ Initialize,
+ /* initialize_hook */ NULL,
+ /* realize */ XtInheritRealize,
+ /* actions */ actions,
+ /* num_actions */ XtNumber(actions),
+ /* resources */ resources,
+ /* num_resources */ XtNumber(resources),
+ /* xrm_class */ NULLQUARK,
+ /* compress_motion */ TRUE,
+ /* compress_exposure */ XtExposeCompressMultiple,
+ /* compress_enterleave */ TRUE,
+ /* visible_interest */ FALSE,
+ /* destroy */ Destroy,
+ /* resize */ Resize,
+ /* expose */ Redisplay,
+ /* set_values */ SetValues,
+ /* set_values_hook */ NULL,
+ /* set_values_almost */ XtInheritSetValuesAlmost,
+ /* get_values_hook */ GetValuesHook,
+ /* accept_focus */ NULL,
+ /* version */ XtVersion,
+ /* callback_private */ NULL,
+ /* tm_table */ defaultTranslations,
+ /* query_geometry */ QueryGeometry,
+ /* display_accelerator */ XtInheritDisplayAccelerator,
+ /* extension */ NULL
+ },
+ {/* simple_class fields */
+ /* change_sensitive */ XtInheritChangeSensitive,
+ },
+ {
+ /* extension */ 0,
+ },
+};
+WidgetClass squareCellWidgetClass = (WidgetClass) & squareCellClassRec;
+static void
+GetDrawGC(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ XGCValues values;
+ XtGCMask mask = GCForeground | GCBackground | GCDashOffset |
+ GCDashList | GCLineStyle;
+ /*
+ * Setting foreground and background to 1 and 0 looks like a
+ * kludge but isn't. This GC is used for drawing
+ * into a pixmap of depth one. Real colors are applied with a
+ * separate GC when the pixmap is copied into the window.
+ */
+ values.foreground = 1;
+ values.background = 0;
+ values.dashes = 1;
+ values.dash_offset = 0;
+ values.line_style = LineOnOffDash;
+ cw->squareCell.draw_gc = XCreateGC(XtDisplay((Widget)cw),
+ cw->squareCell.big_picture, mask, &values);
+}
+static void
+GetUndrawGC(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ XGCValues values;
+ XtGCMask mask = GCForeground | GCBackground;
+ /* this looks like a kludge but isn't. This GC is used for drawing
+ * into a pixmap of depth one. Real colors are applied as the
+ * pixmap is copied into the window.
+ */
+ values.foreground = 0;
+ values.background = 1;
+ cw->squareCell.undraw_gc = XCreateGC(XtDisplay((Widget)cw),
+ cw->squareCell.big_picture, mask, &values);
+}
+static void
+GetCopyGC(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ XGCValues values;
+ XtGCMask mask = GCForeground | GCBackground;
+ values.foreground = cw->squareCell.foreground;
+ values.background = cw->core.background_pixel;
+ cw->squareCell.copy_gc = XtGetGC((Widget)cw, mask, &values);
+}
+static void
+Initialize(treq, tnew, args, num_args)
+Widget treq, tnew;
+ArgList args;
+Cardinal *num_args;
+{
+ SquareCellWidget new = (SquareCellWidget) tnew;
+ new->squareCell.cur_x = 0;
+ new->squareCell.cur_y = 0;
+ /*
+ * Check instance values set by resources that may be invalid.
+ */
+ if ((new->squareCell.pixmap_width_in_cells < 1) ||
+ (new->squareCell.pixmap_height_in_cells < 1)) {
+ XtWarning("SquareCell: pixmapWidth and/or pixmapHeight is too small (using 10 x 10)");
+ new->squareCell.pixmap_width_in_cells = 10;
+ new->squareCell.pixmap_height_in_cells = 10;
+ }
+ if (new->squareCell.cell_size_in_pixels < 5) {
+ XtWarning("SquareCell: cellSize is too small (using 5)");
+ new->squareCell.cell_size_in_pixels = 5;
+ }
+ if ((new->squareCell.cur_x < 0) || (new->squareCell.cur_y < 0)) {
+ XtWarning("SquareCell: cur_x and cur_y must be non-negative (using 0, 0)");
+ new->squareCell.cur_x = 0;
+ new->squareCell.cur_y = 0;
+ }
+ if (new->squareCell.cell == NULL)
+ new->squareCell.cell = XtCalloc(
+ new->squareCell.pixmap_width_in_cells *
+ new->squareCell.pixmap_height_in_cells, sizeof(char));
+ else
+ new->squareCell.user_allocated = True; /* user supplied cell array */
+ new->squareCell.pixmap_width_in_pixels =
+ new->squareCell.pixmap_width_in_cells *
+ new->squareCell.cell_size_in_pixels;
+ new->squareCell.pixmap_height_in_pixels =
+ new->squareCell.pixmap_height_in_cells *
+ new->squareCell.cell_size_in_pixels;
+ if (new->core.width == 0) {
+ if (new->squareCell.show_all == False)
+ new->core.width = (new->squareCell.pixmap_width_in_pixels
+ > DEFAULTWIDTH) ? DEFAULTWIDTH :
+ (new->squareCell.pixmap_width_in_pixels);
+ else
+ new->core.width = new->squareCell.pixmap_width_in_pixels;
+ }
+ if (new->core.height == 0) {
+ if (new->squareCell.show_all == False)
+ new->core.height =
+ (new->squareCell.pixmap_height_in_pixels >
+ DEFAULTWIDTH) ? DEFAULTWIDTH :
+ (new->squareCell.pixmap_height_in_pixels);
+ else
+ new->core.height = new->squareCell.pixmap_height_in_pixels;
+ }
+ CreateBigPixmap(new);
+ GetDrawGC(new);
+ GetUndrawGC(new);
+ GetCopyGC(new);
+ DrawIntoBigPixmap(new);
+}
+static void
+Redisplay(w, event)
+Widget w;
+XExposeEvent *event;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ register int x, y;
+ unsigned int width, height;
+ if (!XtIsRealized((Widget)cw))
+ return;
+ if (event) { /* called from btn-event or expose */
+ x = event->x;
+ y = event->y;
+ width = event->width;
+ height = event->height;
+ }
+ else { /* called because complete redraw */
+ x = 0;
+ y = 0;
+ width = cw->squareCell.pixmap_width_in_pixels;
+ height = cw->squareCell.pixmap_height_in_pixels;
+ }
+ if (DefaultDepthOfScreen(XtScreen((Widget)cw)) == 1)
+ XCopyArea(XtDisplay((Widget)cw), cw->squareCell.big_picture,
+ XtWindow((Widget)cw), cw->squareCell.copy_gc, x +
+ cw->squareCell.cur_x, y + cw->squareCell.cur_y,
+ width, height, x, y);
+ else
+ XCopyPlane(XtDisplay((Widget)cw), cw->squareCell.big_picture,
+ XtWindow((Widget)cw), cw->squareCell.copy_gc, x +
+ cw->squareCell.cur_x, y + cw->squareCell.cur_y,
+ width, height, x, y, 1);
+}
+static Boolean
+SetValues(current, request, new, args, num_args)
+Widget current, request, new;
+ArgList args;
+Cardinal *num_args;
+{
+ SquareCellWidget curcw = (SquareCellWidget) current;
+ SquareCellWidget newcw = (SquareCellWidget) new;
+ Boolean do_redisplay = False;
+ /*
+ ** XtSetValues invoked procedure SetValues
+ */
+ if (curcw->squareCell.foreground != newcw->squareCell.foreground) {
+ XtReleaseGC((Widget)curcw, curcw->squareCell.copy_gc);
+ GetCopyGC(newcw);
+ do_redisplay = True;
+ }
+ if ((curcw->squareCell.cur_x != newcw->squareCell.cur_x) ||
+ (curcw->squareCell.cur_y != newcw->squareCell.cur_y))
+ do_redisplay = True;
+ if (curcw->squareCell.cell_size_in_pixels !=
+ newcw->squareCell.cell_size_in_pixels) {
+ ChangeCellSize(curcw, newcw->squareCell.cell_size_in_pixels);
+ do_redisplay = True;
+ }
+ if (curcw->squareCell.pixmap_width_in_cells !=
+ newcw->squareCell.pixmap_width_in_cells) {
+ newcw->squareCell.pixmap_width_in_cells =
+ curcw->squareCell.pixmap_width_in_cells;
+ XtWarning("SquareCell: pixmap_width_in_cells cannot be set by XtSetValues.\n");
+ }
+ if (curcw->squareCell.pixmap_height_in_cells !=
+ newcw->squareCell.pixmap_height_in_cells) {
+ newcw->squareCell.pixmap_height_in_cells =
+ curcw->squareCell.pixmap_height_in_cells;
+ XtWarning("SquareCell: pixmap_height_in_cells cannot be set by XtSetValues.\n");
+ }
+ return do_redisplay;
+}
+static void
+GetValuesHook(w, args, num_args)
+Widget w;
+ArgList args ;
+Cardinal *num_args ;
+{
+ avs_set_event(1,1);
+}
+
+static void
+Destroy(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ if (cw->squareCell.big_picture)
+ XFreePixmap(XtDisplay(cw), cw->squareCell.big_picture);
+ if (cw->squareCell.draw_gc)
+ XFreeGC(XtDisplay(cw), cw->squareCell.draw_gc);
+ if (cw->squareCell.undraw_gc)
+ XFreeGC(XtDisplay(cw), cw->squareCell.undraw_gc);
+ if (cw->squareCell.copy_gc)
+ XFreeGC(XtDisplay(cw), cw->squareCell.copy_gc);
+ /* Free memory allocated with Calloc. This was done
+ * only if application didn't supply cell array.
+ */
+ if (!cw->squareCell.user_allocated)
+ XtFree(cw->squareCell.cell);
+}
+static void
+DrawCell(w, event)
+Widget w;
+XEvent *event;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ DrawPixmaps(cw->squareCell.draw_gc, DRAW, cw, event);
+}
+static void
+UndrawCell(w, event)
+Widget w;
+XEvent *event;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ DrawPixmaps(cw->squareCell.undraw_gc, UNDRAW, cw, event);
+}
+static void
+ToggleCell(w, event)
+Widget w;
+XEvent *event;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ static int oldx = -1, oldy = -1;
+ GC gc;
+ int mode;
+ int newx, newy;
+ /* This is strictly correct, but doesn't
+ * seem to be necessary */
+ if (event->type == ButtonPress) {
+ newx = (cw->squareCell.cur_x + ((XButtonEvent *)event)->x) /
+ cw->squareCell.cell_size_in_pixels;
+ newy = (cw->squareCell.cur_y + ((XButtonEvent *)event)->y) /
+ cw->squareCell.cell_size_in_pixels;
+ }
+ else {
+ newx = (cw->squareCell.cur_x + ((XMotionEvent *)event)->x) /
+ cw->squareCell.cell_size_in_pixels;
+ newy = (cw->squareCell.cur_y + ((XMotionEvent *)event)->y) /
+ cw->squareCell.cell_size_in_pixels;
+ }
+ if ((mode = cw->squareCell.cell[newx + newy * cw->squareCell.pixmap_width_in_cells]) == DRAWN) {
+ gc = cw->squareCell.undraw_gc;
+ mode = UNDRAW;
+ }
+ else {
+ gc = cw->squareCell.draw_gc;
+ mode = DRAW;
+ }
+ if (oldx != newx || oldy != newy) {
+ oldx = newx;
+ oldy = newy;
+ DrawPixmaps(gc, mode, cw, event);
+ }
+}
+static void
+DrawPixmaps(gc, mode, w, event)
+GC gc;
+int mode;
+Widget w;
+XButtonEvent *event;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ int newx = (cw->squareCell.cur_x + event->x) /
+ cw->squareCell.cell_size_in_pixels;
+ int newy = (cw->squareCell.cur_y + event->y) /
+ cw->squareCell.cell_size_in_pixels;
+ XExposeEvent fake_event;
+ /* if already done, return */
+ if (cw->squareCell.cell[newx + newy * cw->squareCell.pixmap_width_in_cells] == mode)
+ return;
+ /* otherwise, draw or undraw */
+ XFillRectangle(XtDisplay((Widget)cw), cw->squareCell.big_picture, gc,
+ cw->squareCell.cell_size_in_pixels*newx + 2,
+ cw->squareCell.cell_size_in_pixels*newy + 2,
+ (unsigned int)cw->squareCell.cell_size_in_pixels - 3,
+ (unsigned int)cw->squareCell.cell_size_in_pixels - 3);
+ cw->squareCell.cell[newx + newy * cw->squareCell.pixmap_width_in_cells] = mode;
+ info.mode = mode;
+ info.newx = newx;
+ info.newy = newy;
+ fake_event.x = cw->squareCell.cell_size_in_pixels * newx - cw->squareCell.cur_x;
+ fake_event.y = cw->squareCell.cell_size_in_pixels * newy - cw->squareCell.cur_y;
+ fake_event.width = cw->squareCell.cell_size_in_pixels;
+ fake_event.height = cw->squareCell.cell_size_in_pixels;
+ Redisplay(cw, &fake_event);
+ XtCallCallbacks((Widget)cw, XavsNtoggleCallback, &info);
+}
+CreateBigPixmap(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ /* always a 1 bit deep pixmap, regardless of screen depth */
+ cw->squareCell.big_picture = XCreatePixmap(XtDisplay((Widget)cw),
+ RootWindow(XtDisplay((Widget)cw), DefaultScreen(XtDisplay((Widget)cw))),
+ cw->squareCell.pixmap_width_in_pixels + 2,
+ cw->squareCell.pixmap_height_in_pixels + 2, 1);
+}
+DrawIntoBigPixmap(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ int n_horiz_segments, n_vert_segments;
+ XSegment segment[MAXLINES];
+ register int x, y;
+ XFillRectangle(XtDisplay((Widget)cw), cw->squareCell.big_picture,
+ cw->squareCell.undraw_gc, 0, 0,
+ cw->squareCell.pixmap_width_in_pixels
+ + 2, cw->squareCell.pixmap_height_in_pixels + 2);
+ n_horiz_segments = cw->squareCell.pixmap_height_in_cells + 1;
+ n_vert_segments = cw->squareCell.pixmap_width_in_cells + 1;
+ for (x = 0; x < n_horiz_segments; x++) {
+ segment[x].x1 = 0;
+ segment[x].x2 = (short) cw->squareCell.pixmap_width_in_pixels;
+ segment[x].y1 = (short) cw->squareCell.cell_size_in_pixels * x;
+ segment[x].y2 = (short) cw->squareCell.cell_size_in_pixels * x;
+ }
+ XDrawSegments(XtDisplay((Widget)cw), cw->squareCell.big_picture, cw->squareCell.draw_gc, segment, n_horiz_segments);
+ for (y = 0; y < n_vert_segments; y++) {
+ segment[y].x1 = (short) y * cw->squareCell.cell_size_in_pixels;
+ segment[y].x2 = (short) y * cw->squareCell.cell_size_in_pixels;
+ segment[y].y1 = 0;
+ segment[y].y2 = (short) cw->squareCell.pixmap_height_in_pixels;
+ }
+ XDrawSegments(XtDisplay((Widget)cw), cw->squareCell.big_picture, cw->squareCell.draw_gc, segment, n_vert_segments);
+ /* draw current cell array into pixmap */
+ for (x = 0; x < cw->squareCell.pixmap_width_in_cells; x++) {
+ for (y = 0; y < cw->squareCell.pixmap_height_in_cells; y++) {
+ if (cw->squareCell.cell[x + (y * cw->squareCell.pixmap_width_in_cells)] == DRAWN)
+ DoCell(cw, x, y, cw->squareCell.draw_gc);
+ else
+ DoCell(cw, x, y, cw->squareCell.undraw_gc);
+ }
+ }
+}
+/* A Public function, not static */
+char *
+SquareCellGetArray(w, width_in_cells, height_in_cells)
+Widget w;
+int *width_in_cells, *height_in_cells;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ *width_in_cells = cw->squareCell.pixmap_width_in_cells;
+ *height_in_cells = cw->squareCell.pixmap_height_in_cells;
+ return (cw->squareCell.cell);
+}
+static void
+Resize(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ /* resize does nothing unless new size is bigger than entire pixmap */
+ if ((cw->core.width > cw->squareCell.pixmap_width_in_pixels) &&
+ (cw->core.height > cw->squareCell.pixmap_height_in_pixels)) {
+ /*
+ * Calculate the maximum cell size that will allow the
+ * entire bitmap to be displayed.
+ */
+ Dimension w_temp_cell_size_in_pixels, h_temp_cell_size_in_pixels;
+ Dimension new_cell_size_in_pixels;
+
+ w_temp_cell_size_in_pixels = cw->core.width / cw->squareCell.pixmap_width_in_cells;
+ h_temp_cell_size_in_pixels = cw->core.height / cw->squareCell.pixmap_height_in_cells;
+
+ if (w_temp_cell_size_in_pixels < h_temp_cell_size_in_pixels)
+ new_cell_size_in_pixels = w_temp_cell_size_in_pixels;
+ else
+ new_cell_size_in_pixels = h_temp_cell_size_in_pixels;
+
+ /* if size change mandates a new pixmap, make one */
+ if (new_cell_size_in_pixels != cw->squareCell.cell_size_in_pixels)
+ ChangeCellSize(cw, new_cell_size_in_pixels);
+ }
+}
+static void
+ChangeCellSize(w, new_cell_size)
+Widget w;
+int new_cell_size;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ int x, y;
+ cw->squareCell.cell_size_in_pixels = new_cell_size;
+ /* recalculate variables based on cell size */
+ cw->squareCell.pixmap_width_in_pixels =
+ cw->squareCell.pixmap_width_in_cells *
+ cw->squareCell.cell_size_in_pixels;
+ cw->squareCell.pixmap_height_in_pixels =
+ cw->squareCell.pixmap_height_in_cells *
+ cw->squareCell.cell_size_in_pixels;
+
+ /* destroy old and create new pixmap of correct size */
+ XFreePixmap(XtDisplay((Widget)cw), cw->squareCell.big_picture);
+ CreateBigPixmap(cw);
+
+ /* draw lines into new pixmap */
+ DrawIntoBigPixmap(cw);
+
+ /* draw current cell array into pixmap */
+ for (x = 0; x < cw->squareCell.pixmap_width_in_cells; x++) {
+ for (y = 0; y < cw->squareCell.pixmap_height_in_cells; y++) {
+ if (cw->squareCell.cell[x + (y * cw->squareCell.pixmap_width_in_cells)] == DRAWN)
+ DoCell(cw, x, y, cw->squareCell.draw_gc);
+ else
+ DoCell(cw, x, y, cw->squareCell.undraw_gc);
+ }
+ }
+}
+static void
+DoCell(w, x, y, gc)
+Widget w;
+int x, y;
+GC gc;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ /* otherwise, draw or undraw */
+ XFillRectangle(XtDisplay((Widget)cw), cw->squareCell.big_picture, gc,
+ cw->squareCell.cell_size_in_pixels * x + 2,
+ cw->squareCell.cell_size_in_pixels * y + 2,
+ (unsigned int)cw->squareCell.cell_size_in_pixels - 3,
+ (unsigned int)cw->squareCell.cell_size_in_pixels - 3);
+}
+static XtGeometryResult QueryGeometry(w, proposed, answer)
+Widget w;
+XtWidgetGeometry *proposed, *answer;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ /* set fields we care about */
+ answer->request_mode = CWWidth | CWHeight;
+ /* initial width and height */
+ if (cw->squareCell.show_all == True)
+ answer->width = cw->squareCell.pixmap_width_in_pixels;
+ else
+ answer->width = (cw->squareCell.pixmap_width_in_pixels >
+ DEFAULTWIDTH) ? DEFAULTWIDTH :
+ cw->squareCell.pixmap_width_in_pixels;
+ if (cw->squareCell.show_all == True)
+ answer->height = cw->squareCell.pixmap_height_in_pixels;
+ else
+ answer->height = (cw->squareCell.pixmap_height_in_pixels >
+ DEFAULTWIDTH) ? DEFAULTWIDTH :
+ cw->squareCell.pixmap_height_in_pixels;
+ if ( ((proposed->request_mode & (CWWidth | CWHeight))
+ == (CWWidth | CWHeight)) &&
+ proposed->width == answer->width &&
+ proposed->height == answer->height)
+ return XtGeometryYes;
+ else if (answer->width == cw->core.width &&
+ answer->height == cw->core.height)
+ return XtGeometryNo;
+ else
+ return XtGeometryAlmost;
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtGetValues Xt11
+void
+XtGetValues(object, args, num_args)
+>>ASSERTION Good A
+A successful call to
+void XtGetValues(object, args, num_args)
+shall copy the resource value from the instance structure of the
+widget
+.A object
+for the resource specified in the name field of each member of
+the argument list
+.A args
+to the location specified by the corresponding value field.
+>>CODE
+Widget squarew;
+Arg setargs[2], getargs[2];
+int invoked = 0;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tgtvalues1", "XtGetValues");
+ tet_infoline("PREP: Create Square Cell widget");
+ squarew = XtVaCreateManagedWidget("squarew",
+ squareCellWidgetClass,
+ boxw1,
+ (char *)NULL);
+ tet_infoline("PREP: Set resource values");
+ setargs[0].name = XavsNcurX;
+ setargs[0].value = (XtArgVal) 10;
+ setargs[1].name = XavsNcurY;
+ setargs[1].value = (XtArgVal) 10;
+ XtSetValues(squarew, setargs, 2);
+ tet_infoline("PREP: Get resource values");
+ getargs[0].name = XavsNcurX;
+ getargs[1].name = XavsNcurY;
+ getargs[0].value = (XtArgVal)malloc(sizeof(int));
+ getargs[1].value = (XtArgVal)malloc(sizeof(int));
+ XtGetValues(squarew, getargs, 2);
+ tet_infoline("TEST: Resource values");
+ check_dec(10, *((int *)getargs[0].value), XavsNcurX);
+ check_dec(10, *((int *)getargs[1].value), XavsNcurY);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When the class of the specified widget's parent
+is a subclass of constraintWidgetClass
+a call to
+void XtGetValues(object, args, num_args)
+shall obtain the resource values from the widget instance for any
+constraint resources specified in the argument list.
+>>CODE
+Widget formw_good , labelw_good;
+Arg getargs[1];
+Arg setargs[1];
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tgtvalues2", "XtGetValues");
+ tet_infoline("PREP: Create formw_good widget subclass of constraintWidgetClass");
+ tet_infoline(ebuf);
+ formw_good = (Widget) CreateFormWidget(boxw1);
+ tet_infoline("PREP: Create label widget Hello");
+ labelw_good = (Widget) CreateLabelWidget("Hello", formw_good);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Set XtNresizable constraint resource value ");
+ setargs[0].name = XtNresizable;
+ setargs[0].value = (XtArgVal) TRUE;
+ XtSetValues(labelw_good, setargs, 1);
+ tet_infoline("PREP: Get XtNresizable constraint resource value");
+ getargs[0].name = XtNresizable;
+ getargs[0].value = (XtArgVal)malloc(sizeof(unsigned char));
+ XtGetValues(labelw_good, getargs, 1);
+ tet_infoline("TEST: XtNresizable resource value");
+ check_dec(TRUE, *((Boolean *)getargs[0].value),XtNresizable);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When a resource specified in the argument list is not found in any resource
+list for the specified widget a call to
+void XtGetValues(object, args, num_args)
+shall not modify the value at the location specified by the corresponding
+value field.
+>>CODE
+Arg getargs[1];
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tgtvalues3", "XtGetValues");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get bogus resource NoSuchResource value");
+ getargs[0].name = "NoSuchResource";
+ getargs[0].value = 10;
+ XtGetValues(rowcolw, getargs, 1);
+ tet_infoline("TEST: Address field is not modified");
+ check_dec(10, getargs[0].value, "NoSuchResource");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A call to
+void XtGetValues(object, args, num_args)
+shall call the get_values_hook procedures in the widget's
+class and superclass records that are non-NULL in a
+superclass-to-subclass order.
+>>CODE
+Widget squarew;
+Arg setargs[2], getargs[2];
+int invoked = 0;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tgtvalues4", "XtGetValues");
+ tet_infoline("PREP: Create Square Cell widget");
+ squarew = XtVaCreateManagedWidget("squarew",
+ squareCellWidgetClass, boxw1, NULL);
+ tet_infoline("PREP: Set resource values");
+ setargs[0].name = XavsNcurX;
+ setargs[0].value = (XtArgVal) 10;
+ setargs[1].name = XavsNcurY;
+ setargs[1].value = (XtArgVal) 10;
+ XtSetValues(squarew, setargs, 2);
+ tet_infoline("PREP: Get resource values");
+ getargs[0].name = XavsNcurX;
+ getargs[1].name = XavsNcurY;
+ getargs[0].value = (XtArgVal)malloc(sizeof(int));
+ getargs[1].value = (XtArgVal)malloc(sizeof(int));
+ XtGetValues(squarew, getargs, 2);
+ check_dec(10, *((int *)getargs[0].value), XavsNcurX);
+ check_dec(10, *((int *)getargs[1].value), XavsNcurY);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Get_values_hook procedure GetValuesHook was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "GetValuesHook invocations count");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When the class of the specified widget's parent
+is a subclass of constraintWidgetClass, any of the parent's
+class or superclass records have declared ConstraintClassExtension
+records in the Constraint class part extension field with a record
+type of NULLQUARK, and the get_values_hook field in the extension
+record is non-NULL, a call to
+void XtGetValues(object, args, num_args)
+shall call the get_values_hook procedures in superclass-to-subclass order.
+>>CODE
+Widget squarew;
+Arg setargs[2], getargs[2];
+int invoked = 0;
+pid_t pid2;
+Widget formw_good, labelw_good;
+
+ /*avsForm is a subclass of constraint with the appropriate
+ get_value_hook procedures. See libXtTest AvsForm.c*/
+ FORK(pid2);
+ avs_xt_hier("Tgtvalues4", "XtGetValues");
+ tet_infoline("PREP: Create avsform widget in boxw1 widget");
+ formw_good = XtCreateManagedWidget("avsform",
+ avsformWidgetClass,
+ boxw1,
+ NULL,
+ 0);
+ labelw_good = (Widget) CreateLabelWidget("Hello", formw_good);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get XtNresizable constraint resource value");
+ getargs[0].name = XtNresizable;
+ getargs[0].value = (XtArgVal)malloc(sizeof(unsigned char));
+ XtGetValues(labelw_good, getargs, 1);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Parent's extension get_values_hook procedure GetValuesHook was invoked");
+ invoked = avs_get_event(7);
+ check_dec(1, invoked, "parent's extension get_values_hook invocation count");
+ tet_result(TET_PASS);
diff --git a/xts5/Xt11/XtOffset/XtOffset.m b/xts5/Xt11/XtOffset/XtOffset.m
new file mode 100644
index 00000000..c39d5dd4
--- /dev/null
+++ b/xts5/Xt11/XtOffset/XtOffset.m
@@ -0,0 +1,96 @@
+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/Xt11/XtOffset/XtOffset.m,v 1.1 2005-02-12 14:37:54 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/Xt11/XtOffset/XtOffset.m
+>>#
+>># Description:
+>># Tests for XtOffset()
+>>#
+>># Modifications:
+>># $Log: toffset.m,v $
+>># Revision 1.1 2005-02-12 14:37:54 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:23 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:19 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:28 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:02 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:19:19 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:13:58 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+int avs2;
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+>>TITLE XtOffset Xt11
+Cardinal
+XtOffset(pointer_type, field_name)
+>>ASSERTION Good A
+A successful call to
+Cardinal XtOffset(pointer_type, field_name)
+shall return the byte offset of the member
+.A field_name
+within the structure type pointed to by
+.A pointer_type.
+>>CODE
+char label[80];
+char string[10];
+typedef struct {
+ int dumb;
+ char dumb2;
+} *teststruct;
+
+ tet_infoline("TEST: XtOffset returns correct offset");
+ if (XtOffset(teststruct, dumb) != 0) {
+ sprintf(ebuf, "ERROR: Expected offset = 0, received %d", XtOffset(teststruct, dumb2));
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (XtOffset(teststruct, dumb2) != sizeof(int)) {
+ sprintf(ebuf, "ERROR: Expected offset = %d, received %d", sizeof(int), XtOffset(teststruct, dumb2));
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_result(TET_PASS);
diff --git a/xts5/Xt11/XtOffsetOf/XtOffsetOf.m b/xts5/Xt11/XtOffsetOf/XtOffsetOf.m
new file mode 100644
index 00000000..8ac92b49
--- /dev/null
+++ b/xts5/Xt11/XtOffsetOf/XtOffsetOf.m
@@ -0,0 +1,96 @@
+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/Xt11/XtOffsetOf/XtOffsetOf.m,v 1.1 2005-02-12 14:37:54 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/Xt11/XtOffsetOf/XtOffsetOf.m
+>>#
+>># Description:
+>># Tests for XtOffsetOf()
+>>#
+>># Modifications:
+>># $Log: toffsetof.m,v $
+>># Revision 1.1 2005-02-12 14:37:54 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:22 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:18 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:28 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:02 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:19:18 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:13:57 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+int avs2;
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+>>TITLE XtOffsetOf Xt11
+Cardinal
+XtOffsetOf(structure_type, field_name)
+>>ASSERTION Good A
+A successful call to
+Cardinal XtOffsetOf(structure_type, field_name)
+shall return the byte offset of the member
+.A field_name
+within the structure type
+.A structure_type.
+>>CODE
+char label[80];
+char string[10];
+typedef struct {
+ int dumb;
+ char dumb2;
+} teststruct;
+
+ tet_infoline("TEST: XtOffsetOf returns correct offset");
+ if (XtOffsetOf(teststruct, dumb) != 0) {
+ sprintf(ebuf, "ERROR: Expected offset = 0, received %d", XtOffsetOf(teststruct, dumb2));
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (XtOffsetOf(teststruct, dumb2) != sizeof(int)) {
+ sprintf(ebuf, "ERROR: Expected offset = %d, received %d", sizeof(int), XtOffsetOf(teststruct, dumb2));
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_result(TET_PASS);
diff --git a/xts5/Xt11/XtSetSubvalues/XtSetSubvalues.m b/xts5/Xt11/XtSetSubvalues/XtSetSubvalues.m
new file mode 100644
index 00000000..427d69eb
--- /dev/null
+++ b/xts5/Xt11/XtSetSubvalues/XtSetSubvalues.m
@@ -0,0 +1,170 @@
+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/Xt11/XtSetSubvalues/XtSetSubvalues.m,v 1.1 2005-02-12 14:37:54 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/Xt11/XtSetSubvalues/XtSetSubvalues.m
+>>#
+>># Description:
+>># Tests for XtSetSubvalues()
+>>#
+>># Modifications:
+>># $Log: tstsvals.m,v $
+>># Revision 1.1 2005-02-12 14:37:54 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:53 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:51 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:56 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:30 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:20:49 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:15:55 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+
+typedef struct _instance_variables {
+ long foreground;
+ String label;
+} instance_variable_rec;
+typedef struct _instance_variables2 {
+ long l1;
+ long l2;
+} instance_variable_rec2;
+static XtResource resources[] = {
+ {
+ XtNforeground,
+ XtCForeground,
+ XtRPixel, sizeof(Pixel),
+ XtOffsetOf(instance_variable_rec, foreground),
+ XtRString, "XtDefaultforeground"
+ },
+ {
+ XtNlabel,
+ XtCLabel,
+ XtRString, sizeof(String),
+ XtOffsetOf(instance_variable_rec, label),
+ XtRString, "XtDefaultLabel"
+ },
+};
+>>TITLE XtSetSubvalues Xt11
+void
+XtSetSubvalues(base, resources, num_resources, args, num_args)
+>>ASSERTION Good A
+A call to
+void XtSetSubvalues(base, resources, num_resources, args, num_args)
+shall copy the resource value specified by the value field for the
+resource specified in the name field of each member in the
+argument list
+.A args
+that is present in the resource list specified by
+.A resources
+to the structure pointed to by
+.A base.
+>>CODE
+instance_variable_rec base;
+Cardinal num_resources;
+Arg setargs[2], getargs[2];
+Cardinal num_args;
+Pixel integer;
+char *string;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tstsvals1", "XtSetSubvalues");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Initialize the base address");
+ XtGetApplicationResources(topLevel, &base, resources,2,NULL,0);
+ tet_infoline("PREP: Set subvalues");
+ setargs[0].name = XtNforeground;
+ setargs[0].value = (XtArgVal)1;
+ setargs[1].name = XtNlabel;
+ setargs[1].value = (XtArgVal)"Hello World";
+ XtSetSubvalues(&base, resources, 2, &setargs[0], 2 );
+ tet_infoline("PREP: Get subvalues");
+ XtVaGetSubvalues(&base, resources, 2, XtNforeground, &integer,
+ XtNlabel, &string, (char *)NULL);
+ tet_infoline("TEST: Retrieved subvalues");
+ check_dec(1, integer , XtNforeground);
+ check_str("Hello World", string , XtNlabel);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A call to
+void XtSetSubvalues(base, resources, num_resources, args, num_args)
+when a resource specified in the argument list
+.A args
+is not present in the resource list specified by
+.A resources
+shall not copy the resource value to the structure
+.A base.
+>>CODE
+instance_variable_rec2 base;
+Cardinal num_resources;
+Arg setargs[2], getargs[2];
+Cardinal num_args;
+Pixel integer;
+char *string;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tstsvals1", "XtSetSubvalues");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Initialize the base address");
+ XtGetApplicationResources(topLevel, &base, resources,2,NULL,0);
+ tet_infoline("PREP: Set subvalues");
+ setargs[0].name = XtNforeground;
+ setargs[0].value = (XtArgVal)1;
+ setargs[1].name = "not real";
+ setargs[1].value = (XtArgVal)2;
+ base.l1 = (long)-1;
+ base.l2 = (long)-1;
+ XtSetSubvalues(&base, resources, 2, &setargs[0], 2 );
+ tet_infoline("TEST: Only correct values are set");
+ check_dec(1, base.l1 , XtNforeground);
+ check_dec(-1, base.l2 , "missing long value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
diff --git a/xts5/Xt11/XtSetTypeConverter/XtSetTypeConverter.m b/xts5/Xt11/XtSetTypeConverter/XtSetTypeConverter.m
new file mode 100644
index 00000000..11240cb3
--- /dev/null
+++ b/xts5/Xt11/XtSetTypeConverter/XtSetTypeConverter.m
@@ -0,0 +1,1039 @@
+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/Xt11/XtSetTypeConverter/XtSetTypeConverter.m,v 1.1 2005-02-12 14:37:54 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/Xt11/XtSetTypeConverter/XtSetTypeConverter.m
+>>#
+>># Description:
+>># Tests for XtSetTypeConverter()
+>>#
+>># Modifications:
+>># $Log: tstyconv.m,v $
+>># Revision 1.1 2005-02-12 14:37:54 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:46 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:43 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.1 1998/08/07 19:30:21 andy
+>># Adjusted casts for argument data retrieval to handle 64-bit implementations.
+>>#
+>># Revision 6.0 1998/03/02 05:28:49 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:23 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.1 1998/01/13 02:16:47 andy
+>># Added return statements for XtCVT_StringToChar, XtCVT2_StringToChar,
+>># and XtCVT2_StringToInt (SR 114).
+>>#
+>># Revision 4.0 1995/12/15 09:20:21 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:15:19 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+#include <AvsRectObj.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+#ifndef XavsRChar
+#define XavsRChar "Char"
+#endif
+
+Boolean XtCVT_StringToChar(display, args, num_args, from_val, to_val, convertor_data)
+Display *display;
+XrmValuePtr args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *convertor_data;
+{
+ char *str = (char *) (from_val->addr);
+ static unsigned char i;
+ avs_set_event(1, avs_get_event(1)+1);
+ to_val->size = sizeof (unsigned char);
+ to_val->addr = (XtPointer) &i;
+ i = *str;
+ return(True);
+}
+void XtDES_Proc(app_ctext, to_val, converter_data, args, num_args )
+XtAppContext app_ctext;
+XrmValue *to_val;
+XtPointer converter_data;
+XrmValue *args;
+Cardinal *num_args;
+{
+ avs_set_event(2,avs_get_event(2)+1);
+}
+
+Boolean XtCVT2_StringToChar(display, args, num_args, from_val, to_val, convertor_data)
+Display *display;
+XrmValuePtr args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *convertor_data;
+{
+ char *str = (char *) (from_val->addr);
+ static unsigned char i;
+ sprintf(ebuf, "ERROR: Unexpected invocation of XtCVT2_StringToChar");
+ tet_result(TET_FAIL);
+ tet_infoline(ebuf);
+ to_val->size = sizeof (unsigned char);
+ to_val->addr = (XtPointer) &i;
+ i = *str;
+ return(True);
+}
+Boolean XtCVT2_StringToInt(display, args, num_args, from_val, to_val, convertor_data)
+Display *display;
+XrmValuePtr args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *convertor_data;
+{
+ char *str = (char *) (from_val->addr);
+ static unsigned int i;
+ avs_set_event(1, avs_get_event(1)+1);
+ to_val->size = sizeof (unsigned int);
+ to_val->addr = (XtPointer) &i;
+ i = *str;
+ return(True);
+}
+void XtDES2_FreeChar(app_ctext, to_val, converter_data, args, num_args )
+XtAppContext app_ctext;
+XrmValue *to_val;
+XtPointer converter_data;
+XrmValue *args;
+Cardinal *num_args;
+{
+ sprintf(ebuf, "ERROR: Unexpected invocation of XtDES2_FreeChar");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+}
+void XtDES2_FreeInt(app_ctext, to_val, converter_data, args, num_args )
+XtAppContext app_ctext;
+XrmValue *to_val;
+XtPointer converter_data;
+XrmValue *args;
+Cardinal *num_args;
+{
+ avs_set_event(2, avs_get_event(2)+1);
+}
+
+#define NUMARGS 8
+XtConvertArgRec cargs[NUMARGS];
+int argdata[NUMARGS] = {
+ 0, /*don't care*/
+ 2002,
+ 0,
+ 4004,
+ 0,
+ 0,
+ 0,
+ 8008
+};
+
+void xcap(w, size, value)
+Widget w;
+Cardinal *size;
+XrmValue *value;
+{
+ avs_set_event(2, avs_get_event(2)+1);
+ value->addr = (XtPointer)&argdata[7];
+ value->size = sizeof(argdata[7]);
+}
+
+void init_args(checknum)
+int checknum;
+{
+ cargs[0].address_mode = XtImmediate;
+ cargs[0].address_id = (XtPointer)checknum;
+ cargs[0].size = sizeof(XtPointer);
+
+/*XtAddress*/
+ cargs[1].address_mode = XtAddress;
+ cargs[1].address_id = (XtPointer)&argdata[1];
+ cargs[1].size = sizeof(XtPointer);
+
+/*XtBaseOffset*/
+ cargs[2].address_mode = XtBaseOffset;
+ cargs[2].address_id = (XtPointer)XtOffset(Widget, core.screen);
+ cargs[2].size = sizeof(Screen*);
+
+/*XtImmediate*/
+ cargs[3].address_mode = XtImmediate;
+ cargs[3].address_id = (XtPointer)argdata[3];
+ cargs[3].size = sizeof(XtPointer);
+
+/*XtResourceString*/
+ cargs[4].address_mode = XtImmediate;
+ cargs[4].address_id = (XtPointer)argdata[4];
+ cargs[4].size = sizeof(XtPointer);
+
+/*XtResourceQuark*/
+ cargs[5].address_mode = XtImmediate;
+ cargs[5].address_id = (XtPointer)argdata[5];
+ cargs[5].size = sizeof(XtPointer);
+
+/*XtWidgetBaseOffset*/
+ cargs[6].address_mode = XtWidgetBaseOffset;
+ cargs[6].address_id = (XtPointer)XtOffset(Widget, core.self);
+ cargs[6].size = sizeof(Widget);
+
+/*XtProcedureArg*/
+ cargs[7].address_mode = XtProcedureArg;
+ cargs[7].address_id = (XtPointer)xcap;
+ cargs[7].size = sizeof(XtPointer);
+}
+
+Boolean XtCVT_ProcA(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValuePtr args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+int checknum;
+
+ avs_set_event(1, avs_get_event(1)+1);
+ tet_infoline("TEST: Additional arguments passed to converter");
+ if (*num_args != NUMARGS) {
+ sprintf(ebuf, "ERROR: expected %d arguments, received %d", NUMARGS, *num_args);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ return False;
+ }
+
+ checknum = (int)(*(XPointer *)args[0].addr);
+
+ if (checknum == 0) {
+ tet_infoline("ERROR: args[0].addr = 0");
+ tet_result(TET_FAIL);
+ return False;
+ }
+ if (checknum > NUMARGS) {
+ sprintf(ebuf, "ERROR: args[0].addr = %d, should be < %d", checknum, NUMARGS);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ return False;
+ }
+
+ if (args[checknum].addr == NULL) {
+ sprintf(ebuf, "ERROR: args[%d].addr = NULL", checknum);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ return False;
+ }
+
+ switch (checknum) {
+ case 1:
+ case 7:
+ if (((int)*(int *)args[checknum].addr) != argdata[checknum]) {
+ sprintf(ebuf, "ERROR: expected args[%d].addr to point to %d points to %d", checknum, argdata[checknum], ((int)*(int *)args[checknum].addr));
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ return False;
+ }
+ break;
+ case 2:
+ if (((Screen*)*(Screen**)args[checknum].addr) != topLevel->core.screen) {
+ sprintf(ebuf, "ERROR: expected args[%d].addr to point to %p points to %p", checknum, topLevel->core.screen, ((Screen*)*(Screen**)args[checknum].addr));
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ return False;
+ }
+ break;
+ case 3:
+ if (((int)*(XPointer *)args[checknum].addr) != argdata[checknum]) {
+ sprintf(ebuf, "ERROR: expected args[%d].addr to point to %d points to %d", checknum, argdata[checknum], ((int)*(XPointer *)args[checknum].addr));
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ return False;
+ }
+ break;
+ case 6:
+ if (((Widget)*(Widget*)args[checknum].addr) != topLevel->core.self) {
+ sprintf(ebuf, "ERROR: expected args[%d].addr to point to %p points to %p", checknum, topLevel->core.self, ((Widget)*(Widget*)args[checknum].addr));
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ return False;
+ }
+ break;
+ default:
+ sprintf(ebuf, "ERROR: Unknown argument type %d", checknum);
+ tet_infoline(ebuf);
+ tet_result(TET_UNRESOLVED);
+ return False;
+ }
+ return True;
+}
+
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtSetTypeConverter Xt11
+void
+XtSetTypeConverter(from_type, to_type, converter, convert_args, num_args, cache_type, destructor)
+>>ASSERTION Good A
+A successful call to
+void XtSetTypeConverter(from_type, to_type, converter, convert_args,
+num_args, cache_type, destructor)
+shall register
+.A converter
+as the procedure that will be called by the Intrinsics
+to convert a resource value from the representation type
+.A from_type
+to the type
+.A to_type
+in all application contexts created by the calling process,
+including any future application contexts that may be created.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+int pid2;
+
+ FORK( pid2 );
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tstyconv1", "XtSetTypeConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Register resource converter XtCVT_StringToChar");
+ XtSetTypeConverter(XtRString,
+ XavsRChar,
+ XtCVT_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheByDisplay,
+ XtDES_Proc);
+ tet_infoline("PREP: Invoke resource converter XtCVT_StringToChar");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtCallConverter(display_good,
+ XtCVT_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: XtCVT_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ if ( !invoked ) {
+ sprintf(ebuf, "ERROR: Procedure XtCVT_StringToChar was not invoked");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ XtCloseDisplay(display_good);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When
+.A destructor
+is not NULL
+a successful call to
+void XtSetTypeConverter(from_type, to_type, converter, convert_args,
+num_args, cache_type, destructor)
+shall register
+.A destructor
+as the procedure that shall be called by the Intrinsics functions to
+deallocate the resources produced by the corresponding converter.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+int pid2;
+
+ FORK( pid2 );
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tstyconv1", "XtSetTypeConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Register resource converter XtCVT_StringToChar");
+ XtSetTypeConverter(XtRString,
+ XavsRChar,
+ XtCVT_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheByDisplay,
+ XtDES_Proc);
+ tet_infoline("PREP: Invoke resource converter XtCVT_StringToChar");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtCallConverter(display_good,
+ XtCVT_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: XtCVT_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ if ( !invoked ) {
+ sprintf(ebuf, "ERROR: Procedure XtCVT_StringToChar was not invoked");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ tet_infoline("PREP: Close display to invoke destructor");
+ XtCloseDisplay(display_good);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Destructor was invoked");
+ invoked = avs_get_event(2);
+ if (invoked == 0) {
+ sprintf(ebuf, "ERROR: Destructor was not invoked");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When more than one converter is registered for the same
+.A from_type
+and
+.A to_type
+by multiple calls to
+void XtSetTypeConverter(from_type, to_type, converter, convert_args, num_args, cache_type, destructor)
+the most recently registered converter shall override the previous ones.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tstyconv2", "XtSetTypeConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Register converter XtCVT2_StringToChar");
+ XtSetTypeConverter(XtRString,
+ XavsRChar,
+ XtCVT2_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheByDisplay,
+ XtDES2_FreeChar);
+ tet_infoline("PREP: Register converter XtCVT2_StringToInt");
+ XtSetTypeConverter(XtRString,
+ XavsRChar,
+ XtCVT2_StringToInt,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheByDisplay,
+ XtDES2_FreeInt);
+ tet_infoline("PREP: Invoke recently added converter XtCVT2_StringToInt");
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtConvertAndStore(topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ tet_infoline("TEST: Procedure XtCVT2_StringToInt was invoked");
+ invoked = avs_get_event(1);
+ if ( !invoked ) {
+ sprintf(ebuf, "ERROR: Procedure XtCVT2_StringToInt was not invoked");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("PREP: Close display to invoke destructor");
+ display_good = XtDisplay(topLevel);
+ XtCloseDisplay(display_good);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Destructor was invoked");
+ invoked = avs_get_event(2);
+ if (invoked == 0) {
+ sprintf(ebuf, "ERROR: Destructor was not invoked");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+On a call to
+void XtSetTypeConverter(from_type, to_type, converter, convert_args,
+num_args, cache_type, destructor)
+when
+.A cache_type
+is XtCacheNone the converter procedure shall be registered such that
+the results of a previous conversion will not be reused for subsequent
+resource requests.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+int pid2;
+
+ FORK( pid2 );
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tstyconv1", "XtSetTypeConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Register resource converter XtCVT_StringToChar");
+ XtSetTypeConverter(XtRString,
+ XavsRChar,
+ XtCVT_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheNone,
+ XtDES_Proc);
+ tet_infoline("PREP: Invoke resource converter XtCVT_StringToChar");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtCallConverter(display_good,
+ XtCVT_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: XtCVT_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ if ( !invoked ) {
+ sprintf(ebuf, "ERROR: Procedure XtCVT_StringToChar was not invoked");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ tet_infoline("PREP: Invoke resource converter again");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtCallConverter(display_good,
+ XtCVT_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: XtCVT_StringToChar was invoked again");
+ invoked = avs_get_event(1);
+ if (invoked != 2) {
+ sprintf(ebuf, "ERROR: Procedure XtCVT_StringToChar was not invoked");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ XtCloseDisplay(display_good);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+On a call to
+void XtSetTypeConverter(from_type, to_type, converter, convert_args,
+num_args, cache_type, destructor)
+when
+.A cache_type
+is XtCacheAll the converter procedure shall be registered such that
+the results of a a previous conversion will be reused for subsequent
+resource requests with the same source value and conversion arguments.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+int pid2;
+
+ FORK( pid2 );
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tstyconv1", "XtSetTypeConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Register resource converter XtCVT_StringToChar");
+ XtSetTypeConverter(XtRString,
+ XavsRChar,
+ XtCVT_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheAll,
+ XtDES_Proc);
+ tet_infoline("PREP: Invoke resource converter XtCVT_StringToChar");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtCallConverter(display_good,
+ XtCVT_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: XtCVT_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ if ( !invoked ) {
+ sprintf(ebuf, "ERROR: Procedure XtCVT_StringToChar was not invoked");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ tet_infoline("PREP: Invoke resource converter again");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtCallConverter(display_good,
+ XtCVT_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: XtCVT_StringToChar was not invoked again");
+ invoked = avs_get_event(1);
+ if (invoked != 1) {
+ sprintf(ebuf, "ERROR: Procedure XtCVT_StringToChar was invoked");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ XtCloseDisplay(display_good);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+On a call to
+void XtSetTypeConverter(from_type, to_type, converter, convert_args,
+num_args, cache_type, destructor)
+when
+.A cache_type
+is XtCacheByDisplay the converter procedure shall be registered such that
+the results of a previous conversion will be reused for subsequent
+resource requests with the same source value and conversion arguments
+until the display connection associated with the converted value is
+not closed, at which time the values stored in the cache will be
+removed and the destructor procedure will be called.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+int pid2;
+
+ FORK( pid2 );
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tstyconv1", "XtSetTypeConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Register resource converter XtCVT_StringToChar");
+ XtSetTypeConverter(XtRString,
+ XavsRChar,
+ XtCVT_StringToChar,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheByDisplay,
+ XtDES_Proc);
+ tet_infoline("PREP: Invoke resource converter XtCVT_StringToChar");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtCallConverter(display_good,
+ XtCVT_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: XtCVT_StringToChar was invoked");
+ invoked = avs_get_event(1);
+ if ( !invoked ) {
+ sprintf(ebuf, "ERROR: Procedure XtCVT_StringToChar was not invoked");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ tet_infoline("PREP: Invoke resource converter again");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtCallConverter(display_good,
+ XtCVT_StringToChar,
+ (XrmValuePtr)NULL,
+ (Cardinal)0,
+ &from,
+ &to_in_out,
+ &cache_ref_return
+ );
+ tet_infoline("TEST: XtCVT_StringToChar was not invoked again");
+ invoked = avs_get_event(1);
+ if (invoked != 1) {
+ sprintf(ebuf, "ERROR: Procedure XtCVT_StringToChar was invoked");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: Result returned");
+ check_char('H', *(char *)to_in_out.addr, "conversion result");
+ XtCloseDisplay(display_good);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good B 0
+On a call to
+void XtSetTypeConverter(from_type, to_type, converter, convert_args,
+num_args, cache_type, destructor)
+when XtCacheRefCount and XtCacheAll are set in
+.A cache_type
+the converter procedure shall be
+registered such that a count of every call to XtCreateWidget,
+XtCreateManagedWidget, XtGetApplicationResources
+and XtGetSubresources that use the converted value will be made,
+the count decremented when a widget using the converted
+value is destroyed, and the destructor procedure called when the
+count reaches zero.
+>>ASSERTION Good B 0
+On a call to
+void XtSetTypeConverter(from_type, to_type, converter, convert_args,
+num_args, cache_type, destructor)
+when XtCacheRefCount and XtCacheByDisplay are set in
+.A cache_type
+the converter procedure shall be
+registered such that a count of every call to XtCreateWidget,
+XtCreateManagedWidget, XtGetApplicationResources
+and XtGetSubresources that use the converted value will be made,
+the count decremented when a widget using the converted
+value is destroyed, and the destructor procedure called when the
+count reaches zero.
+>>ASSERTION Good A
+When a coverter is registered by a call to
+void XtSetTypeConverter(from_type, to_type, converter, convert_args,
+num_args, cache_type, destructor)
+with the address_mode
+member of an XtConvertArgRec structure in the list pointed to by
+.A convert_args
+set to XtAddress it shall be called by the Intrinsics with the
+data pointed to by the address_id field passed as a conversion
+argument.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+int pid2;
+
+ FORK( pid2 );
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tstyconv1", "XtSetTypeConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Register converter");
+ init_args(1);
+ XtSetTypeConverter(XtRString,
+ XavsRChar,
+ XtCVT_ProcA,
+ (XtConvertArgList)cargs,
+ (Cardinal)NUMARGS,
+ XtCacheNone,
+ NULL);
+ tet_infoline("PREP: Invoke conversion");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtConvertAndStore(
+ topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ XtCloseDisplay(display_good);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: converter was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "converter invocation count");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When a coverter is registered by a call to
+void XtSetTypeConverter(from_type, to_type, converter, convert_args,
+num_args, cache_type, destructor)
+with the address_mode
+member of an XtConvertArgRec structure in the list pointed to by
+.A convert_args
+set to XtBaseOffset it shall be called by the Intrinsics with the
+data at an offset of address_id from the base of the widget, in whose
+context the converter is invoked, passed as a conversion argument.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+int pid2;
+
+ FORK( pid2 );
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tstyconv1", "XtSetTypeConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Register converter");
+ init_args(2);
+ XtSetTypeConverter(XtRString,
+ XavsRChar,
+ XtCVT_ProcA,
+ (XtConvertArgList)cargs,
+ (Cardinal)NUMARGS,
+ XtCacheNone,
+ NULL);
+ tet_infoline("PREP: Invoke conversion");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtConvertAndStore(
+ topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ XtCloseDisplay(display_good);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: converter was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "converter invocation count");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When a coverter is registered by a call to
+void XtSetTypeConverter(from_type, to_type, converter, convert_args,
+num_args, cache_type, destructor)
+with the address_mode
+member of an XtConvertArgRec structure in the list pointed to by
+.A convert_args
+set to XtImmediate it shall be called by the Intrinsics with
+the data in the address_id field passed as a conversion
+argument.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+int pid2;
+
+ FORK( pid2 );
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tstyconv1", "XtSetTypeConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Register converter");
+ init_args(3);
+ XtSetTypeConverter(XtRString,
+ XavsRChar,
+ XtCVT_ProcA,
+ (XtConvertArgList)cargs,
+ (Cardinal)NUMARGS,
+ XtCacheNone,
+ NULL);
+ tet_infoline("PREP: Invoke conversion");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtConvertAndStore(
+ topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ XtCloseDisplay(display_good);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: converter was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "converter invocation count");
+ tet_result(TET_PASS);
+>>ASSERTION Good B 0
+When a coverter is registered by a call to
+void XtSetTypeConverter(from_type, to_type, converter, convert_args,
+num_args, cache_type, destructor)
+with the address_mode
+member of an XtConvertArgRec structure in the list pointed to by
+.A convert_args
+set to XtResourceString it shall be called by the Intrinsics with the
+offset of the resource from the base of the widget, in whose context the
+converter is invoked, for the resource string pointed to by address_id
+passed as a conversion argument.
+>>ASSERTION Good B 0
+When a coverter is registered by a call to
+void XtSetTypeConverter(from_type, to_type, converter, convert_args,
+num_args, cache_type, destructor)
+with the address_mode
+member of an XtConvertArgRec structure in the list pointed to by
+.A convert_args
+set to XtResourceQuark it shall be called by the Intrinsics with the
+offset of the resource from the base of the widget, in whose context
+the converter is invoked, for the resource string specified by the
+quark value in the address_id field passed as a conversion argument.
+>>ASSERTION Good A
+When a coverter is registered by a call to
+void XtSetTypeConverter(from_type, to_type, converter, convert_args,
+num_args, cache_type, destructor)
+with the address_mode
+member of an XtConvertArgRec structure in the list pointed to by
+.A convert_args
+set to XtWidgetBaseOffset it shall be called by the Intrinsics with
+the data at an offset of address_id in the closest windowed
+ancestor of the widget in whose context the converter is called,
+when the widget is not of a subclass of Core, passed as a conversion
+argument.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+int pid2;
+Widget test_widget;
+
+ FORK( pid2 );
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tstyconv1", "XtSetTypeConverter");
+ tet_infoline("PREP: Create AVS RectObj widget");
+ test_widget = XtVaCreateManagedWidget("avsro", avsrectObjClass, topLevel, NULL);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Register converter");
+ init_args(3);
+ XtSetTypeConverter(XtRString,
+ XavsRChar,
+ XtCVT_ProcA,
+ (XtConvertArgList)cargs,
+ (Cardinal)NUMARGS,
+ XtCacheNone,
+ NULL);
+ tet_infoline("PREP: Invoke conversion");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtConvertAndStore(
+ test_widget,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ XtCloseDisplay(display_good);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: converter was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "converter invocation count");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When a coverter is registered by a call to
+void XtSetTypeConverter(from_type, to_type, converter, convert_args,
+num_args, cache_type, destructor)
+with the address_mode
+member of an XtConvertArgRec structure in the list pointed to by
+.A convert_args
+set to XtProcedureArg it shall be called by the Intrinsics with the
+value returned by the function pointed to by the address_id field
+passed as a conversion argument.
+>>CODE
+Display *display_good;
+XrmValue from;
+XrmValue to_in_out;
+XtCacheRef cache_ref_return;
+int invoked = 0;
+int pid2;
+
+ FORK( pid2 );
+ avs_set_event(1, 0);
+ avs_set_event(2, 0);
+ avs_xt_hier("Tstyconv1", "XtSetTypeConverter");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Register converter");
+ init_args(7);
+ XtSetTypeConverter(XtRString,
+ XavsRChar,
+ XtCVT_ProcA,
+ (XtConvertArgList)cargs,
+ (Cardinal)NUMARGS,
+ XtCacheNone,
+ NULL);
+ tet_infoline("PREP: Invoke conversion");
+ display_good = XtDisplay(topLevel);
+ from.addr = (XtPointer) "Hello";
+ from.size = strlen(from.addr) + 1;
+ XtConvertAndStore(
+ topLevel,
+ XtRString,
+ &from,
+ XavsRChar,
+ &to_in_out
+ );
+ XtCloseDisplay(display_good);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: converter was invoked");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "converter invocation count");
+ tet_infoline("TEST: function was invoked");
+ invoked = avs_get_event(2);
+ check_dec(1, invoked, "function invocation count");
+ tet_result(TET_PASS);
diff --git a/xts5/Xt11/XtSetValues/XtSetValues.m b/xts5/Xt11/XtSetValues/XtSetValues.m
new file mode 100644
index 00000000..2009e1c5
--- /dev/null
+++ b/xts5/Xt11/XtSetValues/XtSetValues.m
@@ -0,0 +1,1168 @@
+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/Xt11/XtSetValues/XtSetValues.m,v 1.1 2005-02-12 14:37:54 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/Xt11/XtSetValues/XtSetValues.m
+>>#
+>># Description:
+>># Tests for XtSetValues()
+>>#
+>># Modifications:
+>># $Log: tstvalues.m,v $
+>># Revision 1.1 2005-02-12 14:37:54 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:52 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:49 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:55 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.1 1998/02/24 02:02:50 andy
+>># Made test 13 conditional on coverage level.
+>>#
+>># Revision 5.0 1998/01/26 03:25:29 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.2 1998/01/20 19:46:58 andy
+>># Added return statement to SetValuesHook procedures and changed
+>># compress exposure for squarew to XtExposeNoCompress.
+>>#
+>># Revision 4.0 1995/12/15 09:20:43 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:15:48 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+#include <xt/SquareCelP.h>
+#include <X11/Xaw/Form.h>
+#include <AvsForm.h>
+#include <AvsForm2.h>
+
+extern WidgetClass avsCompWidgetClass, avsWidgetClass;
+extern WidgetClass avsComp2WidgetClass;
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+/* procedure XtTMO_Proc */
+void XtTMO_Proc(client_data, id)
+XtPointer client_data;
+XtIntervalId *id;
+{
+ exit(0);
+}
+
+/*
+ * SquareCell.c - Square Widget
+ */
+#define INTERNAL_WIDTH 2
+#define INTERNAL_HEIGHT 4
+#define DEFAULT_PIXMAP_WIDTH 1 /* in cells */
+#define DEFAULT_PIXMAP_HEIGHT 1 /* in cells */
+#define DEFAULT_CELL_SIE 20 /* in pixels */
+/* values for instance variable is_drawn */
+#define DRAWN 1
+#define UNDRAWN 0
+/* modes for drawing */
+#define DRAW 1
+#define UNDRAW 0
+#define MAXLINES 10 /* max of horiz or vertical cells */
+#define SCROLLBARWIDTH 15
+#define DEFAULTWIDTH 300 /* widget size when show_all is False */
+#define offset(field) XtOffsetOf(SquareCellRec, field)
+static XtResource resources[] = {
+ {
+ XtNforeground,
+ XtCForeground,
+ XtRPixel,
+ sizeof(Pixel),
+ offset(squareCell.foreground),
+ XtRString,
+ XtDefaultForeground
+ },
+ {
+ XavsNtoggleCallback,
+ XavsCToggleCallback,
+ XtRCallback,
+ sizeof(XtPointer),
+ offset(squareCell.callback),
+ XtRCallback,
+ NULL
+ },
+ {
+ XavsNcellSizeInPixels,
+ XavsCCellSizeInPixels,
+ XtRInt, sizeof(int),
+ offset(squareCell.cell_size_in_pixels),
+ XtRImmediate,
+ (XtPointer)DEFAULT_CELL_SIE
+ },
+ {
+ XavsNpixmapWidthInCells,
+ XavsCPixmapWidthInCells,
+ XtRDimension,
+ sizeof(Dimension),
+ offset(squareCell.pixmap_width_in_cells),
+ XtRImmediate,
+ (XtPointer)DEFAULT_PIXMAP_WIDTH
+ },
+ {
+ XavsNpixmapHeightInCells,
+ XavsCPixmapHeightInCells,
+ XtRDimension,
+ sizeof(Dimension),
+ offset(squareCell.pixmap_height_in_cells),
+ XtRImmediate,
+ (XtPointer)DEFAULT_PIXMAP_HEIGHT
+ },
+ {
+ XavsNcurX,
+ XavsCCurX,
+ XtRInt,
+ sizeof(int),
+ offset(squareCell.cur_x),
+ XtRImmediate,
+ (XtPointer) 0
+ },
+ {
+ XavsNcurY,
+ XavsCCurY,
+ XtRInt,
+ sizeof(int),
+ offset(squareCell.cur_y),
+ XtRImmediate,
+ (XtPointer) 0
+ },
+ {
+ XavsNcellArray,
+ XavsCCellArray,
+ XtRString,
+ sizeof(String),
+ offset(squareCell.cell),
+ XtRImmediate,
+ (XtPointer) 0
+ },
+ {
+ XavsNshowEntireBitmap,
+ XavsCShowEntireBitmap,
+ XtRBoolean,
+ sizeof(Boolean),
+ offset(squareCell.show_all),
+ XtRImmediate,
+ (XtPointer) TRUE
+ },
+};
+/* Declaration of methods */
+static void Initialize();
+static void Redisplay();
+static void Destroy();
+static void Resize();
+static Boolean SetValues();
+static Boolean SetValuesHook();
+static XtGeometryResult QueryGeometry();
+/* these Core methods not needed by SquareCell:
+ *
+ * static void ClassInitialize();
+ * static void Realize();
+ */
+/* the following are private functions unique to SquareCell */
+static void DrawPixmaps(), DoCell(), ChangeCellSize();
+/* the following are actions of SquareCell */
+static void DrawCell(), UndrawCell(), ToggleCell();
+/* The following are public functions of SquareCell, declared extern
+ * in the public include file: */
+char *SquareCellGetArray();
+static char defaultTranslations[] =
+ "<Btn1Down>: DrawCell() \n\
+ <Btn2Down>: UndrawCell() \n\
+ <Btn3Down>: ToggleCell() \n\
+ <Btn1Motion>: DrawCell() \n\
+ <Btn2Motion>: UndrawCell() \n\
+ <Btn3Motion>: ToggleCell()";
+static XtActionsRec actions[] = {
+ {"DrawCell", DrawCell},
+ {"UndrawCell", UndrawCell},
+ {"ToggleCell", ToggleCell},
+};
+/* definition in SquareCell.h */
+static SquareCellPointInfo info;
+SquareCellClassRec squareCellClassRec = {
+ {
+ /* core_class fields */
+ /* superclass */ (WidgetClass) &coreClassRec,
+ /* class_name */ "SquareCell",
+ /* widget_size */ sizeof(SquareCellRec),
+ /* class_initialize */ NULL,
+ /* class_part_initialize */ NULL,
+ /* class_inited */ FALSE,
+ /* initialize */ Initialize,
+ /* initialize_hook */ NULL,
+ /* realize */ XtInheritRealize,
+ /* actions */ actions,
+ /* num_actions */ XtNumber(actions),
+ /* resources */ resources,
+ /* num_resources */ XtNumber(resources),
+ /* xrm_class */ NULLQUARK,
+ /* compress_motion */ TRUE,
+ /* compress_exposure */ XtExposeNoCompress,
+ /* compress_enterleave */ TRUE,
+ /* visible_interest */ FALSE,
+ /* destroy */ Destroy,
+ /* resize */ Resize,
+ /* expose */ Redisplay,
+ /* set_values */ SetValues,
+ /* set_values_hook */ SetValuesHook,
+ /* set_values_almost */ XtInheritSetValuesAlmost,
+ /* get_values_hook */ NULL,
+ /* accept_focus */ NULL,
+ /* version */ XtVersion,
+ /* callback_private */ NULL,
+ /* tm_table */ defaultTranslations,
+ /* query_geometry */ QueryGeometry,
+ /* display_accelerator */ XtInheritDisplayAccelerator,
+ /* extension */ NULL
+ },
+ {/* simple_class fields */
+ /* change_sensitive */ XtInheritChangeSensitive,
+ },
+ {
+ /* extension */ 0,
+ },
+};
+WidgetClass squareCellWidgetClass = (WidgetClass) & squareCellClassRec;
+static void
+GetDrawGC(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ XGCValues values;
+ XtGCMask mask = GCForeground | GCBackground | GCDashOffset |
+ GCDashList | GCLineStyle;
+ /*
+ * Setting foreground and background to 1 and 0 looks like a
+ * kludge but isn't. This GC is used for drawing
+ * into a pixmap of depth one. Real colors are applied with a
+ * separate GC when the pixmap is copied into the window.
+ */
+ values.foreground = 1;
+ values.background = 0;
+ values.dashes = 1;
+ values.dash_offset = 0;
+ values.line_style = LineOnOffDash;
+ cw->squareCell.draw_gc = XCreateGC(XtDisplay((Widget)cw),
+ cw->squareCell.big_picture, mask, &values);
+}
+static void
+GetUndrawGC(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ XGCValues values;
+ XtGCMask mask = GCForeground | GCBackground;
+ /* this looks like a kludge but isn't. This GC is used for drawing
+ * into a pixmap of depth one. Real colors are applied as the
+ * pixmap is copied into the window.
+ */
+ values.foreground = 0;
+ values.background = 1;
+ cw->squareCell.undraw_gc = XCreateGC(XtDisplay((Widget)cw),
+ cw->squareCell.big_picture, mask, &values);
+}
+static void
+GetCopyGC(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ XGCValues values;
+ XtGCMask mask = GCForeground | GCBackground;
+ values.foreground = cw->squareCell.foreground;
+ values.background = cw->core.background_pixel;
+ cw->squareCell.copy_gc = XtGetGC((Widget)cw, mask, &values);
+}
+static void
+Initialize(treq, tnew, args, num_args)
+Widget treq, tnew;
+ArgList args;
+Cardinal *num_args;
+{
+ SquareCellWidget new = (SquareCellWidget) tnew;
+ new->squareCell.cur_x = 0;
+ new->squareCell.cur_y = 0;
+ /*
+ * Check instance values set by resources that may be invalid.
+ */
+ if ((new->squareCell.pixmap_width_in_cells < 1) ||
+ (new->squareCell.pixmap_height_in_cells < 1)) {
+ XtWarning("SquareCell: pixmapWidth and/or pixmapHeight is too small (using 10 x 10).");
+ new->squareCell.pixmap_width_in_cells = 10;
+ new->squareCell.pixmap_height_in_cells = 10;
+ }
+ if (new->squareCell.cell_size_in_pixels < 5) {
+ XtWarning("SquareCell: cellSize is too small (using 5).");
+ new->squareCell.cell_size_in_pixels = 5;
+ }
+ if ((new->squareCell.cur_x < 0) || (new->squareCell.cur_y < 0)) {
+ XtWarning("SquareCell: cur_x and cur_y must be non-negative (using 0, 0).");
+ new->squareCell.cur_x = 0;
+ new->squareCell.cur_y = 0;
+ }
+ if (new->squareCell.cell == NULL)
+ new->squareCell.cell = XtCalloc(
+ new->squareCell.pixmap_width_in_cells *
+ new->squareCell.pixmap_height_in_cells, sizeof(char));
+ else
+ new->squareCell.user_allocated = True; /* user supplied cell array */
+ new->squareCell.pixmap_width_in_pixels =
+ new->squareCell.pixmap_width_in_cells *
+ new->squareCell.cell_size_in_pixels;
+ new->squareCell.pixmap_height_in_pixels =
+ new->squareCell.pixmap_height_in_cells *
+ new->squareCell.cell_size_in_pixels;
+ if (new->core.width == 0) {
+ if (new->squareCell.show_all == False)
+ new->core.width = (new->squareCell.pixmap_width_in_pixels
+ > DEFAULTWIDTH) ? DEFAULTWIDTH :
+ (new->squareCell.pixmap_width_in_pixels);
+ else
+ new->core.width = new->squareCell.pixmap_width_in_pixels;
+ }
+ if (new->core.height == 0) {
+ if (new->squareCell.show_all == False)
+ new->core.height =
+ (new->squareCell.pixmap_height_in_pixels >
+ DEFAULTWIDTH) ? DEFAULTWIDTH :
+ (new->squareCell.pixmap_height_in_pixels);
+ else
+ new->core.height = new->squareCell.pixmap_height_in_pixels;
+ }
+ CreateBigPixmap(new);
+ GetDrawGC(new);
+ GetUndrawGC(new);
+ GetCopyGC(new);
+ DrawIntoBigPixmap(new);
+}
+static void
+Redisplay(w, event)
+Widget w;
+XExposeEvent *event;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ register int x, y;
+ unsigned int width, height;
+
+ avs_set_event(6, avs_get_event(6)+1);
+ if (!XtIsRealized((Widget)cw))
+ return;
+
+ if (event) { /* called from btn-event or expose */
+ x = event->x;
+ y = event->y;
+ width = event->width;
+ height = event->height;
+ }
+ else { /* called because complete redraw */
+ x = 0;
+ y = 0;
+ width = cw->squareCell.pixmap_width_in_pixels;
+ height = cw->squareCell.pixmap_height_in_pixels;
+ }
+ if (DefaultDepthOfScreen(XtScreen((Widget)cw)) == 1)
+ XCopyArea(XtDisplay((Widget)cw), cw->squareCell.big_picture,
+ XtWindow((Widget)cw), cw->squareCell.copy_gc, x +
+ cw->squareCell.cur_x, y + cw->squareCell.cur_y,
+ width, height, x, y);
+ else
+ XCopyPlane(XtDisplay((Widget)cw), cw->squareCell.big_picture,
+ XtWindow((Widget)cw), cw->squareCell.copy_gc, x +
+ cw->squareCell.cur_x, y + cw->squareCell.cur_y,
+ width, height, x, y, 1);
+}
+static Boolean
+SetValuesHook(w, args, num_args)
+Widget w;
+ArgList args;
+Cardinal *num_args;
+{
+ avs_set_event(2,avs_get_event(1)+1);
+ return True;
+}
+
+static Boolean
+SetValues(current, request, new, args, num_args)
+Widget current, request, new;
+ArgList args;
+Cardinal *num_args;
+{
+ SquareCellWidget curcw = (SquareCellWidget) current;
+ SquareCellWidget newcw = (SquareCellWidget) new;
+ Boolean do_redisplay = False;
+ /*
+ ** XtSetValues invoked procedure SetValues
+ */
+ avs_set_event(1,avs_get_event(2)+1);
+ if (curcw->squareCell.foreground != newcw->squareCell.foreground) {
+ XtReleaseGC((Widget)curcw, curcw->squareCell.copy_gc);
+ GetCopyGC(newcw);
+ do_redisplay = True;
+ }
+ if ((curcw->squareCell.cur_x != newcw->squareCell.cur_x) ||
+ (curcw->squareCell.cur_y != newcw->squareCell.cur_y))
+ do_redisplay = True;
+ if (curcw->squareCell.cell_size_in_pixels !=
+ newcw->squareCell.cell_size_in_pixels) {
+ ChangeCellSize(curcw, newcw->squareCell.cell_size_in_pixels);
+ do_redisplay = True;
+ }
+ if (curcw->squareCell.pixmap_width_in_cells !=
+ newcw->squareCell.pixmap_width_in_cells) {
+ newcw->squareCell.pixmap_width_in_cells =
+ curcw->squareCell.pixmap_width_in_cells;
+ }
+ if (curcw->squareCell.pixmap_height_in_cells !=
+ newcw->squareCell.pixmap_height_in_cells) {
+ newcw->squareCell.pixmap_height_in_cells =
+ curcw->squareCell.pixmap_height_in_cells;
+ }
+ /*force true for test 13*/
+ return True;
+}
+static void
+Destroy(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ if (cw->squareCell.big_picture)
+ XFreePixmap(XtDisplay(cw), cw->squareCell.big_picture);
+ if (cw->squareCell.draw_gc)
+ XFreeGC(XtDisplay(cw), cw->squareCell.draw_gc);
+ if (cw->squareCell.undraw_gc)
+ XFreeGC(XtDisplay(cw), cw->squareCell.undraw_gc);
+ if (cw->squareCell.copy_gc)
+ XFreeGC(XtDisplay(cw), cw->squareCell.copy_gc);
+ /* Free memory allocated with Calloc. This was done
+ * only if application didn't supply cell array.
+ */
+ if (!cw->squareCell.user_allocated)
+ XtFree(cw->squareCell.cell);
+}
+static void
+DrawCell(w, event)
+Widget w;
+XEvent *event;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ DrawPixmaps(cw->squareCell.draw_gc, DRAW, cw, event);
+}
+static void
+UndrawCell(w, event)
+Widget w;
+XEvent *event;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ DrawPixmaps(cw->squareCell.undraw_gc, UNDRAW, cw, event);
+}
+static void
+ToggleCell(w, event)
+Widget w;
+XEvent *event;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ static int oldx = -1, oldy = -1;
+ GC gc;
+ int mode;
+ int newx, newy;
+ /* This is strictly correct, but doesn't
+ * seem to be necessary */
+ if (event->type == ButtonPress) {
+ newx = (cw->squareCell.cur_x + ((XButtonEvent *)event)->x) /
+ cw->squareCell.cell_size_in_pixels;
+ newy = (cw->squareCell.cur_y + ((XButtonEvent *)event)->y) /
+ cw->squareCell.cell_size_in_pixels;
+ }
+ else {
+ newx = (cw->squareCell.cur_x + ((XMotionEvent *)event)->x) /
+ cw->squareCell.cell_size_in_pixels;
+ newy = (cw->squareCell.cur_y + ((XMotionEvent *)event)->y) /
+ cw->squareCell.cell_size_in_pixels;
+ }
+ if ((mode = cw->squareCell.cell[newx + newy * cw->squareCell.pixmap_width_in_cells]) == DRAWN) {
+ gc = cw->squareCell.undraw_gc;
+ mode = UNDRAW;
+ }
+ else {
+ gc = cw->squareCell.draw_gc;
+ mode = DRAW;
+ }
+ if (oldx != newx || oldy != newy) {
+ oldx = newx;
+ oldy = newy;
+ DrawPixmaps(gc, mode, cw, event);
+ }
+}
+static void
+DrawPixmaps(gc, mode, w, event)
+GC gc;
+int mode;
+Widget w;
+XButtonEvent *event;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ int newx = (cw->squareCell.cur_x + event->x) /
+ cw->squareCell.cell_size_in_pixels;
+ int newy = (cw->squareCell.cur_y + event->y) /
+ cw->squareCell.cell_size_in_pixels;
+ XExposeEvent fake_event;
+ /* if already done, return */
+ if (cw->squareCell.cell[newx + newy * cw->squareCell.pixmap_width_in_cells] == mode)
+ return;
+ /* otherwise, draw or undraw */
+ XFillRectangle(XtDisplay((Widget)cw), cw->squareCell.big_picture, gc,
+ cw->squareCell.cell_size_in_pixels*newx + 2,
+ cw->squareCell.cell_size_in_pixels*newy + 2,
+ (unsigned int)cw->squareCell.cell_size_in_pixels - 3,
+ (unsigned int)cw->squareCell.cell_size_in_pixels - 3);
+ cw->squareCell.cell[newx + newy * cw->squareCell.pixmap_width_in_cells] = mode;
+ info.mode = mode;
+ info.newx = newx;
+ info.newy = newy;
+ fake_event.x = cw->squareCell.cell_size_in_pixels * newx - cw->squareCell.cur_x;
+ fake_event.y = cw->squareCell.cell_size_in_pixels * newy - cw->squareCell.cur_y;
+ fake_event.width = cw->squareCell.cell_size_in_pixels;
+ fake_event.height = cw->squareCell.cell_size_in_pixels;
+ Redisplay(cw, &fake_event);
+ XtCallCallbacks((Widget)cw, XavsNtoggleCallback, &info);
+}
+CreateBigPixmap(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ /* always a 1 bit deep pixmap, regardless of screen depth */
+ cw->squareCell.big_picture = XCreatePixmap(XtDisplay((Widget)cw),
+ RootWindow(XtDisplay((Widget)cw), DefaultScreen(XtDisplay((Widget)cw))),
+ cw->squareCell.pixmap_width_in_pixels + 2,
+ cw->squareCell.pixmap_height_in_pixels + 2, 1);
+}
+DrawIntoBigPixmap(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ int n_horiz_segments, n_vert_segments;
+ XSegment segment[MAXLINES];
+ register int x, y;
+ XFillRectangle(XtDisplay((Widget)cw), cw->squareCell.big_picture,
+ cw->squareCell.undraw_gc, 0, 0,
+ cw->squareCell.pixmap_width_in_pixels
+ + 2, cw->squareCell.pixmap_height_in_pixels + 2);
+ n_horiz_segments = cw->squareCell.pixmap_height_in_cells + 1;
+ n_vert_segments = cw->squareCell.pixmap_width_in_cells + 1;
+ for (x = 0; x < n_horiz_segments; x++) {
+ segment[x].x1 = 0;
+ segment[x].x2 = (short) cw->squareCell.pixmap_width_in_pixels;
+ segment[x].y1 = (short) cw->squareCell.cell_size_in_pixels * x;
+ segment[x].y2 = (short) cw->squareCell.cell_size_in_pixels * x;
+ }
+ XDrawSegments(XtDisplay((Widget)cw), cw->squareCell.big_picture, cw->squareCell.draw_gc, segment, n_horiz_segments);
+ for (y = 0; y < n_vert_segments; y++) {
+ segment[y].x1 = (short) y * cw->squareCell.cell_size_in_pixels;
+ segment[y].x2 = (short) y * cw->squareCell.cell_size_in_pixels;
+ segment[y].y1 = 0;
+ segment[y].y2 = (short) cw->squareCell.pixmap_height_in_pixels;
+ }
+ XDrawSegments(XtDisplay((Widget)cw), cw->squareCell.big_picture, cw->squareCell.draw_gc, segment, n_vert_segments);
+ /* draw current cell array into pixmap */
+ for (x = 0; x < cw->squareCell.pixmap_width_in_cells; x++) {
+ for (y = 0; y < cw->squareCell.pixmap_height_in_cells; y++) {
+ if (cw->squareCell.cell[x + (y * cw->squareCell.pixmap_width_in_cells)] == DRAWN)
+ DoCell(cw, x, y, cw->squareCell.draw_gc);
+ else
+ DoCell(cw, x, y, cw->squareCell.undraw_gc);
+ }
+ }
+}
+/* A Public function, not static */
+char *
+SquareCellGetArray(w, width_in_cells, height_in_cells)
+Widget w;
+int *width_in_cells, *height_in_cells;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ *width_in_cells = cw->squareCell.pixmap_width_in_cells;
+ *height_in_cells = cw->squareCell.pixmap_height_in_cells;
+ return (cw->squareCell.cell);
+}
+static void
+Resize(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ /* resize does nothing unless new size is bigger than entire pixmap */
+ if ((cw->core.width > cw->squareCell.pixmap_width_in_pixels) &&
+ (cw->core.height > cw->squareCell.pixmap_height_in_pixels)) {
+ /*
+ * Calculate the maximum cell size that will allow the
+ * entire bitmap to be displayed.
+ */
+ Dimension w_temp_cell_size_in_pixels, h_temp_cell_size_in_pixels;
+ Dimension new_cell_size_in_pixels;
+
+ w_temp_cell_size_in_pixels = cw->core.width / cw->squareCell.pixmap_width_in_cells;
+ h_temp_cell_size_in_pixels = cw->core.height / cw->squareCell.pixmap_height_in_cells;
+
+ if (w_temp_cell_size_in_pixels < h_temp_cell_size_in_pixels)
+ new_cell_size_in_pixels = w_temp_cell_size_in_pixels;
+ else
+ new_cell_size_in_pixels = h_temp_cell_size_in_pixels;
+
+ /* if size change mandates a new pixmap, make one */
+ if (new_cell_size_in_pixels != cw->squareCell.cell_size_in_pixels)
+ ChangeCellSize(cw, new_cell_size_in_pixels);
+ }
+}
+static void
+ChangeCellSize(w, new_cell_size)
+Widget w;
+int new_cell_size;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ int x, y;
+ cw->squareCell.cell_size_in_pixels = new_cell_size;
+ /* recalculate variables based on cell size */
+ cw->squareCell.pixmap_width_in_pixels =
+ cw->squareCell.pixmap_width_in_cells *
+ cw->squareCell.cell_size_in_pixels;
+ cw->squareCell.pixmap_height_in_pixels =
+ cw->squareCell.pixmap_height_in_cells *
+ cw->squareCell.cell_size_in_pixels;
+
+ /* destroy old and create new pixmap of correct size */
+ XFreePixmap(XtDisplay((Widget)cw), cw->squareCell.big_picture);
+ CreateBigPixmap(cw);
+
+ /* draw lines into new pixmap */
+ DrawIntoBigPixmap(cw);
+
+ /* draw current cell array into pixmap */
+ for (x = 0; x < cw->squareCell.pixmap_width_in_cells; x++) {
+ for (y = 0; y < cw->squareCell.pixmap_height_in_cells; y++) {
+ if (cw->squareCell.cell[x + (y * cw->squareCell.pixmap_width_in_cells)] == DRAWN)
+ DoCell(cw, x, y, cw->squareCell.draw_gc);
+ else
+ DoCell(cw, x, y, cw->squareCell.undraw_gc);
+ }
+ }
+}
+static void
+DoCell(w, x, y, gc)
+Widget w;
+int x, y;
+GC gc;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ /* otherwise, draw or undraw */
+ XFillRectangle(XtDisplay((Widget)cw), cw->squareCell.big_picture, gc,
+ cw->squareCell.cell_size_in_pixels * x + 2,
+ cw->squareCell.cell_size_in_pixels * y + 2,
+ (unsigned int)cw->squareCell.cell_size_in_pixels - 3,
+ (unsigned int)cw->squareCell.cell_size_in_pixels - 3);
+}
+static XtGeometryResult QueryGeometry(w, proposed, answer)
+Widget w;
+XtWidgetGeometry *proposed, *answer;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ /* set fields we care about */
+ answer->request_mode = CWWidth | CWHeight;
+ /* initial width and height */
+ if (cw->squareCell.show_all == True)
+ answer->width = cw->squareCell.pixmap_width_in_pixels;
+ else
+ answer->width = (cw->squareCell.pixmap_width_in_pixels >
+ DEFAULTWIDTH) ? DEFAULTWIDTH :
+ cw->squareCell.pixmap_width_in_pixels;
+ if (cw->squareCell.show_all == True)
+ answer->height = cw->squareCell.pixmap_height_in_pixels;
+ else
+ answer->height = (cw->squareCell.pixmap_height_in_pixels >
+ DEFAULTWIDTH) ? DEFAULTWIDTH :
+ cw->squareCell.pixmap_height_in_pixels;
+ if ( ((proposed->request_mode & (CWWidth | CWHeight))
+ == (CWWidth | CWHeight)) &&
+ proposed->width == answer->width &&
+ proposed->height == answer->height)
+ return XtGeometryYes;
+ else if (answer->width == cw->core.width &&
+ answer->height == cw->core.height)
+ return XtGeometryNo;
+ else
+ return XtGeometryAlmost;
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtSetValues Xt11
+void
+XtSetValues(object, args, num_args)
+>>ASSERTION Good A
+A successful call to
+void XtSetValues(object, args, num_args)
+shall set the resource value in the instance structure of the
+widget
+.A object
+for the resource specified in the name field of each member of
+the argument list
+.A args
+to the value at the location specified by the corresponding value
+field.
+>>CODE
+Widget squarew;
+Arg setargs[2];
+int cur_x, cur_y;
+int invoked = 0;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tstvalues1", "XtSetValues");
+ tet_infoline("PREP: Create Square Cell widget");
+ squarew = XtVaCreateManagedWidget("squarew",
+ squareCellWidgetClass, boxw1, NULL);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Set resource values");
+ setargs[0].name = XavsNcurX;
+ setargs[0].value = (XtArgVal) 2;
+ setargs[1].name = XavsNcurY;
+ setargs[1].value = (XtArgVal) 2;
+ XtSetValues(squarew, setargs, 2);
+ tet_infoline("PREP: Get resource values");
+ XtVaGetValues(squarew,
+ XavsNcurX, &cur_x, XavsNcurY, &cur_y, (char *)NULL);
+ tet_infoline("TEST: Resource values");
+ check_dec(2, cur_x, "XavsNcurX");
+ check_dec(2, cur_y, "XavsNcurY");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When the class of the specified widget's parent
+is a subclass of constraintWidgetClass
+a call to
+void XtSetValues(object, args, num_args)
+shall set the resource values in the widget instance for any
+constraint resources specified in the argument list.
+>>CODE
+Widget pushb_good, formw_good;
+Arg setargs[1];
+Boolean resizable;
+int invoked = 0;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tstvalues4", "XtSetValues");
+ tet_infoline("PREP: Create formw_good widget subclass of constraint");
+ tet_infoline("PREP: widgetclass in boxw1 widget");
+ formw_good = (Widget) CreateFormWidget(boxw1);
+ tet_infoline("PREP: Create pushb_good gadget");
+ pushb_good = (Widget)CreatePushButtonGadget("Hello", formw_good);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Set constraint resource values for pushb_good widget");
+ setargs[0].name = XtNresizable;
+ setargs[0].value = (XtArgVal) TRUE;
+ XtSetValues(pushb_good, setargs, 1);
+ tet_infoline("PREP: Get constraint resource values");
+ XtVaGetValues(pushb_good, XtNresizable, &resizable, (char *)NULL);
+ tet_infoline("TEST: Constraint resource values");
+ check_dec(TRUE, resizable, "TRUE");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+void XtSetValues(object, args, num_args)
+shall call the set_values procedures for
+.A object
+in a superclass-to-subclass order.
+>>CODE
+Widget squarew;
+Arg setargs[2];
+int cur_x, cur_y;
+int invoked = 0;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tstvalues1", "XtSetValues");
+ tet_infoline("PREP: Create Square Cell widget");
+ squarew = XtVaCreateManagedWidget("squarew",
+ squareCellWidgetClass, boxw1, NULL);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Set resource values");
+ setargs[0].name = XavsNcurX;
+ setargs[0].value = (XtArgVal) 2;
+ setargs[1].name = XavsNcurY;
+ setargs[1].value = (XtArgVal) 2;
+ XtSetValues(squarew, setargs, 2);
+ tet_infoline("PREP: Get resource values");
+ XtVaGetValues(squarew,
+ XavsNcurX, &cur_x, XavsNcurY, &cur_y, (char *)NULL);
+ tet_infoline("TEST: Resource values");
+ check_dec(2, cur_x, "XavsNcurX");
+ check_dec(2, cur_y, "XavsNcurY");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: set_values procedure was invoked");
+ invoked = avs_get_event(1);
+ if (!invoked) {
+ sprintf(ebuf, "ERROR: Procedure SetValues was not invoked");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+void XtSetValues(object, args, num_args)
+when a set_values_hook field for
+.A object
+is non-NULL shall call the procedures specified by that field
+immediately after the call to the corresponding set_values
+procedure.
+>>CODE
+Widget squarew;
+Arg setargs[2];
+int cur_x, cur_y;
+int invoked = 0;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tstvalues1", "XtSetValues");
+ tet_infoline("PREP: Create Square Cell widget");
+ squarew = XtVaCreateManagedWidget("squarew",
+ squareCellWidgetClass, boxw1, NULL);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Set resource values");
+ setargs[0].name = XavsNcurX;
+ setargs[0].value = (XtArgVal) 2;
+ setargs[1].name = XavsNcurY;
+ setargs[1].value = (XtArgVal) 2;
+ XtSetValues(squarew, setargs, 2);
+ tet_infoline("PREP: Get resource values");
+ XtVaGetValues(squarew,
+ XavsNcurX, &cur_x, XavsNcurY, &cur_y, (char *)NULL);
+ tet_infoline("TEST: Resource values");
+ check_dec(2, cur_x, "XavsNcurX");
+ check_dec(2, cur_y, "XavsNcurY");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: set_values procedure was invoked first");
+ invoked = avs_get_event(1);
+ if (invoked != 1) {
+ sprintf(ebuf, "ERROR: Expected procedure invocation to be #1, is #%d", invoked);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: set_values_hook procedure was invoked second");
+ invoked = avs_get_event(2);
+ if (invoked != 2) {
+ sprintf(ebuf, "ERROR: Expected procedure invocation to be #2, is #%d", invoked);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When the class of the specified widget's parent
+is a subclass of constraintWidgetClass
+a call to
+void XtSetValues(object, args, num_args)
+shall call the constraint set_values procedures from
+constraintWidgetClass on down to the parent's class, passing
+to them the specified widget as an argument.
+>>CODE
+Arg setargs[2];
+int cur_x, cur_y;
+int invoked = 0;
+pid_t pid2;
+Widget formw_good , labelw_good, formw_good2;
+
+ FORK(pid2);
+ avs_xt_hier("Tstvalues1", "XtSetValues");
+ tet_infoline("PREP: Create avsform widget in boxw1 widget");
+ formw_good = XtCreateManagedWidget("avsform",
+ avsformWidgetClass,
+ boxw1,
+ NULL,
+ 0);
+ tet_infoline("PREP: Create avsform2 widget in avsform widget");
+ formw_good2 = XtCreateManagedWidget("avsform2",
+ avsform2WidgetClass,
+ formw_good,
+ NULL,
+ 0);
+ labelw_good = (Widget) CreateLabelWidget("Hello", formw_good2);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Set constraint resource values for pushb_good widget");
+ setargs[0].name = XtNresizable;
+ setargs[0].value = (XtArgVal) TRUE;
+ XtSetValues(labelw_good, setargs, 1);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: set_values procedure two levels up was invoked first");
+ invoked = avs_get_event(4);
+ if (invoked != 1) {
+ sprintf(ebuf, "ERROR: Expected procedure invocation to be #1, is #%d", invoked);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: set_values procedure of parent was invoked second");
+ invoked = avs_get_event(3);
+ if (invoked != 2) {
+ sprintf(ebuf, "ERROR: Expected procedure invocation to be #2, is #%d", invoked);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_result(TET_PASS);
+>>ASSERTION Good B 0
+A call to
+void XtSetValues(object, args, num_args)
+when
+.A object
+is of a subclass of RectObj and any of the resource values updated
+in the widget instance require a geometry request shall restore
+the original geometry values for the widget and call the geometry
+manager specified for the widget.
+>>ASSERTION Good A
+A call to
+void XtSetValues(object, args, num_args)
+when
+.A object
+is of a subclass of RectObj, any of the resource values updated
+in the widget instance require a geometry request, and the geometry
+manager specified for the widget returns XtGeometryYes shall call
+the resize procedure of the specified widget.
+>>CODE
+Widget cooperative_composite, cooperative_widget;
+Arg setargs[2];
+Dimension new_width, new_height;
+int invoked = 0;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tstvalues2", "XtSetValues");
+ tet_infoline("PREP: Create cooperative composite widget");
+ cooperative_composite = XtVaCreateManagedWidget("cooperative_composite", avsCompWidgetClass, boxw1, NULL);
+ tet_infoline("PREP: Create cooperative widget");
+ cooperative_widget = XtVaCreateManagedWidget("cooperative_widget", avsWidgetClass, cooperative_composite, NULL);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Set resource values");
+ setargs[0].name = XtNwidth;
+ setargs[0].value = (XtArgVal) 10;
+ setargs[1].name = XtNheight;
+ setargs[1].value = (XtArgVal) 10;
+ XtSetValues(cooperative_widget, setargs, 2);
+ tet_infoline("PREP: Get resource values");
+ XtVaGetValues(cooperative_widget,
+ XtNwidth, &new_width,
+ XtNheight, &new_height, (char *)NULL);
+ tet_infoline("TEST: Check resource values");
+ check_dec(10, new_width, "XtNwidth");
+ check_dec(10, new_height, "XtNheight");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good B 0
+On a call to
+void XtSetValues(object, args, num_args)
+when
+.A object
+is of a subclass of RectObj, any of the resource values updated
+in the widget instance require a geometry request, and the geometry
+manager specified for the widget returns XtGeometryDone the geometry
+fields for the widget instance shall hold the new values.
+>>ASSERTION Good A
+On a call to
+void XtSetValues(object, args, num_args)
+when
+.A object
+is of a subclass of RectObj, any of the resource values updated
+in the widget instance require a geometry request, and the geometry
+manager specified for the widget returns XtGeometryNo the
+geometry fields for the widget instance shall hold the original
+values.
+>>CODE
+Widget squarew;
+Arg setargs[2], getargs[2];
+Dimension cell_width, cell_height;
+int invoked = 0;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tstvalues3", "XtSetValues");
+ tet_infoline("PREP: Create Square Cell widget");
+ squarew = XtVaCreateManagedWidget("squarew",
+ squareCellWidgetClass, boxw1, NULL);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Set resource values return XtGeometryNo");
+ setargs[0].name = XavsNpixmapWidthInCells;
+ setargs[0].value = (XtArgVal) -1;
+ setargs[1].name = XavsNpixmapHeightInCells;
+ setargs[1].value = (XtArgVal) -1;
+ XtSetValues(squarew, setargs, 2);
+ tet_infoline("PREP: Get resource values");
+ XtVaGetValues(squarew,
+ XavsNpixmapWidthInCells,
+ &cell_width,
+ XavsNpixmapHeightInCells,
+ &cell_height,
+ (char *)NULL);
+ tet_infoline("TEST: Check original values returned");
+ check_dec(DEFAULT_PIXMAP_WIDTH, cell_width, "XavsNpixmapWidthInCells");
+ check_dec(DEFAULT_PIXMAP_HEIGHT, cell_height, "XavsNpixmapHeightInCells");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A call to
+void XtSetValues(object, args, num_args)
+when
+.A object
+is of a subclass of RectObj, any of the resource values updated
+in the widget instance require a geometry request, and the geometry
+manager specified for the widget returns XtGeometryAlmost shall call
+the set_values_almost procedure of the specified widget.
+>>CODE
+Widget cooperative_composite, cooperative_widget;
+Arg setargs[2];
+Dimension new_width, new_height;
+int invoked = 0;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tstvalues5", "XtSetValues");
+ tet_infoline("PREP: Create cooperative composite widget");
+ cooperative_composite = XtVaCreateManagedWidget("cooperative_composite", avsComp2WidgetClass, boxw1, NULL);
+ tet_infoline("PREP: Create cooperative widget");
+ cooperative_widget = XtVaCreateManagedWidget("cooperative_widget", avsWidgetClass, cooperative_composite, NULL);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Set resource values");
+ setargs[0].name = XtNwidth;
+ setargs[0].value = (XtArgVal) 10;
+ setargs[1].name = XtNheight;
+ setargs[1].value = (XtArgVal) 10;
+ XtSetValues(cooperative_widget, setargs, 2);
+ tet_infoline("TEST: Geometry manager called");
+ invoked = avs_get_event(4);
+ check_dec(1, invoked, "geometry manager invocations count");
+ tet_infoline("TEST: Set_values_almost procedure called");
+ invoked = avs_get_event(3);
+ check_dec(1, invoked, "set_values_almost invocations count");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good B 0
+A call to
+void XtSetValues(object, args, num_args)
+when
+.A object
+is of a subclass of RectObj, any of the resource values updated
+in the widget instance require a geometry request, the geometry
+manager specified for the widget returns XtGeometryAlmost, and the
+call to the set_values_almost procedure of the specified widget
+does not request an alternate geometry shall call the resize
+procedure of the widget.
+>>ASSERTION Good B 0
+A call to
+void XtSetValues(object, args, num_args)
+when
+.A object
+is of a subclass of RectObj, any of the resource values updated
+in the widget instance require a geometry request, the geometry
+manager specified for the widget returns XtGeometryAlmost, and the
+call to the set_values_almost procedure of the specified widget
+requests an alternate geometry shall again call the geometry manager
+of the widget for the newly requested geometry values.
+>>ASSERTION Good A
+A call to
+void XtSetValues(object, args, num_args)
+when
+.A object
+is realized and a set_values procedure for the widget
+returns True shall cause the widget's expose procedure to be invoked.
+>>CODE
+Widget squarew;
+Arg setargs[2];
+int cur_x, cur_y;
+int invoked = 0;
+pid_t pid2, pid3;
+
+/*this test is in the process of review vis consistency of the spec,
+test suite, and sample code*/
+if (config.coverage == 0) {
+ FORK(pid2);
+ avs_xt_hier("Tstvalues1", "XtSetValues");
+ tet_infoline("PREP: Create Square Cell widget");
+ squarew = XtVaCreateManagedWidget("squarew",
+ squareCellWidgetClass, boxw1, NULL);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Set resource values");
+ XtVaGetValues(squarew,
+ XavsNcurX, &cur_x, XavsNcurY, &cur_y, (char *)NULL);
+ setargs[0].name = XavsNcurX;
+ setargs[0].value = (XtArgVal) cur_x+5;
+ setargs[1].name = XavsNcurY;
+ setargs[1].value = (XtArgVal) cur_y+5;
+ XtSetValues(squarew, setargs, 2);
+ tet_infoline("PREP: Get resource values");
+ XtVaGetValues(squarew,
+ XavsNcurX, &cur_x, XavsNcurY, &cur_y, (char *)NULL);
+ tet_infoline("TEST: Resource values");
+ check_dec(5, cur_x, "XavsNcurX");
+ check_dec(5, cur_y, "XavsNcurY");
+ XtAppAddTimeOut(app_ctext, AVSXTLOOPTIMEOUT, XtTMO_Proc, topLevel);
+ XtAppMainLoop(app_ctext);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: set_values procedure was invoked");
+ invoked = avs_get_event(1);
+ if (!invoked) {
+ sprintf(ebuf, "ERROR: Procedure was not invoked");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: expose procedure was invoked");
+ invoked = avs_get_event(6);
+ if (invoked < 2) {
+ sprintf(ebuf, "ERROR: Procedure was invoked %d times, expected at least 2", invoked);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_result(TET_PASS);
+} else
+ tet_result(TET_UNTESTED);
diff --git a/xts5/Xt11/XtVaGetApplicationResources/XtVaGetApplicationResources.m b/xts5/Xt11/XtVaGetApplicationResources/XtVaGetApplicationResources.m
new file mode 100644
index 00000000..1e082c1f
--- /dev/null
+++ b/xts5/Xt11/XtVaGetApplicationResources/XtVaGetApplicationResources.m
@@ -0,0 +1,298 @@
+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/Xt11/XtVaGetApplicationResources/XtVaGetApplicationResources.m,v 1.1 2005-02-12 14:37:54 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/Xt11/XtVaGetApplicationResources/XtVaGetApplicationResources.m
+>>#
+>># Description:
+>># Tests for XtVaGetApplicationResources()
+>>#
+>># Modifications:
+>># $Log: tvagtares.m,v $
+>># Revision 1.1 2005-02-12 14:37:54 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:25 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:21 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:30 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:04 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:19:24 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:05 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+typedef struct _instance_variables {
+ long foreground;
+ String label;
+} instance_variable_rec;
+static XtResource resources[] = {
+ {
+ XtNforeground,
+ XtCForeground,
+ XtRPixel, sizeof(Pixel),
+ XtOffsetOf(instance_variable_rec, foreground),
+ XtRString, "XtDefaultForeground"
+ },
+ {
+ XtNlabel,
+ XtCLabel,
+ XtRString, sizeof(String),
+ XtOffsetOf(instance_variable_rec, label),
+ XtRString, "XtDefaultLabel"
+ },
+};
+int def = 2002;
+
+static XtResource resources2[] = {
+ {
+ XtNforeground,
+ XtCForeground,
+ XtRPixel, sizeof(Pixel),
+ XtOffsetOf(instance_variable_rec, foreground),
+ XtRString, "XtDefaultForeground"
+ },
+ {
+ XtNlabel,
+ XtCLabel,
+ XtRString, sizeof(String),
+ XtOffsetOf(instance_variable_rec, label),
+ XtRInt, &def
+ },
+};
+
+char whereitsat[64];
+
+Boolean XtCVT_Proc(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValuePtr args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+ sprintf(whereitsat, "%d", *(int *)from_val->addr);
+ *(String*)to_val->addr = whereitsat;
+ to_val->size = sizeof(XtPointer);
+ avs_set_event(2, avs_get_event(2)+1);
+ return True;
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtVaGetApplicationResources Xt11
+void
+XtVaGetApplicationResources(w, base, resources, num_resources, ....)
+>>ASSERTION Good A
+A successful call to
+void XtVaGetApplicationResources(w, base, resources, num_resources, ....)
+shall retrieve the resource value for each resource
+specified in the resource list
+.A resources
+from the resource values specified in the varargs style
+variable argument list, or if no value for the resource is
+found in the variable argument list, from the resource database
+associated with the widget
+.A w,
+matching the resource identified by the
+the names and classes of all ancestors of
+.A w,
+the name and class of
+.A w,
+and the resource name and class,
+or if no value is found in the database, from the default_addr
+field of the resource list and copy the resource value at an offset
+specified by the corresponding resource_offset field from the address
+.A base.
+>>CODE
+instance_variable_rec base;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tvagtares1", "XtVaGetApplicationResources");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Retrieve resource values from resource database");
+ XtVaGetApplicationResources(topLevel,
+ &base,
+ resources,
+ XtNumber(resources),
+ (char *)NULL);
+ tet_infoline("TEST: Retrieved resource value");
+ if ((base.foreground != 0) && (base.foreground != 1)) {
+ sprintf(ebuf, "ERROR: expected 0 or 1, received %d", base.foreground);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: Retrieve resource values from arg list");
+ XtVaGetApplicationResources(topLevel,
+ &base,
+ resources,
+ 2,
+ XtNlabel, "label value", NULL
+ );
+ tet_infoline("TEST: Retrieved resource value");
+ if (strcmp(base.label, "label value") != 0) {
+ sprintf(ebuf, "ERROR: Expected \"label value\", received \"%s\"", base.label);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: Retrieve resource values from defaults");
+ XtVaGetApplicationResources(topLevel,
+ &base,
+ resources,
+ XtNumber(resources),
+ (char *)NULL);
+ tet_infoline("TEST: Retrieved resource value");
+ if (strcmp(base.label, "XtDefaultLabel") != 0) {
+ sprintf(ebuf, "ERROR: Expected \"XtDefaultLabel\", received \"%s\"", base.label);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+On a call to
+void XtVaGetApplicationResources(w, base, resources, num_resources, ....)
+when a resource specified in the resource database, variable argument
+list or a default resource value is in a different representation from
+the representation type specified in the resource_type field of the
+resource list it shall call the appropriate type converter to
+perform the conversion and store the converted value in the subpart
+data structure.
+>>CODE
+instance_variable_rec base;
+pid_t pid2;
+int status;
+
+ FORK(pid2);
+ avs_xt_hier("Tvagtares2", "XtVaGetApplicationResources");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ XtAppSetTypeConverter(app_ctext,
+ XtRInt,
+ XtRString,
+ XtCVT_Proc,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheNone,
+ NULL);
+ tet_infoline("TEST: Retrieve resource value needing conversion");
+ XtVaGetApplicationResources(topLevel,
+ &base,
+ resources2,
+ XtNumber(resources),
+ (char *)NULL);
+ tet_infoline("TEST: Retrieved resource value");
+ if (strcmp(base.label, "2002") != 0) {
+ sprintf(ebuf, "ERROR: Expected \"2002\", received \"%s\"", base.label);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: convertor was invoked");
+ status = avs_get_event(2);
+ check_dec(1, status, "XtCVT_Proc invoked status");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+On a call to
+void XtVaGetApplicationResources(w, base, resources, num_resources, ....)
+when the name XtVaTypedArg is specified in place of a resource name
+in the variable argument list it shall interpret the four arguments
+following this argument as a name/type/value/size tuple.
+>>CODE
+instance_variable_rec base;
+pid_t pid2;
+String thelab="label value";
+
+ FORK(pid2);
+ avs_xt_hier("Tvagtares1", "XtVaGetApplicationResources");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Retrieve resource values from arg list");
+ XtVaGetApplicationResources(topLevel,
+ &base,
+ resources,
+ 2,
+ XtVaTypedArg, XtNlabel, XtRString, thelab, strlen(thelab)+1, NULL
+ );
+ tet_infoline("TEST: Retrieved resource value");
+ if (strcmp(base.label, "label value") != 0) {
+ sprintf(ebuf, "ERROR: Expected \"label value\", received \"%s\"", base.label);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+On a call to
+void XtVaGetApplicationResources(w, base, resources, num_resources, ....)
+when the name XtVaNestedList is specified in place of a resource name
+in the variable argument list it shall interpret the next argument
+as a value specifying another varargs style variable argument list and
+logically insert it in the original list at the point of declaration.
+>>CODE
+instance_variable_rec base;
+pid_t pid2;
+XtVarArgsList thelist;
+
+ FORK(pid2);
+ avs_xt_hier("Tvagtares1", "XtVaGetApplicationResources");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Retrieve resource values from arg list");
+ thelist=XtVaCreateArgsList(NULL, XtNlabel, "label value", NULL);
+ XtVaGetApplicationResources(topLevel,
+ &base,
+ resources,
+ 2,
+ XtVaNestedList, thelist, NULL
+ );
+ tet_infoline("TEST: Retrieved resource value");
+ if (strcmp(base.label, "label value") != 0) {
+ sprintf(ebuf, "ERROR: Expected \"label value\", received \"%s\"", base.label);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
diff --git a/xts5/Xt11/XtVaGetSubresources/XtVaGetSubresources.m b/xts5/Xt11/XtVaGetSubresources/XtVaGetSubresources.m
new file mode 100644
index 00000000..3b48db16
--- /dev/null
+++ b/xts5/Xt11/XtVaGetSubresources/XtVaGetSubresources.m
@@ -0,0 +1,309 @@
+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/Xt11/XtVaGetSubresources/XtVaGetSubresources.m,v 1.1 2005-02-12 14:37:54 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/Xt11/XtVaGetSubresources/XtVaGetSubresources.m
+>>#
+>># Description:
+>># Tests for XtVaGetSubresources()
+>>#
+>># Modifications:
+>># $Log: tvagtsres.m,v $
+>># Revision 1.1 2005-02-12 14:37:54 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:24 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:20 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:29 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:03 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.2 1998/01/13 04:27:38 andy
+>># In test 4 call to XtVaCreateArgsList changed value portion of
+>># name/value pair to be a pointer rather than a value (SR 145).
+>>#
+>># Revision 4.1 1997/01/07 19:47:00 mar
+>># req.4.W.00031: tp3, tp4 - use background instead of foreground, since
+>># foreground is not a valid resource in the toplevel shell widget.
+>>#
+>># Revision 4.0 1995/12/15 09:19:21 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:14:01 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+typedef struct _instance_variables {
+ long background;
+ String label;
+} instance_variable_rec;
+static XtResource resources[] = {
+ {
+ XtNbackground,
+ XtCBackground,
+ XtRPixel, sizeof(Pixel),
+ XtOffsetOf(instance_variable_rec, background),
+ XtRString, "XtDefaultbackground"
+ },
+ {
+ XtNlabel,
+ XtCLabel,
+ XtRString, sizeof(String),
+ XtOffsetOf(instance_variable_rec, label),
+ XtRString, "XtDefaultLabel"
+ },
+};
+int def = 2002;
+static XtResource resources2[] = {
+ {
+ XtNbackground,
+ XtCBackground,
+ XtRPixel, sizeof(Pixel),
+ XtOffsetOf(instance_variable_rec, background),
+ XtRString, "XtDefaultBackground"
+ },
+ {
+ XtNlabel,
+ XtCLabel,
+ XtRString, sizeof(String),
+ XtOffsetOf(instance_variable_rec, label),
+ XtRInt, &def
+ },
+};
+
+char whereitsat[64];
+
+Boolean XtCVT_Proc(display, args, num_args, from_val, to_val, converter_data)
+Display *display;
+XrmValuePtr args;
+Cardinal *num_args;
+XrmValue *from_val;
+XrmValue *to_val;
+XtPointer *converter_data;
+{
+ sprintf(whereitsat, "%d", *(int *)from_val->addr);
+ *(String*)to_val->addr = whereitsat;
+ to_val->size = sizeof(XtPointer);
+ avs_set_event(2, avs_get_event(2)+1);
+ return True;
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtVaGetSubresources Xt11
+void
+XtVaGetSubresources(w, base, name, class, resources, num_resources, ...);
+>>ASSERTION Good A
+A successful call to
+void XtVaGetSubresources(w, base, name, class, resources,
+num_resources, ...)
+shall retrieve the resource value for each resource specified in the
+resource list
+.A resources
+from the resource values specified in
+the varargs style argument list,
+or if no value for the resource is found the variable argument list,
+from the resource database associated with the widget
+.A w,
+matching the resource identified by the
+calling application's
+name and class, the names and classes of all ancestors of
+.A w,
+the name and class of
+.A w,
+the subpart name
+.A name
+and class
+.A class,
+and the resource name and class,
+or if no value is found in the database, from the default_addr field
+of the resource list and copy the resource value at an offset specified
+by the corresponding resource_offset field from the address
+.A base.
+>>CODE
+instance_variable_rec base;
+Cardinal num_resources;
+Arg setargs[2], getargs[2];
+Cardinal num_args;
+Pixel pixel;
+char *string;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tvagtsres1", "XtVaGetSubresources");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Initialize the base address");
+ XtGetApplicationResources(topLevel, &base, resources,2,
+ (ArgList)NULL, (Cardinal)0);
+ tet_infoline("PREP: Update subpart resource list");
+ XtVaGetSubresources(topLevel, &base, (String)NULL, (String)NULL,
+ resources, 2, XtNbackground, 1,
+ XtNlabel, "Hello World",(char *)NULL);
+ tet_infoline("PREP: Get subvalues");
+ XtVaGetSubvalues(&base, resources, 2, XtNbackground, &pixel,
+ XtNlabel, &string, (char *)NULL);
+ tet_infoline("TEST: Retrieved subvalues");
+ check_dec(1, pixel , XtNbackground);
+ check_str("Hello World", string , XtNlabel);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+On a call to
+void XtVaGetSubresources(w, base, name, class, resources,
+num_resources, ...)
+when a resource specified in the resource database, the varargs list or
+a default resource value is in a different representation from the
+representation type specified in the resource_type field of the resource
+list it shall call the appropriate type converter to perform the
+conversion and store the converted value in the subpart data structure.
+>>CODE
+instance_variable_rec base;
+Cardinal num_resources;
+Arg setargs[2], getargs[2];
+Cardinal num_args;
+Pixel pixel;
+char *string;
+pid_t pid2;
+int status;
+
+ FORK(pid2);
+ avs_xt_hier("Tvagtsres5", "XtVaGetSubresources");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ XtAppSetTypeConverter(app_ctext,
+ XtRInt,
+ XtRString,
+ XtCVT_Proc,
+ (XtConvertArgList)NULL,
+ (Cardinal)0,
+ XtCacheNone,
+ NULL);
+ tet_infoline("PREP: Initialize the base address");
+ XtGetApplicationResources(topLevel, &base, resources,2,
+ (ArgList)NULL,(Cardinal)0);
+ tet_infoline("PREP: Update subpart resource list");
+ XtVaGetSubresources(topLevel, &base, (String)NULL, (String)NULL,
+ resources2, 2, XtNbackground, 1, NULL);
+ tet_infoline("PREP: Get subvalues");
+ XtVaGetSubvalues(&base, resources2, 2, XtNbackground, &pixel,
+ XtNlabel, &string, (char *)NULL);
+ tet_infoline("TEST: Retrieved subvalues");
+ check_dec(1, pixel , XtNbackground);
+ check_str("2002", string , XtNlabel);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: convertor was invoked");
+ status = avs_get_event(2);
+ check_dec(1, status, "XtCVT_Proc invoked status");
+
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+On a call to
+void XtVaGetSubresources(w, base, name, class, resources,
+num_resources, ...)
+when the name XtVaTypedArg is specified in place of a resource name
+in the variable argument list it shall interpret the four arguments
+following this argument as a name/type/value/size tuple.
+>>CODE
+instance_variable_rec base;
+Cardinal num_resources;
+Arg setargs[2], getargs[2];
+Cardinal num_args;
+Pixel pixel;
+char *string;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tvagtsres1", "XtVaGetSubresources");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Initialize the base address");
+ XtGetApplicationResources(topLevel, &base, resources,2,
+ (ArgList)NULL, (Cardinal)0);
+ tet_infoline("PREP: Update subpart resource list");
+ XtVaGetSubresources(topLevel, &base, (String)NULL, (String)NULL,
+ resources, 2, XtVaTypedArg, XtNbackground, XtRPixel, 0, sizeof(Pixel), XtNlabel, "Hello World",(char *)NULL);
+ tet_infoline("PREP: Get subvalues");
+ XtVaGetSubvalues(&base, resources, 2, XtNbackground, &pixel,
+ XtNlabel, &string, (char *)NULL);
+ tet_infoline("TEST: Retrieved subvalues");
+ check_dec(0, base.background , XtNbackground);
+ check_str("Hello World", string , XtNlabel);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+On a call to
+void XtVaGetSubresources(w, base, name, class, resources,
+num_resources, ...)
+when the name XtVaNestedList is specified in place of a resource name
+in the variable argument list it shall interpret the next argument
+as a value specifying another varargs style variable argument list and
+logically insert it in the original list at the point of declaration.
+>>CODE
+instance_variable_rec base;
+Cardinal num_resources;
+Arg setargs[2], getargs[2];
+Cardinal num_args;
+Pixel pixel;
+char *string;
+pid_t pid2;
+XtVarArgsList sublist;
+
+ FORK(pid2);
+ avs_xt_hier("Tvagtsres1", "XtVaGetSubresources");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Initialize the base address");
+ XtGetApplicationResources(topLevel, &base, resources,2,
+ (ArgList)NULL, (Cardinal)0);
+ tet_infoline("PREP: Update subpart resource list");
+ XtVaGetSubresources(topLevel, &base, (String)NULL, (String)NULL,
+ resources, 2, XtVaTypedArg, XtNbackground, XtRPixel, 0, sizeof(Pixel), XtNlabel, "Hello World",(char *)NULL);
+ tet_infoline("PREP: Create nested list");
+ sublist = XtVaCreateArgsList(NULL, XtNbackground, (XtArgVal)&pixel, NULL);
+ tet_infoline("PREP: Get subvalues");
+ XtVaGetSubvalues(&base, resources, 2, XtVaNestedList, sublist,
+ XtNlabel, &string, (char *)NULL);
+ tet_infoline("TEST: Retrieved subvalues");
+ check_dec(0, base.background, XtNbackground);
+ check_str("Hello World", string , XtNlabel);
+ XtFree((char *)sublist);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
diff --git a/xts5/Xt11/XtVaGetSubvalues/XtVaGetSubvalues.m b/xts5/Xt11/XtVaGetSubvalues/XtVaGetSubvalues.m
new file mode 100644
index 00000000..7a502b8d
--- /dev/null
+++ b/xts5/Xt11/XtVaGetSubvalues/XtVaGetSubvalues.m
@@ -0,0 +1,218 @@
+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/Xt11/XtVaGetSubvalues/XtVaGetSubvalues.m,v 1.1 2005-02-12 14:37:54 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/Xt11/XtVaGetSubvalues/XtVaGetSubvalues.m
+>>#
+>># Description:
+>># Tests for XtVaGetSubvalues()
+>>#
+>># Modifications:
+>># $Log: tvagtsval.m,v $
+>># Revision 1.1 2005-02-12 14:37:54 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:51 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:49 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.1 1998/08/05 22:17:39 andy
+>># Changed the type used for getting XtNforeground from int to Pixel.
+>>#
+>># Revision 6.0 1998/03/02 05:28:54 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:28 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.1 1997/01/07 19:50:32 mar
+>># req.4.W.00032: tp3 - XtVaGetSubvalues() call missing the XtVaNestedList keyword
+>># before the nested args list, thelist.
+>>#
+>># Revision 4.0 1995/12/15 09:20:41 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:15:45 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+typedef struct _instance_variables {
+ long foreground;
+ String label;
+} instance_variable_rec;
+static XtResource resources[] = {
+ {
+ XtNforeground,
+ XtCForeground,
+ XtRPixel, sizeof(Pixel),
+ XtOffsetOf(instance_variable_rec, foreground),
+ XtRString, "XtDefaultforeground"
+ },
+ {
+ XtNlabel,
+ XtCLabel,
+ XtRString, sizeof(String),
+ XtOffsetOf(instance_variable_rec, label),
+ XtRString, "XtDefaultLabel"
+ },
+};
+
+void XtWMHl_Proc(str1)
+String str1;
+{
+ avs_set_event(1,1);
+}
+void XtWMH_Proc(str1, str2, str3, str4, str5, car)
+String str1, str2, str3, str4, *str5;
+Cardinal *car;
+{
+ avs_set_event(1,1);
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtVaGetSubvalues Xt11
+void
+XtVaGetSubvalues(base, resources, num_resources, ...)
+>>ASSERTION Good A
+A call to
+void XtVaGetSubvalues(base, resources, num_resources, ...)
+shall copy the resource value from the structure pointed to by
+.A base
+for each resource name specified in the varargs style variable
+argument list of name/value pairs that is present in the resource
+list specified by
+.A resources
+to the location specified by the corresponding value field.
+>>CODE
+instance_variable_rec base;
+Cardinal num_resources;
+Pixel pixel;
+char *string;
+Cardinal num_args;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tvagtsval1", "XtVaGetSubvalues");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Initialize the base address");
+ XtGetApplicationResources(topLevel, &base, resources, 2,
+ (ArgList) NULL, (Cardinal)0);
+ tet_infoline("PREP: Set subvalues");
+ XtVaSetSubvalues(&base, resources, 2, XtNforeground, 1,
+ XtNlabel, "Hello World", (char *)NULL);
+ tet_infoline("PREP: Get subvalues");
+ XtVaGetSubvalues(&base, resources, 2, XtNforeground, &pixel,
+ XtNlabel, &string, (char *)NULL);
+ tet_infoline("TEST: Retrieved subvalues");
+ check_dec(1, pixel , XtNforeground);
+ check_str("Hello World", string , XtNlabel);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When a member in the variable argument list is of type XtVaTypedArg
+a call to
+void XtVaGetSubvalues(base, resources, num_resources, ...)
+shall issue a warning message and ignore the entry.
+>>CODE
+instance_variable_rec base;
+Cardinal num_resources;
+Pixel pixel;
+char *string;
+Cardinal num_args;
+pid_t pid2;
+int status;
+
+ FORK(pid2);
+ avs_set_event(1, 0);
+ avs_xt_hier("Tvagtsval1", "XtVaGetSubvalues");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ XtAppSetWarningHandler(app_ctext, XtWMHl_Proc);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Initialize the base address");
+ XtGetApplicationResources(topLevel, &base, resources, 2,
+ (ArgList) NULL, (Cardinal)0);
+ tet_infoline("PREP: Set subvalues");
+ XtVaSetSubvalues(&base, resources, 2, XtNforeground, 1,
+ XtNlabel, "Hello World", (char *)NULL);
+ tet_infoline("PREP: Get subvalues");
+
+ XtVaGetSubvalues(&base, resources, 2, XtNforeground, &pixel,
+ XtVaTypedArg, XtNlabel, XtRString, string, 0, (char *)NULL);
+ tet_infoline("TEST: Retrieved subvalues");
+ check_dec(1, pixel , XtNforeground);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Warning handler is called");
+ status = avs_get_event(1);
+ check_dec(1, status, "calls to warning handler count");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+On a call to
+void XtVaGetSubvalues(base, resources, num_resources, ...)
+when the name XtVaNestedList is specified in place of a resource name
+in the variable argument list it shall interpret the next argument
+as a value specifying another varargs style variable argument list and
+logically insert it in the original list at the point of declaration.
+>>CODE
+instance_variable_rec base;
+Cardinal num_resources;
+Pixel pixel;
+char *string;
+Cardinal num_args;
+pid_t pid2;
+XtVarArgsList thelist;
+
+ FORK(pid2);
+ avs_xt_hier("Tvagtsval1", "XtVaGetSubvalues");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Initialize the base address");
+ XtGetApplicationResources(topLevel, &base, resources, 2,
+ (ArgList) NULL, (Cardinal)0);
+ tet_infoline("PREP: Set subvalues");
+ XtVaSetSubvalues(&base, resources, 2, XtNforeground, 1,
+ XtNlabel, "Hello World", (char *)NULL);
+ tet_infoline("PREP: Get subvalues");
+ thelist=XtVaCreateArgsList(NULL, XtNforeground, &pixel, NULL);
+ XtVaGetSubvalues(&base, resources, 2, XtVaNestedList, thelist,
+ XtNlabel, &string, (char *)NULL);
+ tet_infoline("TEST: Retrieved subvalues");
+ check_dec(1, pixel , XtNforeground);
+ check_str("Hello World", string , XtNlabel);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
diff --git a/xts5/Xt11/XtVaGetValues/XtVaGetValues.m b/xts5/Xt11/XtVaGetValues/XtVaGetValues.m
new file mode 100644
index 00000000..3fcdfb52
--- /dev/null
+++ b/xts5/Xt11/XtVaGetValues/XtVaGetValues.m
@@ -0,0 +1,926 @@
+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/Xt11/XtVaGetValues/XtVaGetValues.m,v 1.1 2005-02-12 14:37:55 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/Xt11/XtVaGetValues/XtVaGetValues.m
+>>#
+>># Description:
+>># Tests for XtVaGetValues()
+>>#
+>># Modifications:
+>># $Log: tvagtvals.m,v $
+>># Revision 1.1 2005-02-12 14:37:55 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:50 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:47 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:53 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:27 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.1 1996/10/30 19:49:25 andy
+>># Correct arguments for XtVaTypedArg in TP2 per req.4.W.00026
+>>#
+>># Revision 4.0 1995/12/15 09:20:38 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:15:41 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+#include <X11/Xaw/Form.h>
+#include <xt/SquareCelP.h>
+#include <AvsForm.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+/*
+ * SquareCell.c - Square Widget
+ */
+#define INTERNAL_WIDTH 2
+#define INTERNAL_HEIGHT 4
+#define DEFAULT_PIXMAP_WIDTH 1 /* in cells */
+#define DEFAULT_PIXMAP_HEIGHT 1 /* in cells */
+#define DEFAULT_CELL_SIE 20 /* in pixels */
+/* values for instance variable is_drawn */
+#define DRAWN 1
+#define UNDRAWN 0
+/* modes for drawing */
+#define DRAW 1
+#define UNDRAW 0
+#define MAXLINES 10 /* max of horiz or vertical cells */
+#define SCROLLBARWIDTH 15
+#define DEFAULTWIDTH 300 /* widget size when show_all is False */
+#define offset(field) XtOffsetOf(SquareCellRec, field)
+static XtResource resources[] = {
+ {
+ XtNforeground,
+ XtCForeground,
+ XtRPixel,
+ sizeof(Pixel),
+ offset(squareCell.foreground),
+ XtRString,
+ XtDefaultForeground
+ },
+ {
+ XavsNtoggleCallback,
+ XavsCToggleCallback,
+ XtRCallback,
+ sizeof(XtPointer),
+ offset(squareCell.callback),
+ XtRCallback,
+ NULL
+ },
+ {
+ XavsNcellSizeInPixels,
+ XavsCCellSizeInPixels,
+ XtRInt, sizeof(int),
+ offset(squareCell.cell_size_in_pixels),
+ XtRImmediate,
+ (XtPointer)DEFAULT_CELL_SIE
+ },
+ {
+ XavsNpixmapWidthInCells,
+ XavsCPixmapWidthInCells,
+ XtRDimension,
+ sizeof(Dimension),
+ offset(squareCell.pixmap_width_in_cells),
+ XtRImmediate,
+ (XtPointer)DEFAULT_PIXMAP_WIDTH
+ },
+ {
+ XavsNpixmapHeightInCells,
+ XavsCPixmapHeightInCells,
+ XtRDimension,
+ sizeof(Dimension),
+ offset(squareCell.pixmap_height_in_cells),
+ XtRImmediate,
+ (XtPointer)DEFAULT_PIXMAP_HEIGHT
+ },
+ {
+ XavsNcurX,
+ XavsCCurX,
+ XtRInt,
+ sizeof(int),
+ offset(squareCell.cur_x),
+ XtRImmediate,
+ (XtPointer) 0
+ },
+ {
+ XavsNcurY,
+ XavsCCurY,
+ XtRInt,
+ sizeof(int),
+ offset(squareCell.cur_y),
+ XtRImmediate,
+ (XtPointer) 0
+ },
+ {
+ XavsNcellArray,
+ XavsCCellArray,
+ XtRString,
+ sizeof(String),
+ offset(squareCell.cell),
+ XtRImmediate,
+ (XtPointer) 0
+ },
+ {
+ XavsNshowEntireBitmap,
+ XavsCShowEntireBitmap,
+ XtRBoolean,
+ sizeof(Boolean),
+ offset(squareCell.show_all),
+ XtRImmediate,
+ (XtPointer) TRUE
+ },
+};
+/* Declaration of methods */
+static void Initialize();
+static void Redisplay();
+static void Destroy();
+static void GetValuesHook();
+static void Resize();
+static Boolean SetValues();
+static XtGeometryResult QueryGeometry();
+/* these Core methods not needed by SquareCell:
+ *
+ * static void ClassInitialize();
+ * static void Realize();
+ */
+/* the following are private functions unique to SquareCell */
+static void DrawPixmaps(), DoCell(), ChangeCellSize();
+/* the following are actions of SquareCell */
+static void DrawCell(), UndrawCell(), ToggleCell();
+/* The following are public functions of SquareCell, declared extern
+ * in the public include file: */
+char *SquareCellGetArray();
+static char defaultTranslations[] =
+ "<Btn1Down>: DrawCell() \n\
+ <Btn2Down>: UndrawCell() \n\
+ <Btn3Down>: ToggleCell() \n\
+ <Btn1Motion>: DrawCell() \n\
+ <Btn2Motion>: UndrawCell() \n\
+ <Btn3Motion>: ToggleCell()";
+static XtActionsRec actions[] = {
+ {"DrawCell", DrawCell},
+ {"UndrawCell", UndrawCell},
+ {"ToggleCell", ToggleCell},
+};
+/* definition in SquareCell.h */
+static SquareCellPointInfo info;
+SquareCellClassRec squareCellClassRec = {
+ {
+ /* core_class fields */
+ /* superclass */ (WidgetClass) &coreClassRec,
+ /* class_name */ "SquareCell",
+ /* widget_size */ sizeof(SquareCellRec),
+ /* class_initialize */ NULL,
+ /* class_part_initialize */ NULL,
+ /* class_inited */ FALSE,
+ /* initialize */ Initialize,
+ /* initialize_hook */ NULL,
+ /* realize */ XtInheritRealize,
+ /* actions */ actions,
+ /* num_actions */ XtNumber(actions),
+ /* resources */ resources,
+ /* num_resources */ XtNumber(resources),
+ /* xrm_class */ NULLQUARK,
+ /* compress_motion */ TRUE,
+ /* compress_exposure */ XtExposeCompressMultiple,
+ /* compress_enterleave */ TRUE,
+ /* visible_interest */ FALSE,
+ /* destroy */ Destroy,
+ /* resize */ Resize,
+ /* expose */ Redisplay,
+ /* set_values */ SetValues,
+ /* set_values_hook */ NULL,
+ /* set_values_almost */ XtInheritSetValuesAlmost,
+ /* get_values_hook */ GetValuesHook,
+ /* accept_focus */ NULL,
+ /* version */ XtVersion,
+ /* callback_private */ NULL,
+ /* tm_table */ defaultTranslations,
+ /* query_geometry */ QueryGeometry,
+ /* display_accelerator */ XtInheritDisplayAccelerator,
+ /* extension */ NULL
+ },
+ {/* simple_class fields */
+ /* change_sensitive */ XtInheritChangeSensitive,
+ },
+ {
+ /* extension */ 0,
+ },
+};
+WidgetClass squareCellWidgetClass = (WidgetClass) & squareCellClassRec;
+static void
+GetDrawGC(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ XGCValues values;
+ XtGCMask mask = GCForeground | GCBackground | GCDashOffset |
+ GCDashList | GCLineStyle;
+ /*
+ * Setting foreground and background to 1 and 0 looks like a
+ * kludge but isn't. This GC is used for drawing
+ * into a pixmap of depth one. Real colors are applied with a
+ * separate GC when the pixmap is copied into the window.
+ */
+ values.foreground = 1;
+ values.background = 0;
+ values.dashes = 1;
+ values.dash_offset = 0;
+ values.line_style = LineOnOffDash;
+ cw->squareCell.draw_gc = XCreateGC(XtDisplay((Widget)cw),
+ cw->squareCell.big_picture, mask, &values);
+}
+static void
+GetUndrawGC(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ XGCValues values;
+ XtGCMask mask = GCForeground | GCBackground;
+ /* this looks like a kludge but isn't. This GC is used for drawing
+ * into a pixmap of depth one. Real colors are applied as the
+ * pixmap is copied into the window.
+ */
+ values.foreground = 0;
+ values.background = 1;
+ cw->squareCell.undraw_gc = XCreateGC(XtDisplay((Widget)cw),
+ cw->squareCell.big_picture, mask, &values);
+}
+static void
+GetCopyGC(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ XGCValues values;
+ XtGCMask mask = GCForeground | GCBackground;
+ values.foreground = cw->squareCell.foreground;
+ values.background = cw->core.background_pixel;
+ cw->squareCell.copy_gc = XtGetGC((Widget)cw, mask, &values);
+}
+static void
+Initialize(treq, tnew, args, num_args)
+Widget treq, tnew;
+ArgList args;
+Cardinal *num_args;
+{
+ SquareCellWidget new = (SquareCellWidget) tnew;
+ new->squareCell.cur_x = 0;
+ new->squareCell.cur_y = 0;
+ /*
+ * Check instance values set by resources that may be invalid.
+ */
+ if ((new->squareCell.pixmap_width_in_cells < 1) ||
+ (new->squareCell.pixmap_height_in_cells < 1)) {
+ XtWarning("SquareCell: pixmapWidth and/or pixmapHeight is too small (using 10 x 10).");
+ new->squareCell.pixmap_width_in_cells = 10;
+ new->squareCell.pixmap_height_in_cells = 10;
+ }
+ if (new->squareCell.cell_size_in_pixels < 5) {
+ XtWarning("SquareCell: cellSize is too small (using 5).");
+ new->squareCell.cell_size_in_pixels = 5;
+ }
+ if ((new->squareCell.cur_x < 0) || (new->squareCell.cur_y < 0)) {
+ XtWarning("SquareCell: cur_x and cur_y must be non-negative (using 0, 0).");
+ new->squareCell.cur_x = 0;
+ new->squareCell.cur_y = 0;
+ }
+ if (new->squareCell.cell == NULL)
+ new->squareCell.cell = XtCalloc(
+ new->squareCell.pixmap_width_in_cells *
+ new->squareCell.pixmap_height_in_cells, sizeof(char));
+ else
+ new->squareCell.user_allocated = True; /* user supplied cell array */
+ new->squareCell.pixmap_width_in_pixels =
+ new->squareCell.pixmap_width_in_cells *
+ new->squareCell.cell_size_in_pixels;
+ new->squareCell.pixmap_height_in_pixels =
+ new->squareCell.pixmap_height_in_cells *
+ new->squareCell.cell_size_in_pixels;
+ if (new->core.width == 0) {
+ if (new->squareCell.show_all == False)
+ new->core.width = (new->squareCell.pixmap_width_in_pixels
+ > DEFAULTWIDTH) ? DEFAULTWIDTH :
+ (new->squareCell.pixmap_width_in_pixels);
+ else
+ new->core.width = new->squareCell.pixmap_width_in_pixels;
+ }
+ if (new->core.height == 0) {
+ if (new->squareCell.show_all == False)
+ new->core.height =
+ (new->squareCell.pixmap_height_in_pixels >
+ DEFAULTWIDTH) ? DEFAULTWIDTH :
+ (new->squareCell.pixmap_height_in_pixels);
+ else
+ new->core.height = new->squareCell.pixmap_height_in_pixels;
+ }
+ CreateBigPixmap(new);
+ GetDrawGC(new);
+ GetUndrawGC(new);
+ GetCopyGC(new);
+ DrawIntoBigPixmap(new);
+}
+static void
+Redisplay(w, event)
+Widget w;
+XExposeEvent *event;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ register int x, y;
+ unsigned int width, height;
+ if (!XtIsRealized((Widget)cw))
+ return;
+ if (event) { /* called from btn-event or expose */
+ x = event->x;
+ y = event->y;
+ width = event->width;
+ height = event->height;
+ }
+ else { /* called because complete redraw */
+ x = 0;
+ y = 0;
+ width = cw->squareCell.pixmap_width_in_pixels;
+ height = cw->squareCell.pixmap_height_in_pixels;
+ }
+ if (DefaultDepthOfScreen(XtScreen((Widget)cw)) == 1)
+ XCopyArea(XtDisplay((Widget)cw), cw->squareCell.big_picture,
+ XtWindow((Widget)cw), cw->squareCell.copy_gc, x +
+ cw->squareCell.cur_x, y + cw->squareCell.cur_y,
+ width, height, x, y);
+ else
+ XCopyPlane(XtDisplay((Widget)cw), cw->squareCell.big_picture,
+ XtWindow((Widget)cw), cw->squareCell.copy_gc, x +
+ cw->squareCell.cur_x, y + cw->squareCell.cur_y,
+ width, height, x, y, 1);
+}
+static Boolean
+SetValues(current, request, new, args, num_args)
+Widget current, request, new;
+ArgList args;
+Cardinal *num_args;
+{
+ SquareCellWidget curcw = (SquareCellWidget) current;
+ SquareCellWidget newcw = (SquareCellWidget) new;
+ Boolean do_redisplay = False;
+ /*
+ ** XtSetValues invoked procedure SetValues
+ */
+ if (curcw->squareCell.foreground != newcw->squareCell.foreground) {
+ XtReleaseGC((Widget)curcw, curcw->squareCell.copy_gc);
+ GetCopyGC(newcw);
+ do_redisplay = True;
+ }
+ if ((curcw->squareCell.cur_x != newcw->squareCell.cur_x) ||
+ (curcw->squareCell.cur_y != newcw->squareCell.cur_y))
+ do_redisplay = True;
+ if (curcw->squareCell.cell_size_in_pixels !=
+ newcw->squareCell.cell_size_in_pixels) {
+ ChangeCellSize(curcw, newcw->squareCell.cell_size_in_pixels);
+ do_redisplay = True;
+ }
+ if (curcw->squareCell.pixmap_width_in_cells !=
+ newcw->squareCell.pixmap_width_in_cells) {
+ newcw->squareCell.pixmap_width_in_cells =
+ curcw->squareCell.pixmap_width_in_cells;
+ XtWarning("SquareCell: pixmap_width_in_cells cannot be set by XtSetValues.\n");
+ }
+ if (curcw->squareCell.pixmap_height_in_cells !=
+ newcw->squareCell.pixmap_height_in_cells) {
+ newcw->squareCell.pixmap_height_in_cells =
+ curcw->squareCell.pixmap_height_in_cells;
+ XtWarning("SquareCell: pixmap_height_in_cells cannot be set by XtSetValues.\n");
+ }
+ return do_redisplay;
+}
+static void
+GetValuesHook(w, args, num_args)
+Widget w;
+ArgList args;
+Cardinal *num_args;
+{
+ avs_set_event(1,1);
+}
+static void
+Destroy(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ if (cw->squareCell.big_picture)
+ XFreePixmap(XtDisplay(cw), cw->squareCell.big_picture);
+ if (cw->squareCell.draw_gc)
+ XFreeGC(XtDisplay(cw), cw->squareCell.draw_gc);
+ if (cw->squareCell.undraw_gc)
+ XFreeGC(XtDisplay(cw), cw->squareCell.undraw_gc);
+ if (cw->squareCell.copy_gc)
+ XFreeGC(XtDisplay(cw), cw->squareCell.copy_gc);
+ /* Free memory allocated with Calloc. This was done
+ * only if application didn't supply cell array.
+ */
+ if (!cw->squareCell.user_allocated)
+ XtFree(cw->squareCell.cell);
+}
+static void
+DrawCell(w, event)
+Widget w;
+XEvent *event;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ DrawPixmaps(cw->squareCell.draw_gc, DRAW, cw, event);
+}
+static void
+UndrawCell(w, event)
+Widget w;
+XEvent *event;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ DrawPixmaps(cw->squareCell.undraw_gc, UNDRAW, cw, event);
+}
+static void
+ToggleCell(w, event)
+Widget w;
+XEvent *event;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ static int oldx = -1, oldy = -1;
+ GC gc;
+ int mode;
+ int newx, newy;
+ /* This is strictly correct, but doesn't
+ * seem to be necessary */
+ if (event->type == ButtonPress) {
+ newx = (cw->squareCell.cur_x + ((XButtonEvent *)event)->x) /
+ cw->squareCell.cell_size_in_pixels;
+ newy = (cw->squareCell.cur_y + ((XButtonEvent *)event)->y) /
+ cw->squareCell.cell_size_in_pixels;
+ }
+ else {
+ newx = (cw->squareCell.cur_x + ((XMotionEvent *)event)->x) /
+ cw->squareCell.cell_size_in_pixels;
+ newy = (cw->squareCell.cur_y + ((XMotionEvent *)event)->y) /
+ cw->squareCell.cell_size_in_pixels;
+ }
+ if ((mode = cw->squareCell.cell[newx + newy * cw->squareCell.pixmap_width_in_cells]) == DRAWN) {
+ gc = cw->squareCell.undraw_gc;
+ mode = UNDRAW;
+ }
+ else {
+ gc = cw->squareCell.draw_gc;
+ mode = DRAW;
+ }
+ if (oldx != newx || oldy != newy) {
+ oldx = newx;
+ oldy = newy;
+ DrawPixmaps(gc, mode, cw, event);
+ }
+}
+static void
+DrawPixmaps(gc, mode, w, event)
+GC gc;
+int mode;
+Widget w;
+XButtonEvent *event;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ int newx = (cw->squareCell.cur_x + event->x) /
+ cw->squareCell.cell_size_in_pixels;
+ int newy = (cw->squareCell.cur_y + event->y) /
+ cw->squareCell.cell_size_in_pixels;
+ XExposeEvent fake_event;
+ /* if already done, return */
+ if (cw->squareCell.cell[newx + newy * cw->squareCell.pixmap_width_in_cells] == mode)
+ return;
+ /* otherwise, draw or undraw */
+ XFillRectangle(XtDisplay((Widget)cw), cw->squareCell.big_picture, gc,
+ cw->squareCell.cell_size_in_pixels*newx + 2,
+ cw->squareCell.cell_size_in_pixels*newy + 2,
+ (unsigned int)cw->squareCell.cell_size_in_pixels - 3,
+ (unsigned int)cw->squareCell.cell_size_in_pixels - 3);
+ cw->squareCell.cell[newx + newy * cw->squareCell.pixmap_width_in_cells] = mode;
+ info.mode = mode;
+ info.newx = newx;
+ info.newy = newy;
+ fake_event.x = cw->squareCell.cell_size_in_pixels * newx - cw->squareCell.cur_x;
+ fake_event.y = cw->squareCell.cell_size_in_pixels * newy - cw->squareCell.cur_y;
+ fake_event.width = cw->squareCell.cell_size_in_pixels;
+ fake_event.height = cw->squareCell.cell_size_in_pixels;
+ Redisplay(cw, &fake_event);
+ XtCallCallbacks((Widget)cw, XavsNtoggleCallback, &info);
+}
+CreateBigPixmap(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ /* always a 1 bit deep pixmap, regardless of screen depth */
+ cw->squareCell.big_picture = XCreatePixmap(XtDisplay((Widget)cw),
+ RootWindow(XtDisplay((Widget)cw), DefaultScreen(XtDisplay((Widget)cw))),
+ cw->squareCell.pixmap_width_in_pixels + 2,
+ cw->squareCell.pixmap_height_in_pixels + 2, 1);
+}
+DrawIntoBigPixmap(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ int n_horiz_segments, n_vert_segments;
+ XSegment segment[MAXLINES];
+ register int x, y;
+ XFillRectangle(XtDisplay((Widget)cw), cw->squareCell.big_picture,
+ cw->squareCell.undraw_gc, 0, 0,
+ cw->squareCell.pixmap_width_in_pixels
+ + 2, cw->squareCell.pixmap_height_in_pixels + 2);
+ n_horiz_segments = cw->squareCell.pixmap_height_in_cells + 1;
+ n_vert_segments = cw->squareCell.pixmap_width_in_cells + 1;
+ for (x = 0; x < n_horiz_segments; x++) {
+ segment[x].x1 = 0;
+ segment[x].x2 = (short) cw->squareCell.pixmap_width_in_pixels;
+ segment[x].y1 = (short) cw->squareCell.cell_size_in_pixels * x;
+ segment[x].y2 = (short) cw->squareCell.cell_size_in_pixels * x;
+ }
+ XDrawSegments(XtDisplay((Widget)cw), cw->squareCell.big_picture, cw->squareCell.draw_gc, segment, n_horiz_segments);
+ for (y = 0; y < n_vert_segments; y++) {
+ segment[y].x1 = (short) y * cw->squareCell.cell_size_in_pixels;
+ segment[y].x2 = (short) y * cw->squareCell.cell_size_in_pixels;
+ segment[y].y1 = 0;
+ segment[y].y2 = (short) cw->squareCell.pixmap_height_in_pixels;
+ }
+ XDrawSegments(XtDisplay((Widget)cw), cw->squareCell.big_picture, cw->squareCell.draw_gc, segment, n_vert_segments);
+ /* draw current cell array into pixmap */
+ for (x = 0; x < cw->squareCell.pixmap_width_in_cells; x++) {
+ for (y = 0; y < cw->squareCell.pixmap_height_in_cells; y++) {
+ if (cw->squareCell.cell[x + (y * cw->squareCell.pixmap_width_in_cells)] == DRAWN)
+ DoCell(cw, x, y, cw->squareCell.draw_gc);
+ else
+ DoCell(cw, x, y, cw->squareCell.undraw_gc);
+ }
+ }
+}
+/* A Public function, not static */
+char *
+SquareCellGetArray(w, width_in_cells, height_in_cells)
+Widget w;
+int *width_in_cells, *height_in_cells;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ *width_in_cells = cw->squareCell.pixmap_width_in_cells;
+ *height_in_cells = cw->squareCell.pixmap_height_in_cells;
+ return (cw->squareCell.cell);
+}
+static void
+Resize(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ /* resize does nothing unless new size is bigger than entire pixmap */
+ if ((cw->core.width > cw->squareCell.pixmap_width_in_pixels) &&
+ (cw->core.height > cw->squareCell.pixmap_height_in_pixels)) {
+ /*
+ * Calculate the maximum cell size that will allow the
+ * entire bitmap to be displayed.
+ */
+ Dimension w_temp_cell_size_in_pixels, h_temp_cell_size_in_pixels;
+ Dimension new_cell_size_in_pixels;
+
+ w_temp_cell_size_in_pixels = cw->core.width / cw->squareCell.pixmap_width_in_cells;
+ h_temp_cell_size_in_pixels = cw->core.height / cw->squareCell.pixmap_height_in_cells;
+
+ if (w_temp_cell_size_in_pixels < h_temp_cell_size_in_pixels)
+ new_cell_size_in_pixels = w_temp_cell_size_in_pixels;
+ else
+ new_cell_size_in_pixels = h_temp_cell_size_in_pixels;
+
+ /* if size change mandates a new pixmap, make one */
+ if (new_cell_size_in_pixels != cw->squareCell.cell_size_in_pixels)
+ ChangeCellSize(cw, new_cell_size_in_pixels);
+ }
+}
+static void
+ChangeCellSize(w, new_cell_size)
+Widget w;
+int new_cell_size;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ int x, y;
+ cw->squareCell.cell_size_in_pixels = new_cell_size;
+ /* recalculate variables based on cell size */
+ cw->squareCell.pixmap_width_in_pixels =
+ cw->squareCell.pixmap_width_in_cells *
+ cw->squareCell.cell_size_in_pixels;
+ cw->squareCell.pixmap_height_in_pixels =
+ cw->squareCell.pixmap_height_in_cells *
+ cw->squareCell.cell_size_in_pixels;
+
+ /* destroy old and create new pixmap of correct size */
+ XFreePixmap(XtDisplay((Widget)cw), cw->squareCell.big_picture);
+ CreateBigPixmap(cw);
+
+ /* draw lines into new pixmap */
+ DrawIntoBigPixmap(cw);
+
+ /* draw current cell array into pixmap */
+ for (x = 0; x < cw->squareCell.pixmap_width_in_cells; x++) {
+ for (y = 0; y < cw->squareCell.pixmap_height_in_cells; y++) {
+ if (cw->squareCell.cell[x + (y * cw->squareCell.pixmap_width_in_cells)] == DRAWN)
+ DoCell(cw, x, y, cw->squareCell.draw_gc);
+ else
+ DoCell(cw, x, y, cw->squareCell.undraw_gc);
+ }
+ }
+}
+static void
+DoCell(w, x, y, gc)
+Widget w;
+int x, y;
+GC gc;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ /* otherwise, draw or undraw */
+ XFillRectangle(XtDisplay((Widget)cw), cw->squareCell.big_picture, gc,
+ cw->squareCell.cell_size_in_pixels * x + 2,
+ cw->squareCell.cell_size_in_pixels * y + 2,
+ (unsigned int)cw->squareCell.cell_size_in_pixels - 3,
+ (unsigned int)cw->squareCell.cell_size_in_pixels - 3);
+}
+static XtGeometryResult QueryGeometry(w, proposed, answer)
+Widget w;
+XtWidgetGeometry *proposed, *answer;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ /* set fields we care about */
+ answer->request_mode = CWWidth | CWHeight;
+ /* initial width and height */
+ if (cw->squareCell.show_all == True)
+ answer->width = cw->squareCell.pixmap_width_in_pixels;
+ else
+ answer->width = (cw->squareCell.pixmap_width_in_pixels >
+ DEFAULTWIDTH) ? DEFAULTWIDTH :
+ cw->squareCell.pixmap_width_in_pixels;
+ if (cw->squareCell.show_all == True)
+ answer->height = cw->squareCell.pixmap_height_in_pixels;
+ else
+ answer->height = (cw->squareCell.pixmap_height_in_pixels >
+ DEFAULTWIDTH) ? DEFAULTWIDTH :
+ cw->squareCell.pixmap_height_in_pixels;
+ if ( ((proposed->request_mode & (CWWidth | CWHeight))
+ == (CWWidth | CWHeight)) &&
+ proposed->width == answer->width &&
+ proposed->height == answer->height)
+ return XtGeometryYes;
+ else if (answer->width == cw->core.width &&
+ answer->height == cw->core.height)
+ return XtGeometryNo;
+ else
+ return XtGeometryAlmost;
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtVaGetValues Xt11
+void
+XtVaGetValues(object, ....)
+>>ASSERTION Good A
+A successful call to
+void XtVaGetValues(object, ....)
+shall copy the resource value from the instance structure of the
+widget
+.A object
+for each resource name specified in the varargs style variable
+argument list of name/value pairs into the location specified by
+the corresponding value field.
+>>CODE
+Widget squarew;
+int cur_x , cur_y;
+int invoked = 0;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tvagtvals1", "XtVaGetValues");
+ tet_infoline("PREP: Create Square Cell widget");
+ squarew = XtVaCreateManagedWidget("squarew",
+ squareCellWidgetClass, boxw1,(char *)NULL);
+ tet_infoline("PREP: Set resource values");
+ XtVaSetValues(squarew, XavsNcurX, 10, XavsNcurY, 10 , (char *)NULL);
+ tet_infoline("TEST: Get resource values");
+ XtVaGetValues(squarew, XavsNcurX, &cur_x, XavsNcurY, &cur_y, (char *)NULL);
+ tet_infoline("TEST: Resource values");
+ check_dec(10, cur_x, XavsNcurX);
+ check_dec(10, cur_y, XavsNcurY);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+On a call to
+void XtVaGetValues(object, ....)
+when the name XtVaTypedArg is specified in place of a resource name
+in the variable argument list it shall interpret the four arguments
+following this argument as a name/type/value/size tuple.
+>>CODE
+Widget squarew;
+int cur_x , cur_y;
+int invoked = 0;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tvagtvals1", "XtVaGetValues");
+ tet_infoline("PREP: Create Square Cell widget");
+ squarew = XtVaCreateManagedWidget("squarew",
+ squareCellWidgetClass, boxw1,(char *)NULL);
+ tet_infoline("PREP: Set resource values");
+ XtVaSetValues(squarew, XavsNcurX, 10, XavsNcurY, 10 , (char *)NULL);
+ tet_infoline("TEST: Get resource values");
+ XtVaGetValues(squarew, XtVaTypedArg, XavsNcurX, XtRInt, (XtArgVal)&cur_x, sizeof(XtRInt), XavsNcurY, &cur_y, (char *)NULL);
+ tet_infoline("TEST: Resource values returned");
+ check_dec(10, cur_x, XavsNcurX);
+ check_dec(10, cur_y, XavsNcurY);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+On a call to
+void XtVaGetValues(object, ....)
+when the name XtVaNestedList is specified in place of a
+resource name in the variable argument list it shall interpret
+the next argument as a value specifying another varargs
+style variable argument list and logically insert it in
+the original list at the point of declaration.
+>>CODE
+Widget squarew;
+int cur_x , cur_y;
+int invoked = 0;
+pid_t pid2;
+XtVarArgsList thelist;
+
+ FORK(pid2);
+ avs_xt_hier("Tvagtvals1", "XtVaGetValues");
+ tet_infoline("PREP: Create Square Cell widget");
+ squarew = XtVaCreateManagedWidget("squarew",
+ squareCellWidgetClass, boxw1,(char *)NULL);
+ tet_infoline("PREP: Set resource values");
+ XtVaSetValues(squarew, XavsNcurX, 10, XavsNcurY, 10 , (char *)NULL);
+ tet_infoline("PREP: Retrieve resource values from arg list");
+ thelist=XtVaCreateArgsList(NULL, XavsNcurX, &cur_x, NULL);
+ tet_infoline("TEST: Get resource values");
+ XtVaGetValues(squarew, XtVaNestedList, thelist, XavsNcurY, &cur_y, (char *)NULL);
+ tet_infoline("TEST: Resource values");
+ check_dec(10, cur_x, XavsNcurX);
+ check_dec(10, cur_y, XavsNcurY);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When the class of the specified widget's parent
+is a subclass of constraintWidgetClass
+a call to
+void XtVaGetValues(object, ....)
+shall obtain the resource values from the widget instance for any
+constraint resources specified in the variable argument list.
+>>CODE
+Widget formw_good , labelw_good;
+Boolean resizable;
+Arg setargs[1];
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tvagtvals2", "XtVaGetValues");
+ tet_infoline("PREP: Create formw_good widget subclass of constraintWidgetClass");
+ formw_good = (Widget) CreateFormWidget(boxw1);
+ tet_infoline("PREP: Create label widget Hello");
+ labelw_good = (Widget) CreateLabelWidget("Hello", formw_good);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Set XtNresizable constraint resource value for");
+ tet_infoline("PREP: labelw_good widget");
+ setargs[0].name = XtNresizable;
+ setargs[0].value = (XtArgVal) TRUE;
+ XtSetValues(labelw_good, setargs, 1);
+ tet_infoline("TEST: Get XtNresizable constraint resource value");
+ XtVaGetValues(labelw_good, XtNresizable, &resizable, (char *)NULL);
+ tet_infoline("TEST: XtNresizable resource value");
+ check_dec(TRUE, resizable, XtNresizable);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When a resource specified in the variable argument list is
+not found in any resource list for the specified widget a call to
+void XtVaGetValues(object, ....)
+shall not modify the value at the location specified by the
+corresponding value member.
+>>CODE
+int name_value;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tvagtvals3", "XtVaGetValues");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Try bogus resource NoSuchResource value");
+ name_value = 10;
+ XtVaGetValues(rowcolw, "NoSuchResource", &name_value, (char *)NULL);
+ tet_infoline("TEST: Address field is not modified");
+ check_dec(10, name_value, "NoSuchResource");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A call to
+void XtVaGetValues(object, ....)
+shall call the get_values_hook procedures in the widget's
+class and superclass records that are non-NULL in a
+superclass-to-subclass order.
+>>CODE
+Widget squarew;
+int cur_x , cur_y;
+int invoked = 0;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tvagtvals4", "XtVaGetValues");
+ tet_infoline("PREP: Create Square Cell widget");
+ squarew = XtVaCreateManagedWidget("squarew",
+ squareCellWidgetClass, boxw1, (char *)NULL);
+ tet_infoline("PREP: Set resource values");
+ XtVaSetValues(squarew, XavsNcurX, 10, XavsNcurY, 10 , (char *)NULL);
+ tet_infoline("TEST: Get resource values");
+ XtVaGetValues(squarew, XavsNcurX, &cur_x, XavsNcurY, &cur_y, (char *)NULL);
+ check_dec(10, cur_x, XavsNcurX);
+ check_dec(10, cur_y, XavsNcurY);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: get_values_hook procedure GetValuesHook was invoked");
+ invoked = avs_get_event(1);
+ if (!invoked) {
+ sprintf(ebuf, "ERROR: Procedure GetValuesHook was not invoked");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When the class of the specified widget's parent
+is a subclass of constraintWidgetClass, any of the parent's
+class or superclass records have declared ConstraintClassExtension
+records in the Constraint class part extension field with a record
+type of NULLQUARK, and the get_values_hook field in the extension
+record is non-NULL, a call to
+void XtVaGetValues(object, ....)
+shall call the get_values_hook procedures in a
+superclass-to-subclass order.
+>>CODE
+Widget squarew;
+Arg setargs[2], getargs[2];
+int invoked = 0;
+pid_t pid2;
+Widget formw_good, labelw_good;
+unsigned char thechar;
+
+ /*avsForm is a subclass of constraint with the appropriate
+ get_value_hook procedures. See libXtTest AvsForm.c*/
+ FORK(pid2);
+ avs_xt_hier("Tgtvalues4", "XtGetValues");
+ tet_infoline("PREP: Create avsform widget in boxw1 widget");
+ formw_good = XtCreateManagedWidget("avsform",
+ avsformWidgetClass,
+ boxw1,
+ NULL,
+ 0);
+ labelw_good = (Widget) CreateLabelWidget("Hello", formw_good);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get XtNresizable constraint resource value");
+ XtVaGetValues(labelw_good, XtNresizable, &thechar, (char *)NULL);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Parent's extension get_values_hook procedure GetValuesHook was invoked");
+ invoked = avs_get_event(7);
+ check_dec(1, invoked, "parent's extension get_values_hook invocation count");
+ tet_result(TET_PASS);
diff --git a/xts5/Xt11/XtVaSetSubvalues/XtVaSetSubvalues.m b/xts5/Xt11/XtVaSetSubvalues/XtVaSetSubvalues.m
new file mode 100644
index 00000000..934dc9c3
--- /dev/null
+++ b/xts5/Xt11/XtVaSetSubvalues/XtVaSetSubvalues.m
@@ -0,0 +1,254 @@
+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/Xt11/XtVaSetSubvalues/XtVaSetSubvalues.m,v 1.1 2005-02-12 14:37:55 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/Xt11/XtVaSetSubvalues/XtVaSetSubvalues.m
+>>#
+>># Description:
+>># Tests for XtVaSetSubvalues()
+>>#
+>># Modifications:
+>># $Log: tvastsvls.m,v $
+>># Revision 1.1 2005-02-12 14:37:55 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:53 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:52 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.1 1998/08/06 22:22:31 andy
+>># Changed the type used for getting XtNforeground from int to Pixel.
+>>#
+>># Revision 6.0 1998/03/02 05:28:56 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:25:30 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:20:50 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:15:57 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+void XtWMH3l_Proc(str)
+String str;
+{
+ avs_set_event(2,1);
+}
+
+void XtWMH3_Proc(str1, str2, str3, str4, str5, car)
+String str1, str2, str3, str4, *str5;
+Cardinal *car;
+{
+ avs_set_event(2,1);
+}
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+typedef struct _instance_variables {
+ long foreground;
+ String label;
+} instance_variable_rec;
+typedef struct _instance_variables2 {
+ long l1;
+ long l2;
+} instance_variable_rec2;
+static XtResource resources[] = {
+ {
+ XtNforeground,
+ XtCForeground,
+ XtRPixel, sizeof(Pixel),
+ XtOffsetOf(instance_variable_rec, foreground),
+ XtRString, "XtDefaultforeground"
+ },
+ {
+ XtNlabel,
+ XtCLabel,
+ XtRString, sizeof(String),
+ XtOffsetOf(instance_variable_rec, label),
+ XtRString, "XtDefaultLabel"
+ },
+};
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtVaSetSubvalues Xt11
+void
+XtVaSetSubvalues(base, resources, num_resources,...)
+>>ASSERTION Good A
+A call to
+void XtVaSetSubvalues(base, resources, num_resources,...)
+shall copy the resource value specified by the value field for the
+resource specified in the name field of each name/value pair in the
+varargs style variable argument list that is present in the
+resource list specified by
+.A resources
+to the structure pointed to by
+.A base.
+>>CODE
+instance_variable_rec base;
+Cardinal num_resources;
+Pixel pixel;
+char *string;
+Cardinal num_args;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tvastsvls1", "XtVaSetSubvalues");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Initialize the base address");
+ XtGetApplicationResources(topLevel, &base, resources, 2,
+ (ArgList) NULL,(Cardinal)0);
+ tet_infoline("PREP: Set subvalues");
+ XtVaSetSubvalues(&base, resources, 2, XtNforeground, 1,
+ XtNlabel, "Hello World", (char *)NULL);
+ tet_infoline("PREP: Get subvalues");
+ XtVaGetSubvalues(&base, resources, 2, XtNforeground, &pixel,
+ XtNlabel, &string, (char *)NULL);
+ tet_infoline("TEST: Retrieved subvalues");
+ check_dec(1, pixel , XtNforeground);
+ check_str("Hello World", string , XtNlabel);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A call to
+void XtVaSetSubvalues(base, resources, num_resources,...)
+when a resource specified in the variable argument list
+is not present in the resource list specified by
+.A resources
+shall not copy the resource value to the structure
+.A base.
+>>CODE
+instance_variable_rec2 base;
+Cardinal num_resources;
+Pixel pixel;
+char *string;
+Cardinal num_args;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tvastsvls1", "XtVaSetSubvalues");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Initialize the base address");
+ XtGetApplicationResources(topLevel, &base, resources, 2,
+ (ArgList) NULL,(Cardinal)0);
+ tet_infoline("PREP: Set subvalues");
+ base.l1 = (long)-1;
+ base.l2 = (long)-1;
+ XtVaSetSubvalues(&base, resources, 2, XtNforeground, 1,
+ "not real", 2, (char *)NULL);
+ tet_infoline("TEST: Only correct values are set");
+ check_dec(1, base.l1 , XtNforeground);
+ check_dec(-1, base.l2 , "missing long value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When the name XtVaTypedArg is specified in place of a resource name
+in the variable argument list a call to
+void XtVaSetSubvalues(base, resources, num_resources, ...)
+shall issue a warning message and ignore the entry.
+>>CODE
+instance_variable_rec base;
+Cardinal num_resources;
+Pixel pixel;
+int status;
+char *string;
+Cardinal num_args;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tvastsvls1", "XtVaSetSubvalues");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Set Warning Message Handler");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH3_Proc);
+ XtAppSetWarningHandler(app_ctext, XtWMH3l_Proc);
+ tet_infoline("PREP: Initialize the base address");
+ XtGetApplicationResources(topLevel, &base, resources, 2,
+ (ArgList) NULL,(Cardinal)0);
+ tet_infoline("PREP: Set subvalues");
+ XtVaSetSubvalues(&base, resources, 2, XtNforeground, 1,
+ XtVaTypedArg, "name", "type", (XtArgVal)1, 1, XtNlabel, "Hello World", (char *)NULL);
+ tet_infoline("PREP: Get subvalues");
+ XtVaGetSubvalues(&base, resources, 2, XtNforeground, &pixel,
+ XtNlabel, &string, (char *)NULL);
+ tet_infoline("TEST: Retrieved subvalues");
+ check_dec(1, pixel , XtNforeground);
+ check_str("Hello World", string , XtNlabel);
+ tet_infoline("TEST: Warning message was generated");
+ status = avs_get_event(2);
+ check_dec(1, status, "warning handler called");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+On a call to
+void XtVaSetSubvalues(base, resources, num_resources, ...)
+when the name XtVaNestedList is specified in place of a resource name
+in the variable argument list the next argument shall be interpreted
+as a value specifying another varargs style variable argument list
+which shall be logically inserted into the original list at the point
+of declaration.
+>>CODE
+instance_variable_rec base;
+Cardinal num_resources;
+Pixel pixel;
+char *string;
+Cardinal num_args;
+pid_t pid2;
+XtVarArgsList sublist;
+
+ FORK(pid2);
+ avs_xt_hier("Tvastsvls1", "XtVaSetSubvalues");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Initialize the base address");
+ XtGetApplicationResources(topLevel, &base, resources, 2,
+ (ArgList) NULL,(Cardinal)0);
+ tet_infoline("PREP: Create nested list");
+ sublist = XtVaCreateArgsList(NULL, XtNforeground, (XtArgVal)1, NULL);
+ tet_infoline("PREP: Set subvalues");
+ XtVaSetSubvalues(&base, resources, 2, XtVaNestedList, sublist,
+ XtNlabel, "Hello World", (char *)NULL, 0);
+ tet_infoline("PREP: Get subvalues");
+ XtVaGetSubvalues(&base, resources, 2, XtNforeground, &pixel,
+ XtNlabel, &string, (char *)NULL);
+ tet_infoline("TEST: Retrieved subvalues");
+ check_dec(1, pixel , XtNforeground);
+ check_str("Hello World", string , XtNlabel);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
diff --git a/xts5/Xt11/XtVaSetValues/XtVaSetValues.m b/xts5/Xt11/XtVaSetValues/XtVaSetValues.m
new file mode 100644
index 00000000..c216ba05
--- /dev/null
+++ b/xts5/Xt11/XtVaSetValues/XtVaSetValues.m
@@ -0,0 +1,1199 @@
+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/Xt11/XtVaSetValues/XtVaSetValues.m,v 1.1 2005-02-12 14:37:55 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/Xt11/XtVaSetValues/XtVaSetValues.m
+>>#
+>># Description:
+>># Tests for XtVaSetValues()
+>>#
+>># Modifications:
+>># $Log: tvastvals.m,v $
+>># Revision 1.1 2005-02-12 14:37:55 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:37:52 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 23:00:50 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:28:55 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.1 1998/02/24 02:03:28 andy
+>># Made test 13 conditional on coverage.
+>>#
+>># Revision 5.0 1998/01/26 03:25:29 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.2 1998/01/20 19:47:14 andy
+>># Added return statement to SetValuesHook procedures and changed
+>># compress exposure for squarew to XtExposeNoCompress.
+>>#
+>># Revision 4.0 1995/12/15 09:20:46 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 02:15:52 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+#include <xt/SquareCelP.h>
+#include <X11/Xaw/Form.h>
+#include <AvsForm.h>
+#include <AvsForm2.h>
+
+extern WidgetClass avsCompWidgetClass, avsWidgetClass;
+extern WidgetClass avsComp2WidgetClass;
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+/* procedure XtTMO_Proc */
+void XtTMO_Proc(client_data, id)
+XtPointer client_data;
+XtIntervalId *id;
+{
+ exit(0);
+}
+/*
+ * SquareCell.c - Square Widget
+ */
+#define INTERNAL_WIDTH 2
+#define INTERNAL_HEIGHT 4
+#define DEFAULT_PIXMAP_WIDTH 1 /* in cells */
+#define DEFAULT_PIXMAP_HEIGHT 1 /* in cells */
+#define DEFAULT_CELL_SIE 20 /* in pixels */
+/* values for instance variable is_drawn */
+#define DRAWN 1
+#define UNDRAWN 0
+/* modes for drawing */
+#define DRAW 1
+#define UNDRAW 0
+#define MAXLINES 10 /* max of horiz or vertical cells */
+#define SCROLLBARWIDTH 15
+#define DEFAULTWIDTH 300 /* widget size when show_all is False */
+#define offset(field) XtOffsetOf(SquareCellRec, field)
+static XtResource resources[] = {
+ {
+ XtNforeground,
+ XtCForeground,
+ XtRPixel,
+ sizeof(Pixel),
+ offset(squareCell.foreground),
+ XtRString,
+ XtDefaultForeground
+ },
+ {
+ XavsNtoggleCallback,
+ XavsCToggleCallback,
+ XtRCallback,
+ sizeof(XtPointer),
+ offset(squareCell.callback),
+ XtRCallback,
+ NULL
+ },
+ {
+ XavsNcellSizeInPixels,
+ XavsCCellSizeInPixels,
+ XtRInt, sizeof(int),
+ offset(squareCell.cell_size_in_pixels),
+ XtRImmediate,
+ (XtPointer)DEFAULT_CELL_SIE
+ },
+ {
+ XavsNpixmapWidthInCells,
+ XavsCPixmapWidthInCells,
+ XtRDimension,
+ sizeof(Dimension),
+ offset(squareCell.pixmap_width_in_cells),
+ XtRImmediate,
+ (XtPointer)DEFAULT_PIXMAP_WIDTH
+ },
+ {
+ XavsNpixmapHeightInCells,
+ XavsCPixmapHeightInCells,
+ XtRDimension,
+ sizeof(Dimension),
+ offset(squareCell.pixmap_height_in_cells),
+ XtRImmediate,
+ (XtPointer)DEFAULT_PIXMAP_HEIGHT
+ },
+ {
+ XavsNcurX,
+ XavsCCurX,
+ XtRInt,
+ sizeof(int),
+ offset(squareCell.cur_x),
+ XtRImmediate,
+ (XtPointer) 0
+ },
+ {
+ XavsNcurY,
+ XavsCCurY,
+ XtRInt,
+ sizeof(int),
+ offset(squareCell.cur_y),
+ XtRImmediate,
+ (XtPointer) 0
+ },
+ {
+ XavsNcellArray,
+ XavsCCellArray,
+ XtRString,
+ sizeof(String),
+ offset(squareCell.cell),
+ XtRImmediate,
+ (XtPointer) 0
+ },
+ {
+ XavsNshowEntireBitmap,
+ XavsCShowEntireBitmap,
+ XtRBoolean,
+ sizeof(Boolean),
+ offset(squareCell.show_all),
+ XtRImmediate,
+ (XtPointer) TRUE
+ },
+};
+/* Declaration of methods */
+static void Initialize();
+static void Redisplay();
+static void Destroy();
+static void Resize();
+static Boolean SetValues();
+static Boolean SetValuesHook();
+static XtGeometryResult QueryGeometry();
+/* these Core methods not needed by SquareCell:
+ *
+ * static void ClassInitialize();
+ * static void Realize();
+ */
+/* the following are private functions unique to SquareCell */
+static void DrawPixmaps(), DoCell(), ChangeCellSize();
+/* the following are actions of SquareCell */
+static void DrawCell(), UndrawCell(), ToggleCell();
+/* The following are public functions of SquareCell, declared extern
+ * in the public include file: */
+char *SquareCellGetArray();
+static char defaultTranslations[] =
+ "<Btn1Down>: DrawCell() \n\
+ <Btn2Down>: UndrawCell() \n\
+ <Btn3Down>: ToggleCell() \n\
+ <Btn1Motion>: DrawCell() \n\
+ <Btn2Motion>: UndrawCell() \n\
+ <Btn3Motion>: ToggleCell()";
+static XtActionsRec actions[] = {
+ {"DrawCell", DrawCell},
+ {"UndrawCell", UndrawCell},
+ {"ToggleCell", ToggleCell},
+};
+/* definition in SquareCell.h */
+static SquareCellPointInfo info;
+SquareCellClassRec squareCellClassRec = {
+ {
+ /* core_class fields */
+ /* superclass */ (WidgetClass) &coreClassRec,
+ /* class_name */ "SquareCell",
+ /* widget_size */ sizeof(SquareCellRec),
+ /* class_initialize */ NULL,
+ /* class_part_initialize */ NULL,
+ /* class_inited */ FALSE,
+ /* initialize */ Initialize,
+ /* initialize_hook */ NULL,
+ /* realize */ XtInheritRealize,
+ /* actions */ actions,
+ /* num_actions */ XtNumber(actions),
+ /* resources */ resources,
+ /* num_resources */ XtNumber(resources),
+ /* xrm_class */ NULLQUARK,
+ /* compress_motion */ TRUE,
+ /* compress_exposure */ XtExposeNoCompress,
+ /* compress_enterleave */ TRUE,
+ /* visible_interest */ FALSE,
+ /* destroy */ Destroy,
+ /* resize */ Resize,
+ /* expose */ Redisplay,
+ /* set_values */ SetValues,
+ /* set_values_hook */ SetValuesHook,
+ /* set_values_almost */ XtInheritSetValuesAlmost,
+ /* get_values_hook */ NULL,
+ /* accept_focus */ NULL,
+ /* version */ XtVersion,
+ /* callback_private */ NULL,
+ /* tm_table */ defaultTranslations,
+ /* query_geometry */ QueryGeometry,
+ /* display_accelerator */ XtInheritDisplayAccelerator,
+ /* extension */ NULL
+ },
+ {/* simple_class fields */
+ /* change_sensitive */ XtInheritChangeSensitive,
+ },
+ {
+ /* extension */ 0,
+ },
+};
+WidgetClass squareCellWidgetClass = (WidgetClass) & squareCellClassRec;
+static void
+GetDrawGC(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ XGCValues values;
+ XtGCMask mask = GCForeground | GCBackground | GCDashOffset |
+ GCDashList | GCLineStyle;
+ /*
+ * Setting foreground and background to 1 and 0 looks like a
+ * kludge but isn't. This GC is used for drawing
+ * into a pixmap of depth one. Real colors are applied with a
+ * separate GC when the pixmap is copied into the window.
+ */
+ values.foreground = 1;
+ values.background = 0;
+ values.dashes = 1;
+ values.dash_offset = 0;
+ values.line_style = LineOnOffDash;
+ cw->squareCell.draw_gc = XCreateGC(XtDisplay((Widget)cw),
+ cw->squareCell.big_picture, mask, &values);
+}
+static void
+GetUndrawGC(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ XGCValues values;
+ XtGCMask mask = GCForeground | GCBackground;
+ /* this looks like a kludge but isn't. This GC is used for drawing
+ * into a pixmap of depth one. Real colors are applied as the
+ * pixmap is copied into the window.
+ */
+ values.foreground = 0;
+ values.background = 1;
+ cw->squareCell.undraw_gc = XCreateGC(XtDisplay((Widget)cw),
+ cw->squareCell.big_picture, mask, &values);
+}
+static void
+GetCopyGC(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ XGCValues values;
+ XtGCMask mask = GCForeground | GCBackground;
+ values.foreground = cw->squareCell.foreground;
+ values.background = cw->core.background_pixel;
+ cw->squareCell.copy_gc = XtGetGC((Widget)cw, mask, &values);
+}
+static void
+Initialize(treq, tnew, args, num_args)
+Widget treq, tnew;
+ArgList args;
+Cardinal *num_args;
+{
+ SquareCellWidget new = (SquareCellWidget) tnew;
+ new->squareCell.cur_x = 0;
+ new->squareCell.cur_y = 0;
+ /*
+ * Check instance values set by resources that may be invalid.
+ */
+ if ((new->squareCell.pixmap_width_in_cells < 1) ||
+ (new->squareCell.pixmap_height_in_cells < 1)) {
+ XtWarning("SquareCell: pixmapWidth and/or pixmapHeight is too small (using 10 x 10).");
+ new->squareCell.pixmap_width_in_cells = 10;
+ new->squareCell.pixmap_height_in_cells = 10;
+ }
+ if (new->squareCell.cell_size_in_pixels < 5) {
+ XtWarning("SquareCell: cellSize is too small (using 5).");
+ new->squareCell.cell_size_in_pixels = 5;
+ }
+ if ((new->squareCell.cur_x < 0) || (new->squareCell.cur_y < 0)) {
+ XtWarning("SquareCell: cur_x and cur_y must be non-negative (using 0, 0).");
+ new->squareCell.cur_x = 0;
+ new->squareCell.cur_y = 0;
+ }
+ if (new->squareCell.cell == NULL)
+ new->squareCell.cell = XtCalloc(
+ new->squareCell.pixmap_width_in_cells *
+ new->squareCell.pixmap_height_in_cells, sizeof(char));
+ else
+ new->squareCell.user_allocated = True; /* user supplied cell array */
+ new->squareCell.pixmap_width_in_pixels =
+ new->squareCell.pixmap_width_in_cells *
+ new->squareCell.cell_size_in_pixels;
+ new->squareCell.pixmap_height_in_pixels =
+ new->squareCell.pixmap_height_in_cells *
+ new->squareCell.cell_size_in_pixels;
+ if (new->core.width == 0) {
+ if (new->squareCell.show_all == False)
+ new->core.width = (new->squareCell.pixmap_width_in_pixels
+ > DEFAULTWIDTH) ? DEFAULTWIDTH :
+ (new->squareCell.pixmap_width_in_pixels);
+ else
+ new->core.width = new->squareCell.pixmap_width_in_pixels;
+ }
+ if (new->core.height == 0) {
+ if (new->squareCell.show_all == False)
+ new->core.height =
+ (new->squareCell.pixmap_height_in_pixels >
+ DEFAULTWIDTH) ? DEFAULTWIDTH :
+ (new->squareCell.pixmap_height_in_pixels);
+ else
+ new->core.height = new->squareCell.pixmap_height_in_pixels;
+ }
+ CreateBigPixmap(new);
+ GetDrawGC(new);
+ GetUndrawGC(new);
+ GetCopyGC(new);
+ DrawIntoBigPixmap(new);
+}
+static void
+Redisplay(w, event)
+Widget w;
+XExposeEvent *event;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ register int x, y;
+ unsigned int width, height;
+
+ avs_set_event(6, avs_get_event(6)+1);
+ if (!XtIsRealized((Widget)cw))
+ return;
+ if (event) { /* called from btn-event or expose */
+ x = event->x;
+ y = event->y;
+ width = event->width;
+ height = event->height;
+ }
+ else { /* called because complete redraw */
+ x = 0;
+ y = 0;
+ width = cw->squareCell.pixmap_width_in_pixels;
+ height = cw->squareCell.pixmap_height_in_pixels;
+ }
+ if (DefaultDepthOfScreen(XtScreen((Widget)cw)) == 1)
+ XCopyArea(XtDisplay((Widget)cw), cw->squareCell.big_picture,
+ XtWindow((Widget)cw), cw->squareCell.copy_gc, x +
+ cw->squareCell.cur_x, y + cw->squareCell.cur_y,
+ width, height, x, y);
+ else
+ XCopyPlane(XtDisplay((Widget)cw), cw->squareCell.big_picture,
+ XtWindow((Widget)cw), cw->squareCell.copy_gc, x +
+ cw->squareCell.cur_x, y + cw->squareCell.cur_y,
+ width, height, x, y, 1);
+}
+static Boolean
+SetValuesHook(w, args, num_args)
+Widget w;
+ArgList args;
+Cardinal *num_args;
+{
+ avs_set_event(2,avs_get_event(1)+1);
+ return TRUE;
+}
+
+
+static Boolean
+SetValues(current, request, new, args, num_args)
+Widget current, request, new;
+ArgList args;
+Cardinal *num_args;
+{
+ SquareCellWidget curcw = (SquareCellWidget) current;
+ SquareCellWidget newcw = (SquareCellWidget) new;
+ Boolean do_redisplay = False;
+ /*
+ ** XtSetValues invoked procedure SetValues
+ */
+ avs_set_event(1,avs_get_event(2)+1);
+ if (curcw->squareCell.foreground != newcw->squareCell.foreground) {
+ XtReleaseGC((Widget)curcw, curcw->squareCell.copy_gc);
+ GetCopyGC(newcw);
+ do_redisplay = True;
+ }
+ if ((curcw->squareCell.cur_x != newcw->squareCell.cur_x) ||
+ (curcw->squareCell.cur_y != newcw->squareCell.cur_y))
+ do_redisplay = True;
+ if (curcw->squareCell.cell_size_in_pixels !=
+ newcw->squareCell.cell_size_in_pixels) {
+ ChangeCellSize(curcw, newcw->squareCell.cell_size_in_pixels);
+ do_redisplay = True;
+ }
+ if (curcw->squareCell.pixmap_width_in_cells !=
+ newcw->squareCell.pixmap_width_in_cells) {
+ newcw->squareCell.pixmap_width_in_cells =
+ curcw->squareCell.pixmap_width_in_cells;
+ }
+ if (curcw->squareCell.pixmap_height_in_cells !=
+ newcw->squareCell.pixmap_height_in_cells) {
+ newcw->squareCell.pixmap_height_in_cells =
+ curcw->squareCell.pixmap_height_in_cells;
+ }
+ /*force true for test 13*/
+ return TRUE;
+}
+static void
+Destroy(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ if (cw->squareCell.big_picture)
+ XFreePixmap(XtDisplay((Widget)cw), cw->squareCell.big_picture);
+ if (cw->squareCell.draw_gc)
+ XFreeGC(XtDisplay((Widget)cw), cw->squareCell.draw_gc);
+ if (cw->squareCell.undraw_gc)
+ XFreeGC(XtDisplay((Widget)cw), cw->squareCell.undraw_gc);
+ if (cw->squareCell.copy_gc)
+ XFreeGC(XtDisplay((Widget)cw), cw->squareCell.copy_gc);
+ /* Free memory allocated with Calloc. This was done
+ * only if application didn't supply cell array.
+ */
+ if (!cw->squareCell.user_allocated)
+ XtFree(cw->squareCell.cell);
+}
+static void
+DrawCell(w, event)
+Widget w;
+XEvent *event;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ DrawPixmaps(cw->squareCell.draw_gc, DRAW, cw, event);
+}
+static void
+UndrawCell(w, event)
+Widget w;
+XEvent *event;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ DrawPixmaps(cw->squareCell.undraw_gc, UNDRAW, cw, event);
+}
+static void
+ToggleCell(w, event)
+Widget w;
+XEvent *event;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ static int oldx = -1, oldy = -1;
+ GC gc;
+ int mode;
+ int newx, newy;
+ /* This is strictly correct, but doesn't
+ * seem to be necessary */
+ if (event->type == ButtonPress) {
+ newx = (cw->squareCell.cur_x + ((XButtonEvent *)event)->x) /
+ cw->squareCell.cell_size_in_pixels;
+ newy = (cw->squareCell.cur_y + ((XButtonEvent *)event)->y) /
+ cw->squareCell.cell_size_in_pixels;
+ }
+ else {
+ newx = (cw->squareCell.cur_x + ((XMotionEvent *)event)->x) /
+ cw->squareCell.cell_size_in_pixels;
+ newy = (cw->squareCell.cur_y + ((XMotionEvent *)event)->y) /
+ cw->squareCell.cell_size_in_pixels;
+ }
+ if ((mode = cw->squareCell.cell[newx + newy * cw->squareCell.pixmap_width_in_cells]) == DRAWN) {
+ gc = cw->squareCell.undraw_gc;
+ mode = UNDRAW;
+ }
+ else {
+ gc = cw->squareCell.draw_gc;
+ mode = DRAW;
+ }
+ if (oldx != newx || oldy != newy) {
+ oldx = newx;
+ oldy = newy;
+ DrawPixmaps(gc, mode, cw, event);
+ }
+}
+static void
+DrawPixmaps(gc, mode, w, event)
+GC gc;
+int mode;
+Widget w;
+XButtonEvent *event;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ int newx = (cw->squareCell.cur_x + event->x) /
+ cw->squareCell.cell_size_in_pixels;
+ int newy = (cw->squareCell.cur_y + event->y) /
+ cw->squareCell.cell_size_in_pixels;
+ XExposeEvent fake_event;
+ /* if already done, return */
+ if (cw->squareCell.cell[newx + newy * cw->squareCell.pixmap_width_in_cells] == mode)
+ return;
+ /* otherwise, draw or undraw */
+ XFillRectangle(XtDisplay((Widget)cw), cw->squareCell.big_picture, gc,
+ cw->squareCell.cell_size_in_pixels*newx + 2,
+ cw->squareCell.cell_size_in_pixels*newy + 2,
+ (unsigned int)cw->squareCell.cell_size_in_pixels - 3,
+ (unsigned int)cw->squareCell.cell_size_in_pixels - 3);
+ cw->squareCell.cell[newx + newy * cw->squareCell.pixmap_width_in_cells] = mode;
+ info.mode = mode;
+ info.newx = newx;
+ info.newy = newy;
+ fake_event.x = cw->squareCell.cell_size_in_pixels * newx - cw->squareCell.cur_x;
+ fake_event.y = cw->squareCell.cell_size_in_pixels * newy - cw->squareCell.cur_y;
+ fake_event.width = cw->squareCell.cell_size_in_pixels;
+ fake_event.height = cw->squareCell.cell_size_in_pixels;
+ Redisplay(cw, &fake_event);
+ XtCallCallbacks((Widget)cw, XavsNtoggleCallback, &info);
+}
+CreateBigPixmap(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ /* always a 1 bit deep pixmap, regardless of screen depth */
+ cw->squareCell.big_picture = XCreatePixmap(XtDisplay((Widget)cw),
+ RootWindow(XtDisplay((Widget)cw), DefaultScreen(XtDisplay((Widget)cw))),
+ cw->squareCell.pixmap_width_in_pixels + 2,
+ cw->squareCell.pixmap_height_in_pixels + 2, 1);
+}
+DrawIntoBigPixmap(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ int n_horiz_segments, n_vert_segments;
+ XSegment segment[MAXLINES];
+ register int x, y;
+ XFillRectangle(XtDisplay((Widget)cw), cw->squareCell.big_picture,
+ cw->squareCell.undraw_gc, 0, 0,
+ cw->squareCell.pixmap_width_in_pixels
+ + 2, cw->squareCell.pixmap_height_in_pixels + 2);
+ n_horiz_segments = cw->squareCell.pixmap_height_in_cells + 1;
+ n_vert_segments = cw->squareCell.pixmap_width_in_cells + 1;
+ for (x = 0; x < n_horiz_segments; x++) {
+ segment[x].x1 = 0;
+ segment[x].x2 = (short) cw->squareCell.pixmap_width_in_pixels;
+ segment[x].y1 = (short) cw->squareCell.cell_size_in_pixels * x;
+ segment[x].y2 = (short) cw->squareCell.cell_size_in_pixels * x;
+ }
+ XDrawSegments(XtDisplay((Widget)cw), cw->squareCell.big_picture, cw->squareCell.draw_gc, segment, n_horiz_segments);
+ for (y = 0; y < n_vert_segments; y++) {
+ segment[y].x1 = (short) y * cw->squareCell.cell_size_in_pixels;
+ segment[y].x2 = (short) y * cw->squareCell.cell_size_in_pixels;
+ segment[y].y1 = 0;
+ segment[y].y2 = (short) cw->squareCell.pixmap_height_in_pixels;
+ }
+ XDrawSegments(XtDisplay((Widget)cw), cw->squareCell.big_picture, cw->squareCell.draw_gc, segment, n_vert_segments);
+ /* draw current cell array into pixmap */
+ for (x = 0; x < cw->squareCell.pixmap_width_in_cells; x++) {
+ for (y = 0; y < cw->squareCell.pixmap_height_in_cells; y++) {
+ if (cw->squareCell.cell[x + (y * cw->squareCell.pixmap_width_in_cells)] == DRAWN)
+ DoCell(cw, x, y, cw->squareCell.draw_gc);
+ else
+ DoCell(cw, x, y, cw->squareCell.undraw_gc);
+ }
+ }
+}
+/* A Public function, not static */
+char *
+SquareCellGetArray(w, width_in_cells, height_in_cells)
+Widget w;
+int *width_in_cells, *height_in_cells;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ *width_in_cells = cw->squareCell.pixmap_width_in_cells;
+ *height_in_cells = cw->squareCell.pixmap_height_in_cells;
+ return (cw->squareCell.cell);
+}
+static void
+Resize(w)
+Widget w;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ /* resize does nothing unless new size is bigger than entire pixmap */
+ if ((cw->core.width > cw->squareCell.pixmap_width_in_pixels) &&
+ (cw->core.height > cw->squareCell.pixmap_height_in_pixels)) {
+ /*
+ * Calculate the maximum cell size that will allow the
+ * entire bitmap to be displayed.
+ */
+ Dimension w_temp_cell_size_in_pixels, h_temp_cell_size_in_pixels;
+ Dimension new_cell_size_in_pixels;
+
+ w_temp_cell_size_in_pixels = cw->core.width / cw->squareCell.pixmap_width_in_cells;
+ h_temp_cell_size_in_pixels = cw->core.height / cw->squareCell.pixmap_height_in_cells;
+
+ if (w_temp_cell_size_in_pixels < h_temp_cell_size_in_pixels)
+ new_cell_size_in_pixels = w_temp_cell_size_in_pixels;
+ else
+ new_cell_size_in_pixels = h_temp_cell_size_in_pixels;
+
+ /* if size change mandates a new pixmap, make one */
+ if (new_cell_size_in_pixels != cw->squareCell.cell_size_in_pixels)
+ ChangeCellSize(cw, new_cell_size_in_pixels);
+ }
+}
+static void
+ChangeCellSize(w, new_cell_size)
+Widget w;
+int new_cell_size;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ int x, y;
+ cw->squareCell.cell_size_in_pixels = new_cell_size;
+ /* recalculate variables based on cell size */
+ cw->squareCell.pixmap_width_in_pixels =
+ cw->squareCell.pixmap_width_in_cells *
+ cw->squareCell.cell_size_in_pixels;
+ cw->squareCell.pixmap_height_in_pixels =
+ cw->squareCell.pixmap_height_in_cells *
+ cw->squareCell.cell_size_in_pixels;
+
+ /* destroy old and create new pixmap of correct size */
+ XFreePixmap(XtDisplay((Widget)cw), cw->squareCell.big_picture);
+ CreateBigPixmap(cw);
+
+ /* draw lines into new pixmap */
+ DrawIntoBigPixmap(cw);
+
+ /* draw current cell array into pixmap */
+ for (x = 0; x < cw->squareCell.pixmap_width_in_cells; x++) {
+ for (y = 0; y < cw->squareCell.pixmap_height_in_cells; y++) {
+ if (cw->squareCell.cell[x + (y * cw->squareCell.pixmap_width_in_cells)] == DRAWN)
+ DoCell(cw, x, y, cw->squareCell.draw_gc);
+ else
+ DoCell(cw, x, y, cw->squareCell.undraw_gc);
+ }
+ }
+}
+static void
+DoCell(w, x, y, gc)
+Widget w;
+int x, y;
+GC gc;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ /* otherwise, draw or undraw */
+ XFillRectangle(XtDisplay((Widget)cw), cw->squareCell.big_picture, gc,
+ cw->squareCell.cell_size_in_pixels * x + 2,
+ cw->squareCell.cell_size_in_pixels * y + 2,
+ (unsigned int)cw->squareCell.cell_size_in_pixels - 3,
+ (unsigned int)cw->squareCell.cell_size_in_pixels - 3);
+}
+static XtGeometryResult QueryGeometry(w, proposed, answer)
+Widget w;
+XtWidgetGeometry *proposed, *answer;
+{
+ SquareCellWidget cw = (SquareCellWidget) w;
+ /* set fields we care about */
+ answer->request_mode = CWWidth | CWHeight;
+ /* initial width and height */
+ if (cw->squareCell.show_all == True)
+ answer->width = cw->squareCell.pixmap_width_in_pixels;
+ else
+ answer->width = (cw->squareCell.pixmap_width_in_pixels >
+ DEFAULTWIDTH) ? DEFAULTWIDTH :
+ cw->squareCell.pixmap_width_in_pixels;
+ if (cw->squareCell.show_all == True)
+ answer->height = cw->squareCell.pixmap_height_in_pixels;
+ else
+ answer->height = (cw->squareCell.pixmap_height_in_pixels >
+ DEFAULTWIDTH) ? DEFAULTWIDTH :
+ cw->squareCell.pixmap_height_in_pixels;
+ if ( ((proposed->request_mode & (CWWidth | CWHeight))
+ == (CWWidth | CWHeight)) &&
+ proposed->width == answer->width &&
+ proposed->height == answer->height)
+ return XtGeometryYes;
+ else if (answer->width == cw->core.width &&
+ answer->height == cw->core.height)
+ return XtGeometryNo;
+ else
+ return XtGeometryAlmost;
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtVaSetValues Xt11
+void
+XtVaSetValues(object, ...)
+>>ASSERTION Good A
+A successful call to
+void XtVaSetValues(object, ...)
+shall set the resource value in the instance structure of the
+widget
+.A object
+for the resource specified in the name field of each name/value pair
+of the varargs style variable argument list to the value at
+the location specified by the corresponding value field.
+>>CODE
+Widget squarew;
+int cur_x , cur_y;
+int invoked = 0;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tvastvals1", "XtVaSetValues");
+ tet_infoline("PREP: Create Square Cell widget");
+ squarew = XtVaCreateManagedWidget("squarew",
+ squareCellWidgetClass, boxw1, (char *)NULL);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Set resource values");
+ XtVaSetValues(squarew, XavsNcurX, 2, XavsNcurY, 2 , (char *)NULL);
+ tet_infoline("PREP: Get resource values");
+ XtVaGetValues(squarew,
+ XavsNcurX, &cur_x, XavsNcurY, &cur_y, (char *)NULL);
+ tet_infoline("TEST: Resource values");
+ check_dec(2, cur_x, "XavsNcurX");
+ check_dec(2, cur_y, "XavsNcurY");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When the class of the specified widget's parent
+is a subclass of constraintWidgetClass
+a call to
+void XtVaSetValues(object, ...)
+shall set the resource values in the widget instance for any
+constraint resources specified in the argument list.
+>>CODE
+Widget pushb_good, formw_good;
+Arg getargs[1];
+Boolean resizable;
+int invoked = 0;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tvastvals4", "XtVaSetValues");
+ tet_infoline("PREP: Create formw_good widget subclass of constraint");
+ tet_infoline("PREP: widgetclass in boxw1 widget");
+ formw_good = (Widget) CreateFormWidget(boxw1);
+ tet_infoline("PREP: Create pushb_good gadget");
+ pushb_good = (Widget)CreatePushButtonGadget("Hello", formw_good);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Set constraint resource values for pushb_good widget");
+ XtVaSetValues(pushb_good, XtNresizable, TRUE, (char *)NULL);
+ tet_infoline("PREP: Get constraint resource values");
+ XtVaGetValues(pushb_good, XtNresizable, &resizable, (char *)NULL);
+ tet_infoline("TEST: Constraint resource values");
+ check_dec(TRUE, resizable, "TRUE");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+void XtVaSetValues(object, ...)
+shall call the set_values procedures for
+.A object
+in a superclass-to-subclass order.
+>>CODE
+Widget squarew;
+int cur_x , cur_y;
+int invoked = 0;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tvastvals1", "XtVaSetValues");
+ tet_infoline("PREP: Create Square Cell widget");
+ squarew = XtVaCreateManagedWidget("squarew",
+ squareCellWidgetClass, boxw1, (char *)NULL);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Set resource values");
+ XtVaSetValues(squarew, XavsNcurX, 2, XavsNcurY, 2 , (char *)NULL);
+ tet_infoline("PREP: Get resource values");
+ XtVaGetValues(squarew,
+ XavsNcurX, &cur_x, XavsNcurY, &cur_y, (char *)NULL);
+ tet_infoline("TEST: Resource values");
+ check_dec(2, cur_x, "XavsNcurX");
+ check_dec(2, cur_y, "XavsNcurY");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: Set_values procedure SetValues was invoked");
+ invoked = avs_get_event(1);
+ if (!invoked) {
+ sprintf(ebuf, "ERROR: The procedure SetValues was not invoked");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+void XtVaSetValues(object, ...)
+when a set_values_hook field for
+.A object
+is non-NULL shall call the procedures specified by that field
+immediately after the call to the corresponding set_values
+procedure.
+>>CODE
+Widget squarew;
+int cur_x , cur_y;
+int invoked = 0;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tvastvals1", "XtVaSetValues");
+ tet_infoline("PREP: Create Square Cell widget");
+ squarew = XtVaCreateManagedWidget("squarew",
+ squareCellWidgetClass, boxw1, (char *)NULL);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Set resource values");
+ XtVaSetValues(squarew, XavsNcurX, 2, XavsNcurY, 2 , (char *)NULL);
+ tet_infoline("PREP: Get resource values");
+ XtVaGetValues(squarew,
+ XavsNcurX, &cur_x, XavsNcurY, &cur_y, (char *)NULL);
+ tet_infoline("TEST: Resource values");
+ check_dec(2, cur_x, "XavsNcurX");
+ check_dec(2, cur_y, "XavsNcurY");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: set_values procedure was invoked first");
+ invoked = avs_get_event(1);
+ if (invoked != 1) {
+ sprintf(ebuf, "ERROR: Expected procedure invocation to be #1, is #%d", invoked);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: set_values_hook procedure was invoked second");
+ invoked = avs_get_event(2);
+ if (invoked != 2) {
+ sprintf(ebuf, "ERROR: Expected procedure invocation to be #2, is #%d", invoked);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When the class of the specified widget's parent
+is a subclass of constraintWidgetClass
+a call to
+void XtVaSetValues(object, ...)
+shall call the constraint set_values procedures from
+constraintWidgetClass on down to the parent's class, passing
+to them the specified widget as an argument.
+>>CODE
+Arg setargs[2];
+int cur_x, cur_y;
+int invoked = 0;
+pid_t pid2;
+Widget formw_good , labelw_good, formw_good2;
+
+ FORK(pid2);
+ avs_xt_hier("Tstvalues1", "XtSetValues");
+ tet_infoline("PREP: Create avsform widget in boxw1 widget");
+ formw_good = XtCreateManagedWidget("avsform",
+ avsformWidgetClass,
+ boxw1,
+ NULL,
+ 0);
+ tet_infoline("PREP: Create avsform2 widget in avsform widget");
+ formw_good2 = XtCreateManagedWidget("avsform2",
+ avsform2WidgetClass,
+ formw_good,
+ NULL,
+ 0);
+ labelw_good = (Widget) CreateLabelWidget("Hello", formw_good2);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Set constraint resource values for pushb_good widget");
+ XtVaSetValues(labelw_good, XtNresizable, TRUE, (char *)NULL);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: set_values procedure two levels up was invoked first");
+ invoked = avs_get_event(4);
+ if (invoked != 1) {
+ sprintf(ebuf, "ERROR: Expected procedure invocation to be #1, is #%d", invoked);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: set_values procedure of parent was invoked second");
+ invoked = avs_get_event(3);
+ if (invoked != 2) {
+ sprintf(ebuf, "ERROR: Expected procedure invocation to be #2, is #%d", invoked);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_result(TET_PASS);
+>>ASSERTION Good B 0
+A call to
+void XtVaSetValues(object, ...)
+when
+.A object
+is of a subclass of RectObj and any of the resource values updated
+in the widget instance require a geometry request shall restore
+the original geometry values for the widget and call the geometry
+manager specified for the widget.
+>>ASSERTION Good A
+A call to
+void XtVaSetValues(object, ...)
+when
+.A object
+is of a subclass of RectObj, any of the resource values updated
+in the widget instance require a geometry request, and the geometry
+manager specified for the widget returns XtGeometryYes shall call
+the resize procedure of the specified widget.
+>>CODE
+Widget cooperative_composite, cooperative_widget;
+XtWidgetGeometry geom;
+int new_width, new_height;
+int invoked = 0;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tvastvals2", "XtVaSetValues");
+ tet_infoline("PREP: Create cooperative composite widget");
+ cooperative_composite = XtVaCreateManagedWidget("cooperative_composite", avsCompWidgetClass, boxw1, NULL);
+ tet_infoline("PREP: Create cooperative widget");
+ cooperative_widget = XtVaCreateManagedWidget("cooperative_widget", avsWidgetClass, cooperative_composite, NULL);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Set resource values");
+ XtVaSetValues(cooperative_widget, XtNwidth, 40 , XtNheight, 40, (char *)NULL);
+ tet_infoline("PREP: Request geometry of cooperative_widget widget");
+ XtQueryGeometry(cooperative_widget, NULL, &geom);
+ tet_infoline("TEST: Cooperative_widget widget is resized");
+ check_dec(40, geom.width, "width");
+ check_dec(40, geom.height, "height");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good B 0
+On a call to
+void XtVaSetValues(object, ...)
+when
+.A object
+is of a subclass of RectObj, any of the resource values updated
+in the widget instance require a geometry request, and the geometry
+manager specified for the widget returns XtGeometryDone the geometry
+fields for the widget instance shall hold the new values.
+>>ASSERTION Good A
+On a call to
+void XtVaSetValues(object, ...)
+when
+.A object
+is of a subclass of RectObj, any of the resource values updated
+in the widget instance require a geometry request, and the geometry
+manager specified for the widget returns XtGeometryNo the
+geometry fields for the widget instance shall hold the original
+values.
+>>CODE
+Widget squarew;
+Dimension cell_width , cell_height;
+int invoked = 0;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tvastvals3", "XtVaSetValues");
+ tet_infoline("PREP: Create Square Cell widget");
+ squarew = XtVaCreateManagedWidget("squarew",
+ squareCellWidgetClass, boxw1, (char *)NULL);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Set resource values return XtGeometryNo");
+ XtVaSetValues(squarew, XtNwidth, -1,
+ XtNheight, -1,(char *)NULL);
+ tet_infoline("PREP: Get resource values");
+ XtVaGetValues(squarew,
+ XavsNpixmapWidthInCells,
+ &cell_width,
+ XavsNpixmapHeightInCells,
+ &cell_height,
+ (char *)NULL);
+ tet_infoline("TEST: Original values returned");
+ check_dec(DEFAULT_PIXMAP_WIDTH, cell_width,
+ "XavsNpixmapWidthInCells");
+ check_dec(DEFAULT_PIXMAP_HEIGHT, cell_height,
+ "XavsNpixmapHeightInCells");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A call to
+void XtVaSetValues(object, ...)
+when
+.A object
+is of a subclass of RectObj, any of the resource values updated
+in the widget instance require a geometry request, and the geometry
+manager specified for the widget returns XtGeometryAlmost shall call
+the set_values_almost procedure of the specified widget.
+>>CODE
+Widget cooperative_composite, cooperative_widget;
+Arg setargs[2];
+Dimension new_width, new_height;
+int invoked = 0;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tvastvals5", "XtVaSetValues");
+ tet_infoline("PREP: Create cooperative composite widget");
+ cooperative_composite = XtVaCreateManagedWidget("cooperative_composite", avsComp2WidgetClass, boxw1, NULL);
+ tet_infoline("PREP: Create cooperative widget");
+ cooperative_widget = XtVaCreateManagedWidget("cooperative_widget", avsWidgetClass, cooperative_composite, NULL);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Set resource values");
+ XtVaSetValues(cooperative_widget, XtNwidth, 10, XtNheight, 10 , (char *)NULL);
+ invoked = avs_get_event(4);
+ tet_infoline("TEST: Geometry manager called");
+ check_dec(1, invoked, "geometry manager invocations count");
+ invoked = avs_get_event(3);
+ tet_infoline("TEST: Set_values_almost procedure called");
+ check_dec(1, invoked, "set_values_almost invocations count");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good B 0
+A call to
+void XtVaSetValues(object, ...)
+when
+.A object
+is of a subclass of RectObj, any of the resource values updated
+in the widget instance require a geometry request, the geometry
+manager specified for the widget returns XtGeometryAlmost, and the
+call to the set_values_almost procedure of the specified widget
+does not request for an alternate geometry shall call the resize
+procedure of the widget.
+>>ASSERTION Good B 0
+A call to
+void XtVaSetValues(object, ...)
+when
+.A object
+is of a subclass of RectObj, any of the resource values updated
+in the widget instance require a geometry request, the geometry
+manager specified for the widget returns XtGeometryAlmost, and the
+call to the set_values_almost procedure of the specified widget
+requests for an alternate geometry shall again call the geometry
+manager of the widget for the newly requested geometry values.
+>>ASSERTION Good A
+A call to
+void XtVaSetValues(object, ...)
+when
+.A object
+is realized and a set_values procedure for the widget
+returns True shall cause the widget's expose procedure to be
+invoked.
+>>CODE
+Widget squarew;
+Arg setargs[2];
+int cur_x, cur_y;
+int invoked = 0;
+pid_t pid2, pid3;
+
+/*this test is in the process of review vis consistency of the spec,
+test suite, and sample code*/
+if (config.coverage == 0) {
+ FORK(pid2);
+ avs_xt_hier("Tstvalues1", "XtSetValues");
+ tet_infoline("PREP: Create Square Cell widget");
+ squarew = XtVaCreateManagedWidget("squarew",
+ squareCellWidgetClass, boxw1, NULL);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Set resource values");
+ XtVaGetValues(squarew,
+ XavsNcurX, &cur_x, XavsNcurY, &cur_y, (char *)NULL);
+ setargs[0].name = XavsNcurX;
+ setargs[0].value = (XtArgVal) cur_x+5;
+ setargs[1].name = XavsNcurY;
+ setargs[1].value = (XtArgVal) cur_y+5;
+ XtVaSetValues(squarew, XavsNcurX, (XtArgVal) cur_x+5, XavsNcurY, (XtArgVal) cur_y+5 , (char *)NULL);
+ tet_infoline("PREP: Get resource values");
+ XtVaGetValues(squarew,
+ XavsNcurX, &cur_x, XavsNcurY, &cur_y, (char *)NULL);
+ tet_infoline("TEST: Resource values");
+ check_dec(5, cur_x, "XavsNcurX");
+ check_dec(5, cur_y, "XavsNcurY");
+ XtAppAddTimeOut(app_ctext, AVSXTLOOPTIMEOUT, XtTMO_Proc, topLevel);
+ XtAppMainLoop(app_ctext);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_infoline("TEST: set_values procedure was invoked");
+ invoked = avs_get_event(1);
+ if (!invoked) {
+ sprintf(ebuf, "ERROR: Procedure was not invoked");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: expose procedure was invoked");
+ invoked = avs_get_event(6);
+ if (invoked < 2) {
+ sprintf(ebuf, "ERROR: Procedure was invoked %d times, expected at least 2", invoked);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_result(TET_PASS);
+}
+else {
+ tet_result(TET_UNTESTED);
+}
+>>ASSERTION Good A
+On a call to
+void XtVaSetValues(object, ...)
+when the name XtVaTypedArg is specified in place of a resource name
+in the variable argument list it shall interpret the four arguments
+following this argument as a name/type/value/size tuple.
+>>CODE
+Widget squarew;
+int cur_x , cur_y;
+int invoked = 0;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tvastvals1", "XtVaSetValues");
+ tet_infoline("PREP: Create Square Cell widget");
+ squarew = XtVaCreateManagedWidget("squarew",
+ squareCellWidgetClass, boxw1, (char *)NULL);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Set resource values");
+ XtVaSetValues(squarew, XavsNcurX, 2, XtVaTypedArg, XavsNcurY, XtRInt, 2 , sizeof(XtRInt), (char *)NULL);
+ tet_infoline("PREP: Get resource values");
+ XtVaGetValues(squarew,
+ XavsNcurX, &cur_x, XavsNcurY, &cur_y, (char *)NULL);
+ tet_infoline("TEST: Resource values");
+ check_dec(2, cur_x, "XavsNcurX");
+ check_dec(2, cur_y, "XavsNcurY");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+On a call to
+void XtVaSetValues(object, ...)
+when the name XtVaNestedList is specified in place of a resource name
+in the variable argument list it shall interpret the next argument
+as a value specifying another varargs style variable argument list and
+logically insert it in the original list at the point of declaration.
+>>CODE
+Widget squarew;
+int cur_x , cur_y;
+int invoked = 0;
+pid_t pid2;
+XtVarArgsList sublist;
+
+ FORK(pid2);
+ avs_xt_hier("Tvastvals1", "XtVaSetValues");
+ tet_infoline("PREP: Create Square Cell widget");
+ squarew = XtVaCreateManagedWidget("squarew",
+ squareCellWidgetClass, boxw1, (char *)NULL);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Create nested list");
+ sublist = XtVaCreateArgsList(NULL, XavsNcurX, 2, NULL);
+ tet_infoline("TEST: Set resource values");
+ XtVaSetValues(squarew, XtVaNestedList, sublist, XavsNcurY, 2 , (char *)NULL);
+ tet_infoline("PREP: Get resource values");
+ XtVaGetValues(squarew,
+ XavsNcurX, &cur_x, XavsNcurY, &cur_y, (char *)NULL);
+ tet_infoline("TEST: Resource values");
+ check_dec(2, cur_x, "XavsNcurX");
+ check_dec(2, cur_y, "XavsNcurY");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);