summaryrefslogtreecommitdiff
path: root/xts5/Xt4
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/Xt4
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/Xt4')
-rw-r--r--xts5/Xt4/XtAppCreateShell/XtAppCreateShell.m293
-rw-r--r--xts5/Xt4/XtAppInitialize/XtAppInitialize.m939
-rw-r--r--xts5/Xt4/XtAppSetFallbackResources/XtAppSetFallbackResources.m151
-rw-r--r--xts5/Xt4/XtCloseDisplay/XtCloseDisplay.m185
-rw-r--r--xts5/Xt4/XtCreateApplicationContext/XtCreateApplicationContext.m85
-rw-r--r--xts5/Xt4/XtCreateVarArgsList/XtCreateVarArgsList.m742
-rw-r--r--xts5/Xt4/XtCreateWidget/XtCreateWidget.m911
-rw-r--r--xts5/Xt4/XtCreateWindow/XtCreateWindow.m743
-rw-r--r--xts5/Xt4/XtDatabase/XtDatabase.m148
-rw-r--r--xts5/Xt4/XtDestroyApplicationContext/XtDestroyApplicationContext.m128
-rw-r--r--xts5/Xt4/XtDestroyWidget/XtDestroyWidget.m357
-rw-r--r--xts5/Xt4/XtDisplay/XtDisplay.m92
-rw-r--r--xts5/Xt4/XtDisplayInitialize/XtDisplayInitialize.m566
-rw-r--r--xts5/Xt4/XtDisplayOfObject/XtDisplayOfObject.m115
-rw-r--r--xts5/Xt4/XtIsRealized/XtIsRealized.m112
-rw-r--r--xts5/Xt4/XtMergeArgLists/XtMergeArgLists.m124
-rw-r--r--xts5/Xt4/XtName/XtName.m81
-rw-r--r--xts5/Xt4/XtOpenDisplay/XtOpenDisplay.m889
-rw-r--r--xts5/Xt4/XtParent/XtParent.m91
-rw-r--r--xts5/Xt4/XtRealizeWidget/XtRealizeWidget.m149
-rw-r--r--xts5/Xt4/XtScreen/XtScreen.m88
-rw-r--r--xts5/Xt4/XtScreenDatabase/XtScreenDatabase.m122
-rw-r--r--xts5/Xt4/XtScreenOfObject/XtScreenOfObject.m117
-rw-r--r--xts5/Xt4/XtSetArg/XtSetArg.m111
-rw-r--r--xts5/Xt4/XtSetLanguageProc/XtSetLanguageProc.m440
-rw-r--r--xts5/Xt4/XtToolkitInitialize/XtToolkitInitialize.m69
-rw-r--r--xts5/Xt4/XtUnrealizeWidget/XtUnrealizeWidget.m129
-rw-r--r--xts5/Xt4/XtVaAppCreateShell/XtVaAppCreateShell.m316
-rw-r--r--xts5/Xt4/XtVaAppInitialize/XtVaAppInitialize.m945
-rw-r--r--xts5/Xt4/XtVaCreateWidget/XtVaCreateWidget.m1066
-rw-r--r--xts5/Xt4/XtWidgetToApplicationContext/XtWidgetToApplicationContext.m98
-rw-r--r--xts5/Xt4/XtWindow/XtWindow.m89
-rw-r--r--xts5/Xt4/XtWindowOfObject/XtWindowOfObject.m113
33 files changed, 10604 insertions, 0 deletions
diff --git a/xts5/Xt4/XtAppCreateShell/XtAppCreateShell.m b/xts5/Xt4/XtAppCreateShell/XtAppCreateShell.m
new file mode 100644
index 00000000..320c4002
--- /dev/null
+++ b/xts5/Xt4/XtAppCreateShell/XtAppCreateShell.m
@@ -0,0 +1,293 @@
+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/Xt4/XtAppCreateShell/XtAppCreateShell.m,v 1.1 2005-02-12 14:38:00 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/Xt4/XtAppCreateShell/XtAppCreateShell.m
+>>#
+>># Description:
+>># Tests for XtAppCreateShell()
+>>#
+>># Modifications:
+>># $Log: tapcrshel.m,v $
+>># Revision 1.1 2005-02-12 14:38:00 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:24 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:14 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.1 1998/06/23 22:41:43 andy
+>># Added sleep(XT_RESET_DELAY) to each test. SR# 186.
+>>#
+>># Revision 6.0 1998/03/02 05:27:35 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:08 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:16:06 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:19:55 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+#include <X11/Xatom.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+>>TITLE XtAppCreateShell Xt4
+Widget
+XtAppCreateShell(name, application_class, widget_class, display, args, num_args)
+>>ASSERTION Good A
+A successful call to
+Widget XtAppCreateShell(name, application_class, widget_class, display, args, num_args)
+shall create a top-level shell widget that is
+the root of a widget tree with name as the widget instance name,
+associate it with the display specified by the argument display, and
+return the shell widget instance.
+>>CODE
+Display *display_good;
+String name_good;
+XtAppContext app_ctext_good;
+Widget topLevel_good;
+Boolean status;
+int argcount = 0;
+pid_t pid2;
+
+ FORK(pid2);
+ XtToolkitInitialize();
+ tet_infoline("PREP: Create application context");
+ app_ctext_good = XtCreateApplicationContext();
+ tet_infoline("PREP: Open display");
+ sleep(config.reset_delay);
+ display_good = XtOpenDisplay(
+ app_ctext_good, /* application context */
+ (String)config.display, /* display name */
+ "Hi there", /* application name use argv[0] */
+ "World", /* application class */
+ (XrmOptionDescRec *)NULL,
+ (Cardinal) 0, /* command line options */
+ &argcount,
+ (String *)NULL /* command line args */
+ );
+ if (display_good == NULL) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("TEST: Create top level widget");
+ topLevel_good = XtAppCreateShell("Hello", "World",
+ applicationShellWidgetClass, display_good,
+ (ArgList)NULL, (Cardinal)0);
+ tet_infoline("TEST: Class is applicationShell");
+ status = XtIsApplicationShell(topLevel_good);
+ check_dec(True, status, "Return value");
+ tet_infoline("TEST: Name");
+ name_good = XtName(topLevel_good);
+ check_str("Hello", name_good, "Name");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+On a successful call to
+Widget XtAppCreateShell(name, application_class, widget_class, display, args,
+num_args)
+when widget_class is ApplicationShell or a subclass thereof the shell widget
+instance created shall have WM_COMMAND property set from the values of the
+XtNargv and XtNargc resources.
+>>CODE
+Display *display_good;
+String name_good, class_good;
+char name[20], class[20];
+XtAppContext app_ctext_good;
+Widget widget_good;
+Widget labelw_msg;
+char *msg = "Property widget";
+XTextProperty *text_prop;
+Window window_good;
+int argcount = 0;
+int ret_value = 0;
+Atom actual_type;
+int actual_format;
+unsigned long num_elements;
+long bytes_after;
+unsigned char *property_data_buff;
+Arg args[2] = {
+{ "XtNwidth", 100 },
+{ "XtNheight", 100 }
+};
+pid_t pid2;
+
+ FORK(pid2);
+
+ XtToolkitInitialize();
+ tet_infoline("PREP: Create application context");
+ app_ctext_good = XtCreateApplicationContext();
+ tet_infoline("PREP: Open display");
+ sleep(config.reset_delay);
+ display_good = XtOpenDisplay(
+ app_ctext_good, /* application context */
+ (String)config.display, /* display name */
+ "Hello", /* application name use argv[0] */
+ "World", /* application class */
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0, /* command line options */
+ &argcount,
+ (String *)NULL /* command line args */
+ );
+ if (display_good == NULL) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("PREP: Create top level widget");
+ widget_good = XtAppCreateShell("Hello", "World",
+ applicationShellWidgetClass, display_good,
+ &args[0], 2);
+ tet_infoline("PREP: Create label widget");
+ labelw_msg = (Widget) CreateLabelWidget(msg, widget_good);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(widget_good);
+ tet_infoline("TEST: WM_COMMAND property is set");
+ window_good = XtWindow(labelw_msg);
+ ret_value = XGetWindowProperty(display_good, window_good,
+ XA_WM_COMMAND, (long)0,
+ 128, False, AnyPropertyType,
+ &actual_type,
+ &actual_format,
+ &num_elements,
+ (unsigned long *)&bytes_after,
+ &property_data_buff);
+ check_dec(Success, ret_value, "Return value");
+ tet_infoline("TEST: WM_CLASS property is set");
+ window_good = XtWindow(labelw_msg);
+ ret_value = XGetWindowProperty(display_good, window_good,
+ XA_WM_CLASS, (long)0,
+ 128, False, AnyPropertyType,
+ &actual_type,
+ &actual_format,
+ &num_elements,
+ (unsigned long *)&bytes_after,
+ &property_data_buff);
+ check_dec(Success, ret_value, "Return value");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to Widget XtAppCreateShell(name, application_class,
+widget_class, display, args, num_args) when name is NULL shall name the
+shell widget instance with the application name passed to XtDisplayInitialize.
+>>CODE
+Display *display_good;
+String name_good;
+XtAppContext app_ctext_good;
+Widget topLevel_good;
+Boolean status;
+int argcount = 0;
+pid_t pid2;
+
+ FORK(pid2);
+ XtToolkitInitialize();
+ tet_infoline("PREP: Create application context");
+ app_ctext_good = XtCreateApplicationContext();
+ tet_infoline("PREP: Open display");
+ sleep(config.reset_delay);
+ display_good = XtOpenDisplay(
+ app_ctext_good, /* application context */
+ (String)config.display, /* display name */
+ "Hi there", /* application name use argv[0] */
+ "World", /* application class */
+ (XrmOptionDescRec *)NULL,
+ (Cardinal) 0, /* command line options */
+ &argcount,
+ (String *)NULL /* command line args */
+ );
+ if (display_good == NULL) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("TEST: Create top level widget");
+ topLevel_good = XtAppCreateShell(NULL, "World",
+ applicationShellWidgetClass, display_good,
+ (ArgList)NULL, (Cardinal)0);
+ tet_infoline("TEST: Class is applicationShell");
+ status = XtIsApplicationShell(topLevel_good);
+ check_dec(True, status, "Return value");
+ tet_infoline("TEST: Name");
+ name_good = XtName(topLevel_good);
+ check_str("Hi there", name_good, "Name");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good B 0
+A successful call to
+Widget XtAppCreateShell(name, application_class, widget_class, display, args,
+num_args)
+when args specifies the XtNscreen
+argument shall create the resource database for the shell widget using the
+resource values specified in args and resource values from the resource
+database of the screen specified by the XtNscreen argument for those
+resources not specified in args.
+>>ASSERTION Good B 0
+A successful call to
+Widget XtAppCreateShell(name, application_class, widget_class, display, args,
+num_args)
+when args does not specify the
+XtNscreen argument, widget_class is applicationShellWidgetClass or a subclass
+thereof, and the resource database of the default screen for display
+specifies the resource name.screen, class application_class.screen shall
+create the resource database for the shell widget using the resource values
+specified in args and resource values from the resource database of the screen
+specified in the resource database of the default screen for those resources
+not specified in args.
+>>ASSERTION Good B 0
+A successful call to
+Widget XtAppCreateShell(name, application_class, widget_class, display,
+args, num_args)
+when args does not specify the XtNscreen argument, widget_class is not
+applicationShellWidgetClass or a subclass thereof, and the resource database
+of the default screen for display specifies the resource name.screen,
+class Class.screen, where Class is the class_name field from CoreClassPart
+of widget_class, shall create the resource database for the shell widget
+using the resource values specified in args and resource values from the
+resource database of the screen specified in the resource database of the
+default screen for those resources not specified in args.
+>>ASSERTION Good B 0
+A successful call to
+Widget XtAppCreateShell(name, application_class, widget_class, display,
+args, num_args)
+when args does not specify the XtNscreen argument and the resource database
+of the default screen for display does not specify the resource name.screen,
+class application_class.screen shall create the resource database for the
+shell widget using the resource values specified in args and resource values
+from the resource database of the default screen for those resources not
+specified in args.
diff --git a/xts5/Xt4/XtAppInitialize/XtAppInitialize.m b/xts5/Xt4/XtAppInitialize/XtAppInitialize.m
new file mode 100644
index 00000000..a1ab6ee5
--- /dev/null
+++ b/xts5/Xt4/XtAppInitialize/XtAppInitialize.m
@@ -0,0 +1,939 @@
+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/Xt4/XtAppInitialize/XtAppInitialize.m,v 1.1 2005-02-12 14:38:00 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/Xt4/XtAppInitialize/XtAppInitialize.m
+>>#
+>># Description:
+>># Tests for XtAppInitialize()
+>>#
+>># Modifications:
+>># $Log: tapintlze.m,v $
+>># Revision 1.1 2005-02-12 14:38:00 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:25 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:15 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.1 1998/06/23 22:35:02 andy
+>># Added sleep(XT_RESET_DELAY) to each test. SR# 186.
+>>#
+>># Revision 6.0 1998/03/02 05:27:36 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:09 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.1 1998/01/13 04:50:30 andy
+>># In test 17 changed type of closure_ret from XtPointer * to XtPointer (SR 140).
+>>#
+>># Revision 4.0 1995/12/15 09:16:09 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:19:59 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+#include <X11/Xatom.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+char *msg="/tmp/outfile";
+char *args11[] = {
+ "-background", "green",
+ "-bd", "green",
+ "-bg", "green",
+ "-borderwidth", "3",
+ "-bordercolor", "red",
+ "-bw", "3",
+ "-fg", "green",
+ "-font", XtDefaultFont,
+ "-fn", XtDefaultFont,
+ "-foreground", "blue",
+ "-geometry", "100x100",
+ "-iconic",
+ "-reverse",
+ "-rv",
+ "+rv",
+ "-selectionTimeout", "50",
+ "-synchronous",
+ "+synchronous",
+ "-title", "ApTest",
+ "-xnlLanguage", "C",
+ NULL};
+
+
+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, "very bad idea"
+ },
+};
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtAppInitialize Xt4
+Widget
+XtAppInitialize(app_context_return, application_class, options, num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+>>ASSERTION Good A
+A call to
+Widget XtAppInitialize(app_context_return, application_class,
+options, num_options, argc_in_out, argv_in_out, fallback_resources, args,
+num_args)
+shall initialize the Intrinsics internals, create an application context for
+the calling application, return the context in app_context_return, open
+a display, create a top-level shell widget that is the root of a widget
+tree, and return the shell widget instance.
+>>CODE
+XtAppContext app_ctext_return;
+Widget widget_good;
+Display *display_good;
+String name_good, class_good;
+char name[20], class[20];
+Boolean status;
+int argcount = 0;
+pid_t pid2;
+
+ FORK(pid2);
+ tet_infoline("TEST: Initialize toolkit");
+ sleep(config.reset_delay);
+ sprintf(ebuf, "DISPLAY=%s", config.display);
+ putenv(ebuf);
+ widget_good = XtAppInitialize(&app_ctext_return,
+ "TAppInitialize",
+ (XrmOptionDescList)NULL,
+ (Cardinal)0,
+ &argcount,
+ (String *)NULL,
+ (String *)NULL,
+ (ArgList)NULL,
+ (Cardinal)0
+ );
+ avs_set_event(1,1);
+ tet_infoline("TEST: Class is applicationShell");
+ status = XtIsApplicationShell(widget_good);
+ check_dec(True, status, "Return value");
+ tet_infoline("TEST: Application name and class.");
+ display_good = XtDisplay(widget_good);
+ XtGetApplicationNameAndClass(display_good, &name_good, &class_good );
+ check_str("main", name_good, "Name");
+ check_str("TAppInitialize", class_good, "Class");
+ KROF(pid2);
+ if (avs_get_event(1) != 1) {
+ tet_infoline("ERROR: Process terminated by XtAppInitialize ");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When the display cannot be opened, a call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+shall issue an error message and terminate the calling process.
+>>CODE
+XtAppContext app_ctext_return;
+Widget widget_good;
+Display *display_good;
+String name_good, class_good;
+char name[20], class[20];
+Boolean status;
+int argcount = 0;
+pid_t pid2;
+FILE *stream;
+char line[80], *retval;
+
+ tet_infoline("TEST: Initialize toolkit");
+ FORK(pid2);
+ sleep(config.reset_delay);
+ sprintf(ebuf, "PREP: Direct error message to %s", msg);
+ tet_infoline(ebuf);
+ push_stderr("outfile", "w");
+ sprintf(ebuf, "DISPLAY=%s", "notarealdisplay");
+ putenv(ebuf);
+ widget_good = XtAppInitialize(&app_ctext_return,
+ "TAppInitialize",
+ (XrmOptionDescList)NULL,
+ (Cardinal)0,
+ &argcount,
+ (String *)NULL,
+ (String *)NULL,
+ (ArgList)NULL,
+ (Cardinal)0
+ );
+ avs_set_event(1,1);
+ pop_stderr();
+ KROF(pid2);
+ tet_infoline("TEST: Open the file and read the message");
+ stream = (FILE *)fopen(msg, "r");
+ retval = fgets(line, 80, stream) ;
+ if (retval == NULL) {
+ tet_infoline("ERROR: No error message issued");
+ tet_result(TET_FAIL);
+ unlink(msg);
+ exit(0);
+ }
+ unlink(msg);
+ if (avs_get_event(1) == 1) {
+ tet_infoline("ERROR: Process not terminated by XtAppInitialize ");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+
+ tet_result(TET_PASS);
+>>#
+>># Start of XtCreateApplicationContext
+>>#
+>># -----
+>>#
+>># Start of XtOpenDisplay
+>>#
+>>ASSERTION Good B 0
+A successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+shall create a resource database for the display opened.
+>>ASSERTION Good A
+A successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+when the -display option is specified in argv_in_out shall use this value as
+the display to be opened and initialized.
+>>CODE
+XtAppContext app_ctext_return;
+Widget widget_good;
+Display *display_good;
+Boolean status;
+pid_t pid2;
+int argc_count;
+char **argv_string;
+int count = 3;
+char *argvals[4];
+char *display_name;
+
+
+ FORK(pid2);
+ sleep(config.reset_delay);
+ tet_infoline("TEST: Initialize toolkit");
+ tet_infoline("PREP: Set arguments to include -display");
+ argvals[0] = "tinitlize";
+ argvals[1] = "-display";
+ argvals[2] = (char *)config.display;
+ argvals[3] = (char *)NULL;
+ argc_count = count;
+ argv_string = &argvals[0];
+ widget_good = XtAppInitialize(&app_ctext_return,
+ "TAppInitialize",
+ (XrmOptionDescList)NULL,
+ (Cardinal)0,
+ &argc_count,
+ argv_string,
+ (String *)NULL,
+ (ArgList)NULL,
+ (Cardinal)0
+ );
+ avs_set_event(1,1);
+ display_good = XtDisplay(widget_good);
+ tet_infoline("TEST: Display name is correct");
+ display_name = XDisplayString(display_good);
+ check_str(config.display, display_name, "Display name");
+ KROF(pid2);
+ if (avs_get_event(1) != 1) {
+ tet_infoline("ERROR: Process terminated by XtAppInitialize ");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+when the -display option is not specified in argv_in_out and the DISPLAY environment
+variable is set shall use this value as the display to be opened and
+initialized.
+>>CODE
+XtAppContext app_ctext_return;
+Widget widget_good;
+Display *display_good;
+Boolean status;
+int argcount = 0;
+char *display_name;
+pid_t pid2;
+
+ FORK(pid2);
+ sleep(config.reset_delay);
+ tet_infoline("PREP: Set DISPLAY");
+ sprintf(ebuf, "DISPLAY=%s", config.display);
+ putenv(ebuf);
+ tet_infoline("TEST: Initialize toolkit");
+ widget_good = XtAppInitialize(&app_ctext_return,
+ "TAppInitialize",
+ (XrmOptionDescList)NULL,
+ (Cardinal)0,
+ &argcount,
+ (String *)NULL,
+ (String *)NULL,
+ (ArgList)NULL,
+ (Cardinal)0
+ );
+ avs_set_event(1,1);
+ display_good = XtDisplay(widget_good);
+ tet_infoline("TEST: Display name is correct");
+ display_name = XDisplayString(display_good);
+ check_str(config.display, display_name, "Display name");
+ KROF(pid2);
+ if (avs_get_event(1) != 1) {
+ tet_infoline("ERROR: Process terminated by XtAppInitialize ");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+when the -name option is specified in argv_in_out shall use this value as the
+application name to query the server and screen resource databases for
+the name.xnlLanguage resource to create the resource database for the display.
+>>CODE
+XtAppContext app_ctext_return;
+Widget widget_good;
+Display *display_good;
+String name_good, class_good;
+char name[20], class[20];
+int argcount = 0;
+Boolean status;
+pid_t pid2;
+int pstatus;
+int argc_count;
+char **argv_string;
+int count = 3;
+char *argvals[4];
+
+ FORK(pid2);
+ sleep(config.reset_delay);
+ sprintf(ebuf, "DISPLAY=%s", config.display);
+ putenv(ebuf);
+ tet_infoline("TEST: Initialize toolkit and open display");
+ argvals[0] = "tinitlize";
+ argvals[1] = "-name";
+ argvals[2] = "testname";
+ argvals[3] = (char *)NULL;
+ argc_count = count;
+ argv_string = &argvals[0];
+ widget_good = XtAppInitialize(&app_ctext_return,
+ "TAppInitialize",
+ (XrmOptionDescList)NULL,
+ (Cardinal)0,
+ &argc_count,
+ argv_string,
+ (String *)NULL,
+ (ArgList)NULL,
+ (Cardinal)0
+ );
+ tet_infoline("TEST: widget_good class is applicationShell");
+ status = XtIsApplicationShell(widget_good);
+ check_dec(True, status, "XtIsApplicationShell return value");
+ tet_infoline("TEST: Application name and class");
+ display_good = XtDisplay(widget_good);
+ XtGetApplicationNameAndClass(display_good, &name_good, &class_good );
+ check_str("testname", name_good, "Application Name");
+ KROF3(pid2, pstatus, AVSXTTIMEOUT-2);
+ if (pstatus != 0) {
+ tet_infoline("ERROR: Test process exited abnormally");
+ tet_infoline(" May mean display cannot be opened");
+ tet_result(TET_UNRESOLVED);
+ } else
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+when the -name option is not specified in argv_in_out and the environment variable
+RESOURCE_NAME is set shall use this value as the application name to query
+the server and screen resource databases for the name.xnlLanguage resource
+to create the resource database for the display.
+>>CODE
+XtAppContext app_ctext_return;
+Widget widget_good;
+Display *display_good;
+String name_good, class_good;
+char name[20], class[20];
+int argcount = 0;
+Boolean status;
+pid_t pid2;
+int pstatus;
+
+ FORK(pid2);
+ sleep(config.reset_delay);
+ tet_infoline("PREP: Set up env variable RESOURCE_NAME");
+ putenv("RESOURCE_NAME=testname2");
+ sprintf(ebuf, "DISPLAY=%s", config.display);
+ putenv(ebuf);
+ tet_infoline("TEST: Initialize toolkit and open display");
+ widget_good = XtAppInitialize(&app_ctext_return,
+ "TAppInitialize",
+ (XrmOptionDescList)NULL,
+ (Cardinal)0,
+ &argcount,
+ (String *)NULL,
+ (String *)NULL,
+ (ArgList)NULL,
+ (Cardinal)0
+ );
+ tet_infoline("TEST: widget_good class is applicationShell");
+ status = XtIsApplicationShell(widget_good);
+ check_dec(True, status, "XtIsApplicationShell return value");
+ tet_infoline("TEST: Application name and class");
+ display_good = XtDisplay(widget_good);
+ XtGetApplicationNameAndClass(display_good, &name_good, &class_good );
+ check_str("testname2", name_good, "Application Name");
+ KROF3(pid2, pstatus, AVSXTTIMEOUT-2);
+ if (pstatus != 0) {
+ tet_infoline("ERROR: Test process exited abnormally");
+ tet_infoline(" May mean display cannot be opened");
+ tet_result(TET_UNRESOLVED);
+ } else
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+when the -name option is not specified in argv_in_out, the environment variable
+RESOURCE_NAME is not set, and argv_in_out[0] is not an empty string shall use
+this value as the application name to query the server and screen resource
+databases for the name.xnlLanguage resource to create the resource database
+for the display.
+>>CODE
+XtAppContext app_ctext_return;
+Widget widget_good;
+Display *display_good;
+String name_good, class_good;
+char name[20], class[20];
+int argcount = 0;
+Boolean status;
+pid_t pid2;
+int pstatus;
+int argc_count;
+char **argv_string;
+int count = 1;
+char *argvals[4];
+
+ FORK(pid2);
+ sleep(config.reset_delay);
+ sprintf(ebuf, "DISPLAY=%s", config.display);
+ putenv(ebuf);
+ tet_infoline("TEST: Initialize toolkit and open display");
+ argvals[0] = "testname3";
+ argvals[1] = (char *)NULL;
+ argc_count = count;
+ argv_string = &argvals[0];
+ widget_good = XtAppInitialize(&app_ctext_return,
+ "TAppInitialize",
+ (XrmOptionDescList)NULL,
+ (Cardinal)0,
+ &argc_count,
+ argv_string,
+ (String *)NULL,
+ (ArgList)NULL,
+ (Cardinal)0
+ );
+ tet_infoline("TEST: widget_good class is applicationShell");
+ status = XtIsApplicationShell(widget_good);
+ check_dec(True, status, "XtIsApplicationShell return value");
+ tet_infoline("TEST: Application name and class");
+ display_good = XtDisplay(widget_good);
+ XtGetApplicationNameAndClass(display_good, &name_good, &class_good );
+ check_str("testname3", name_good, "Application Name");
+ KROF3(pid2, pstatus, AVSXTTIMEOUT-2);
+ if (pstatus != 0) {
+ tet_infoline("ERROR: Test process exited abnormally");
+ tet_infoline(" May mean display cannot be opened");
+ tet_result(TET_UNRESOLVED);
+ } else
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+when the -name option is not specified in argv_in_out, the environment variable
+RESOURCE_NAME is not set, and argv_in_out[0] is an empty string shall use the
+string "main" as the application name to query the server and screen resource
+databases for the name.xnlLanguage resource to create the resource database
+for the display.
+>>CODE
+XtAppContext app_ctext_return;
+Widget widget_good;
+Display *display_good;
+String name_good, class_good;
+char name[20], class[20];
+Boolean status;
+int argcount = 0;
+pid_t pid2;
+
+ FORK(pid2);
+ sleep(config.reset_delay);
+ tet_infoline("TEST: Initialize toolkit");
+ sprintf(ebuf, "DISPLAY=%s", config.display);
+ putenv(ebuf);
+ widget_good = XtAppInitialize(&app_ctext_return,
+ "TAppInitialize",
+ (XrmOptionDescList)NULL,
+ (Cardinal)0,
+ &argcount,
+ (String *)NULL,
+ (String *)NULL,
+ (ArgList)NULL,
+ (Cardinal)0
+ );
+ avs_set_event(1,1);
+ tet_infoline("TEST: Class is applicationShell");
+ status = XtIsApplicationShell(widget_good);
+ check_dec(True, status, "Return value");
+ tet_infoline("TEST: Application name and class.");
+ display_good = XtDisplay(widget_good);
+ XtGetApplicationNameAndClass(display_good, &name_good, &class_good );
+ check_str("main", name_good, "Name");
+ check_str("TAppInitialize", class_good, "Class");
+ KROF(pid2);
+ if (avs_get_event(1) != 1) {
+ tet_infoline("ERROR: Process terminated by XtAppInitialize ");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_result(TET_PASS);
+>># >>#
+>># >># Start of XtDisplayInitialize assertions
+>># >>#
+>>ASSERTION Good A
+When the synchronize resource is set to True in the resource database
+created by a successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+it shall put Xlib into synchronous mode for this display connection.
+>>CODE
+Window window;
+int scr;
+static char *property_data = "Hello World";
+XtAppContext app_ctext_return;
+Display *display;
+int queued_events, events;
+int argc = 2;
+pid_t pid2;
+int pstatus;
+ /*
+ ** -synchronous on
+ ** +synchronous off
+ */
+char *argv[] = { "tinitlize", "-synchronous", (char *)NULL };
+Widget widget_good;
+
+ FORK(pid2);
+ sleep(config.reset_delay);
+ sprintf(ebuf, "DISPLAY=%s", config.display);
+ putenv(ebuf);
+ tet_infoline("TEST: Initialize toolkit and open display");
+ widget_good = XtAppInitialize(&app_ctext_return,
+ "TAppInitialize",
+ (XrmOptionDescList)NULL,
+ (Cardinal)0,
+ &argc,
+ argv,
+ (String *)NULL,
+ (ArgList)NULL,
+ (Cardinal)0
+ );
+ avs_set_event(1,1);
+ display = XtDisplay(widget_good);
+ tet_infoline("PREP: Create a window for events");
+ scr = DefaultScreen(display);
+ window = XCreateWindow(display, RootWindow(display, scr),
+ 0, 0, 5, 5, 0, /* x,y,wid,ht,brd width */
+ DefaultDepth(display, scr),
+ InputOutput,
+ DefaultVisual(display, scr),
+ (XtValueMask) 0,
+ (XSetWindowAttributes *) 0);
+ tet_infoline("TEST: Check Xlib is in synchronous mode");
+ queued_events = XQLength(display);
+ XSelectInput(display, window,
+ (unsigned long)PropertyChangeMask);
+ for (events = 0; events < 3; events++)
+ XChangeProperty(display, window, XA_RESOURCE_MANAGER, XA_STRING, 8,0, (unsigned char *)property_data, 16);
+ check_dec(3+queued_events, XQLength(display), "queue length");
+ KROF3(pid2, pstatus, AVSXTTIMEOUT-2);
+ if (avs_get_event(1) != 1) {
+ tet_infoline("ERROR: Process terminated by XtAppInitialize ");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_result(TET_PASS);
+>>ASSERTION Good B 0
+If the implementation is X11R5 or later:
+A successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+shall determine a language string for the display
+by searching the following sources in the specified order:
+
+- the resource database created from the command line.
+
+- the resource application_name.xnlLanguage, class
+ application_class.XnlLanguage in the server's RESOURCE_MANAGER
+ property for the root window of screen zero if it exists, or in
+ the user preference resource file otherwise.
+
+- the environment.
+>>ASSERTION Good B 0
+If the implementation is X11R5 or later and is POSIX-based:
+A successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+shall use the LANG environment variable as the environment value to
+search when determining the language string for the display.
+>>ASSERTION Good D 0
+If the implementation is X11R5 or later:
+A successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+shall set the language string for the display to the empty string if the
+server's RESOURCE_MANAGER property for the root window of screen zero
+exists, and a language string is not found on the command line, in this
+property, or in the environment.
+>>ASSERTION Good D 0
+If the implementation is X11R5 or later:
+A successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+shall set the language string for the display to the empty string if the
+server's RESOURCE_MANAGER property for the root window of screen
+zero does not exist and a language string is not found on the
+command line, in the user preference resource file, or in the
+environment.
+>>ASSERTION Good D 0
+A successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+shall associate with the default screen of the display a resource
+database created by combining entries from the following sources,
+in order, with the first named source having the highest precedence:
+
+- the application command line
+
+- the user's environment resource file
+
+- per-screen resource specifications from the server, as returned by
+ XScreenResourceString()
+
+- per display resource specifications from the server (the
+ server's RESOURCE_MANAGER property for the root window of
+ screen zero) if they exist, otherwise the user preference file
+
+- the application-specific user resource file.
+
+- the application-specific class resource file .
+>>ASSERTION Good A
+A successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+shall recognize options specified on the command line that are in the
+standard table of options in section 4.4 of the specification or in
+the table specific to the application specified by
+.A options
+and
+.A num_options.
+>>CODE
+Display *display_good;
+String name_good, class_good;
+int argcount = 20;
+instance_variable_rec base;
+pid_t pid2;
+Widget widget_good;
+XtAppContext app_ctext_return;
+
+ FORK(pid2);
+ sleep(config.reset_delay);
+ tet_infoline("PREP: Set DISPLAY");
+ sprintf(ebuf, "DISPLAY=%s", config.display);
+ putenv(ebuf);
+ tet_infoline("TEST: Initialize toolkit");
+ widget_good = XtAppInitialize(&app_ctext_return,
+ "TAppInitialize",
+ (XrmOptionDescList)NULL,
+ (Cardinal)0,
+ &argcount,
+ args11,
+ (String *)NULL,
+ (ArgList)NULL,
+ (Cardinal)0
+ );
+ tet_infoline("TEST: Retrieve resource values from resource database");
+ XtGetApplicationResources(widget_good,
+ &base,
+ resources,
+ 1,
+ (ArgList)NULL,
+ (Cardinal)0);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+when the reverseVideo resource is define as True on the command line shall use
+the value of XtDefaultForeground instead of XtDefaultBackground and
+vice versa in the resource database created for the display.
+>>CODE
+Window window;
+int scr;
+static char *property_data = "Hello World";
+XtAppContext app_ctext;
+Display *display;
+int queued_events, events;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+Boolean closure;
+XtPointer closure_ret = (XtPointer *) &closure;
+int argc = 2;
+char *argv[] = { "tdsplyintl2", "+rv", (char *)NULL };
+Screen *screen;
+Colormap colormap;
+pid_t pid2;
+Pixel res;
+Boolean status;
+XtAppContext app_ctext_return;
+Widget widget_good;
+
+ FORK(pid2);
+ sleep(config.reset_delay);
+ sprintf(ebuf, "DISPLAY=%s", config.display);
+ putenv(ebuf);
+ tet_infoline("TEST: Initialize and application with +rv in args");
+ widget_good = XtAppInitialize(&app_ctext_return,
+ "TAppInitialize",
+ (XrmOptionDescList)NULL,
+ (Cardinal)0,
+ &argc,
+ argv,
+ (String *)NULL,
+ (ArgList)NULL,
+ (Cardinal)0
+ );
+ display = XtDisplay(widget_good);
+ 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: Convert XtDefaultForeground");
+ fromVal.addr = XtDefaultForeground;
+ fromVal.size = strlen(XtDefaultForeground)+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");
+ tet_infoline("TEST: Convert XtDefaultBackground");
+ fromVal.addr = XtDefaultBackground;
+ fromVal.size = strlen(XtDefaultBackground)+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);
+>>ASSERTION Good D 0
+If the implementation is POSIX-based:
+A successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+when the environment variable XENVIRONMENT exists shall use the value
+of this variable as the name of the user environment resource file.
+>>ASSERTION Good D 0
+If the implementation is POSIX-based:
+A successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+when the environment variable XENVIRONMENT does not exist shall use
+the file .Xdefaults-host, where host is the name of the system running
+the application, in the user's home directory as the user environment
+resource file.
+>>ASSERTION Good B 0
+A successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+shall set the values from the higher precedence sources of the resource
+database being created for the display as the current resource database
+before determining the file name for the application-specific user resource file.
+>>ASSERTION Good D 0
+If the implementation is POSIX-based:
+A successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+when the environment variable XUSERFILESEARCHPATH is defined
+shall use the result of calling XtResolvePathname(display, path,
+NULL, NULL, NULL, NULL, 0, NULL) with the value of this variable as path
+as the name of the application-specific user resource file.
+>>ASSERTION Good D 0
+If the implementation is POSIX-based:
+A successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+when the environment variable XUSERFILESEARCHPATH is not defined and
+the environment variable XAPPLRESDIR is not defined shall
+use the result of calling XtResolvePathname(display, path,
+NULL, NULL, NULL, NULL, 0, NULL) as the name of the application-specific
+user resource file where path contains at least entries containing $HOME as
+the directory prefix plus the following substitutions, in the order specified:
+
+- %C, %N, %L or %C, %N, %l, %t, %c
+
+- %C, %N, %l
+
+- %C, %N
+
+- %N, %L or %N, %l, %t, %c
+
+- %N, %l
+
+- %N
+>>ASSERTION Good D 0
+If the implementation is POSIX-based:
+A successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+when the environment variable XUSERFILESEARCHPATH is not defined and
+the environment variable XAPPLRESDIR is defined shall use the result
+of calling XtResolvePathname(display, path, NULL, NULL, NULL, NULL, 0, NULL)
+as the name of the application-specific user resource file where path
+contains at least entries containing the following directory prefixes and
+substitutions, in the order specified:
+
+- $XPPLRESDIR with %C, %N, %L or %C, %N, %l, %t, %c
+
+- $XPPLRESDIR with %C, %N, %l
+
+- $XPPLRESDIR with %C, %N
+
+- $XPPLRESDIR with %N, %L or %N, %l, %t, %c
+
+- $XPPLRESDIR with %N, %l
+
+- $XPPLRESDIR with %N
+
+- $HOME with %N
+>>ASSERTION Good B 0
+A successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+shall use the result of calling XtResolvePathname(display, "app-defaults",
+NULL, NULL, NULL, NULL, 0, NULL) as the name of the application-specific
+class resource file, with the values from the higher precedence sources of
+the resource database being created for the display set as the current
+resource database before the call is made.
+>>#
+>># Start of XtAppCreateShell
+>>#
+>>ASSERTION Good B 0
+On a successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+the shell widget instance created shall have WM_COMMAND property set from
+the values of the XtNargv and XtNargc resources.
+>>ASSERTION Good B 0
+A successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+shall name the shell widget instance with the application name passed to
+XtDisplayInitialize.
+>>ASSERTION Good B 0
+A successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+when args specifies the XtNscreen argument shall create the resource database
+for the shell widget using the resource values specified in args and
+resource values from the resource database of the screen specified by the
+XtNscreen argument for those resources not specified in args.
+>>ASSERTION Good B 0
+A successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+when args does not specify the XtNscreen argument and the resource database
+of the default screen for display
+specifies the resource name.screen, class application_class.screen shall
+create the resource database for the shell widget using the resource values
+specified in args and resource values from the resource database of the screen
+specified in the resource database of the default screen for those resources
+not specified in args.
+>>ASSERTION Good B 0
+A successful call to
+Widget XtAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, args, num_args)
+when args does not specify the XtNscreen argument and the resource database
+of the default screen for display does not specify the resource name.screen,
+class application_class.screen shall create the resource database for the
+shell widget using the resource values specified in args and resource values
+from the resource database of the default screen for those resources not
+specified in args.
diff --git a/xts5/Xt4/XtAppSetFallbackResources/XtAppSetFallbackResources.m b/xts5/Xt4/XtAppSetFallbackResources/XtAppSetFallbackResources.m
new file mode 100644
index 00000000..bed1cf86
--- /dev/null
+++ b/xts5/Xt4/XtAppSetFallbackResources/XtAppSetFallbackResources.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/Xt4/XtAppSetFallbackResources/XtAppSetFallbackResources.m,v 1.1 2005-02-12 14:38:00 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/Xt4/XtAppSetFallbackResources/XtAppSetFallbackResources.m
+>>#
+>># Description:
+>># Tests for XtAppSetFallbackResources()
+>>#
+>># Modifications:
+>># $Log: tappstfllb.m,v $
+>># Revision 1.1 2005-02-12 14:38:00 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:21 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:10 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:27:32 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:05 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:15:54 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:19: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;
+>>TITLE XtAppSetFallbackResources Xt4
+void
+XtAppSetFallbackResources(app_ctext, specification_list)
+>>ASSERTION Good A
+A call to void XtAppSetFallbackResources(app_ctext, specification_list)
+shall set the default resource values for the application context app_ctext
+from the resource list specification_list to be used in place of an
+application-specific class resource file in initializing a resource database
+if the application-specific class resource file is not found.
+>>CODE
+Display *display;
+Widget labelw_good;
+XrmDatabase database;
+char *str_type;
+XrmValue value[1];
+int argcount = 0;
+static String fallback_res[] = {
+ "*hello.labelString: Hello World",
+ NULL,
+};
+
+ avs_xt_hier("Tappstfllb1", "XtAppSetFallbackResources");
+ tet_infoline("TEST: Set default set of resource values.");
+ XtAppSetFallbackResources(app_ctext, fallback_res);
+ tet_infoline("TEST: Initialize display to add resources");
+ display = XtDisplay(topLevel);
+ XtDisplayInitialize(app_ctext, display,
+ "tappstfllb1", "Tappstfllb1",
+ (XrmOptionDescRec *)NULL,
+ (Cardinal) 0, &argcount,
+ (String *)NULL );
+ tet_infoline("TEST: Get the resource database");
+ database = XtDatabase(display);
+ tet_infoline("TEST: Check the default resource values");
+ XrmGetResource(database, "hello.labelString", NULL, &str_type, &value[0]);
+ if (strncmp("Hello World", value[0].addr, strlen("Hello World")) != 0 ) {
+ sprintf(ebuf, "ERROR: Expected \"Hello World\" for hello.labelString, Received \"%s\"", value[0].addr);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When the argument specification_list is NULL, a call to void
+XtAppSetFallbackResources(app_ctext, specification_list) shall remove
+any previous fallback resource specification for the application context.
+>>CODE
+Display *display;
+Widget labelw_good;
+XrmDatabase database;
+char *str_type[40];
+XrmValue result;
+XrmValue *value = &result;
+int argcount = 1;
+char *str_class = NULL;
+char string[40];
+static String fallback_res[] = {
+ "*hello.labelString: Hello World",
+ (String)NULL,
+};
+
+ avs_xt_hier("Tappstfllb2", "XtAppSetFallbackResources");
+ tet_infoline("TEST: Set label resource to Hello World.");
+ XtAppSetFallbackResources(app_ctext, &fallback_res[0]);
+ display = XtDisplay(topLevel);
+ XtDisplayInitialize(app_ctext, display,
+ "tappstfllb2", "Tappstfllb2",
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0, &argcount,
+ (String *)NULL );
+ tet_infoline("TEST: Specify resource list as NULL");
+ XtAppSetFallbackResources(app_ctext, (String *)NULL);
+ tet_infoline("TEST: Initialize display to add resources");
+ XtDisplayInitialize(app_ctext, display,
+ "tappstfllb2", "Tappstfllb2",
+ (XrmOptionDescRec *)NULL,
+ (Cardinal) 0, &argcount,
+ (String *)NULL );
+ tet_infoline("TEST: Get resource database");
+ database = XtDatabase(display);
+ tet_infoline("TEST: Check label resource value is deleted from list");
+ XrmGetResource(database, "hello.labelString", str_class, str_type, value);
+ if ( value->size != 0 ) {
+ sprintf(ebuf, "ERROR: Expected NULL, Received %s", value->addr);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_result(TET_PASS);
diff --git a/xts5/Xt4/XtCloseDisplay/XtCloseDisplay.m b/xts5/Xt4/XtCloseDisplay/XtCloseDisplay.m
new file mode 100644
index 00000000..5c021e59
--- /dev/null
+++ b/xts5/Xt4/XtCloseDisplay/XtCloseDisplay.m
@@ -0,0 +1,185 @@
+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/Xt4/XtCloseDisplay/XtCloseDisplay.m,v 1.1 2005-02-12 14:38:00 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/Xt4/XtCloseDisplay/XtCloseDisplay.m
+>>#
+>># Description:
+>># Tests for XtCloseDisplay()
+>>#
+>># Modifications:
+>># $Log: tclsdsply.m,v $
+>># Revision 1.1 2005-02-12 14:38:00 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:19 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:09 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:27:30 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:04 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.1 1998/01/14 01:23:39 andy
+>># Changed both tests to not poke the widgets for the display after
+>># it is closed as this causes core dumps on some implementations (SR 142).
+>>#
+>># Revision 4.0 1995/12/15 09:15:50 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:19: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;
+Display *display_good;
+
+/*
+** XtEMH_Proc
+*/
+void XtEMH_Proc(str, str2, str3, str4, str5, car)
+String str, str2, str3, str4, *str5;
+Cardinal *car;
+{
+ avs_set_event(2, 1);
+ exit(0);
+}
+
+/*timeout callback*/
+void XtTI_Proc(client_data, id)
+XtPointer client_data;
+XtIntervalId *id;
+{
+ exit(0);
+}
+
+/*
+** Registered procedure XtEVT_Proc to be invoked
+*/
+void XtEVT_Proc(w, client_data, event, continue_to_dispatch)
+Widget w;
+XtPointer client_data;
+XEvent *event;
+Boolean *continue_to_dispatch;
+{
+
+ if (event->type == ButtonPress){
+ display_good= XtDisplay(topLevel);
+ tet_infoline("PREP: Close the display during a dispatch");
+ XtCloseDisplay(display_good);
+ tet_infoline("TEST: Display is still good inside handler");
+ if (XtDisplay(labelw) == NULL) {
+ sprintf(ebuf, "ERROR: Expected valid display pointer");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ avs_set_event(1,1);
+ exit(0);
+ }
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtCloseDisplay Xt4
+void
+XtCloseDisplay(display)
+>>ASSERTION Good A
+A call to void XtCloseDisplay(display) shall close the display specified
+by the argument display and remove it from the application context of the
+calling program.
+>>CODE
+char string[10];
+Widget labelw_good , widget_good;
+Window window_good;
+pid_t pid2;
+int invoked;
+
+ avs_xt_hier("Tclsdsply1", "XtCloseDisplay");
+ display_good = XtDisplay(topLevel);
+ 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: Register timeout");
+ XtAppAddTimeOut(app_ctext, AVSXTLOOPTIMEOUT, XtTI_Proc, topLevel);
+ tet_infoline("PREP: Register error handler");
+ XtAppSetErrorMsgHandler(app_ctext, XtEMH_Proc);
+ tet_infoline("TEST: Close the display");
+ XtCloseDisplay(display_good);
+ /*the safest thing to do, as best we can tell, as it
+ actually validates the pointer and gives an error message
+ if the display isn't valid*/
+ tet_infoline("TEST: Display is no longer valid");
+ FORK(pid2);
+ XtCloseDisplay(display_good);
+ KROF(pid2);
+ invoked = avs_get_event(2);
+ check_dec(1, invoked, "Error handler invoked status");
+ /*ensure as best we can that the appcontext is still valid*/
+ tet_infoline("TEST: Application context is still valid");
+ FORK(pid2);
+ XtAppMainLoop(app_ctext);
+ KROF(pid2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+void XtCloseDisplay(display) when called from within an event dispatch
+shall not close the display until the dispatch is complete.
+>>CODE
+Widget labelw_msg;
+char *msg = "Event widget";
+int status;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tclsdsply2", "XtCloseDisplay");
+ tet_infoline("PREP: Create labelw_msg widget in boxw1 widget");
+ labelw_msg = (Widget) CreateLabelWidget(msg, boxw1);
+ tet_infoline("PREP: Register procedure to handle ButtonPress events");
+ XtAddEventHandler(labelw_msg,
+ ButtonPressMask,
+ False,
+ XtEVT_Proc,
+ (Display *)display_good
+ );
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Send ButtonPress over wire to labelw_msg widget");
+ send_event(labelw_msg, ButtonPress, ButtonPressMask, FALSE);
+ XtAppMainLoop(app_ctext);
+ KROF(pid2);
+ status = avs_get_event(1);
+ check_dec(1, status, "Callback invocation count");
+ tet_result(TET_PASS);
diff --git a/xts5/Xt4/XtCreateApplicationContext/XtCreateApplicationContext.m b/xts5/Xt4/XtCreateApplicationContext/XtCreateApplicationContext.m
new file mode 100644
index 00000000..3f721f0d
--- /dev/null
+++ b/xts5/Xt4/XtCreateApplicationContext/XtCreateApplicationContext.m
@@ -0,0 +1,85 @@
+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/Xt4/XtCreateApplicationContext/XtCreateApplicationContext.m,v 1.1 2005-02-12 14:38:00 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/Xt4/XtCreateApplicationContext/XtCreateApplicationContext.m
+>>#
+>># Description:
+>># Tests for XtCreateApplicationContext()
+>>#
+>># Modifications:
+>># $Log: tcrtapplct.m,v $
+>># Revision 1.1 2005-02-12 14:38:00 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:16 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:05 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:27:27 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:01 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:15:40 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:19:22 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext, app_ctext_good;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+>>TITLE XtCreateApplicationContext Xt4
+XtAppContext
+XtCreateApplicationContext()
+>>ASSERTION Good A
+A call to XtAppContext XtCreateApplicationContext() shall initialize the
+per-application state and return an application context for the calling
+application.
+>>CODE
+
+ avs_xt_hier("Tcrtapplct1", "XtCreateApplicationContext");
+ tet_infoline("TEST: Create application context app_ctext_good");
+ app_ctext_good = XtCreateApplicationContext();
+ if (app_ctext_good == NULL) {
+ sprintf(ebuf, "ERROR: Expected valid application context returned NULL");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_infoline("CLEANUP: Destroy app_ctext_good ");
+ XtDestroyApplicationContext(app_ctext_good);
+ tet_result(TET_PASS);
diff --git a/xts5/Xt4/XtCreateVarArgsList/XtCreateVarArgsList.m b/xts5/Xt4/XtCreateVarArgsList/XtCreateVarArgsList.m
new file mode 100644
index 00000000..54a773f4
--- /dev/null
+++ b/xts5/Xt4/XtCreateVarArgsList/XtCreateVarArgsList.m
@@ -0,0 +1,742 @@
+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/Xt4/XtCreateVarArgsList/XtCreateVarArgsList.m,v 1.1 2005-02-12 14:38:13 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/Xt4/XtCreateVarArgsList/XtCreateVarArgsList.m
+>>#
+>># Description:
+>># Tests for XtVaCreateArgsList()
+>>#
+>># Modifications:
+>># $Log: tvcrtargsl.m,v $
+>># Revision 1.1 2005-02-12 14:38:13 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:22 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:12 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:27:33 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:07 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:15:57 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:19:44 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)
+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;
+ }
+ XtSetValues((Widget) new, args, *num_args);
+ 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((Widget)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(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(cw),
+ RootWindow(XtDisplay(cw), DefaultScreen(XtDisplay(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(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(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(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 XtCreateVarArgsList Xt4
+XtVarArgsList
+XtVaCreateArgsList(unused, ...)
+>>ASSERTION Good A
+A call to XtVarArgsList XtVaCreateArgsList(unused, ...) shall allocate and
+return a varargs list from the specified list of resource name/value pairs.
+>>CODE
+XtVarArgsList VarArgsList ;
+int cur_x, cur_y ;
+Widget squarew ;
+
+ avs_xt_hier("Tvcrtargsl1", "XtVaCreateArgsList");
+ tet_infoline("PREP: Convert resource list to varargs list.");
+ VarArgsList = XtVaCreateArgsList((XtPointer)NULL,
+ XavsNcurX, (XtArgVal)10,
+ XavsNcurY, (XtArgVal)10,
+ (char *)NULL);
+ tet_infoline("PREP: Create Square Cell widget using varargs list");
+ squarew = (Widget)XtVaCreateManagedWidget(
+ "squarew", /* arbitrary widget name */
+ squareCellWidgetClass,
+ boxw1, /* parent widget */
+ XtVaNestedList,
+ VarArgsList,
+ (char *)NULL
+ );
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: 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");
+#if 0
+ tet_infoline("TEST: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+#endif
+ tet_infoline("CLEANUP: Free list");
+ XtFree((char *)VarArgsList);
+ tet_result(TET_PASS);
+>>ASSERTION Good B 1
+On a call to
+XtVarArgsList XtVaCreateArgsList(unused, ...)
+the varargs list returned shall be terminated by a NULL name entry.
diff --git a/xts5/Xt4/XtCreateWidget/XtCreateWidget.m b/xts5/Xt4/XtCreateWidget/XtCreateWidget.m
new file mode 100644
index 00000000..add9a05c
--- /dev/null
+++ b/xts5/Xt4/XtCreateWidget/XtCreateWidget.m
@@ -0,0 +1,911 @@
+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/Xt4/XtCreateWidget/XtCreateWidget.m,v 1.1 2005-02-12 14:38:00 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/Xt4/XtCreateWidget/XtCreateWidget.m
+>>#
+>># Description:
+>># Tests for XtCreateWidget()
+>>#
+>># Modifications:
+>># $Log: tcrtwdgt.m,v $
+>># Revision 1.1 2005-02-12 14:38:00 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:23 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:12 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:27:33 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:07 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:16:00 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:19:48 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+#include <X11/Xaw/Label.h>
+#include <xt/SquareCelP.h>
+#include <X11/Xaw/Form.h>
+#include <AvsComp.h>
+#include <AvsRectObj.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+/*
+** XtEMH_Proc
+*/
+void XtEMH_Proc(str1, str2, str3, str4, str5, car)
+String str1, str2, str3, str4, *str5;
+Cardinal *car;
+{
+ avs_set_event(1,1);
+ 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 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((Widget)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((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((char *)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(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(cw),
+ RootWindow(XtDisplay(cw), DefaultScreen(XtDisplay(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(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(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(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;
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtCreateWidget Xt4
+Widget
+XtCreateWidget(name, object_class, parent, args, num_args)
+>>ASSERTION Good A
+A successful call to
+Widget XtCreateWidget(name, object_class, parent, args, num_args)
+shall create a new widget instance belonging to the widget class
+object_class, with parent as its immediate ancestor, and return a pointer to
+the widget instance structure.
+>>CODE
+Boolean value_good;
+char string[10];
+Widget widget_good, labelw_good;
+Widget rowcolw_good;
+
+ avs_xt_hier("Tcrtwdgt1", "XtCreateWidget");
+ tet_infoline("PREP: Create rowcolw_good widget in box1w widget");
+ rowcolw_good = (Widget) CreateRowColWidget(boxw1);
+ (void) CreateLabelWidget("Failsafe widget", rowcolw_good);
+ tet_infoline("TEST: Create label widget Hello");
+ labelw_good = XtCreateWidget(
+ "Hello",
+ labelWidgetClass,
+ rowcolw_good,
+ (ArgList)NULL,
+ (Cardinal)0
+ );
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Check the labelw_good widget is not managed");
+ value_good = XtIsManaged(labelw_good);
+ check_dec(False, value_good , "XtIsmanaged return value");
+ tet_infoline("TEST: Check the labelw_good widget is child of rowcolumn widget");
+ widget_good = (Widget)XtParent(labelw_good);
+ if (widget_good == NULL) {
+ tet_infoline("ERROR: Expected parent widget instance returned NULL");
+ tet_result(TET_FAIL);
+ }
+ else
+ check_str("rowcolw", XtName(widget_good), "Parent widget name");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A call to
+Widget XtCreateWidget(name, object_class, parent, args, num_args)
+when object_class is not coreWidgetClass or a subclass thereof, the class of
+parent is a subclass of compositeWidgetClass, and there is no extension
+record in the composite class part extension field of parent with the
+record_type equal to NULLQUARK shall issue a fatal error.
+>>CODE
+Boolean value_good;
+char string[10];
+Widget test_widget, test_widget2;
+int status;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tcrtwdgt5", "XtCreateWidget");
+ tet_infoline("PREP: Register error message handler");
+ XtAppSetErrorMsgHandler(app_ctext, XtEMH_Proc);
+ tet_infoline("TEST: Create composite widget");
+ test_widget = XtCreateWidget(
+ "Composite",
+ avsCompWidgetClass,
+ topLevel,
+ (ArgList)NULL,
+ (Cardinal)0
+ );
+ tet_infoline("TEST: Create rect obj in it");
+ test_widget2 = XtCreateWidget(
+ "RectObj",
+ avsrectObjClass,
+ test_widget,
+ (ArgList)NULL,
+ (Cardinal)0
+ );
+ KROF(pid2);
+ tet_infoline("TEST: Error handler was invoked");
+ status = avs_get_event(1);
+ check_dec(1, status , "handler invocations count");
+ tet_result(TET_PASS);
+>>ASSERTION Good B 0
+A call to
+Widget XtCreateWidget(name, object_class, parent, args, num_args)
+when object_class is not coreWidgetClass or a subclass thereof, the class of
+parent is a subclass of compositeWidgetClass, and the accepts_object
+field in the parent's composite class part extension record is False shall
+issue a fatal error.
+>>ASSERTION Good A
+A successful call to
+Widget XtCreateWidget(name, object_class, parent, args, num_args)
+shall perform the following actions in the order specified:
+
+- invoke the class_initialize procedure for the class object_class and
+ all superclasses for which this procedure has not been invoked prior to
+ this call, in a superclass-to-subclass order.
+
+- allocate memory for the widget instance.
+
+- if the parent belongs to the class constraintWidgetClass or a
+ subclass thereof, allocate memory for the constraints of parent
+ and store the address of this memory in the constraints field of the
+ widget instance structure.
+
+- initialize the Core non-resource data fields of the widget instance.
+
+- initialize the resource fields of the widget instance using the
+ CoreClassPart resource list specified for object_class and all superclasses,
+ overridden by the resource values specified in args.
+
+- if parent is a subclass of constraintWidgetClass, initialize the resource
+ fields of the constraints record from the constraint resource list specified
+ for the parent's class and all superclasses up to constraintWidgetClass,
+ overridden by the resource values specified in args.
+
+- call all the initialize procedures starting at Object on down to the
+ initialize procedure of the widget.
+
+- if parent is a member of compositeWidgetClass, call the insert_child
+ procedure of the parent.
+
+- if parent belongs to the class contraintWidgetClass or a subclass thereof,
+ call all the ConstraintClassPart initialize procedures starting at
+ constraintWidgetClass on down to the initialize procedure of the parent.
+>>CODE
+Boolean value_good;
+char string[10];
+Widget squarew;
+Dimension cell_height, cell_width;
+Widget formw_good ;
+Widget labelw_good;
+Arg setargs[1];
+Boolean resizable;
+pid_t pid2;
+Widget widget_good;
+
+ /*a combination of earlier tests, needs enhancement*/
+ FORK(pid2);
+ avs_xt_hier("Tcrtwdgt3", "XtCreateWidget");
+ tet_infoline("TEST: Create Square Cell widget");
+ squarew = XtCreateWidget("squarew",
+ squareCellWidgetClass,
+ boxw1,
+ (ArgList)NULL,
+ (Cardinal)0);
+ tet_infoline("TEST: Check resource values");
+ XtVaGetValues(squarew,
+ XavsNpixmapWidthInCells, &cell_width,
+ XavsNpixmapHeightInCells, &cell_height,
+ (char *)NULL);
+ check_dec(DEFAULT_PIXMAP_WIDTH, cell_width, XavsNpixmapWidthInCells);
+ check_dec(DEFAULT_PIXMAP_HEIGHT, cell_height, XavsNpixmapHeightInCells);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ FORK(pid2);
+ avs_xt_hier("Tcrtwdgt3", "XtCreateWidget");
+ tet_infoline("TEST: Create formw_good widget subclass of constraintWidgetClass");
+ formw_good = (Widget) CreateFormWidget(boxw1);
+ (void) CreateLabelWidget("failsafe widget", formw_good);
+ tet_infoline("PREP: Create labelw_good widget Hello");
+ setargs[0].name = XtNresizable;
+ setargs[0].value = (XtArgVal) TRUE;
+ labelw_good = XtCreateWidget(
+ "Hello",
+ labelWidgetClass,
+ formw_good,
+ (ArgList)&setargs[0],
+ (Cardinal)1
+ );
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Check XtNresizable resource value");
+ XtVaGetValues(labelw_good, XtNresizable, &resizable, (char *)NULL);
+ check_dec(TRUE,resizable,XtNresizable);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ FORK(pid2);
+ avs_xt_hier("Tcrtwdgt4", "XtCreateWidget");
+ tet_infoline("PREP: Create formw_good widget subclass of constraintWidgetClass");
+ formw_good = (Widget) CreateFormWidget(boxw1);
+ (void) CreateLabelWidget("Failsafe widget", formw_good);
+ tet_infoline("TEST: Create labelw_good widget Hello");
+ labelw_good = XtCreateWidget(
+ "Hello",
+ labelWidgetClass,
+ formw_good,
+ (ArgList)NULL,
+ (Cardinal)0
+ );
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Labelw_good widget is child of formw widget");
+ widget_good = (Widget)XtParent(labelw_good);
+ if (widget_good == NULL) {
+ tet_infoline("ERROR: Expected parent widget instance returned NULL");
+ tet_result(TET_FAIL);
+ }
+ else
+ check_str("formw", XtName(widget_good), "Parent name");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
diff --git a/xts5/Xt4/XtCreateWindow/XtCreateWindow.m b/xts5/Xt4/XtCreateWindow/XtCreateWindow.m
new file mode 100644
index 00000000..cbe5204e
--- /dev/null
+++ b/xts5/Xt4/XtCreateWindow/XtCreateWindow.m
@@ -0,0 +1,743 @@
+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/Xt4/XtCreateWindow/XtCreateWindow.m,v 1.1 2005-02-12 14:38:00 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/Xt4/XtCreateWindow/XtCreateWindow.m
+>>#
+>># Description:
+>># Tests for XtCreateWindow()
+>>#
+>># Modifications:
+>># $Log: tcrwindow.m,v $
+>># Revision 1.1 2005-02-12 14:38:00 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:27 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:17 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:27:37 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:11 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:16:16 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:20:09 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)
+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 */ Realize,
+ /* 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 Realize(w, valueMask, attributes)
+ register Widget w;
+ Mask *valueMask;
+ XSetWindowAttributes *attributes;
+{
+ attributes->bit_gravity = NorthWestGravity;
+ *valueMask |= CWBitGravity;
+ XtCreateWindow( w, (unsigned)InputOutput, (Visual *)CopyFromParent,
+ *valueMask, attributes);
+} /* Realize */
+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(cw),
+ RootWindow(XtDisplay(cw), DefaultScreen(XtDisplay(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(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(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(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 XtCreateWindow Xt4
+void
+XtCreateWindow(w, window_class, visual, value_mask, attributes)
+>>ASSERTION Good A
+A call to void XtCreateWindow(w, window_class, visual, value_mask, attributes)
+shall create a window for the widget w using the attributes specified in
+attributes, the colormap specified in the visual parameter, and assign the
+newly created window to the window field of the widget instance structure.
+>>CODE
+Widget squarew;
+int status;
+Display *display;
+Widget widget;
+Window window;
+
+ avs_xt_hier("Tcrwindow1", "XtCreateWindow");
+ /*
+ ** Realize procedure creates window with XtCreateWindow()
+ ** call.
+ */
+ tet_infoline("PREP: Invoke Realize and create widget's working window.");
+ squarew = XtVaCreateManagedWidget("squarew",
+ squareCellWidgetClass, boxw1, NULL);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Check window id is valid.");
+ window = XtWindow(squarew);
+ if (window <= 0) {
+ sprintf(ebuf, "ERROR: Expected valid window id Returned %d", window);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: Window id is that of squarew widget");
+ display = XtDisplay(squarew);
+ widget = XtWindowToWidget(display, window);
+ check_str("squarew", XtName(widget), "Widget name");
+ tet_result(TET_PASS);
diff --git a/xts5/Xt4/XtDatabase/XtDatabase.m b/xts5/Xt4/XtDatabase/XtDatabase.m
new file mode 100644
index 00000000..0d3af11a
--- /dev/null
+++ b/xts5/Xt4/XtDatabase/XtDatabase.m
@@ -0,0 +1,148 @@
+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/Xt4/XtDatabase/XtDatabase.m,v 1.1 2005-02-12 14:38:02 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/Xt4/XtDatabase/XtDatabase.m
+>>#
+>># Description:
+>># Tests for XtDatabase()
+>>#
+>># Modifications:
+>># $Log: tdtbs.m,v $
+>># Revision 1.1 2005-02-12 14:38:02 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:20 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:10 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.1 1998/06/23 22:47:15 andy
+>># Added sleep(XT_RESET_DELAY) to each test. SR# 186.
+>>#
+>># Revision 6.0 1998/03/02 05:27:31 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:05 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:15:53 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:19:38 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 XtDatabase Xt4
+XrmDatabase
+XtDatabase(display)
+>>ASSERTION Good A
+A call to XrmDatabase XtDatabase(display) shall return the default
+resource database associated with display.
+>>CODE
+Display *display;
+Widget labelw_good;
+XrmDatabase database;
+char *str_type;
+int argcount = 0;
+XrmValue value[1];
+static String fallback_res[] = {
+ "*hello.labelString: Hello World",
+ NULL,
+};
+
+ XtToolkitInitialize();
+ app_ctext = XtCreateApplicationContext();
+ tet_infoline("PREP: Set default set of resource values.");
+ XtAppSetFallbackResources(app_ctext, fallback_res);
+ tet_infoline("PREP: Initialize display");
+ sleep(config.reset_delay);
+ display = XOpenDisplay(config.display);
+ if (display == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ XtDisplayInitialize(app_ctext, display,
+ "tdtbs1", "Tdtbs1",
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0, &argcount,
+ (String *)NULL );
+ tet_infoline("TEST: Get the resource database");
+ database = XtDatabase(display);
+ tet_infoline("TEST: Check resource values");
+ XrmGetResource(database, "hello.labelString", NULL,
+ &str_type, &value[0]);
+ if (strncmp("Hello World", value[0].addr, strlen("Hello World")) != 0 ) {
+ sprintf(ebuf, "ERROR: Expected \"Hello World\"for hello.labelString, Received %s", value[0].addr);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_result(TET_PASS);
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to XrmDatabase XtDatabase(display) when display has not been
+initialized shall return NULL.
+>>CODE
+Display *display;
+XrmDatabase database;
+
+#if XT_X_RELEASE > 4
+ XtToolkitInitialize();
+ app_ctext = XtCreateApplicationContext();
+ if (app_ctext == NULL) {
+ tet_infoline("ERROR: Expected valid application context returned NULL");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_infoline("PREP: Open display");
+ sleep(config.reset_delay);
+ display = XOpenDisplay(config.display);
+ if (display == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("TEST: Database is NULL");
+ database = XtDatabase(display);
+ if (database != NULL) {
+ tet_infoline("ERROR: Expected return of NULL");
+ tet_result(TET_FAIL);
+ }
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation is X11R4");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt4/XtDestroyApplicationContext/XtDestroyApplicationContext.m b/xts5/Xt4/XtDestroyApplicationContext/XtDestroyApplicationContext.m
new file mode 100644
index 00000000..105383ea
--- /dev/null
+++ b/xts5/Xt4/XtDestroyApplicationContext/XtDestroyApplicationContext.m
@@ -0,0 +1,128 @@
+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/Xt4/XtDestroyApplicationContext/XtDestroyApplicationContext.m,v 1.1 2005-02-12 14:38:02 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/Xt4/XtDestroyApplicationContext/XtDestroyApplicationContext.m
+>>#
+>># Description:
+>># Tests for XtDestroyApplicationContext()
+>>#
+>># Modifications:
+>># $Log: tdstryappl.m,v $
+>># Revision 1.1 2005-02-12 14:38:02 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:16 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:06 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:27:28 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:01 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:15:41 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:19: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;
+
+/*
+** Procedure XtEVT_Proc
+*/
+void XtEVT_Proc(w, client_data, event, flag)
+Widget w;
+XtPointer client_data;
+XEvent *event;
+Boolean *flag;
+{
+ if (event->type == ButtonPress) {
+ XtDestroyApplicationContext((XtAppContext)client_data);
+ avs_set_event(1,1);
+ exit(0);
+ }
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtDestroyApplicationContext Xt4
+void
+XtDestroyApplicationContext(app_context)
+>>ASSERTION Good A
+A call to void XtDestroyApplicationContext(app_context) shall destroy
+the application context app_context and close all the display connections
+associated with it.
+>>CODE
+
+ avs_xt_hier("Tdstryappl1", "XtDestroyApplicationContext");
+ tet_infoline("TEST: Destroy an application context");
+ XtDestroyApplicationContext(app_ctext);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A call to void XtDestroyApplicationContext(app_context) when called from
+within an event dispatch shall not destroy the application context until
+the dispatch is complete.
+>>CODE
+Widget labelw_msg;
+char *msg = "Test widget";
+pid_t pid2;
+int invoked = 0;
+
+ FORK(pid2);
+ avs_xt_hier("Tdstryappl2", "XtDestroyApplicationContext");
+ tet_infoline("PREP: Create labelw_msg widget in boxw1");
+ labelw_msg = (Widget) CreateLabelWidget(msg, boxw1);
+ tet_infoline("PREP: Register procedure to handle ButtonPress events to");
+ tet_infoline("PREP: labelw_msg widget");
+ XtAddEventHandler(labelw_msg,
+ ButtonPressMask,
+ False,
+ XtEVT_Proc,
+ (XtPointer)app_ctext
+ );
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Simulate ButtonPress on widget labelw_msg");
+ send_event(labelw_msg, ButtonPress, ButtonPressMask, FALSE);
+ tet_infoline("TEST: Loop for events");
+ XtAppMainLoop(app_ctext);
+ KROF(pid2);
+ tet_infoline("TEST: Context terminated on event handler completion");
+ invoked = avs_get_event(1);
+ check_dec(1, invoked, "Event handler invoked count");
+ tet_result(TET_PASS);
diff --git a/xts5/Xt4/XtDestroyWidget/XtDestroyWidget.m b/xts5/Xt4/XtDestroyWidget/XtDestroyWidget.m
new file mode 100644
index 00000000..47e0dbc6
--- /dev/null
+++ b/xts5/Xt4/XtDestroyWidget/XtDestroyWidget.m
@@ -0,0 +1,357 @@
+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/Xt4/XtDestroyWidget/XtDestroyWidget.m,v 1.1 2005-02-12 14:38:00 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/Xt4/XtDestroyWidget/XtDestroyWidget.m
+>>#
+>># Description:
+>># Tests for XtDestroyWidget()
+>>#
+>># Modifications:
+>># $Log: tdestywid.m,v $
+>># Revision 1.1 2005-02-12 14:38:00 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:32 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:23 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.1 1998/06/22 23:04:17 andy
+>># Altered test 1 so second call to XtDestroyWidget is made from with
+>># destroy callback. SR 181.
+>>#
+>># Revision 6.0 1998/03/02 05:27:42 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:15 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:16:28 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:20:24 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;
+
+/* procedure XtTMO_Proc */
+void XtTMO_Proc(client_data, id)
+XtPointer client_data;
+XtIntervalId *id;
+{
+ exit(0);
+}
+
+void analyse_events(widget)
+Widget widget;
+{
+ XtAppContext app_context;
+ Display *display;
+ XEvent loop_event;
+ XEvent return_event;
+ app_context = XtWidgetToApplicationContext(widget);
+ display = XtDisplay(widget);
+ for (;;) {
+ XtAppNextEvent(app_context, &loop_event);
+ XSync(display, False);
+ if (loop_event.type == DestroyNotify) {
+ avs_set_event(1,1);
+ XtAppNextEvent(app_context, &return_event);
+ if (return_event.type == DestroyNotify) {
+ avs_set_event(2,1);
+ exit(0);
+ }
+ } /* end if */
+ XtDispatchEvent(&loop_event);
+ } /* end for */
+}
+
+Boolean flag;
+
+Widget labelw_msg1;
+
+void XtCBP(w, client_data, call_data)
+Widget w;
+XtPointer client_data, call_data;
+{
+ tet_infoline("TEST: Destroy labelw_msg1 widget within destroy callback");
+ XtDestroyWidget(labelw_msg1);
+ avs_set_event(2, avs_get_event(2)+1);
+}
+void XtCBP_ChildProc(w, client_data, call_data)
+Widget w;
+XtPointer client_data, call_data;
+{
+ flag = True;
+ avs_set_event(1, 1);
+}
+void XtCBP_ParentProc(w, client_data, call_data)
+Widget w;
+XtPointer client_data, call_data;
+{
+ /*
+ ** XtCBP_ChildProc to be invoked before XtCBP_ParentProc
+ */
+ if (flag)
+ avs_set_event(2, 1);
+ else {
+ sprintf(ebuf, "ERROR: XtCBP_ChildProc to be invoked before XtCBP_ParentProc");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtDestroyWidget Xt4
+void
+XtDestroyWidget(w)
+>>ASSERTION Good A
+A call to void XtDestroyWidget(w)
+when the being_destroyed field of the widget w is True shall return
+immediately.
+>>CODE
+XEvent loop_event;
+char *msg = "Test widget";
+Display *display;
+Window window;
+int status = 0;
+pid_t pid2;
+int i;
+Widget rowcolw_good;
+Widget labelw_good;
+Window rowcolw_good_window;
+Window labelw_good_window;
+
+ FORK(pid2);
+ avs_xt_hier("Tdestywid1", "XtDestroyWidget");
+ tet_infoline("PREP: Create labelw_msg1 widget in boxw1 widget");
+ labelw_msg1 = (Widget) CreateLabelWidget(msg, boxw1);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Catch DestroyNotify event");
+ display = XtDisplay(labelw_msg1);
+ window = XtWindow(labelw_msg1);
+ XSelectInput(display, window, StructureNotifyMask);
+ tet_infoline("PREP: Add callback procedure XtCBP_ParentProc() to labelw_msg1");
+ XtAddCallback(labelw_msg1,
+ XtNdestroyCallback,
+ XtCBP,
+ (XtPointer)NULL
+ );
+ tet_infoline("TEST: Destroy labelw_msg1 widget");
+ XtDestroyWidget(labelw_msg1);
+ tet_infoline("PREP: Register timeout");
+ XtAppAddTimeOut(app_ctext, AVSXTLOOPTIMEOUT, XtTMO_Proc, topLevel);
+ tet_infoline("TEST: DestroyNotify event generated just once");
+ for (i = 0; i < 10; i++) {
+ XtAppNextEvent(app_ctext, &loop_event);
+ XSync(display, False);
+ if (loop_event.type == DestroyNotify)
+ avs_set_event(1,avs_get_event(1)+1);
+ XtDispatchEvent(&loop_event);
+ i= 0;
+ }
+ KROF(pid2);
+ status = avs_get_event(1);
+ check_dec(1, status, "DestroyNotify event count");
+ tet_infoline("TEST: Destroy callback called just once");
+ status = avs_get_event(2);
+ check_dec(1, status, "Destroy callback count");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When it is not called from within an application callback routine and the
+widget w is not already being destroyed a call to void XtDestroyWidget(w)
+shall perform the following actions in the order specified:
+
+- call the destroy callback procedures registered for the widget w and
+ all normal and pop-up descendents in postorder.
+
+- if the widget w is not a pop-up child and the widget's parent is
+ a subclass of compositeWidgetClass, and if the parent is not being
+ destroyed, unmanage on the widget and call the widget's parent's
+ delete_child procedure.
+
+- if the widget w is not a pop-up child and the widget's parent is
+ a subclass of constraintWidgetClass, call the ConstraintClassPart
+ destroy procedure for the parent, followed by the destroy procedures
+ of the parent's superclass, up to and including the ConstraintClassPart
+ destroy procedure for constraintWidgetClass.
+
+- calls the destroy procedures for the widget and all normal and
+ pop-up descendents in postorder, calling the CoreClassPart
+ destroy procedure in each widget followed by the destroy
+ procedures in its superclasses, up to and including the
+ Object class.
+
+- if the widget w is realized destroy the window for the widget
+ and the windows for all its normal descendents.
+
+- recursively descend the tree and destroy the windows for all
+ realized popup descendents.
+>>CODE
+XEvent loop_event;
+Widget labelw_msg;
+char *msg = "Test widget";
+Display *display;
+Window window;
+int status = 0;
+pid_t pid2;
+int i;
+Widget rowcolw_good;
+Widget labelw_good;
+Window rowcolw_good_window;
+Window labelw_good_window;
+
+ /*this is catenation of the earlier tests - needs enhancement*/
+ avs_set_event(1,0);
+ avs_set_event(2,0);
+ FORK(pid2);
+ avs_xt_hier("Tdestywid1", "XtDestroyWidget");
+ tet_infoline("PREP: Create labelw_msg widget in boxw1 widget");
+ labelw_msg = (Widget) CreateLabelWidget(msg, boxw1);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Catch DestroyNotify event");
+ display = XtDisplay(labelw_msg);
+ window = XtWindow(labelw_msg);
+ XSelectInput(display, window, StructureNotifyMask);
+ tet_infoline("TEST: Destroy labelw_msg widget");
+ XtDestroyWidget(labelw_msg);
+ tet_infoline("TEST: DestroyNotify event generated");
+ for (i = 0; i < 10; i++) {
+ XtAppNextEvent(app_ctext, &loop_event);
+ XSync(display, False);
+ if (loop_event.type == DestroyNotify) {
+ avs_set_event(1,1);
+ exit(0);
+ }
+ XtDispatchEvent(&loop_event);
+ i= 0;
+ }
+ KROF(pid2);
+ status = avs_get_event(1);
+ check_dec(1, status, "DestroyNotify event count");
+ avs_set_event(1,0);
+ avs_set_event(2,0);
+ FORK(pid2);
+ avs_xt_hier("Tdestywid2", "XtDestroyWidget");
+ tet_infoline("PREP: Create rowcolw_good widget in boxw1 widget");
+ rowcolw_good = (Widget) CreateRowColWidget(boxw1);
+ tet_infoline("PREP: Create labelw_good widget in rowcolw_good widget");
+ labelw_good = (Widget) CreateLabelWidget("Hello", rowcolw_good);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Catch DestroyNotify event");
+ display = XtDisplay(rowcolw_good);
+ rowcolw_good_window = XtWindow(rowcolw_good);
+ XSelectInput(display, rowcolw_good_window, StructureNotifyMask);
+ labelw_good_window = XtWindow(labelw_good);
+ XSelectInput(display, labelw_good_window, StructureNotifyMask);
+ tet_infoline("TEST: Destroy rowcolw_good widget");
+ XtDestroyWidget(rowcolw_good);
+ analyse_events(rowcolw);
+ KROF(pid2);
+ tet_infoline("TEST: DestroyNotify event was generated for labelw_good");
+ status = avs_get_event(1);
+ check_dec(1, status, "DestroyNotify event count");
+ tet_infoline("TEST: DestroyNotify event was generated for rowcolw_good");
+ status = avs_get_event(2);
+ check_dec(1, status, "DestroyNotify event count");
+ avs_set_event(1,0);
+ avs_set_event(2,0);
+ FORK(pid2);
+ avs_xt_hier("Tdestywid3", "XtDestroyWidget");
+ tet_infoline("PREP: Create rowcolw_good widget in boxw1 widget");
+ rowcolw_good = (Widget) CreateRowColWidget(boxw1);
+ tet_infoline("PREP: Add callback procedure XtCBP_ParentProc() to rowcolw_good");
+ XtAddCallback(rowcolw_good,
+ XtNdestroyCallback,
+ XtCBP_ParentProc,
+ (XtPointer)NULL
+ );
+ tet_infoline("PREP: Create labelw_good widget in rowcolw_good widget");
+ labelw_good = (Widget) CreateLabelWidget("Hello", rowcolw_good);
+ tet_infoline("PREP: Add callback procedure XtCBP_ChildProc to labelw_good");
+ XtAddCallback(labelw_good,
+ XtNdestroyCallback,
+ XtCBP_ChildProc,
+ (XtPointer)NULL
+ );
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Destroy rowcolw_good widget");
+ XtDestroyWidget(rowcolw_good);
+ KROF(pid2);
+ tet_infoline("TEST: XtCBP_ChildProc procedure was invoked");
+ status = avs_get_event(1);
+ check_dec(1, status, "callback called count");
+ tet_infoline("TEST: XtCBP_ParentProc procedure was invoked");
+ status = avs_get_event(2);
+ check_dec(1, status, "callback called count");
+ tet_result(TET_PASS);
+>>ASSERTION Good B 0
+When called from within an application callback routine, if the
+widget w is not already being destroyed a call to void XtDestroyWidget(w)
+shall set the being_destroyed field of the widget w and its normal and
+pop-up children but shall not take other action until XtDispatchEvent
+is about to return, at which point it shall perform the following
+actions in the order specified:
+
+- call the destroy callback procedures registered for the widget w and
+ all normal and pop-up descendents in postorder.
+
+- if the widget w is not a pop-up child and the widget's parent is
+ a subclass of compositeWidgetClass, and if the parent is not being
+ destroyed, unmanage on the widget and call the widget's parent's
+ delete_child procedure.
+
+- if the widget w is not a pop-up child and the widget's parent is
+ a subclass of constraintWidgetClass, call the ConstraintClassPart
+ destroy procedure for the parent, followed by the destroy procedures
+ of the parent's superclass, up to and including the ConstraintClassPart
+ destroy procedure for constraintWidgetClass.
+
+- calls the destroy procedures for the widget and all normal and
+ pop-up descendents in postorder, calling the CoreClassPart
+ destroy procedure in each widget followed by the destroy
+ procedures in its superclasses, up to and including the
+ Object class.
+
+- if the widget w is realized destroy the window for the widget
+ and the windows for all its normal descendents.
+
+- recursively descend the tree and destroy the windows for all
+ realized popup descendents.
diff --git a/xts5/Xt4/XtDisplay/XtDisplay.m b/xts5/Xt4/XtDisplay/XtDisplay.m
new file mode 100644
index 00000000..975339c1
--- /dev/null
+++ b/xts5/Xt4/XtDisplay/XtDisplay.m
@@ -0,0 +1,92 @@
+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/Xt4/XtDisplay/XtDisplay.m,v 1.1 2005-02-12 14:38:00 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/Xt4/XtDisplay/XtDisplay.m
+>>#
+>># Description:
+>># Tests for XtDisplay()
+>>#
+>># Modifications:
+>># $Log: tdisplay.m,v $
+>># Revision 1.1 2005-02-12 14:38:00 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:28 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:18 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:27:38 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:11 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:16:18 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:20: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;
+>>TITLE XtDisplay Xt4
+Display *
+XtDisplay(w)
+>>ASSERTION Good A
+A call to Display *XtDisplay(w) shall return the display pointer
+of the widget w.
+>>CODE
+char string[10];
+Widget labelw_good , widget_good;
+Display *display_good;
+Window window_good;
+
+ avs_xt_hier("Tdisplay1", "XtDisplay");
+ 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("TEST: Get the display pointer for label widget `Hello' ");
+ if((display_good = XtDisplay(labelw_good)) == NULL ){
+ tet_infoline("ERROR: Expected valid display pointer, received NULL");
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: Display pointer is valid for specified widget");
+ window_good = XtWindow(labelw_good);
+ widget_good = XtWindowToWidget(display_good, window_good);
+ strcpy(string, XtName(widget_good) );
+ check_str("Hello", string, "Widget Name");
+ tet_result(TET_PASS);
diff --git a/xts5/Xt4/XtDisplayInitialize/XtDisplayInitialize.m b/xts5/Xt4/XtDisplayInitialize/XtDisplayInitialize.m
new file mode 100644
index 00000000..3b9ad3bf
--- /dev/null
+++ b/xts5/Xt4/XtDisplayInitialize/XtDisplayInitialize.m
@@ -0,0 +1,566 @@
+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/Xt4/XtDisplayInitialize/XtDisplayInitialize.m,v 1.1 2005-02-12 14:38:01 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/Xt4/XtDisplayInitialize/XtDisplayInitialize.m
+>>#
+>># Description:
+>># Tests for XtDisplayInitialize()
+>>#
+>># Modifications:
+>># $Log: tdsplyintl.m,v $
+>># Revision 1.1 2005-02-12 14:38:01 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:17 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:07 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.1 1998/06/23 22:54:45 andy
+>># Added sleep(XT_RESET_DELAY) to each test. SR# 186.
+>>#
+>># Revision 6.0 1998/03/02 05:27:29 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:02 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.1 1998/01/13 05:39:19 andy
+>># In test 12: Changed type of closure_ret from XtPointer * to XtPointer.
+>>#
+>># Revision 4.0 1995/12/15 09:15:44 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:19:27 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+#include <X11/Xatom.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+char *args11[] = {
+ "-background", "green",
+ "-bd", "green",
+ "-bg", "green",
+ "-borderwidth", "3",
+ "-bordercolor", "red",
+ "-bw", "3",
+ "-fg", "green",
+ "-font", XtDefaultFont,
+ "-fn", XtDefaultFont,
+ "-foreground", "blue",
+ "-geometry", "100x100",
+ "-iconic",
+ "-reverse",
+ "-rv",
+ "+rv",
+ "-selectionTimeout", "50",
+ "-synchronous",
+ "+synchronous",
+ "-title", "ApTest",
+ "-xnlLanguage", "C",
+ NULL};
+
+
+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, "very bad idea"
+ },
+};
+>>TITLE XtDisplayInitialize Xt4
+void
+XtDisplayInitialize(app_context, display, application_name, application_class, options, num_options, argc, argv)
+>>ASSERTION Good A
+A successful call to
+void XtDisplayInitialize(app_context, display,
+application_name, application_class, options, num_options, argc, argv)
+shall perform initialization for the previously opened display connection
+specified
+by
+.A display
+and add it to the application context
+.A app_context.
+>>CODE
+Display *display_good;
+String name_good, class_good;
+int argcount = 0;
+
+ tet_infoline("PREP: Initialize the Xt toolkit");
+ XtToolkitInitialize();
+ tet_infoline("PREP: Create an application context");
+ app_ctext = XtCreateApplicationContext();
+ tet_infoline("PREP: Open a display connection");
+ sleep(config.reset_delay);
+ display_good = XOpenDisplay(config.display);
+ if (display_good == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("TEST: Initialize display and add it to an application context.");
+ XtDisplayInitialize(app_ctext, display_good, "tdsplyintl1",
+ "Tdsplyintl1",
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0, &argcount,
+ (String *)NULL );
+ XtAppSetErrorMsgHandler(app_ctext, xt_handler);
+ tet_infoline("TEST: Get the application name and class");
+ XtGetApplicationNameAndClass(display_good, &name_good,
+ &class_good );
+ tet_infoline("TEST: Check the name and class are valid.");
+ check_str("tdsplyintl1", name_good, "Name of Application");
+ check_str("Tdsplyintl1", class_good, "Class of Application");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When the synchronize resource is set to True in the resource database
+created by a successful call to
+void XtDisplayInitialize(app_context, display, application_name,
+application_class, options, num_options, argc, argv)
+it shall put Xlib into synchronous mode for this display connection
+and any others currently open in the application context app_context.
+>>CODE
+Window window;
+int scr;
+static char *property_data = "Hello World";
+XtAppContext app_ctext;
+Display *display;
+int queued_events, events;
+int argc = 2;
+ /*
+ ** -synchronous on
+ ** +synchronous off
+ */
+char *argv[] = { "tdsplyintl2", "-synchronous", (char *)NULL };
+
+ tet_infoline("PREP: Initialize the Xt toolkit");
+ XtToolkitInitialize();
+ tet_infoline("PREP: Create an application context");
+ app_ctext = XtCreateApplicationContext();
+ tet_infoline("PREP: Open a display connection");
+ sleep(config.reset_delay);
+ display = XOpenDisplay(config.display);
+ if (display == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("PREP: Create a window for events");
+ scr = DefaultScreen(display);
+ window = XCreateWindow(display, RootWindow(display, scr),
+ 0, 0, 5, 5, 0, /* x,y,wid,ht,brd width */
+ DefaultDepth(display, scr),
+ InputOutput,
+ DefaultVisual(display, scr),
+ (XtValueMask) 0,
+ (XSetWindowAttributes *) 0);
+ tet_infoline("TEST: Initialize display and add it to an application context.");
+ XtDisplayInitialize(app_ctext, display,
+ "tdsplyintl2",
+ "Tdsplyintl2",
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0,
+ &argc, &argv[0] );
+ tet_infoline("TEST: Check Xlib is in synchronous mode");
+ queued_events = XQLength(display);
+ XSelectInput(display, window,
+ (unsigned long)PropertyChangeMask);
+ for (events = 0; events < 3; events++)
+ XChangeProperty(display, window, XA_RESOURCE_MANAGER,
+ XA_STRING, 8,0, (unsigned char *)property_data, 16);
+ check_dec(3+queued_events, XQLength(display), "queue length");
+ tet_result(TET_PASS);
+>>ASSERTION Good B 0
+If the implementation is X11R5 or later:
+When a language procedure has been registered for the application context
+.A app_context
+a successful call to
+void XtDisplayInitialize(app_context, display,
+application_name, application_class, options, num_options, argc, argv)
+shall call the language procedure with a language string determined
+by searching the following sources in the specified order:
+
+- the -xnlLanguage resource or a -xrm option containing the
+ xnlLanguage/XnlLanguage resource defined in the command line,
+
+- the resource application_name.xnlLanguage, class
+ application_class.XnlLanguage in the server's RESOURCE_MANAGER
+ property for the root window of screen zero if it exists, and in
+ the user preference resource file otherwise.
+>>ASSERTION Good D 0
+If the implementation is X11R5 or later:
+When a language procedure has been registered for the application context
+.A app_context
+a successful call to
+void XtDisplayInitialize(app_context, display,
+application_name, application_class, options, num_options, argc, argv)
+shall call the procedure with the empty string if the server's
+RESOURCE_MANAGER property for the root window of screen zero exists
+and a language string is not found on the command line or in this
+property.
+>>ASSERTION Good D 0
+If the implementation is X11R5 or later:
+When a language procedure has been registered for the application context
+.A app_context
+a successful call to
+void XtDisplayInitialize(app_context, display,
+application_name, application_class, options, num_options, argc, argv)
+shall call the procedure with the empty string if the server's
+RESOURCE_MANAGER property for the root window of screen zero does not exist
+and a language string is not found on the command line or in the user
+preference resource file.
+>>ASSERTION Good D 0
+If the implementation is X11R5 or later:
+When a language procedure has not been registered for the application context
+.A app_context
+a successful call to
+void XtDisplayInitialize(app_context, display,
+application_name, application_class, options, num_options, argc, argv)
+shall determine a language string for the display
+by searching the following sources in the specified order:
+
+- the resource database created from the command line.
+
+- the resource application_name.xnlLanguage, class
+ application_class.XnlLanguage in the server's RESOURCE_MANAGER
+ property for the root window of screen zero if it exists, or in
+ the user preference resource file otherwise.
+
+- the environment.
+>>ASSERTION Good D 0
+If the implementation is X11R5 or later and is POSIX-based:
+When a language procedure has not been registered for the application context
+.A app_context
+a successful call to
+void XtDisplayInitialize(app_context, display,
+application_name, application_class, options, num_options, argc, argv)
+shall use the LANG environment variable as the environment value to
+search when determining the language string for the display.
+>>ASSERTION Good D 0
+If the implementation is X11R5 or later:
+When a language procedure has not been registered for the application context
+.A app_context
+a successful call to
+void XtDisplayInitialize(app_context, display,
+application_name, application_class, options, num_options, argc, argv)
+shall set the language string for the display to the empty string if the
+server's RESOURCE_MANAGER property for the root window of screen zero exists,
+and a language string is not found on the command line, in this
+property, or in the environment.
+>>ASSERTION Good D 0
+If the implementation is X11R5 or later:
+When a language procedure has not been registered for the application context
+.A app_context
+a successful call to
+void XtDisplayInitialize(app_context, display,
+application_name, application_class, options, num_options, argc, argv)
+shall set the language string for the display to the empty string if the
+server's RESOURCE_MANAGER property for the root window of screen zero does
+not exist and a language string is not found on the command line, in the user
+preference resource file, or in the environment.
+>>ASSERTION Good B 0
+A successful call to
+void XtDisplayInitialize(app_context, display, application_name,
+application_name, application_class, options, num_options, argc, argv)
+shall associate with the default screen of the display a resource
+database created by combining entries from the following sources,
+in order, with the first named source having the highest precedence:
+
+- the application command line
+
+- the user's environment resource file
+
+- per-screen resource specifications from the server, as returned by
+ XScreenResourceString()
+
+- per display resource specifications from the server (the
+ server's RESOURCE_MANAGER property for the root window of
+ screen zero) if they exist, otherwise the user preference file
+
+- the application-specific user resource file.
+
+- the application-specific class resource file .
+>>ASSERTION Good A
+A successful call to
+void XtDisplayInitialize(app_context, display, application_name,
+application_class, options, num_options, argc, argv)
+shall recognize options specified on the command line that are in the
+standard table of options in section 4.4 of the specification or in
+the table specific to the application specified by
+.A options
+and
+.A num_options.
+>>CODE
+Display *display_good;
+String name_good, class_good;
+int argcount = 20;
+instance_variable_rec base;
+pid_t pid2;
+
+ FORK(pid2);
+ tet_infoline("PREP: Initialize the Xt toolkit");
+ XtToolkitInitialize();
+ tet_infoline("PREP: Create an application context");
+ app_ctext = XtCreateApplicationContext();
+ tet_infoline("PREP: Open a display connection");
+ sleep(config.reset_delay);
+ display_good = XOpenDisplay(config.display);
+ if (display_good == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("TEST: Initialize display and add it to an application context.");
+ XtDisplayInitialize(app_ctext, display_good, "tdsplyintl1",
+ "Tdsplyintl1",
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0, &argcount,
+ args11);
+ tet_infoline("TEST: Create top level widget");
+ topLevel = XtAppCreateShell("Hello", "World",
+ applicationShellWidgetClass, display_good,
+ (ArgList)NULL, (Cardinal)0);
+ tet_infoline("TEST: Retrieve resource values from resource database");
+ XtGetApplicationResources(topLevel,
+ &base,
+ resources,
+ 1,
+ (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);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+void XtDisplayInitialize(app_context, display, application_name,
+application_class, options, num_options, argc, argv)
+when the reverseVideo resource is define as True on the command line shall use
+the value of XtDefaultForeground instead of XtDefaultBackground and
+vice versa in the resource database created for the display.
+>>CODE
+Window window;
+int scr;
+static char *property_data = "Hello World";
+XtAppContext app_ctext;
+Display *display;
+int queued_events, events;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+Boolean closure;
+XtPointer closure_ret = (XtPointer *) &closure;
+int argc = 2;
+char *argv[] = { "tdsplyintl2", "+rv", (char *)NULL };
+Screen *screen;
+Colormap colormap;
+pid_t pid2;
+Pixel res;
+Boolean status;
+
+ FORK(pid2);
+ tet_infoline("PREP: Initialize the Xt toolkit");
+ XtToolkitInitialize();
+ tet_infoline("PREP: Create an application context");
+ app_ctext = XtCreateApplicationContext();
+ tet_infoline("PREP: Open a display connection");
+ sleep(config.reset_delay);
+ display = XOpenDisplay(config.display);
+ if (display == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("TEST: Initializae display connection with +rv in args");
+ XtDisplayInitialize(app_ctext, display, "tdsplyintl1",
+ "Tdsplyintl1",
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0, &argc,
+ &argv[0] );
+ 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: Convert XtDefaultForeground");
+ fromVal.addr = XtDefaultForeground;
+ fromVal.size = strlen(XtDefaultForeground)+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");
+ tet_infoline("TEST: Convert XtDefaultBackground");
+ fromVal.addr = XtDefaultBackground;
+ fromVal.size = strlen(XtDefaultBackground)+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);
+>>ASSERTION Good B 5
+A successful call to
+void XtDisplayInitialize(app_context, display, application_name,
+application_class, options, num_options, argc, argv)
+when the application context app_context has more than one display and
+the selectionTimeout resource is specified on the command line shall set
+this value in the selectionTimeout resource in the resource databases
+of all the displays in the application context.
+>>ASSERTION Good D 0
+If the implementation is POSIX-based:
+A successful call to
+void XtDisplayInitialize(app_context, display,
+application_name, application_class, options, num_options, argc, argv)
+when the environment variable XENVIRONMENT exists shall use the value
+of this variable as the name of the user environment resource file.
+>>ASSERTION Good D 0
+If the implementation is POSIX-based:
+A successful call to
+void XtDisplayInitialize(app_context, display,
+application_name, application_class, options, num_options, argc, argv)
+when the environment variable XENVIRONMENT does not exist shall use
+the file .Xdefaults-host, where host is the name of the system running
+the application, in the user's home directory as the user environment
+resource file.
+>>ASSERTION Good B 0
+A successful call to
+void XtDisplayInitialize(app_context, display,
+application_name, application_class, options, num_options, argc, argv)
+shall set the values from the higher precedence sources of the resource
+database being created for the display as the current resource database
+before determining the file name for the application-specific user resource file.
+>>ASSERTION Good D 0
+If the implementation is POSIX-based:
+A successful call to
+void XtDisplayInitialize(app_context, display,
+application_name, application_class, options, num_options, argc, argv)
+when the environment variable XUSERFILESEARCHPATH is defined
+shall use the result of calling XtResolvePathname(display, path,
+NULL, NULL, NULL, NULL, 0, NULL) with the value of this variable as path
+as the name of the application-specific user resource file.
+>>ASSERTION Good D 0
+If the implementation is POSIX-based:
+A successful call to
+void XtDisplayInitialize(app_context, display,
+application_name, application_class, options, num_options, argc, argv)
+when the environment variable XUSERFILESEARCHPATH is not defined and
+the environment variable XAPPLRESDIR is not defined shall
+use the result of calling XtResolvePathname(display, path,
+NULL, NULL, NULL, NULL, 0, NULL) as the name of the application-specific
+user resource file where path contains at least entries containing $HOME as
+the directory prefix plus the following substitutions, in the order specified:
+
+- %C, %N, %L or %C, %N, %l, %t, %c
+
+- %C, %N, %l
+
+- %C, %N
+
+- %N, %L or %N, %l, %t, %c
+
+- %N, %l
+
+- %N
+>>ASSERTION Good D 0
+If the implementation is POSIX-based:
+A successful call to
+void XtDisplayInitialize(app_context, display,
+application_name, application_class, options, num_options, argc, argv)
+when the environment variable XUSERFILESEARCHPATH is not defined and
+the environment variable XAPPLRESDIR is defined shall use the result
+of calling XtResolvePathname(display, path, NULL, NULL, NULL, NULL, 0, NULL)
+as the name of the application-specific user resource file where path
+contains at least entries containing the following directory prefixes and
+substitutions, in the order specified:
+
+- $XPPLRESDIR with %C, %N, %L or %C, %N, %l, %t, %c
+
+- $XPPLRESDIR with %C, %N, %l
+
+- $XPPLRESDIR with %C, %N
+
+- $XPPLRESDIR with %N, %L or %N, %l, %t, %c
+
+- $XPPLRESDIR with %N, %l
+
+- $XPPLRESDIR with %N
+
+- $HOME with %N
+>>ASSERTION Good B 0
+A successful call to
+void XtDisplayInitialize(app_context, display,
+application_name, application_class, options, num_options, argc, argv)
+shall use the result of calling XtResolvePathname(display, "app-defaults",
+NULL, NULL, NULL, NULL, 0, NULL) as the name of the application-specific
+class resource file, with the values from the higher precedence sources of
+the resource database being created for the display set as the current
+resource database before the call is made.
diff --git a/xts5/Xt4/XtDisplayOfObject/XtDisplayOfObject.m b/xts5/Xt4/XtDisplayOfObject/XtDisplayOfObject.m
new file mode 100644
index 00000000..82817d90
--- /dev/null
+++ b/xts5/Xt4/XtDisplayOfObject/XtDisplayOfObject.m
@@ -0,0 +1,115 @@
+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/Xt4/XtDisplayOfObject/XtDisplayOfObject.m,v 1.1 2005-02-12 14:38:00 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/Xt4/XtDisplayOfObject/XtDisplayOfObject.m
+>>#
+>># Description:
+>># Tests for XtDisplayOfObject()
+>>#
+>># Modifications:
+>># $Log: tdisplofo.m,v $
+>># Revision 1.1 2005-02-12 14:38:00 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:30 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:20 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:27:39 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:13 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:16:22 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:20: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;
+>>TITLE XtDisplayOfObject Xt4
+Display *
+XtDisplayOfObject(object)
+>>ASSERTION Good A
+A call to Display *XtDisplayOfObject(object) when object is a widget
+shall return the display pointer for the widget.
+>>CODE
+Widget labelw_good , widget_good;
+Display *display_good;
+Window window_good;
+
+ avs_xt_hier("Tdisplofo1", "XtDisplayOfObject");
+ 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("TEST: Get the display pointer for label widget `Hello' ");
+ if ((display_good = XtDisplayOfObject(labelw_good) ) == NULL ) {
+ sprintf(ebuf, "ERROR: Expected display pointer returned NULL");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: Display pointer is valid for widget");
+ window_good = XtWindow(labelw_good);
+ widget_good = XtWindowToWidget(display_good, window_good);
+ check_str("Hello", XtName(widget_good), "widget name");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A call to Display *XtDisplayOfObject(object) when object is not a widget
+shall return the display pointer of the nearest ancestor of object
+that belongs to class Widget or a subclass thereof.
+>>CODE
+Widget widget_good;
+Display *display_good;
+Window window_good;
+
+ avs_xt_hier("Tdisplofo2", "XtDisplayOfObject");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Get the display pointer for nearest widget");
+ tet_infoline(" to push button gadget");
+ if ( ( display_good = XtDisplayOfObject(click_quit) ) == NULL ) {
+ sprintf(ebuf, "ERROR: Expected valid display pointer returned NULL");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: Display pointer is valid");
+ window_good = XtWindow(rowcolw);
+ widget_good = XtWindowToWidget(display_good, window_good);
+ check_str("rowcolw", XtName(widget_good), "widget name");
+ tet_result(TET_PASS);
diff --git a/xts5/Xt4/XtIsRealized/XtIsRealized.m b/xts5/Xt4/XtIsRealized/XtIsRealized.m
new file mode 100644
index 00000000..25828488
--- /dev/null
+++ b/xts5/Xt4/XtIsRealized/XtIsRealized.m
@@ -0,0 +1,112 @@
+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/Xt4/XtIsRealized/XtIsRealized.m,v 1.1 2005-02-12 14:38:02 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/Xt4/XtIsRealized/XtIsRealized.m
+>>#
+>># Description:
+>># Tests for XtIsRealized()
+>>#
+>># Modifications:
+>># $Log: tisrealiz.m,v $
+>># Revision 1.1 2005-02-12 14:38:02 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:33 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:24 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:27:42 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:16 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:16:29 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:20:26 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;
+>>TITLE XtIsRealized Xt4
+Boolean XtIsRealized(object)
+>>ASSERTION Good A
+A call to Boolean XtIsRealized(w) shall return True when the window for
+the widget w has a non-zero ID.
+>>CODE
+Boolean status;
+
+ avs_xt_hier("Tisrealiz1", "XtIsRealized");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Widget labelw is realized shall return True");
+ status = XtIsRealized(labelw);
+ check_dec(True, status, "Return value");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A call to Boolean XtIsRealized(w) shall when the widget w has not been
+realized shall return a value other than True.
+>>CODE
+Boolean status;
+
+ avs_xt_hier("Tisrealiz2", "XtIsRealized");
+ tet_infoline("TEST: labelw widget NOT realized - shall return False");
+ status = XtIsRealized(labelw);
+ check_dec(False, status, "Return value");
+ tet_result(TET_PASS);
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to Boolean XtIsRealized(w) when w is not a widget shall
+return the state of the nearest widget ancestor.
+>>CODE
+Widget test_widget;
+Boolean status;
+
+ avs_xt_hier("Tisrealiz1", "XtIsRealized");
+ tet_infoline("PREP: Create AVS RectObj widget");
+ test_widget = XtVaCreateManagedWidget("avsro", avsrectObjClass, topLevel, NULL);
+
+ tet_infoline("TEST: XtIsRealized returns False");
+ status = XtIsRealized(test_widget);
+ check_dec(False, status, "Return value");
+ tet_infoline("PREP: Realize nearest widget ancenstor");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: XtIsRealized returns True");
+ status = XtIsRealized(test_widget);
+ check_dec(True, status, "Return value");
+ tet_result(TET_PASS);
diff --git a/xts5/Xt4/XtMergeArgLists/XtMergeArgLists.m b/xts5/Xt4/XtMergeArgLists/XtMergeArgLists.m
new file mode 100644
index 00000000..68a0b75b
--- /dev/null
+++ b/xts5/Xt4/XtMergeArgLists/XtMergeArgLists.m
@@ -0,0 +1,124 @@
+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/Xt4/XtMergeArgLists/XtMergeArgLists.m,v 1.1 2005-02-12 14:38:02 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/Xt4/XtMergeArgLists/XtMergeArgLists.m
+>>#
+>># Description:
+>># Tests for XtMergeArgLists()
+>>#
+>># Modifications:
+>># $Log: tmrgarglst.m,v $
+>># Revision 1.1 2005-02-12 14:38:02 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:22 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:11 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:27:32 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:06 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:15:56 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:19:42 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 XtMergeArgLists Xt4
+ArgList
+XtMergeArgLists(args1, num_args1, args2, num_args2)
+>>ASSERTION Good A
+A call to ArgList XtMergeArgLists(args1, num_args1, args2, num_args2) shall
+combine args1 and args2, store them in a newly allocated ArgList, and
+return a pointer the new ArgList.
+>>CODE
+Arg list_one[1], list_two[1] ;
+ArgList ArgPtr;
+
+ avs_xt_hier("Tmrgarglst1", "XtMergeArgLists");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Allocate memory for list");
+ ArgPtr = (Arg *) malloc(sizeof(Arg));
+ tet_infoline("PREP: Construct two argument lists to be merged");
+ list_one[0].name = "Hello";
+ list_one[0].value = (XtArgVal) 100;
+ list_two[0].name = "World";
+ list_two[0].value = (XtArgVal) 100;
+ tet_infoline("PREP: Call XtMergeArgList");
+ ArgPtr = XtMergeArgLists(&list_one[0], 1, &list_two[0], 1);
+ tet_infoline("TEST: Two lists were merged");
+ check_str("Hello", ArgPtr[0].name, "ArgPtr[0].name");
+ check_dec(100, ArgPtr[0].value, "ArgPtr[0].value");
+ check_str("World", ArgPtr[1].name, "ArgPtr[1].name");
+ check_dec(100, ArgPtr[1].value, "ArgPtr[1].value");
+ XtFree((char *)ArgPtr);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A call to ArgList XtMergeArgLists(args1, num_args1, args2, num_args2)
+shall not check for duplicate entries in args1 and args2.
+>>CODE
+Arg list_one[1], list_two[1] ;
+ArgList ArgPtr;
+
+ avs_xt_hier("Tmrgarglst2", "XtMergeArgLists");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Allocate memory for list");
+ ArgPtr = (Arg *) malloc(sizeof(Arg));
+ tet_infoline("PREP: Construct two overlapping argument lists to be merged");
+ list_one[0].name = "Hello";
+ list_one[0].value = (XtArgVal) 100;
+ list_two[0].name = "Hello";
+ list_two[0].value = (XtArgVal) 100;
+ tet_infoline("PREP: Call XtMergeArgList");
+ ArgPtr = XtMergeArgLists(&list_one[0], 1, &list_two[0], 1);
+ tet_infoline("TEST: Duplicates retained when two lists were merged");
+ check_str("Hello", ArgPtr[0].name, "ArgPtr[0].name");
+ check_dec(100, ArgPtr[0].value, "ArgPtr[0].value");
+ check_str("Hello", ArgPtr[1].name, "ArgPtr[1].name");
+ check_dec(100, ArgPtr[1].value, "ArgPtr[1].value");
+ XtFree((char *)ArgPtr);
+ tet_result(TET_PASS);
+>>ASSERTION Good B 3
+On a call to
+ArgList XtMergeArgLists(args1, num_args1, args2, num_args2)
+the length of the new list shall be the sum of args1 and args2.
diff --git a/xts5/Xt4/XtName/XtName.m b/xts5/Xt4/XtName/XtName.m
new file mode 100644
index 00000000..5c8d6074
--- /dev/null
+++ b/xts5/Xt4/XtName/XtName.m
@@ -0,0 +1,81 @@
+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/Xt4/XtName/XtName.m,v 1.1 2005-02-12 14:38:03 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/Xt4/XtName/XtName.m
+>>#
+>># Description:
+>># Tests for XtName()
+>>#
+>># Modifications:
+>># $Log: tname.m,v $
+>># Revision 1.1 2005-02-12 14:38:03 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:31 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:22 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:27:41 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:15 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:16:26 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:20: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;
+>>TITLE XtName Xt4
+String
+XtName(object)
+>>ASSERTION Good A
+A call to String XtName(object) shall return a pointer to the
+instance name of object.
+>>CODE
+Widget labelw_good;
+
+ avs_xt_hier("Tname1", "XtName");
+ tet_infoline("PREP: Create test label widget name `Hello' in first box widget");
+ labelw_good = (Widget) CreateLabelWidget("Hello", boxw1);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: XtName returns instance name");
+ check_str("Hello", XtName(labelw_good), "labelw_good name");
+ tet_result(TET_PASS);
diff --git a/xts5/Xt4/XtOpenDisplay/XtOpenDisplay.m b/xts5/Xt4/XtOpenDisplay/XtOpenDisplay.m
new file mode 100644
index 00000000..d0383fc1
--- /dev/null
+++ b/xts5/Xt4/XtOpenDisplay/XtOpenDisplay.m
@@ -0,0 +1,889 @@
+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/Xt4/XtOpenDisplay/XtOpenDisplay.m,v 1.1 2005-02-12 14:38:03 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/Xt4/XtOpenDisplay/XtOpenDisplay.m
+>>#
+>># Description:
+>># Tests for XtOpenDisplay()
+>>#
+>># Modifications:
+>># $Log: topndsply.m,v $
+>># Revision 1.1 2005-02-12 14:38:03 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:19 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:08 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.1 1998/06/23 22:52:09 andy
+>># Added sleep(XT_RESET_DELAY) to each test. SR# 186.
+>>#
+>># Revision 6.0 1998/03/02 05:27:30 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.1 1998/02/04 23:16:27 andy
+>># Editorial
+>>#
+>># Revision 5.0 1998/01/26 03:24:03 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.1 1998/01/13 03:19:37 andy
+>># In test 20, changed closure_ret from XtPointer * to XtPointer (SR 146).
+>>#
+>># Revision 4.0 1995/12/15 09:15:48 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:19:32 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+#include <X11/Xatom.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+char *args11[] = {
+ "-background", "green",
+ "-bd", "green",
+ "-bg", "green",
+ "-borderwidth", "3",
+ "-bordercolor", "red",
+ "-bw", "3",
+ "-fg", "green",
+ "-font", XtDefaultFont,
+ "-fn", XtDefaultFont,
+ "-foreground", "blue",
+ "-geometry", "100x100",
+ "-iconic",
+ "-reverse",
+ "-rv",
+ "+rv",
+ "-selectionTimeout", "50",
+ "-synchronous",
+ "+synchronous",
+ "-title", "ApTest",
+ "-xnlLanguage", "C",
+ NULL};
+
+
+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, "very bad idea"
+ },
+};
+>>TITLE XtOpenDisplay Xt4
+Display *
+XtOpenDisplay(app_context, display_string, application_name, application_class, options, num_options, argc, argv)
+>>ASSERTION Good A
+A successful call to
+Display *XtOpenDisplay(app_context, display_string,
+application_name, application_class, options, num_options, argc, argv)
+shall open the display specified by the argument display_string, create
+a resource database for the display, and return a pointer to the opened
+display.
+>>CODE
+Display *display_good;
+String name_good, class_good;
+int argcount = 0;
+
+ XtToolkitInitialize();
+ app_ctext= XtCreateApplicationContext();
+ tet_infoline("TEST: Open display");
+ sleep(config.reset_delay);
+ display_good = XtOpenDisplay(
+ app_ctext, /* application context */
+ (String)config.display, /* display name */
+ "topndsply1", /* application name use argv[0] */
+ "Topndsply1", /* application class */
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0, /* command line options */
+ &argcount,
+ (String *)NULL /* command line args */
+ );
+ if (display_good == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("PREP: Get the application name and class");
+ XtGetApplicationNameAndClass(display_good, &name_good, &class_good );
+ tet_infoline("TEST: Application name and class.");
+ check_str("topndsply1", name_good, "Name of Application:");
+ check_str("Topndsply1", class_good,"Class of Application:");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+Display *XtOpenDisplay(app_context, display_string,
+application_name, application_class, options, num_options, argc, argv)
+when display_string is NULL shall use the -display option specified in
+argv as the display to be opened and initialized.
+>>CODE
+char name_good[40];
+Display *display_good;
+char *display_name;
+int argc_count;
+char **argv_string;
+int count = 3;
+char *argvals[4];
+
+ XtToolkitInitialize();
+ app_ctext= XtCreateApplicationContext();
+ tet_infoline("PREP: Construct -display option");
+ argvals[0] = "topndsply2";
+ argvals[1] = "-display";
+ argvals[2] = (char *)config.display;
+ argvals[3] = (char *)NULL;
+ argc_count = count;
+ argv_string = &argvals[0];
+ tet_infoline("TEST: Open display");
+ sleep(config.reset_delay);
+ display_good = XtOpenDisplay(
+ app_ctext, /* application context */
+ (String)NULL, /* display name */
+ "topndsply2", /* application name use argv[0] */
+ "Topndsply2", /* application class */
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0, /* command line options */
+ &argc_count,
+ argv_string /* command line args */
+ );
+ if (display_good == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("TEST: Display name is correct.");
+ display_name = XDisplayString(display_good);
+ check_str(config.display, display_name, "Display name");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+Display *XtOpenDisplay(app_context, display_string, application_name,
+application_class, options, num_options, argc, argv)
+when display_string is NULL and the -display option is not specified
+in argv shall use the value set in the DISPLAY environment variable as
+the display to be opened and initialized.
+>>CODE
+Display *display_good;
+String name_good, class_good;
+char return_name[40];
+char *display_name;
+int argcount = 0;
+
+ XtToolkitInitialize();
+ app_ctext= XtCreateApplicationContext();
+ sprintf(ebuf, "DISPLAY=%s", config.display);
+ putenv(ebuf);
+ tet_infoline("TEST: Open display");
+ sleep(config.reset_delay);
+ display_good = XtOpenDisplay(
+ app_ctext, /* application context */
+ (String)NULL, /* display name */
+ "topndsply3", /* application name use argv[0] */
+ "Topndsply3", /* application class */
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0, /* command line options */
+ &argcount,
+ (String *)NULL /* command line args */
+ );
+ if (display_good == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("TEST: Check the env DISPLAY name is used.");
+ display_name = XDisplayString(display_good);
+ check_str(config.display, display_name, "Display name");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+Display *XtOpenDisplay(app_context, display_string,
+application_name, application_class, options, num_options, argc, argv)
+when the -name option is specified in argv shall use this value as the
+application name to query the server and screen resource databases for
+the name.xnlLanguage resource to create the resource database for the display.
+>>CODE
+Display *display_good;
+String name_good, class_good;
+int argc_count;
+char **argv_string;
+int count = 3;
+char *argvals[4];
+
+ XtToolkitInitialize();
+ app_ctext= XtCreateApplicationContext();
+ tet_infoline("PREP: Construct -name option");
+ argvals[0] = "topndsply4";
+ argvals[1] = "-name";
+ argvals[2] = "topndsply4";
+ argvals[3] = (char *)NULL;
+ argc_count = count;
+ argv_string = &argvals[0];
+ tet_infoline("TEST: Open display");
+ sleep(config.reset_delay);
+ display_good = XtOpenDisplay(
+ app_ctext, /* application context */
+ (String)config.display, /* display name */
+ (String)NULL, /* application name use argv[0] */
+ "Topndsply4", /* application class */
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0, /* command line options */
+ &argc_count,
+ argv_string /* command line args */
+ );
+ if (display_good == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("PREP: Get the application name");
+ XtGetApplicationNameAndClass(display_good, &name_good,
+ &class_good );
+ tet_infoline("TEST: Application name");
+ check_str("topndsply4", name_good, "Name of Application:");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+Display *XtOpenDisplay(app_context, display_string,
+application_name, application_class, options, num_options, argc, argv)
+when the -name option is not specified in argv and application_name is
+non-NULL shall use this value as the application name to query the
+server and the screen resource databases for the name.xnlLanguage
+resource to create the resource database for the display.
+>>CODE
+Display *display_good;
+String name_good, class_good;
+int argcount = 0;
+
+ XtToolkitInitialize();
+ app_ctext= XtCreateApplicationContext();
+ tet_infoline("TEST: Open display");
+ sleep(config.reset_delay);
+ display_good = XtOpenDisplay(
+ app_ctext, /* application context */
+ (String)config.display, /* display name */
+ "topndsply5", /* application name use argv[0] */
+ "Topndsply5", /* application class */
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0, /* command line options */
+ &argcount,
+ (String *)NULL /* command line args */
+ );
+ if (display_good == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("PREP: Get the application name");
+ XtGetApplicationNameAndClass(display_good, &name_good,
+ &class_good );
+ tet_infoline("TEST: Application name");
+ check_str("topndsply5", name_good, "Name of Application");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+Display *XtOpenDisplay(app_context, display_string,
+application_name, application_class, options, num_options, argc, argv)
+when the -name option is not specified in argv, application_name is
+NULL, and the environment variable RESOURCE_NAME is set shall use this
+value as the application name to query the server and screen resource
+databases for the name.xnlLanguage resource to create the resource database
+for the display.
+>>CODE
+Display *display_good;
+String name_good, class_good;
+int argcount = 0;
+
+ XtToolkitInitialize();
+ app_ctext= XtCreateApplicationContext();
+ tet_infoline("PREP: Set up env variable RESOURCE_NAME=topndsply5");
+ putenv("RESOURCE_NAME=topndsply6");
+ tet_infoline("TEST: Open display");
+ sleep(config.reset_delay);
+ display_good = XtOpenDisplay(
+ app_ctext, /* application context */
+ (String)config.display, /* display name */
+ (String)NULL, /* application name use argv[0] */
+ "Topndsply6", /* application class */
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0, /* command line options */
+ &argcount,
+ (String *)NULL /* command line args */
+ );
+ if (display_good == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("PREP: Get the application name");
+ XtGetApplicationNameAndClass(display_good, &name_good, &class_good );
+ tet_infoline("TEST: Application name");
+ check_str("topndsply6", name_good, "Name of Application:");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to Display *XtOpenDisplay(app_context, display_string,
+application_name, application_class, options, num_options, argc, argv)
+when the -name option is not specified in argv, application_name is NULL,
+the environment variable RESOURCE_NAME is not set, and argv[0] is not an
+empty string shall use this value as the application name to query the
+server and screen resource databases for the name.xnlLanguage resource to
+create the resource database for the display.
+>>CODE
+Display *display_good;
+String name_good, class_good;
+int argc_count;
+char **argv_string;
+char argv1[] = "topndsply7";
+char *argvals[2] = { "topndsply7", 0 };
+int count = 1;
+
+ argc_count = count;
+ argv_string = &argvals[0];
+ XtToolkitInitialize();
+ app_ctext= XtCreateApplicationContext();
+ tet_infoline("TEST: Open display");
+ sleep(config.reset_delay);
+ display_good = XtOpenDisplay(
+ app_ctext, /* application context */
+ (String)config.display, /* display name */
+ (String)NULL, /* application name use argv[0] */
+ "Topndsply7", /* application class */
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0, /* command line options */
+ &argc_count,
+ (String *)argv_string /* command line args */
+ );
+ if (display_good == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("PREP: Get the application name");
+ XtGetApplicationNameAndClass(display_good, &name_good, &class_good );
+ tet_infoline("TEST: Application name");
+ check_str("topndsply7", name_good, "Name of Application:");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to Display *XtOpenDisplay(app_context, display_string,
+application_name, application_class, options, num_options, argc, argv)
+when the -name option is not specified in argv, application_name is NULL,
+the environment variable RESOURCE_NAME is not set, and argv[0] is an empty
+string shall use the string "main" as the application name to query the
+server and screen resource databases for the name.xnlLanguage resource to
+create the resource database for the display.
+>>CODE
+Display *display_good;
+String name_good, class_good;
+int argcount = 0;
+
+ XtToolkitInitialize();
+ app_ctext= XtCreateApplicationContext();
+ tet_infoline("TEST: Open display");
+ sleep(config.reset_delay);
+ display_good = XtOpenDisplay(
+ app_ctext, /* application context */
+ (String)config.display, /* display name */
+ (String)NULL, /* application name use argv[0] */
+ "Topndsply1", /* application class */
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0, /* command line options */
+ &argcount,
+ (String *)NULL /* command line args */
+ );
+ if (display_good == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("PREP: Get the application name");
+ XtGetApplicationNameAndClass(display_good, &name_good,
+ &class_good );
+ tet_infoline("TEST: Application name is main");
+ check_str("main", name_good, "Name of Application:");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A call to
+Display *XtOpenDisplay(app_context, display_string, application_name,
+application_class, options, num_options, argc, argv)
+shall return NULL on failure.
+>>CODE
+Display *display_good;
+String name_good, class_good;
+int argcount = 0;
+
+ XtToolkitInitialize();
+ app_ctext= XtCreateApplicationContext();
+ tet_infoline("TEST: Open display");
+ sleep(config.reset_delay);
+ display_good = XtOpenDisplay(
+ app_ctext, /* application context */
+ "gibberish", /* display name */
+ "topndsply1", /* application name use argv[0] */
+ "Topndsply1", /* application class */
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0, /* command line options */
+ &argcount,
+ (String *)NULL /* command line args */
+ );
+ tet_infoline("TEST: returns NULL with non-existant display");
+ if (display_good != NULL) {
+ tet_infoline("ERROR: expected NULL, got a display");
+ tet_result(TET_FAIL);
+ }
+ tet_result(TET_PASS);
+>>#
+>># Start of XtDisplayInitialize assertions
+>>#
+>>ASSERTION Good A
+When the synchronize resource is set to True in the resource database
+created by a successful call to
+Display *XtOpenDisplay(app_context, display_string, application_name,
+application_class, options, num_options, argc, argv)
+it shall
+put Xlib into synchronous mode for this display connection
+and any others currently open in the application context app_context.
+>>CODE
+Window window;
+int scr;
+static char *property_data = "Hello World";
+XtAppContext app_ctext;
+Display *display;
+int queued_events, events;
+int argc = 2;
+ /*
+ ** -synchronous on
+ ** +synchronous off
+ */
+char *argv[] = { "tdsplyintl2", "-synchronous", (char *)NULL };
+
+ tet_infoline("PREP: Initialize the Xt toolkit");
+ XtToolkitInitialize();
+ tet_infoline("PREP: Create an application context");
+ app_ctext = XtCreateApplicationContext();
+ tet_infoline("TEST: Open a display connection");
+ sleep(config.reset_delay);
+ display = XtOpenDisplay(app_ctext,
+ config.display,
+ "tdsplyintl2",
+ "Tdsplyintl2",
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0,
+ &argc, &argv[0] );
+ if (display == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("PREP: Create a window for events");
+ scr = DefaultScreen(display);
+ window = XCreateWindow(display, RootWindow(display, scr),
+ 0, 0, 5, 5, 0, /* x,y,wid,ht,brd width */
+ DefaultDepth(display, scr),
+ InputOutput,
+ DefaultVisual(display, scr),
+ (XtValueMask) 0,
+ (XSetWindowAttributes *) 0);
+ tet_infoline("TEST: Check Xlib is in synchronous mode");
+ queued_events = XQLength(display);
+ XSelectInput(display, window,
+ (unsigned long)PropertyChangeMask);
+ for (events = 0; events < 3; events++)
+ XChangeProperty(display, window, XA_RESOURCE_MANAGER,
+ XA_STRING, 8,0, (unsigned char *)property_data, 16);
+ check_dec(3+queued_events, XQLength(display), "queue length");
+ tet_result(TET_PASS);
+>>ASSERTION Good D 0
+If the implementation is X11R5 or later:
+When a language procedure has been registered for the application context
+.A app_context
+a successful call to
+Display *XtOpenDisplay(app_context, display_string, application_name,
+application_class, options, num_options, argc, argv)
+shall call the language procedure with a language string determined
+by searching the following sources in the specified order:
+
+- the -xnlLanguage resource or a -xrm option containing the
+ xnlLanguage/XnlLanguage resource defined in the command line,
+
+- the resource application_name.xnlLanguage, class
+ application_class.XnlLanguage in the server's RESOURCE_MANAGER
+ property for the root window of screen zero if it exists, and in
+ the user preference resource file otherwise.
+>>ASSERTION Good D 0
+If the implementation is X11R5 or later:
+When a language procedure has been registered for the application context
+.A app_context
+a successful call to
+Display *XtOpenDisplay(app_context, display_string, application_name,
+application_class, options, num_options, argc, argv)
+shall call the procedure with the empty string if the server's
+RESOURCE_MANAGER property for the root window of screen zero exists
+and a language string is not found on the command line or in this
+property.
+>>ASSERTION Good D 0
+If the implementation is X11R5 or later:
+When a language procedure has been registered for the application context
+.A app_context
+a successful call to
+Display *XtOpenDisplay(app_context, display_string, application_name,
+application_class, options, num_options, argc, argv)
+shall call the procedure with the empty string if the server's
+RESOURCE_MANAGER property for the root window of screen zero does not exist
+and a language string is not found on the command line or in the user
+preference resource file.
+>>ASSERTION Good D 0
+If the implementation is X11R5 or later:
+When a language procedure has not been registered for the application context
+.A app_context
+a successful call to
+Display *XtOpenDisplay(app_context, display_string, application_name,
+application_class, options, num_options, argc, argv)
+shall determine a language string for the display
+by searching the following sources in the specified order:
+
+- the resource database created from the command line.
+
+- the resource application_name.xnlLanguage, class
+ application_class.XnlLanguage in the server's RESOURCE_MANAGER
+ property for the root window of screen zero if it exists, or in
+ the user preference resource file otherwise.
+
+- the environment.
+>>ASSERTION Good D 0
+If the implementation is X11R5 or later and is POSIX-based:
+When a language procedure has not been registered for the application context
+.A app_context
+a successful call to
+Display *XtOpenDisplay(app_context, display_string, application_name,
+application_class, options, num_options, argc, argv)
+shall use the LANG environment variable as the environment value to
+search when determining the language string for the display.
+>>ASSERTION Good D 0
+If the implementation is X11R5 or later:
+When a language procedure has not been registered for the application context
+.A app_context
+a successful call to
+Display *XtOpenDisplay(app_context, display_string, application_name,
+application_class, options, num_options, argc, argv)
+shall set the language string for the display to the empty string if the
+server's RESOURCE_MANAGER property for the root window of screen zero exists,
+and a language string is not found on the command line, in this
+property, or in the environment.
+>>ASSERTION Good D 0
+If the implementation is X11R5 or later:
+When a language procedure has not been registered for the application context
+.A app_context
+a successful call to
+Display *XtOpenDisplay(app_context, display_string, application_name,
+application_class, options, num_options, argc, argv)
+shall set the language string for the display to the empty string if the
+server's RESOURCE_MANAGER property for the root window of screen zero does
+not exist and a language string is not found on the command line, in the user
+preference resource file, or in the environment.
+>>ASSERTION Good D 0
+A successful call to
+Display *XtOpenDisplay(app_context, display_string, application_name,
+application_class, options, num_options, argc, argv)
+shall associate with the default screen of the display a resource
+database created by combining entries from the following sources,
+in order, with the first named source having the highest precedence:
+
+- the application command line
+
+- the user's environment resource file
+
+- per-screen resource specifications from the server, as returned by
+ XScreenResourceString()
+
+- per display resource specifications from the server (the
+ server's RESOURCE_MANAGER property for the root window of
+ screen zero) if they exist, otherwise the user preference file
+
+- the application-specific user resource file.
+
+- the application-specific class resource file .
+>>ASSERTION Good A
+A successful call to
+Display *XtOpenDisplay(app_context, display_string, application_name,
+application_class, options, num_options, argc, argv)
+shall recognize options specified on the command line that are in the
+standard table of options in section 4.4 of the specification or in
+the table specific to the application specified by
+.A options
+and
+.A num_options.
+>>CODE
+Display *display_good;
+String name_good, class_good;
+int argcount = 20;
+instance_variable_rec base;
+pid_t pid2;
+
+ FORK(pid2);
+ XtToolkitInitialize();
+ app_ctext= XtCreateApplicationContext();
+ tet_infoline("TEST: Open display");
+ sleep(config.reset_delay);
+ display_good = XtOpenDisplay(
+ app_ctext, /* application context */
+ (String)config.display, /* display name */
+ "topndsply1", /* application name use argv[0] */
+ "Topndsply1", /* application class */
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0, /* command line options */
+ &argcount,
+ args11 /* command line args */
+ );
+ if (display_good == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("TEST: Create top level widget");
+ topLevel = XtAppCreateShell("Hello", "World",
+ applicationShellWidgetClass, display_good,
+ (ArgList)NULL, (Cardinal)0);
+ tet_infoline("TEST: Retrieve resource values from resource database");
+ XtGetApplicationResources(topLevel,
+ &base,
+ resources,
+ 1,
+ (ArgList)NULL,
+ (Cardinal)0);
+ tet_infoline("TEST: Retrieved resource value");
+ if ((base.foreground != 0) && (base.foreground != 1)) {
+ sprintf(ebuf, "ERROR: expected foreground value of 0 or 1, received %d", base.foreground);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+Display *XtOpenDisplay(app_context, display_string, application_name,
+application_class, options, num_options, argc, argv)
+when the reverseVideo resource is define as True on the command line shall use
+the value of XtDefaultForeground instead of XtDefaultBackground and
+vice versa in the resource database created for the display.
+>>CODE
+Window window;
+int scr;
+static char *property_data = "Hello World";
+XtAppContext app_ctext;
+Display *display;
+int queued_events, events;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+Boolean closure;
+XtPointer closure_ret = (XtPointer *) &closure;
+int argc = 2;
+char *argv[] = { "tdsplyintl2", "+rv", (char *)NULL };
+Screen *screen;
+Colormap colormap;
+pid_t pid2;
+Pixel res;
+Boolean status;
+
+ FORK(pid2);
+ tet_infoline("PREP: Initialize the Xt toolkit");
+ XtToolkitInitialize();
+ tet_infoline("PREP: Create an application context");
+ app_ctext = XtCreateApplicationContext();
+ tet_infoline("TEST: Open a display connection with +rv in args");
+ sleep(config.reset_delay);
+ display = XtOpenDisplay(app_ctext,
+ config.display,
+ "tdsplyintl2",
+ "Tdsplyintl2",
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0,
+ &argc, &argv[0] );
+ if (display == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ 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: Convert XtDefaultForeground");
+ fromVal.addr = XtDefaultForeground;
+ fromVal.size = strlen(XtDefaultForeground)+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");
+ tet_infoline("TEST: Convert XtDefaultBackground");
+ fromVal.addr = XtDefaultBackground;
+ fromVal.size = strlen(XtDefaultBackground)+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);
+>>ASSERTION Good B 5
+A successful call to
+Display *XtOpenDisplay(app_context, display_string, application_name,
+application_class, options, num_options, argc, argv)
+when the application context app_context has more than one display and
+the selectionTimeout resource is specified on the command line shall set
+this value in the selectionTimeout resource in the resource databases
+of all the displays in the application context.
+>>ASSERTION Good D 0
+If the implementation is POSIX-based:
+A successful call to
+Display *XtOpenDisplay(app_context, display_string, application_name,
+application_class, options, num_options, argc, argv)
+when the environment variable XENVIRONMENT exists shall use the value
+of this variable as the name of the user environment resource file.
+>>ASSERTION Good D 0
+If the implementation is POSIX-based:
+A successful call to
+Display *XtOpenDisplay(app_context, display_string, application_name,
+application_class, options, num_options, argc, argv)
+when the environment variable XENVIRONMENT does not exist shall use
+the file .Xdefaults-host, where host is the name of the system running
+the application, in the user's home directory as the user environment
+resource file.
+>>ASSERTION Good B 0
+A successful call to
+Display *XtOpenDisplay(app_context, display_string, application_name,
+application_class, options, num_options, argc, argv)
+shall set the values from the higher precedence sources of the resource
+database being created for the display as the current resource database
+before determining the file name for the application-specific user resource file.
+>>ASSERTION Good D 0
+If the implementation is POSIX-based:
+A successful call to
+Display *XtOpenDisplay(app_context, display_string, application_name,
+application_class, options, num_options, argc, argv)
+when the environment variable XUSERFILESEARCHPATH is defined
+shall use the result of calling XtResolvePathname(display, path,
+NULL, NULL, NULL, NULL, 0, NULL) with the value of this variable as path
+as the name of the application-specific user resource file.
+>>ASSERTION Good D 0
+If the implementation is POSIX-based:
+A successful call to
+Display *XtOpenDisplay(app_context, display_string, application_name,
+application_class, options, num_options, argc, argv)
+when the environment variable XUSERFILESEARCHPATH is not defined and
+the environment variable XAPPLRESDIR is not defined shall
+use the result of calling XtResolvePathname(display, path,
+NULL, NULL, NULL, NULL, 0, NULL) as the name of the application-specific
+user resource file where path contains at least entries containing $HOME as
+the directory prefix plus the following substitutions, in the order specified:
+
+- %C, %N, %L or %C, %N, %l, %t, %c
+
+- %C, %N, %l
+
+- %C, %N
+
+- %N, %L or %N, %l, %t, %c
+
+- %N, %l
+
+- %N
+>>ASSERTION Good D 0
+If the implementation is POSIX-based:
+A successful call to
+Display *XtOpenDisplay(app_context, display_string, application_name,
+application_class, options, num_options, argc, argv)
+when the environment variable XUSERFILESEARCHPATH is not defined and
+the environment variable XAPPLRESDIR is defined shall use the result
+of calling XtResolvePathname(display, path, NULL, NULL, NULL, NULL, 0, NULL)
+as the name of the application-specific user resource file where path
+contains at least entries containing the following directory prefixes and
+substitutions, in the order specified:
+
+- $XPPLRESDIR with %C, %N, %L or %C, %N, %l, %t, %c
+
+- $XPPLRESDIR with %C, %N, %l
+
+- $XPPLRESDIR with %C, %N
+
+- $XPPLRESDIR with %N, %L or %N, %l, %t, %c
+
+- $XPPLRESDIR with %N, %l
+
+- $XPPLRESDIR with %N
+
+- $HOME with %N
+>>ASSERTION Good B 0
+A successful call to
+Display *XtOpenDisplay(app_context, display_string, application_name,
+application_class, options, num_options, argc, argv)
+shall use the result of calling XtResolvePathname(display, "app-defaults",
+NULL, NULL, NULL, NULL, 0, NULL) as the name of the application-specific
+class resource file, with the values from the higher precedence sources of
+the resource database being created for the display set as the current
+resource database before the call is made.
diff --git a/xts5/Xt4/XtParent/XtParent.m b/xts5/Xt4/XtParent/XtParent.m
new file mode 100644
index 00000000..83e5c7f4
--- /dev/null
+++ b/xts5/Xt4/XtParent/XtParent.m
@@ -0,0 +1,91 @@
+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/Xt4/XtParent/XtParent.m,v 1.1 2005-02-12 14:38:03 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/Xt4/XtParent/XtParent.m
+>>#
+>># Description:
+>># Tests for XtParent()
+>>#
+>># Modifications:
+>># $Log: tparent.m,v $
+>># Revision 1.1 2005-02-12 14:38:03 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:28 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:18 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:27:38 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:12 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:16:20 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:20: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 XtParent Xt4
+Widget
+XtParent(w)
+>>ASSERTION Good A
+A call to Widget XtParent(w) shall return the parent object for the widget w.
+>>CODE
+Widget ret_parent, test_lw, test_rw;
+Widget widget_good , labelw_good;
+Widget rowcolw_good;
+
+ avs_xt_hier("Tparent1", "XtParent");
+ tet_infoline("PREP: Create rowcolw_good widget in box1w widget");
+ rowcolw_good = (Widget) CreateRowColWidget(boxw1);
+ tet_infoline("PREP: Create test label widget name `Hello' in first box widget");
+ labelw_good = (Widget) CreateLabelWidget("Hello", rowcolw_good);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: A call to XtParent shall return parent row column widget");
+ tet_infoline(" of the label Hello widget");
+ widget_good = (Widget)XtParent(labelw_good);
+ if (widget_good == NULL) {
+ tet_infoline("ERROR: Expected parent widget instance returned NULL");
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: Returned widget is indeed parent row column widget");
+ check_str("rowcolw", XtName(widget_good), "widget name");
+ tet_result(TET_PASS);
diff --git a/xts5/Xt4/XtRealizeWidget/XtRealizeWidget.m b/xts5/Xt4/XtRealizeWidget/XtRealizeWidget.m
new file mode 100644
index 00000000..aff34bf7
--- /dev/null
+++ b/xts5/Xt4/XtRealizeWidget/XtRealizeWidget.m
@@ -0,0 +1,149 @@
+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/Xt4/XtRealizeWidget/XtRealizeWidget.m,v 1.1 2005-02-12 14:38:04 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/Xt4/XtRealizeWidget/XtRealizeWidget.m
+>>#
+>># Description:
+>># Tests for XtRealizeWidget()
+>>#
+>># Modifications:
+>># $Log: trealwdgt.m,v $
+>># Revision 1.1 2005-02-12 14:38:04 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:27 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:17 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:27:37 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:10 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:16:15 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:20: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 XtRealizeWidget Xt4
+void
+XtRealizeWidget(w)
+>>ASSERTION Good B 0
+A call to void XtRealizeWidget(w) shall bind all action names in the
+translation table of the widget w to procedures.
+>>ASSERTION Good A
+A call to void XtRealizeWidget(w) when the widget w is already realized
+shall return immediately.
+>>CODE
+Window window_good;
+Widget widget_good, labelw_good;
+Display *display_good;
+
+ avs_xt_hier("Trealwdgt2", "XtRealizeWidget");
+ tet_infoline("PREP: Create test label widget `Hello' in box widget");
+ labelw_good = (Widget) CreateLabelWidget("Hello", boxw1);
+ tet_infoline("TEST: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Call XtRealize again");
+ XtRealizeWidget(topLevel);
+ tet_result(TET_PASS);
+>>ASSERTION Good B 0
+A call to void XtRealizeWidget(w) shall make a post order traversal of the
+widget tree starting at the widget w and call each non-NULL change_managed
+procedure of all composite widgets that have one or more managed
+children in the reverse order of their appearance in the CompositePart
+children list.
+>>ASSERTION Good B 0
+A call to void XtRealizeWidget(w) when the widget w is not a subclass of
+compositeWidgetClass shall return without realizing or mapping its children.
+>>ASSERTION Good B 0
+A successful call to void XtRealizeWidget(w) shall recursively descend the
+widget tree starting at the widget w and call the realize procedures of all
+the managed children in the reverse order of their appearance in the
+CompositePart children list, passing to them the widget, a XtValueMask, and
+a XSetWindowAttributes structure as parameters.
+>>ASSERTION Good B 0
+A successful call to void XtRealizeWidget(w) shall set the
+background_pixmap, border_pixmap, and the colormap fields of the
+XSetWindowAttributes structure to their corresponding fields in the
+widget core structure before passing it to the realize procedures of
+the managed children.
+>>ASSERTION Good B 0
+A successful call to void XtRealizeWidget(w) shall set the
+event_mask field of the XSetWindowAttributes structure to indicate the
+event handlers registered, the event translations specified, the expose
+field is non-NULL, and the visible_interest field is True before passing
+it to the realize procedures of the managed children.
+>>ASSERTION Good B 0
+A successful call to void XtRealizeWidget(w) shall set the
+bit_gravity field of the XSetWindowAttributes structure, before passing
+it to the realize procedures of the managed children, to NorthWestGravity
+when the expose field of the widget core structure is NULL.
+>>ASSERTION Good B 0
+A successful call to void XtRealizeWidget(w) shall map the windows of all the
+managed children that have the mapped_when_managed field set to True.
+>>ASSERTION Good A
+A successful call to void XtRealizeWidget(w) when the widget w is a top-level shell
+widget and has the mapped_when_managed field set to True shall map the
+widget window.
+>>CODE
+Window window_good;
+Widget widget_good;
+Display *display_good;
+
+ avs_xt_hier("Trealwdgt2", "XtRealizeWidget");
+ tet_infoline("TEST: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Check XtWindow() returns valid window id");
+ if ((window_good = XtWindow(topLevel) ) <= 0 ) {
+ sprintf(ebuf, "ERROR: Expected Valid window id returned %d", window_good);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ exit(0);
+ }
+ tet_infoline("TEST: Window id is correct");
+ display_good = XtDisplay(topLevel);
+ widget_good = XtWindowToWidget(display_good, window_good);
+ check_str("VSW5 X Toolkit Tests", XtName(topLevel), "widget name");
+ tet_result(TET_PASS);
+>>ASSERTION Good B 0
+A call to void XtRealizeWidget(w) when the widget w is a top-level shell
+widget and has the mapped_when_managed field set to a value other than
+True shall not map the widget window.
diff --git a/xts5/Xt4/XtScreen/XtScreen.m b/xts5/Xt4/XtScreen/XtScreen.m
new file mode 100644
index 00000000..7149f6f4
--- /dev/null
+++ b/xts5/Xt4/XtScreen/XtScreen.m
@@ -0,0 +1,88 @@
+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/Xt4/XtScreen/XtScreen.m,v 1.1 2005-02-12 14:38:07 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/Xt4/XtScreen/XtScreen.m
+>>#
+>># Description:
+>># Tests for XtScreen()
+>>#
+>># Modifications:
+>># $Log: tscreen.m,v $
+>># Revision 1.1 2005-02-12 14:38:07 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:29 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:19 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:27:39 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:12 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:16:21 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:20:14 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 XtScreen Xt4
+Screen *
+XtScreen(w)
+>>ASSERTION Good A
+A call to Screen *XtScreen(w) shall return the screen pointer for the widget w.
+>>CODE
+Screen *screen_good, *ret_screen;
+Display *display_good;
+int screen_id_good , ret_screen_id;
+
+ avs_xt_hier("Tscreen1", "XtScreen");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: XtScreen shall return the screen pointer for labelw widget");
+ if ((screen_good = XtScreen(labelw)) == NULL) {
+ tet_infoline("ERROR: Expected Screen pointer returned NULL");
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: Returned screen pointer is valid");
+ display_good = XtDisplay(labelw);
+ ret_screen = XDefaultScreenOfDisplay(display_good);
+ ret_screen_id = XScreenNumberOfScreen(ret_screen);
+ screen_id_good = XScreenNumberOfScreen(screen_good);
+ check_dec(screen_id_good, ret_screen_id, "screen number");
+ tet_result(TET_PASS);
diff --git a/xts5/Xt4/XtScreenDatabase/XtScreenDatabase.m b/xts5/Xt4/XtScreenDatabase/XtScreenDatabase.m
new file mode 100644
index 00000000..b5386e7f
--- /dev/null
+++ b/xts5/Xt4/XtScreenDatabase/XtScreenDatabase.m
@@ -0,0 +1,122 @@
+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/Xt4/XtScreenDatabase/XtScreenDatabase.m,v 1.1 2005-02-12 14:38:08 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/Xt4/XtScreenDatabase/XtScreenDatabase.m
+>>#
+>># Description:
+>># Tests for XtScreenDatabase()
+>>#
+>># Modifications:
+>># $Log: tscrndtbs.m,v $
+>># Revision 1.1 2005-02-12 14:38:08 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:20 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:09 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:27:31 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:04 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:15:51 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:19:36 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 XtScreenDatabase Xt4
+XrmDatabase
+XtScreenDatabase(screen)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to XrmDatabase XtScreenDatabase(screen) shall return the
+fully merged resource database for the screen specified by the screen
+argument.
+>>CODE
+#if XT_X_RELEASE > 4
+Display *display;
+Widget labelw_good;
+Screen *screen_good;
+char *str_type;
+int argcount = 0;
+XrmValue value[1];
+XrmDatabase database;
+static String fallback_res[] = {
+ "*hello.labelString: Hello World",
+ NULL,
+};
+#endif
+
+#if XT_X_RELEASE > 4
+ avs_xt_hier("Tscrndtbs1", "XtScreenDatabase");
+ tet_infoline("TEST: Set default set of resource values.");
+ XtAppSetFallbackResources(app_ctext, fallback_res);
+ tet_infoline("TEST: Initialize display to add resources");
+ display = XtDisplay(topLevel);
+ XtDisplayInitialize(app_ctext, display,
+ "tscrndtbs1", "Tscrndtbs1",
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0, &argcount,
+ (String *)NULL );
+ tet_infoline("PREP: Create labelw_good widget 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 screen pointer for labelw widget");
+ if ((screen_good = XtScreen(labelw)) == NULL ) {
+ sprintf(ebuf, "ERROR: Expected Screen pointer returned NULL");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: Get the resource database");
+ database = XtScreenDatabase(screen_good);
+ tet_infoline("TEST: Check resource values");
+ XrmGetResource(database, "*hello.labelString", NULL, &str_type, &value[0]);
+ if (strncmp("Hello World", value[0].addr, strlen("Hello World")) != 0 ) {
+ sprintf(ebuf, "ERROR: Expected \"Hello World\" for hello.labelString, Received \"%s\"", value[0].addr);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation not X11R5 or greater");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt4/XtScreenOfObject/XtScreenOfObject.m b/xts5/Xt4/XtScreenOfObject/XtScreenOfObject.m
new file mode 100644
index 00000000..11545c8b
--- /dev/null
+++ b/xts5/Xt4/XtScreenOfObject/XtScreenOfObject.m
@@ -0,0 +1,117 @@
+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/Xt4/XtScreenOfObject/XtScreenOfObject.m,v 1.1 2005-02-12 14:38:05 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/Xt4/XtScreenOfObject/XtScreenOfObject.m
+>>#
+>># Description:
+>># Tests for XtScreenOfObject()
+>>#
+>># Modifications:
+>># $Log: tscnofobt.m,v $
+>># Revision 1.1 2005-02-12 14:38:05 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:30 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:20 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:27:40 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:14 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:16:23 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:20:18 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 XtScreenOfObject Xt4
+Screen *
+XtScreenOfObject(object)
+>>ASSERTION Good A
+A call to Screen *XtScreenOfObject(object) when object is a widget
+shall return the screen pointer for the widget.
+>>CODE
+Screen *screen_good, *ret_screen;
+Display *display_good;
+int ret_screen_id , screen_id_good;
+
+ avs_xt_hier("Tscnofobt1", "XtScreenOfObject");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Get the screen pointer for widget label");
+ if ((screen_good = XtScreenOfObject(labelw)) == NULL) {
+ sprintf(ebuf, "ERROR: Expected Screen pointer returned NULL");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: Returned screen pointer is valid");
+ display_good = XtDisplay(labelw);
+ ret_screen = XDefaultScreenOfDisplay(display_good);
+ ret_screen_id = XScreenNumberOfScreen(ret_screen);
+ screen_id_good = XScreenNumberOfScreen(screen_good);
+ check_dec(screen_id_good, ret_screen_id, "screen number");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A call to
+Screen *XtScreenOfObject(object)
+when object is not a widget shall return the screen pointer for the nearest
+ancestor of object that is of class Object or a subclass thereof.
+>>CODE
+Screen *screen_good, *ret_screen;
+Display *display_good;
+int ret_screen_id , screen_id_good;
+
+ avs_xt_hier("Tscnofobt2", "XtScreenOfObject");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Get the screen pointer for push button gadget");
+ if ((screen_good = XtScreenOfObject(click_quit)) == NULL) {
+ sprintf(ebuf, "ERROR: Expected Screen pointer returned NULL");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: Returned screen pointer is that of the gadget's parent");
+ display_good = XtDisplay(rowcolw);
+ ret_screen = XDefaultScreenOfDisplay(display_good);
+ ret_screen_id = XScreenNumberOfScreen(ret_screen);
+ screen_id_good = XScreenNumberOfScreen(screen_good);
+ check_dec(screen_id_good, ret_screen_id, "screen number");
+ tet_result(TET_PASS);
diff --git a/xts5/Xt4/XtSetArg/XtSetArg.m b/xts5/Xt4/XtSetArg/XtSetArg.m
new file mode 100644
index 00000000..0121dfa9
--- /dev/null
+++ b/xts5/Xt4/XtSetArg/XtSetArg.m
@@ -0,0 +1,111 @@
+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/Xt4/XtSetArg/XtSetArg.m,v 1.1 2005-02-12 14:38:09 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/Xt4/XtSetArg/XtSetArg.m
+>>#
+>># Description:
+>># Tests for XtSetArg()
+>>#
+>># Modifications:
+>># $Log: tstarg.m,v $
+>># Revision 1.1 2005-02-12 14:38:09 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:21 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:11 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:27:32 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:06 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:15:55 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:19:41 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+extern char * event_names[];
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+>>TITLE XtSetArg Xt4
+void
+XtSetArg(arg, resource_name, value)
+>>ASSERTION Good A
+A call to void XtSetArg(arg, resource_name, value) when the size of value
+is less than or equal to the size of XtArgVal shall set the arg.name
+member of the structure arg to resource_name and the arg.value member to
+value.
+>>CODE
+Display *display;
+Arg testarg;
+
+ tet_infoline("TEST: XtSetArg sets arg members correctly");
+ XtSetArg(testarg, "ApTest", 1);
+ if (strcmp(testarg.name, "ApTest") != 0) {
+ sprintf(ebuf, "ERROR: expected arg name = \"ApTest\", was \"%s\"", testarg.name);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (testarg.value != 1) {
+ sprintf(ebuf, "ERROR: expected value = 1, was %d", testarg.value);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A call to void XtSetArg(arg, resource_name, value) when the size of value
+is greater than the size of XtArgVal shall store a pointer to value in
+the arg.value member of the structure arg.
+>>CODE
+Display *display;
+Arg testarg;
+
+ tet_infoline("TEST: XtSetArg sets arg members correctly");
+ XtSetArg(testarg, "ApTest2", "A string");
+ if (strcmp(testarg.name, "ApTest2") != 0) {
+ sprintf(ebuf, "ERROR: expected arg name = \"ApTest2\", was \"%s\"", testarg.name);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (strncmp((char *)testarg.value, "A string", strlen("A string")) != 0) {
+ tet_infoline("ERROR: expected value to point to string");
+ tet_result(TET_FAIL);
+ }
+ tet_result(TET_PASS);
diff --git a/xts5/Xt4/XtSetLanguageProc/XtSetLanguageProc.m b/xts5/Xt4/XtSetLanguageProc/XtSetLanguageProc.m
new file mode 100644
index 00000000..65d78ca1
--- /dev/null
+++ b/xts5/Xt4/XtSetLanguageProc/XtSetLanguageProc.m
@@ -0,0 +1,440 @@
+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/Xt4/XtSetLanguageProc/XtSetLanguageProc.m,v 1.2 2005-04-21 09:40:42 ajosey Exp $
+
+Copyright (c) 2004 The Open Group
+Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995
+Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993
+All Rights Reserved.
+
+>>#
+>># Project: VSW5
+>>#
+>># File: tset/Xt4/XtSetLanguageProc/XtSetLanguageProc.m
+>>#
+>># Description:
+>># Tests for XtSetLanguageProc()
+>>#
+>># Modifications:
+>># $Log: tstlnggprc.m,v $
+>># Revision 1.2 2005-04-21 09:40:42 ajosey
+>># resync to VSW5.1.5
+>>#
+>># Revision 8.2 2005/01/14 12:15:44 gwc
+>># Updated copyright notice
+>>#
+>># Revision 8.1 2004/02/12 15:54:44 gwc
+>># Set LC_ALL in environment instead of LANG in test 7
+>>#
+>># Revision 8.0 1998/12/23 23:36:18 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:08 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.1 1998/06/23 22:49:32 andy
+>># Added sleep(XT_RESET_DELAY) to each test. SR# 186.
+>>#
+>># Revision 6.0 1998/03/02 05:27:29 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:03 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:15:46 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:19:29 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <locale.h>
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+
+XtAppContext app_ctext, app_ctext2;
+Display *display_good;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+
+char client_stuff[] = "These are the times that try men's souls";
+
+/*
+** Procedure XtLP_Proc
+*/
+String XtLP_Proc(display, language, client_data)
+Display *display;
+String language;
+XtPointer client_data;
+{
+ avs_set_event(1,avs_get_event(1)+1);
+ tet_infoline("TEST: Client data correctly passed to language procedure");
+ if (strcmp(client_data, client_stuff) != 0) {
+ sprintf(ebuf, "ERROR: Expected client_data \"%s\", received \"%s\"", client_stuff, (char *)client_data);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ return (String)setlocale(LC_ALL, NULL);
+#endif
+}
+
+void WarnH(msg)
+String msg;
+{
+ avs_set_event(2,1);
+}
+
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtSetLanguageProc Xt4
+XtLanguageProc
+XtSetLanguageProc(app_context, proc, client_data)
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to XtLanguageProc XtSetLanguageProc(app_context, proc, client_data)
+shall register proc as the language procedure that will be called
+from XtDisplayInitialize() for all subsequent displays initialized in
+app_context and return the previously registered language procedure.
+>>CODE
+#if XT_X_RELEASE > 4
+Widget TopLevel2;
+XtLanguageProc oldproc;
+int argcount = 0;
+int status;
+#endif
+
+#if XT_X_RELEASE > 4
+ tet_infoline("PREP: Initialize the Xt toolkit");
+ XtToolkitInitialize();
+ tet_infoline("PREP: Create an application context");
+ app_ctext = XtCreateApplicationContext();
+ tet_infoline("PREP: Register XT error handler");
+ XtAppSetErrorMsgHandler(app_ctext, xt_handler);
+ tet_infoline("PREP: Open a display connection");
+ sleep(config.reset_delay);
+ display_good = XOpenDisplay(config.display);
+ if (display_good == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("TEST: Call XtSetLanguageProc");
+ oldproc = XtSetLanguageProc(app_ctext, &XtLP_Proc, client_stuff);
+ tet_infoline("TEST: Initialize display");
+ XtDisplayInitialize(app_ctext, display_good, "tstlnggprc1",
+ "Tstlnggprc1",
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0, &argcount,
+ (String *)NULL );
+ tet_infoline("TEST: Language procedure was invoked");
+ status = avs_get_event(1);
+ check_dec(1, status, "language procedure invocation count");
+ tet_infoline("PREP: Open another display connection");
+ display_good = XOpenDisplay(config.display);
+ if (display_good == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("TEST: Initialize it");
+ XtDisplayInitialize(app_ctext, display_good, "tstlnggprc1",
+ "Tstlnggprc1",
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0, &argcount,
+ (String *)NULL );
+ tet_infoline("TEST: Language procedure was invoked again");
+ status = avs_get_event(1);
+ check_dec(2, status, "language procedure invocation count");
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation is X11R4");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to XtLanguageProc XtSetLanguageProc(app_context, proc, client_data)
+when app_context is NULL shall register proc in all application contexts
+created by the application, including those created in the future.
+>>CODE
+#if XT_X_RELEASE > 4
+XtLanguageProc oldproc;
+int argcount = 0;
+int status;
+#endif
+
+#if XT_X_RELEASE > 4
+ tet_infoline("PREP: Initialize the Xt toolkit");
+ XtToolkitInitialize();
+ tet_infoline("PREP: Create an application context");
+ app_ctext = XtCreateApplicationContext();
+ tet_infoline("PREP: Register XT error handler");
+ XtAppSetErrorMsgHandler(app_ctext, xt_handler);
+ tet_infoline("PREP: Open a display connection");
+ sleep(config.reset_delay);
+ display_good = XOpenDisplay(config.display);
+ if (display_good == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("TEST: Call XtSetLanguageProc with NULL application context");
+ oldproc = XtSetLanguageProc(NULL, &XtLP_Proc, client_stuff);
+ tet_infoline("TEST: Initialize display");
+ XtDisplayInitialize(app_ctext, display_good, "tstlnggprc1",
+ "Tstlnggprc1",
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0, &argcount,
+ (String *)NULL );
+ tet_infoline("TEST: Language procedure was invoked");
+ status = avs_get_event(1);
+ check_dec(1, status, "language procedure invocation count");
+ tet_infoline("PREP: Establish another application context");
+ app_ctext2 = XtCreateApplicationContext();
+ tet_infoline("PREP: Register XT error handler");
+ XtAppSetErrorMsgHandler(app_ctext2, xt_handler);
+ tet_infoline("PREP: Open another display connection");
+ display_good = XOpenDisplay(config.display);
+ if (display_good == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("TEST: Initialize it");
+ XtDisplayInitialize(app_ctext, display_good, "tstlnggprc1",
+ "Tstlnggprc1",
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0, &argcount,
+ (String *)NULL );
+ tet_infoline("TEST: Language procedure was invoked again");
+ status = avs_get_event(1);
+ check_dec(2, status, "language procedure invocation count");
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation is X11R4");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+A call to XtLanguageProc XtSetLanguageProc(app_context, proc, client_data)
+when proc is NULL shall register a default language procedure.
+>>CODE
+#if XT_X_RELEASE > 4
+XtLanguageProc oldproc, oldproc2;
+int argcount = 0 ;
+int status;
+#endif
+
+#if XT_X_RELEASE > 4
+ tet_infoline("PREP: Initialize the Xt toolkit");
+ XtToolkitInitialize();
+ tet_infoline("PREP: Create an application context");
+ app_ctext = XtCreateApplicationContext();
+ tet_infoline("PREP: Register XT error handler");
+ XtAppSetErrorMsgHandler(app_ctext, xt_handler);
+ tet_infoline("TEST: Call XtSetLanguageProc with NULL proc");
+ /*when nothing has been registered, returns what gets the default*/
+ oldproc = XtSetLanguageProc(app_ctext, NULL, client_stuff);
+ tet_infoline("TEST: Call XtSetLanguageProc again to get last proc set");
+ oldproc2 = XtSetLanguageProc(app_ctext, &XtLP_Proc, client_stuff);
+ tet_infoline("TEST: Compare returns from two calls");
+ if (oldproc != oldproc2) {
+ sprintf(ebuf, "ERROR: Default language procedure wasn't registered");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: Call XtSetLanguageProc again with NULL proc");
+ oldproc = XtSetLanguageProc(app_ctext, NULL, client_stuff);
+ tet_infoline("TEST: Open a display connection");
+ sleep(config.reset_delay);
+ display_good = XOpenDisplay(config.display);
+ if (display_good == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("TEST: Initialize display");
+ XtDisplayInitialize(app_ctext, display_good, "tstlnggprc1",
+ "Tstlnggprc1",
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0, &argcount,
+ (String *)NULL );
+ tet_infoline("TEST: Test procedure was not invoked");
+ status = avs_get_event(1);
+ check_dec(0, status, "language procedure invocation count");
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation is X11R4");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+When a language procedure has not yet been registered, a call to
+XtLanguageProc XtSetLanguageProc(app_context, proc, client_data) shall
+return a value which will cause the default language procedure
+to be registered when used in a subsequent call to XtSetLanguageProc().
+>>CODE
+#if XT_X_RELEASE > 4
+int argcount = 0;
+int status;
+XtLanguageProc oldproc, oldproc2;
+#endif
+
+#if XT_X_RELEASE > 4
+ tet_infoline("PREP: Initialize the Xt toolkit");
+ XtToolkitInitialize();
+ tet_infoline("PREP: Create an application context");
+ app_ctext = XtCreateApplicationContext();
+ tet_infoline("PREP: Register XT error handler");
+ XtAppSetErrorMsgHandler(app_ctext, xt_handler);
+ tet_infoline("TEST: Call XtSetLanguageProc setting test procedure");
+ oldproc = XtSetLanguageProc(app_ctext, &XtLP_Proc, client_stuff);
+ tet_infoline("TEST: Call XtSetLanguageProc with return from first call");
+ oldproc2 = XtSetLanguageProc(app_ctext, oldproc, client_stuff);
+ tet_infoline("TEST: Open a display connection");
+ sleep(config.reset_delay);
+ display_good = XOpenDisplay(config.display);
+ if (display_good == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("TEST: Initialize display");
+ XtDisplayInitialize(app_ctext, display_good, "tstlnggprc1",
+ "Tstlnggprc4",
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0, &argcount,
+ (String *)NULL );
+ tet_infoline("TEST: Test procedure was not invoked");
+ status = avs_get_event(1);
+ check_dec(0, status, "language procedure invocation count");
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation is X11R4");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good B 3
+If the implementation is X11R5 or later:
+The default language procedure set by a call to
+XtLanguageProc XtSetLanguageProc(app_context, proc, client_data)
+shall set the locale according to the environment.
+>>ASSERTION Good B 1
+If the implementation is X11R5 or later:
+The default language procedure set by a call to
+XtLanguageProc XtSetLanguageProc(app_context, proc, client_data)
+shall issue a warning if an error is encountered in setting the locale.
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+The default language procedure set by a call to
+XtLanguageProc XtSetLanguageProc(app_context, proc, client_data)
+shall issue a warning and the set the locale to "C" if the locale
+specified by the environment is not supported.
+>>CODE
+#if XT_X_RELEASE > 4
+Widget TopLevel2;
+XtLanguageProc oldproc;
+int argcount = 0;
+int status;
+#endif
+
+#if XT_X_RELEASE > 4
+ putenv("LC_ALL=unreal");
+ tet_infoline("PREP: Initialize the Xt toolkit");
+ XtToolkitInitialize();
+ tet_infoline("PREP: Create an application context");
+ app_ctext = XtCreateApplicationContext();
+ XtAppSetWarningHandler(app_ctext, WarnH);
+ tet_infoline("TEST: Call XtSetLanguageProc again with NULL proc");
+ oldproc = XtSetLanguageProc(app_ctext, NULL, client_stuff);
+ tet_infoline("PREP: Open a display connection");
+ sleep(config.reset_delay);
+ display_good = XOpenDisplay(config.display);
+ if (display_good == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("TEST: Initialize display");
+ XtDisplayInitialize(app_ctext, display_good, "tstlnggprc1",
+ "Tstlnggprc1",
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0, &argcount,
+ NULL);
+ tet_infoline("TEST: Warning was issued");
+ status = avs_get_event(2);
+ check_dec(1, status, "warning handler invocation count");
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation is X11R4");
+ tet_result(TET_UNSUPPORTED);
+#endif
+>>ASSERTION Good C
+If the implementation is X11R5 or later:
+After setting the locale, the default language procedure set by a call to
+XtLanguageProc XtSetLanguageProc(app_context, proc, client_data)
+shall set the X locale modifiers to the empty string.
+>>CODE
+#if XT_X_RELEASE > 4
+Widget TopLevel2;
+XtLanguageProc oldproc;
+int argcount = 0;
+int status;
+char *mod_ret;
+#endif
+
+#if XT_X_RELEASE > 4
+ tet_infoline("PREP: Initialize the Xt toolkit");
+ XtToolkitInitialize();
+ tet_infoline("PREP: Create an application context");
+ app_ctext = XtCreateApplicationContext();
+ XtAppSetWarningHandler(app_ctext, WarnH);
+ tet_infoline("TEST: Call XtSetLanguageProc again with NULL proc");
+ oldproc = XtSetLanguageProc(app_ctext, NULL, client_stuff);
+ tet_infoline("PREP: Open a display connection");
+ sleep(config.reset_delay);
+ display_good = XOpenDisplay(config.display);
+ if (display_good == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("TEST: Initialize display");
+ XtDisplayInitialize(app_ctext, display_good, "tstlnggprc1",
+ "Tstlnggprc1",
+ (XrmOptionDescRec *)NULL,
+ (Cardinal)0, &argcount,
+ NULL);
+ tet_infoline("PREP: Get locale modifiers");
+ mod_ret = XSetLocaleModifiers("");
+ if (mod_ret == NULL) {
+ tet_infoline("ERROR: XSetLocaleModifiers return value is NULL");
+ tet_result(TET_FAIL);
+ } else {
+ if (strcmp(mod_ret, "") != 0) {
+ sprintf(ebuf, "ERROR: Expected empty string, received \"%s\"", mod_ret);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ }
+ tet_result(TET_PASS);
+#else
+ tet_infoline("INFO: Implementation is X11R4");
+ tet_result(TET_UNSUPPORTED);
+#endif
diff --git a/xts5/Xt4/XtToolkitInitialize/XtToolkitInitialize.m b/xts5/Xt4/XtToolkitInitialize/XtToolkitInitialize.m
new file mode 100644
index 00000000..d4cc06be
--- /dev/null
+++ b/xts5/Xt4/XtToolkitInitialize/XtToolkitInitialize.m
@@ -0,0 +1,69 @@
+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/Xt4/XtToolkitInitialize/XtToolkitInitialize.m,v 1.1 2005-02-12 14:38:10 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/Xt4/XtToolkitInitialize/XtToolkitInitialize.m
+>>#
+>># Description:
+>># Tests for XtToolkitInitialize()
+>>#
+>># Modifications:
+>># $Log: ttlktintlz.m,v $
+>># Revision 1.1 2005-02-12 14:38:10 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:15 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:04 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:27:27 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:00 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:15:39 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:19:21 andy
+>># Prepare for GA Release
+>>#
+>>TITLE XtToolkitInitialize Xt4
+void
+XtToolkitInitialize()
+>>ASSERTION Good A
+A call to void XtToolkitInitialize() shall initialize the internal
+Toolkit data structures.
+a display.
+>>CODE
+
+ tet_infoline("TEST: Initialize the toolkit internals");
+ /*no testable behavior !?!*/
+ XtToolkitInitialize() ;
+ tet_result(TET_PASS);
diff --git a/xts5/Xt4/XtUnrealizeWidget/XtUnrealizeWidget.m b/xts5/Xt4/XtUnrealizeWidget/XtUnrealizeWidget.m
new file mode 100644
index 00000000..6e8c9a7f
--- /dev/null
+++ b/xts5/Xt4/XtUnrealizeWidget/XtUnrealizeWidget.m
@@ -0,0 +1,129 @@
+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/Xt4/XtUnrealizeWidget/XtUnrealizeWidget.m,v 1.1 2005-02-12 14:38:11 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/Xt4/XtUnrealizeWidget/XtUnrealizeWidget.m
+>>#
+>># Description:
+>># Tests for XtUnrealizeWidget()
+>>#
+>># Modifications:
+>># $Log: tunrlzwgt.m,v $
+>># Revision 1.1 2005-02-12 14:38:11 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:32 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:23 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:27:41 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:15 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:16:27 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:20:22 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 XtUnrealizeWidget Xt4
+void
+XtUnrealizeWidget(w)
+>>ASSERTION Good A
+When w is realized a call to
+void XtUnrealizeWidget(w)
+shall destroy the windows associated with the widget w and its descendants.
+>>CODE
+Window window_bad;
+Widget widget_good, labelw_good;
+Widget rowcolw_good;
+Display *display_good;
+Boolean status;
+
+ avs_xt_hier("Tunrlzwgt1", "XtUnrealizeWidget");
+ tet_infoline("PREP: Create rowcolw_good widget in boxw1 widget");
+ rowcolw_good = (Widget) CreateRowColWidget(boxw1);
+ tet_infoline("PREP: Create test label widget `Hello' in rowcolw_good widget");
+ labelw_good = (Widget) CreateLabelWidget("Hello", rowcolw_good);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Unrealize rowcolw_good widget");
+ XtUnrealizeWidget(rowcolw_good);
+ tet_infoline("TEST: Root widget rowcolw_good is unrealized");
+ status = XtIsRealized(rowcolw_good);
+ check_dec(False, status, "XtIsRealized return value");
+ tet_infoline("TEST: Leaf widget labelw_good is unrealized");
+ status = XtIsRealized(labelw_good);
+ check_dec(False, status, "XtIsRealized return value");
+ tet_infoline("TEST: Window of rowcolw_good widget is destroyed");
+ if ((window_bad = XtWindow(rowcolw_good)) > 0) {
+ sprintf(ebuf, "ERROR: Expected Invalid window id received %d", window_bad);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When w is unrealized a call to
+void XtUnrealizeWidget(w)
+shall have no effect.
+>>CODE
+Window window_bad;
+Widget widget_good, labelw_good;
+Widget rowcolw_good;
+Display *display_good;
+Boolean status;
+
+ avs_xt_hier("Tunrlzwgt1", "XtUnrealizeWidget");
+ tet_infoline("PREP: Create rowcolw_good widget in boxw1 widget");
+ rowcolw_good = (Widget) CreateRowColWidget(boxw1);
+ tet_infoline("PREP: Create test label widget `Hello' in rowcolw_good widget");
+ labelw_good = (Widget) CreateLabelWidget("Hello", rowcolw_good);
+ tet_infoline("PREP: Unrealize rowcolw_good widget");
+ XtUnrealizeWidget(rowcolw_good);
+ tet_result(TET_PASS);
+>>ASSERTION Good B 3
+When w is realized and managed a call to
+void XtUnrealizeWidget(w)
+shall remove it from the managed list of its parent.
+>>ASSERTION Good B 0
+When w is realized a call to
+void XtUnrealizeWidget(w)
+shall make a child-to-parent traversal of the widget tree with the widget w as
+the root and call the procedures on the XtNunrealizeCallback list of each
+widget that has a callback list resource named "unrealizeCallback" defined.
diff --git a/xts5/Xt4/XtVaAppCreateShell/XtVaAppCreateShell.m b/xts5/Xt4/XtVaAppCreateShell/XtVaAppCreateShell.m
new file mode 100644
index 00000000..dc570573
--- /dev/null
+++ b/xts5/Xt4/XtVaAppCreateShell/XtVaAppCreateShell.m
@@ -0,0 +1,316 @@
+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/Xt4/XtVaAppCreateShell/XtVaAppCreateShell.m,v 1.1 2005-02-12 14:38:12 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/Xt4/XtVaAppCreateShell/XtVaAppCreateShell.m
+>>#
+>># Description:
+>># Tests for XtVaAppCreateShell()
+>>#
+>># Modifications:
+>># $Log: tvapcrshl.m,v $
+>># Revision 1.1 2005-02-12 14:38:12 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:25 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:14 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.1 1998/06/23 22:43:34 andy
+>># Added sleep(XT_RESET_DELAY) to each test. SR# 186.
+>>#
+>># Revision 6.0 1998/03/02 05:27:35 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:09 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:16:07 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:19:57 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+#include <X11/Xatom.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+>>TITLE XtVaAppCreateShell Xt4
+Widget
+XtVaAppCreateShell(name, application_class, widget_class, display, ...)
+>>ASSERTION Good A
+A successful call to
+Widget XtVaAppCreateShell(name, application_class, widget_class, display, ...)
+shall create a top-level shell widget that is
+the root of a widget tree with name as the shall widget instance name, associate
+it with the display specified by the argument display, and return the shell
+widget instance.
+>>CODE
+Display *display_good;
+String name_good, class_good;
+XtAppContext app_ctext_good;
+Widget topLevel_good;
+Boolean status;
+int argcount = 0;
+
+ avs_xt_hier("Tvapcrshl1", "XtVaAppCreateShell");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Create application context app_ctext_good");
+ app_ctext_good = XtCreateApplicationContext();
+ tet_infoline("PREP: Open display and initialize toolkit for app_ctext_good");
+ sleep(config.reset_delay);
+ display_good = XtOpenDisplay(
+ app_ctext_good, /* application context */
+ (String)config.display, /* display name */
+ "Hello", /* application name use argv[0] */
+ "World", /* application class */
+ (XrmOptionDescRec *)NULL,
+ (Cardinal) 0, /* command line options */
+ &argcount,
+ (String *)NULL /* command line args */
+ );
+ if (display_good == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("TEST: Create additional top level widget");
+ topLevel_good = XtVaAppCreateShell("Hello", "World",
+ applicationShellWidgetClass, display_good,
+ (char *)NULL);
+
+ tet_infoline("TEST: TopLevel_good widget class is applicationShell");
+ status = XtIsApplicationShell(topLevel_good);
+ check_dec(True, status, "XtIsApplicationShell return value");
+ tet_infoline("PREP: Get the application name and class");
+ XtGetApplicationNameAndClass(display_good, &name_good, &class_good );
+ tet_infoline("TEST: Application name and class");
+ check_str("Hello", name_good, "Application Name");
+ check_str("World", class_good, "Application Class");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+On a successful call to
+Widget XtVaAppCreateShell(name, application_class, widget_class, display, ...)
+when widget_class is ApplicationShell or a subclass thereof
+the shell widget instance created shall have WM_COMMAND property set from
+the values of the XtNargv and XtNargc resources.
+>>CODE
+Display *display_good;
+String name_good, class_good;
+XtAppContext app_ctext_good;
+Widget widget_good;
+Widget rowcolw_good;
+XTextProperty *text_prop;
+Window window_good;
+int argcount = 1;
+Atom actual_type;
+int actual_format;
+unsigned long num_elements;
+long bytes_after;
+unsigned char *property_data;
+int status;
+String argvector[] = { "tvapcrshl2", NULL };
+Arg args[2] = {
+ { "XtNwidth", 100 },
+ { "XtNheight", 100 }
+};
+
+ tet_infoline("PREP: Initialize the X toolkit");
+ XtToolkitInitialize();
+ tet_infoline("PREP: Get application context");
+ app_ctext_good = XtCreateApplicationContext();;
+ tet_infoline("PREP: Set up the XtToolkitError handler");
+ XtAppSetErrorMsgHandler(app_ctext_good, xt_handler);
+ tet_infoline("PREP: Open display and initialize toolkit for app_ctext_good");
+ sleep(config.reset_delay);
+ display_good = XtOpenDisplay(
+ app_ctext_good, /* application context */
+ (String)config.display, /* display name */
+ "tvapcrshl2", /* application name use argv[0] */
+ "test", /* application class */
+ NULL, 0, /* command line options */
+ &argcount, argvector /* command line args */
+ );
+ if (display_good == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("TEST: Create top level widget");
+ widget_good = XtVaAppCreateShell("tvapcrshl2", "test",
+ applicationShellWidgetClass, display_good, XtNheight, 100, XtNwidth, 100, XtNargc, argcount, XtNargv, argvector, NULL);
+ tet_infoline("PREP: Create rowcol widget");
+ rowcolw_good = (Widget) CreateRowColWidget(widget_good);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(widget_good);
+ XSync(display_good, False);
+ tet_infoline("TEST: WM_CLASS property is set");
+ window_good = XtWindow(widget_good);
+
+ tet_infoline("TEST: Window property values");
+ status = XGetWindowProperty(display_good,
+ window_good,
+ XA_WM_CLASS,
+ (long)0,
+ (long)128,
+ False,
+ AnyPropertyType,
+ &actual_type,
+ &actual_format,
+ &num_elements,
+ (unsigned long *)&bytes_after,
+ &property_data);
+ check_dec(Success, status, "Return value");
+ if ( actual_format == (int)0 ) {
+ sprintf(ebuf, "ERROR: Expected actual format not zero");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if ( actual_type == (Atom)None) {
+ sprintf(ebuf, "ERROR: Expected actual type None Received %d", actual_type);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ check_str("tvapcrshl2", (char *)property_data, "Class");
+ tet_infoline("TEST: WM_COMMAND property is set");
+
+ status = XGetWindowProperty(display_good,
+ window_good,
+ XA_WM_COMMAND,
+ (long)0,
+ (long)128,
+ False,
+ AnyPropertyType,
+ &actual_type,
+ &actual_format,
+ &num_elements,
+ (unsigned long *)&bytes_after,
+ &property_data);
+ check_dec(Success, status, "Return value");
+ if ( actual_format == (int)0 ) {
+ sprintf(ebuf, "ERROR: Expected actual format not zero");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ if (actual_type == (Atom)None) {
+ sprintf(ebuf, "ERROR: Expected actual type not None Received %d", actual_type);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+Widget XtVaAppCreateShell(name, application_class, widget_class, display, ...)
+when name is NULL shall name the shell widget instance with the application
+name passed to XtDisplayInitialize.
+>>CODE
+Display *display_good;
+String name_good, class_good;
+XtAppContext app_ctext_good;
+Widget topLevel_good;
+Boolean status;
+int argcount = 0;
+
+ avs_xt_hier("Tvapcrshl3", "XtVaAppCreateShell");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Create application context app_ctext_good");
+ app_ctext_good = XtCreateApplicationContext();
+ tet_infoline("PREP: Open display and initialize toolkit for app_ctext_good");
+ sleep(config.reset_delay);
+ display_good = XtOpenDisplay(
+ app_ctext_good, /* application context */
+ (String)config.display, /* display name */
+ "Tvapcrshl3", /* application name use argv[0] */
+ "World", /* application class */
+ (XrmOptionDescRec *)NULL,
+ (Cardinal) 0, /* command line options */
+ &argcount,
+ (String *)NULL /* command line args */
+ );
+ if (display_good == 0) {
+ tet_infoline("ERROR: Cannot open display");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_infoline("TEST: Create additional top level widget");
+ topLevel_good = XtVaAppCreateShell(NULL, "World",
+ applicationShellWidgetClass, display_good,
+ (char *)NULL);
+ tet_infoline("TEST: TopLevel_good widget class is applicationShell");
+ status = XtIsApplicationShell(topLevel_good);
+ check_dec(True, status, "XtIsApplicationShell return value");
+ tet_infoline("PREP: Get the application name and class");
+ XtGetApplicationNameAndClass(display_good, &name_good, &class_good );
+ tet_infoline("TEST: Application name");
+ check_str("Tvapcrshl3", name_good, "Application Name");
+ tet_result(TET_PASS);
+>>ASSERTION Good B 0
+A successful call to Widget XtVaAppCreateShell(name, application_class,
+widget_class, display, ...) when the resource arguments specify
+XtNscreen shall create the resource database for the shell widget using the
+resource arguments specified in varargs style and the resource values from
+the resource database of the screen specified in the XtNscreen argument for
+those resources not specified in the resource arguments.
+>>ASSERTION Good B 0
+A successful call to Widget XtVaAppCreateShell(name, application_class,
+widget_class, display, ...) when the resource arguments do not specify
+XtNscreen, widget_class is applicationShellWidgetClass or a subclass thereof,
+and the resource database of the default screen for display specifies
+the resource name.screen, class application_class.screen shall create
+the resource database for the shell widget using the resource arguments and
+the resource values from the resource database of the screen specified in
+the resource database of the default screen for those resources not
+specified in the resource arguments.
+>>ASSERTION Good B 0
+A successful call to Widget XtVaAppCreateShell(name, application_class,
+widget_class, display, ...) when the resource arguments do not specify
+XtNscreen, widget_class is not applicationShellWidgetClass or a subclass
+thereof, and the resource database of the default screen for display
+specifies the resource name.screen, class Class.screen, where Class is the
+class_name field from CoreClassPart of widget_class, shall create the
+resource database for the shell widget using the resource arguments and
+the resource values from the resource database of the screen specified in
+the resource database of the default screen for those resources not specified
+in the resource arguments.
+>>ASSERTION Good B 0
+A successful call to Widget XtVaAppCreateShell(name, application_class,
+widget_class, display, ...) when the resource arguments do not specify
+XtNscreen and the resource database of the default screen for
+display does not specify the resource name.screen, class
+application_class.screen shall create the resource database for the
+shell widget using the resource arguments and the resource values from
+the resource database of the default screen for those resources not specified
+in the resource arguments.
diff --git a/xts5/Xt4/XtVaAppInitialize/XtVaAppInitialize.m b/xts5/Xt4/XtVaAppInitialize/XtVaAppInitialize.m
new file mode 100644
index 00000000..e4e6c58c
--- /dev/null
+++ b/xts5/Xt4/XtVaAppInitialize/XtVaAppInitialize.m
@@ -0,0 +1,945 @@
+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/Xt4/XtVaAppInitialize/XtVaAppInitialize.m,v 1.2 2005-04-21 09:40:42 ajosey Exp $
+
+Copyright (c) 2001 The Open Group
+Copyright (c) Applied Testing and Technology, Inc. 1993, 1994, 1995
+Copyright (c) 88open Consortium, Ltd. 1990, 1991, 1992, 1993
+All Rights Reserved.
+
+>>#
+>># Project: VSW5
+>>#
+>># File: tset/Xt4/XtVaAppInitialize/XtVaAppInitialize.m
+>>#
+>># Description:
+>># Tests for XtVaAppInitialize()
+>>#
+>># Modifications:
+>># $Log: tvapintlz.m,v $
+>># Revision 1.2 2005-04-21 09:40:42 ajosey
+>># resync to VSW5.1.5
+>>#
+>># Revision 8.2 2005/01/21 12:18:22 gwc
+>># Updated copyright notice
+>>#
+>># Revision 8.1 2001/04/12 14:48:03 vsx
+>># tp9 - argv_string was uninitialised
+>>#
+>># Revision 8.0 1998/12/23 23:36:26 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:16 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.1 1998/06/23 22:39:05 andy
+>># Added sleep(XT_RESET_DELAY) to each test. SR# 186.
+>>#
+>># Revision 6.0 1998/03/02 05:27:36 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:10 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.1 1998/01/13 04:55:13 andy
+>># In test 17 changed type of closure_ret from XtPointer * to XtPointer (SR 141).
+>>#
+>># Revision 4.0 1995/12/15 09:16:12 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:20:04 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+#include <X11/Xatom.h>
+
+XtAppContext app_ctext;
+Widget topLevel, panedw, boxw1, boxw2;
+Widget labelw, rowcolw, click_quit;
+char *msg="/tmp/outfile";
+char *args11[] = {
+ "-background", "green",
+ "-bd", "green",
+ "-bg", "green",
+ "-borderwidth", "3",
+ "-bordercolor", "red",
+ "-bw", "3",
+ "-fg", "green",
+ "-font", XtDefaultFont,
+ "-fn", XtDefaultFont,
+ "-foreground", "blue",
+ "-geometry", "100x100",
+ "-iconic",
+ "-reverse",
+ "-rv",
+ "+rv",
+ "-selectionTimeout", "50",
+ "-synchronous",
+ "+synchronous",
+ "-title", "ApTest",
+ "-xnlLanguage", "C",
+ NULL};
+
+
+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, "very bad idea"
+ },
+};
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtVaAppInitialize Xt4
+Widget
+XtVaAppInitialize(app_context_return, application_class, options, num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+>>ASSERTION Good A
+A call to
+Widget XtVaAppInitialize(app_context_return, application_class,
+options, num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+shall initialize the Intrinsics internals, create an application context for
+the calling application and return the context in app_context_return, open
+a display, create a top-level shell widget that is the root of a widget
+tree, and return the shell widget instance.
+>>CODE
+XtAppContext app_ctext_return;
+Widget widget_good;
+Display *display_good;
+String name_good, class_good;
+char name[20], class[20];
+int argcount = 0;
+Boolean status;
+pid_t pid2;
+
+ FORK(pid2);
+ tet_infoline("TEST: Initialize toolkit");
+ sleep(config.reset_delay);
+ sprintf(ebuf, "DISPLAY=%s", config.display);
+ putenv(ebuf);
+ widget_good = XtVaAppInitialize(&app_ctext_return,
+ "TVaAppInitialize",
+ (XrmOptionDescList)NULL,
+ (Cardinal)0,
+ &argcount,
+ (String *)NULL,
+ (String *)NULL,
+ (char *)NULL
+ );
+ avs_set_event(1,1);
+ tet_infoline("TEST: Widget_good class is applicationShell");
+ status = XtIsApplicationShell(widget_good);
+ check_dec(True, status, "XtIsApplicationShell return value");
+ display_good = XtDisplay(widget_good);
+ tet_infoline("PREP: Get application name and class");
+ XtGetApplicationNameAndClass(display_good, &name_good, &class_good );
+ tet_infoline("TEST: Application name and class.");
+ check_str("main", name_good, "Name");
+ check_str("TVaAppInitialize", class_good, "Class");
+ KROF(pid2);
+ if (avs_get_event(1) != 1) {
+ tet_infoline("ERROR: Process terminated by XtVaAppInitialize ");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+When the display cannot be opened a call to
+Widget XtVaAppInitialize(app_context_return, application_class,
+options, num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+shall issue an error message and terminate the application.
+>>CODE
+XtAppContext app_ctext_return;
+Widget widget_good;
+Display *display_good;
+String name_good, class_good;
+char name[20], class[20];
+int argcount = 0;
+Boolean status;
+pid_t pid2;
+FILE *stream;
+char line[80], *retval;
+
+ tet_infoline("TEST: Initialize toolkit");
+ FORK(pid2);
+ sleep(config.reset_delay);
+ sprintf(ebuf, "PREP: Direct error message to %s", msg);
+ tet_infoline(ebuf);
+ push_stderr("outfile", "w");
+ sprintf(ebuf, "DISPLAY=%s", "notarealdisplay");
+ putenv(ebuf);
+ widget_good = XtVaAppInitialize(&app_ctext_return,
+ "TVaAppInitialize",
+ (XrmOptionDescList)NULL,
+ (Cardinal)0,
+ &argcount,
+ (String *)NULL,
+ (String *)NULL,
+ (char *)NULL
+ );
+ avs_set_event(1,1);
+ pop_stderr();
+ KROF(pid2);
+ tet_infoline("TEST: Open the file and read the message");
+ stream = (FILE *)fopen(msg, "r");
+ retval = fgets(line, 80, stream) ;
+ if (retval == NULL) {
+ tet_infoline("ERROR: No error message issued");
+ tet_result(TET_FAIL);
+ unlink(msg);
+ exit(0);
+ }
+ unlink(msg);
+ if (avs_get_event(1) == 1) {
+ tet_infoline("ERROR: Process not terminated by XtVaAppInitialize ");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_result(TET_PASS);
+>>#
+>># Start of XtCreateApplicationContext
+>>#
+>># -----
+>>#
+>># Start of XtOpenDisplay
+>>#
+>>ASSERTION Good B 0
+A successful call to
+Widget XtVaAppInitialize(app_context_return, application_class,
+options, num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+shall create a resource database for the display.
+>>ASSERTION Good A
+A successful call to
+Widget XtVaAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+when the -display option is specified in argv_in_out shall use this value as
+the display to be opened and initialized.
+>>CODE
+XtAppContext app_ctext_return;
+Widget widget_good;
+Display *display_good;
+Boolean status;
+pid_t pid2;
+int argc_count;
+char **argv_string;
+int count = 3;
+char *argvals[4];
+char *display_name;
+
+
+ FORK(pid2);
+ tet_infoline("TEST: Initialize toolkit");
+ sleep(config.reset_delay);
+ tet_infoline("PREP: Set arguments to include -display");
+ argvals[0] = "tinitlize";
+ argvals[1] = "-display";
+ argvals[2] = (char *)config.display;
+ argvals[3] = (char *)NULL;
+ argc_count = count;
+ argv_string = &argvals[0];
+ widget_good = XtVaAppInitialize(&app_ctext_return,
+ "TAppInitialize",
+ (XrmOptionDescList)NULL,
+ (Cardinal)0,
+ &argc_count,
+ argv_string,
+ (String *)NULL,
+ (ArgList)NULL,
+ (char *)NULL
+ );
+ avs_set_event(1,1);
+ display_good = XtDisplay(widget_good);
+ tet_infoline("TEST: Display name is correct");
+ display_name = XDisplayString(display_good);
+ check_str(config.display, display_name, "Display name");
+ KROF(pid2);
+ if (avs_get_event(1) != 1) {
+ tet_infoline("ERROR: Process terminated by XtVaAppInitialize ");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+Widget XtVaAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+when the -display option is not specified in argv and the DISPLAY environment
+variable is set shall use this value as the display to be opened and
+initialized.
+>>CODE
+XtAppContext app_ctext_return;
+Widget widget_good;
+Display *display_good;
+char *display_name;
+int argcount = 0;
+Boolean status;
+pid_t pid2;
+
+ FORK(pid2);
+ sleep(config.reset_delay);
+ tet_infoline("PREP: Set DISPLAY");
+ sprintf(ebuf, "DISPLAY=%s", config.display);
+ putenv(ebuf);
+ tet_infoline("TEST: Initialize toolkit");
+ widget_good = XtVaAppInitialize(&app_ctext_return,
+ "TVaAppInitialize",
+ (XrmOptionDescList)NULL,
+ (Cardinal)0,
+ &argcount,
+ (String *)NULL,
+ (String *)NULL,
+ (char *)NULL
+ );
+ avs_set_event(1,1);
+ display_good = XtDisplay(widget_good);
+ tet_infoline("TEST: Display name is correct");
+ display_name = XDisplayString(display_good);
+ check_str(config.display, display_name, "Display name");
+ KROF(pid2);
+ if (avs_get_event(1) != 1) {
+ tet_infoline("ERROR: Process terminated by XtVaAppInitialize ");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+Widget XtVaAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+when the -name option is specified in argv_in_out shall use this value as the
+application name to query the server and screen resource databases for
+the name.xnlLanguage resource to create the resource database for the display.
+>>CODE
+XtAppContext app_ctext_return;
+Widget widget_good;
+Display *display_good;
+String name_good, class_good;
+char name[20], class[20];
+int argcount = 0;
+Boolean status;
+pid_t pid2;
+int pstatus;
+int argc_count;
+char **argv_string;
+int count = 3;
+char *argvals[4];
+
+ FORK(pid2);
+ sleep(config.reset_delay);
+ sprintf(ebuf, "DISPLAY=%s", config.display);
+ putenv(ebuf);
+ tet_infoline("TEST: Initialize toolkit and open display");
+ argvals[0] = "tinitlize";
+ argvals[1] = "-name";
+ argvals[2] = "testname";
+ argvals[3] = (char *)NULL;
+ argc_count = count;
+ argv_string = &argvals[0];
+ widget_good = XtVaAppInitialize(&app_ctext_return,
+ "TVaAppInitialize",
+ (XrmOptionDescList)NULL,
+ (Cardinal)0,
+ &argc_count,
+ argv_string,
+ (String *)NULL,
+ (char *)NULL
+ );
+ tet_infoline("TEST: widget_good class is applicationShell");
+ status = XtIsApplicationShell(widget_good);
+ check_dec(True, status, "XtIsApplicationShell return value");
+ tet_infoline("TEST: Application name and class");
+ display_good = XtDisplay(widget_good);
+ XtGetApplicationNameAndClass(display_good, &name_good, &class_good );
+ check_str("testname", name_good, "Application Name");
+ KROF3(pid2, pstatus, AVSXTTIMEOUT-2);
+ if (pstatus != 0) {
+ tet_infoline("ERROR: Test process exited abnormally");
+ tet_infoline(" May mean display cannot be opened");
+ tet_result(TET_UNRESOLVED);
+ } else
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+Widget XtVaAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+when the -name option is not specified in argv and the environment variable
+RESOURCE_NAME is set shall use this value as the application name to query
+the server and screen resource databases for the name.xnlLanguage resource
+to create the resource database for the display.
+>>CODE
+XtAppContext app_ctext_return;
+Widget widget_good;
+Display *display_good;
+String name_good, class_good;
+char name[20], class[20];
+int argcount = 0;
+Boolean status;
+pid_t pid2;
+int pstatus;
+
+ FORK(pid2);
+ sleep(config.reset_delay);
+ tet_infoline("PREP: Set up env variable RESOURCE_NAME");
+ putenv("RESOURCE_NAME=testname2");
+ sprintf(ebuf, "DISPLAY=%s", config.display);
+ putenv(ebuf);
+ tet_infoline("TEST: Initialize toolkit and open display");
+ widget_good = XtVaAppInitialize(&app_ctext_return,
+ "TVaAppInitialize",
+ (XrmOptionDescList)NULL,
+ (Cardinal)0,
+ &argcount,
+ (String *)NULL,
+ (String *)NULL,
+ (char *)NULL
+ );
+ tet_infoline("TEST: widget_good class is applicationShell");
+ status = XtIsApplicationShell(widget_good);
+ check_dec(True, status, "XtIsApplicationShell return value");
+ tet_infoline("TEST: Application name and class");
+ display_good = XtDisplay(widget_good);
+ XtGetApplicationNameAndClass(display_good, &name_good, &class_good );
+ check_str("testname2", name_good, "Application Name");
+ KROF3(pid2, pstatus, AVSXTTIMEOUT-2);
+ if (pstatus != 0) {
+ tet_infoline("ERROR: Test process exited abnormally");
+ tet_infoline(" May mean display cannot be opened");
+ tet_result(TET_UNRESOLVED);
+ } else
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+Widget XtVaAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+when the -name option is not specified in argv_in_out, the environment variable
+RESOURCE_NAME is not set, and argv_in_out[0] is not an empty string shall use
+this value as the application name to query the server and screen resource
+databases for the name.xnlLanguage resource to create the resource database
+for the display.
+>>CODE
+XtAppContext app_ctext_return;
+Widget widget_good;
+Display *display_good;
+String name_good, class_good;
+char name[20], class[20];
+int argcount = 0;
+Boolean status;
+pid_t pid2;
+int pstatus;
+int argc_count;
+char **argv_string;
+int count = 1;
+char *argvals[4];
+
+ FORK(pid2);
+ sleep(config.reset_delay);
+ sprintf(ebuf, "DISPLAY=%s", config.display);
+ putenv(ebuf);
+ tet_infoline("TEST: Initialize toolkit and open display");
+ argvals[0] = "testname3";
+ argvals[1] = (char *)NULL;
+ argc_count = count;
+ argv_string = &argvals[0];
+ widget_good = XtVaAppInitialize(&app_ctext_return,
+ "TAppInitialize",
+ (XrmOptionDescList)NULL,
+ (Cardinal)0,
+ &argc_count,
+ argv_string,
+ (String *)NULL,
+ (char *)NULL
+ );
+ tet_infoline("TEST: widget_good class is applicationShell");
+ status = XtIsApplicationShell(widget_good);
+ check_dec(True, status, "XtIsApplicationShell return value");
+ tet_infoline("TEST: Application name and class");
+ display_good = XtDisplay(widget_good);
+ XtGetApplicationNameAndClass(display_good, &name_good, &class_good );
+ check_str("testname3", name_good, "Application Name");
+ KROF3(pid2, pstatus, AVSXTTIMEOUT-2);
+ if (pstatus != 0) {
+ tet_infoline("ERROR: Test process exited abnormally");
+ tet_infoline(" May mean display cannot be opened");
+ tet_result(TET_UNRESOLVED);
+ } else
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+Widget XtVaAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+when the -name option is not specified in argv_in_out, the environment variable
+RESOURCE_NAME is not set, and argv_in_out[0] is an empty string shall use the
+string "main" as the application name to query the server and screen resource
+databases for the name.xnlLanguage resource to create the resource database
+for the display.
+>>CODE
+XtAppContext app_ctext_return;
+Widget widget_good;
+Display *display_good;
+String name_good, class_good;
+char name[20], class[20];
+int argcount = 0;
+Boolean status;
+pid_t pid2;
+int pstatus;
+int argc_count;
+char **argv_string;
+int count = 1;
+char *argvals[4];
+
+ FORK(pid2);
+ sleep(config.reset_delay);
+ sprintf(ebuf, "DISPLAY=%s", config.display);
+ putenv(ebuf);
+ tet_infoline("TEST: Initialize toolkit and open display");
+ argvals[0] = "";
+ argvals[1] = (char *)NULL;
+ argc_count = count;
+ argv_string = &argvals[0];
+ widget_good = XtVaAppInitialize(&app_ctext_return,
+ "TAppInitialize",
+ (XrmOptionDescList)NULL,
+ (Cardinal)0,
+ &argc_count,
+ argv_string,
+ (String *)NULL,
+ (char *)NULL
+ );
+ tet_infoline("TEST: widget_good class is applicationShell");
+ status = XtIsApplicationShell(widget_good);
+ check_dec(True, status, "XtIsApplicationShell return value");
+ tet_infoline("TEST: Application name and class");
+ display_good = XtDisplay(widget_good);
+ XtGetApplicationNameAndClass(display_good, &name_good, &class_good );
+ check_str("main", name_good, "Application Name");
+ KROF3(pid2, pstatus, AVSXTTIMEOUT-2);
+ if (pstatus != 0) {
+ tet_infoline("ERROR: Test process exited abnormally");
+ tet_infoline(" May mean display cannot be opened");
+ tet_result(TET_UNRESOLVED);
+ } else
+ tet_result(TET_PASS);
+>># >>#
+>># >># Start of XtDisplayInitialize assertions
+>># >>#
+>>ASSERTION Good A
+When the synchronize resource is set to True in the resource database
+created by a successful call to
+Widget XtVaAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+it shall put Xlib into synchronous mode for this display connection.
+>>CODE
+Window window;
+int scr;
+static char *property_data = "Hello World";
+XtAppContext app_ctext_return;
+Display *display;
+int queued_events, events;
+int argc = 2;
+pid_t pid2;
+int pstatus;
+ /*
+ ** -synchronous on
+ ** +synchronous off
+ */
+char *argv[] = { "tinitlize", "-synchronous", (char *)NULL };
+Widget widget_good;
+
+ FORK(pid2);
+ sleep(config.reset_delay);
+ sprintf(ebuf, "DISPLAY=%s", config.display);
+ putenv(ebuf);
+ tet_infoline("TEST: Initialize toolkit and open display");
+ widget_good = XtVaAppInitialize(&app_ctext_return,
+ "TVaAppInitialize",
+ (XrmOptionDescList)NULL,
+ (Cardinal)0,
+ &argc,
+ argv,
+ (String *)NULL,
+ (ArgList)NULL,
+ NULL
+ );
+ avs_set_event(1,1);
+ display = XtDisplay(widget_good);
+ tet_infoline("PREP: Create a window for events");
+ scr = DefaultScreen(display);
+ window = XCreateWindow(display, RootWindow(display, scr),
+ 0, 0, 5, 5, 0, /* x,y,wid,ht,brd width */
+ DefaultDepth(display, scr),
+ InputOutput,
+ DefaultVisual(display, scr),
+ (XtValueMask) 0,
+ (XSetWindowAttributes *) 0);
+ tet_infoline("TEST: Check Xlib is in synchronous mode");
+ queued_events = XQLength(display);
+ XSelectInput(display, window,
+ (unsigned long)PropertyChangeMask);
+ for (events = 0; events < 3; events++)
+ XChangeProperty(display, window, XA_RESOURCE_MANAGER, XA_STRING, 8,0, (unsigned char *)property_data, 16);
+ check_dec(3+queued_events, XQLength(display), "queue length");
+ KROF3(pid2, pstatus, AVSXTTIMEOUT-2);
+ if (avs_get_event(1) != 1) {
+ tet_infoline("ERROR: Process terminated by XtVaAppInitialize ");
+ tet_result(TET_FAIL);
+ exit(1);
+ }
+ tet_result(TET_PASS);
+>>ASSERTION Good D 0
+If the implementation is X11R5 or later:
+A successful call to
+Widget XtVaAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+shall determine a language string for the display
+by searching the following sources in the specified order:
+
+- the resource database created from the command line.
+
+- the resource application_name.xnlLanguage, class
+ application_class.XnlLanguage in the server's RESOURCE_MANAGER
+ property for the root window of screen zero if it exists, or in
+ the user preference resource file otherwise.
+
+- the environment.
+>>ASSERTION Good D 0
+If the implementation is X11R5 or later and is POSIX-based:
+A successful call to
+Widget XtVaAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+shall use the LANG environment variable as the environment value to
+search when determining the language string for the display.
+>>ASSERTION Good D 0
+If the implementation is X11R5 or later:
+A successful call to
+Widget XtVaAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+shall set the language string for the display to the empty string if the
+server's RESOURCE_MANAGER property for the root window of screen zero
+exists, and a language string is not found on the command line, in this
+property, or in the environment.
+>>ASSERTION Good D 0
+If the implementation is X11R5 or later:
+A successful call to
+Widget XtVaAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+shall set the language string for the display to the empty string if the
+server's RESOURCE_MANAGER property for the root window of screen
+zero does not exist and a language string is not found on the
+command line, in the user preference resource file, or in the
+environment.
+>>ASSERTION Good B 0
+A successful call to
+Widget XtVaAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+shall associate with the default screen of the display a resource
+database created by combining entries from the following sources,
+in order, with the first named source having the highest precedence:
+
+- the application command line
+
+- the user's environment resource file
+
+- per-screen resource specifications from the server, as returned by
+ XScreenResourceString()
+
+- per display resource specifications from the server (the
+ server's RESOURCE_MANAGER property for the root window of
+ screen zero) if they exist, otherwise the user preference file
+
+- the application-specific user resource file.
+
+- the application-specific class resource file .
+>>ASSERTION Good A
+A successful call to
+Widget XtVaAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+shall recognize options specified on the command line that are in the
+standard table of options in section 4.4 of the specification or in
+the table specific to the application specified by
+.A options
+and
+.A num_options.
+>>CODE
+Display *display_good;
+String name_good, class_good;
+int argcount = 20;
+instance_variable_rec base;
+pid_t pid2;
+Widget widget_good;
+XtAppContext app_ctext_return;
+
+ FORK(pid2);
+ sleep(config.reset_delay);
+ tet_infoline("PREP: Set DISPLAY");
+ sprintf(ebuf, "DISPLAY=%s", config.display);
+ putenv(ebuf);
+ tet_infoline("TEST: Initialize toolkit");
+ widget_good = XtVaAppInitialize(&app_ctext_return,
+ "TVaAppInitialize",
+ (XrmOptionDescList)NULL,
+ (Cardinal)0,
+ &argcount,
+ args11,
+ (String *)NULL,
+ (ArgList)NULL,
+ NULL
+ );
+ tet_infoline("TEST: Retrieve resource values from resource database");
+ XtGetApplicationResources(widget_good,
+ &base,
+ resources,
+ 1,
+ (ArgList)NULL,
+ (Cardinal)0);
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+Widget XtVaAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+when the reverseVideo resource is define as True on the command line shall use
+the value of XtDefaultForeground instead of XtDefaultBackground and
+vice versa in the resource database created for the display.
+>>CODE
+Window window;
+int scr;
+static char *property_data = "Hello World";
+XtAppContext app_ctext;
+Display *display;
+int queued_events, events;
+XrmValue args[2];
+Cardinal num_args;
+XrmValue fromVal;
+XrmValue toVal;
+Boolean closure;
+XtPointer closure_ret = (XtPointer *) &closure;
+int argc = 2;
+char *argv[] = { "tdsplyintl2", "+rv", (char *)NULL };
+Screen *screen;
+Colormap colormap;
+pid_t pid2;
+Pixel res;
+Boolean status;
+XtAppContext app_ctext_return;
+Widget widget_good;
+
+ FORK(pid2);
+ sleep(config.reset_delay);
+ sprintf(ebuf, "DISPLAY=%s", config.display);
+ putenv(ebuf);
+ tet_infoline("TEST: Initialize and application with +rv in args");
+ widget_good = XtVaAppInitialize(&app_ctext_return,
+ "TVaAppInitialize",
+ (XrmOptionDescList)NULL,
+ (Cardinal)0,
+ &argc,
+ argv,
+ (String *)NULL,
+ (ArgList)NULL,
+ NULL
+ );
+ display = XtDisplay(widget_good);
+ 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: Convert XtDefaultForeground");
+ fromVal.addr = XtDefaultForeground;
+ fromVal.size = strlen(XtDefaultForeground)+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");
+ tet_infoline("TEST: Convert XtDefaultBackground");
+ fromVal.addr = XtDefaultBackground;
+ fromVal.size = strlen(XtDefaultBackground)+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);
+>>ASSERTION Good D 0
+If the implementation is POSIX-based:
+A successful call to
+Widget XtVaAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+when the environment variable XENVIRONMENT exists shall use the value
+of this variable as the name of the user environment resource file.
+>>ASSERTION Good D 0
+If the implementation is POSIX-based:
+A successful call to
+Widget XtVaAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+when the environment variable XENVIRONMENT does not exist shall use
+the file .Xdefaults-host, where host is the name of the system running
+the application, in the user's home directory as the user environment
+resource file.
+>>ASSERTION Good B 0
+A successful call to
+Widget XtVaAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+shall set the values from the higher precedence sources of the resource
+database being created for the display as the current resource database
+before determining the file name for the application-specific user resource file.
+>>ASSERTION Good D 0
+If the implementation is POSIX-based:
+A successful call to
+Widget XtVaAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+when the environment variable XUSERFILESEARCHPATH is defined
+shall use the result of calling XtResolvePathname(display, path,
+NULL, NULL, NULL, NULL, 0, NULL) with the value of this variable as path
+as the name of the application-specific user resource file.
+>>ASSERTION Good D 0
+If the implementation is POSIX-based:
+A successful call to
+Widget XtVaAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+when the environment variable XUSERFILESEARCHPATH is not defined and
+the environment variable XAPPLRESDIR is not defined shall
+use the result of calling XtResolvePathname(display, path,
+NULL, NULL, NULL, NULL, 0, NULL) as the name of the application-specific
+user resource file where path contains at least entries containing $HOME as
+the directory prefix plus the following substitutions, in the order specified:
+
+- %C, %N, %L or %C, %N, %l, %t, %c
+
+- %C, %N, %l
+
+- %C, %N
+
+- %N, %L or %N, %l, %t, %c
+
+- %N, %l
+
+- %N
+>>ASSERTION Good D 0
+If the implementation is POSIX-based:
+A successful call to
+Widget XtVaAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+when the environment variable XUSERFILESEARCHPATH is not defined and
+the environment variable XAPPLRESDIR is defined shall use the result
+of calling XtResolvePathname(display, path, NULL, NULL, NULL, NULL, 0, NULL)
+as the name of the application-specific user resource file where path
+contains at least entries containing the following directory prefixes and
+substitutions, in the order specified:
+
+- $XPPLRESDIR with %C, %N, %L or %C, %N, %l, %t, %c
+
+- $XPPLRESDIR with %C, %N, %l
+
+- $XPPLRESDIR with %C, %N
+
+- $XPPLRESDIR with %N, %L or %N, %l, %t, %c
+
+- $XPPLRESDIR with %N, %l
+
+- $XPPLRESDIR with %N
+
+- $HOME with %N
+>>ASSERTION Good B 0
+A successful call to
+Widget XtVaAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+shall use the result of calling XtResolvePathname(display, "app-defaults",
+NULL, NULL, NULL, NULL, 0, NULL) as the name of the application-specific
+class resource file, with the values from the higher precedence sources of
+the resource database being created for the display set as the current
+resource database before the call is made.
+>>#
+>># Start of XtAppCreateShell
+>>#
+>>ASSERTION Good B 0
+On a successful call to
+Widget XtVaAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+the shell widget instance created shall have WM_COMMAND property set from
+the values of the XtNargv and XtNargc resources.
+>>ASSERTION Good B 0
+A successful call to
+Widget XtVaAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+shall name the shell widget instance with the application name passed to
+XtDisplayInitialize.
+>>ASSERTION Good B 0
+A successful call to
+Widget XtVaAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+when the varargs style variable argument list specifies the XtNscreen argument shall create
+the resource database for the shell widget using the resource values specified
+in the variable argument list and resource values from the resource database of the screen specified
+by the XtNscreen argument for those resources not specified in the variable argument list.
+>>ASSERTION Good B 0
+A successful call to
+Widget XtVaAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+when the variable argument list does not specify the XtNscreen argument and the resource database
+of the default screen for display
+specifies the resource name.screen, class application_class.screen shall
+create the resource database for the shell widget using the resource values
+specified in the variable argument list and resource values from the resource database of the screen
+specified in the resource database of the default screen for those resources
+not specified in the variable argument list.
+>>ASSERTION Good B 0
+A successful call to
+Widget XtVaAppInitialize(app_context_return, application_class, options,
+num_options, argc_in_out, argv_in_out, fallback_resources, ...)
+when the variable argument list does not specify the XtNscreen argument and the resource database
+of the default screen for display does not specify the resource name.screen,
+class application_class.screen shall create the resource database for the
+shell widget using the resource values specified in the variable argument list and resource values
+from the resource database of the default screen for those resources not
+specified in the variable argument list.
diff --git a/xts5/Xt4/XtVaCreateWidget/XtVaCreateWidget.m b/xts5/Xt4/XtVaCreateWidget/XtVaCreateWidget.m
new file mode 100644
index 00000000..f338c291
--- /dev/null
+++ b/xts5/Xt4/XtVaCreateWidget/XtVaCreateWidget.m
@@ -0,0 +1,1066 @@
+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/Xt4/XtVaCreateWidget/XtVaCreateWidget.m,v 1.1 2005-02-12 14:38:13 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/Xt4/XtVaCreateWidget/XtVaCreateWidget.m
+>>#
+>># Description:
+>># Tests for XtVaCreateWidget()
+>>#
+>># Modifications:
+>># $Log: tvcrtwdgt.m,v $
+>># Revision 1.1 2005-02-12 14:38:13 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:24 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:13 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:27:34 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:08 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:16:03 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:19:51 andy
+>># Prepare for GA Release
+>>#
+>>EXTERN
+#include <X11/IntrinsicP.h>
+#include <X11/ConstrainP.h>
+#include <X11/CoreP.h>
+#include <X11/Xaw/Label.h>
+#include <xt/SquareCelP.h>
+#include <X11/Xaw/Form.h>
+#include <AvsComp.h>
+#include <AvsRectObj.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);
+}
+
+/*
+** XtEMH_Proc
+*/
+void XtEMH_Proc(str1, str2, str3, str4, str5, car)
+String str1, str2, str3, str4, *str5;
+Cardinal *car;
+{
+ avs_set_event(1,1);
+ 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 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((char *)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(cw),
+ RootWindow(XtDisplay(cw), DefaultScreen(XtDisplay(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(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(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(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;
+}
+>>SET tpstartup avs_alloc_sem
+>>SET tpcleanup avs_free_sem
+>>TITLE XtVaCreateWidget Xt4
+Widget
+XtVaCreateWidget(name, object_class, parent,...)
+>>ASSERTION Good A
+A call to
+Widget XtVaCreateWidget(name, object_class, parent,...)
+shall create a new widget instance belonging to the widget class
+object_class, with parent as its immediate ancestor, and return a pointer to
+the widget instance structure.
+>>CODE
+Boolean value_good;
+char string[10];
+Widget widget_good , labelw_good;
+Widget rowcolw_good, labelw_msg;
+char *msg = "Failsafe widget";
+
+ avs_xt_hier("Tvcrtwdgt1", "XtVaCreateWidget");
+ tet_infoline("PREP: Create rowcolw_good widget in box1w widget");
+ rowcolw_good = (Widget) CreateRowColWidget(boxw1);
+ tet_infoline("PREP: Create failsafe widget in rowcolw_good");
+ labelw_msg = (Widget) CreateLabelWidget(msg, rowcolw_good);
+ tet_infoline("TEST: Create label widget Hello");
+ labelw_good = XtVaCreateWidget(
+ "Hello",
+ labelWidgetClass,
+ rowcolw_good,
+ NULL
+ );
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Labelw_good widget is not managed");
+ value_good = XtIsManaged(labelw_good);
+ check_dec(False, value_good , "XtIsManaged return value");
+ tet_infoline("TEST: Labelw_good widget is child of rowcolumn widget");
+ widget_good = (Widget)XtParent(labelw_good);
+ if (widget_good == NULL) {
+ sprintf(ebuf, "ERROR: Expected parent widget instance returned NULL");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ else
+ check_str("rowcolw", XtName(widget_good), "widget name");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A call to
+Widget XtVaCreateWidget(name, object_class, parent, ...)
+when object_class is not coreWidgetClass or a subclass thereof, the class of
+parent is a subclass of compositeWidgetClass, and there is no extension
+record in the composite class part extension field of parent with the
+record_type equal to NULLQUARK shall issue a fatal error.
+>>CODE
+Boolean value_good;
+char string[10];
+Widget test_widget, test_widget2;
+int status;
+pid_t pid2;
+
+ FORK(pid2);
+ avs_xt_hier("Tcrwidget5", "XtCreateWidget");
+ XtAppSetWarningMsgHandler(app_ctext, XtWMH_Proc);
+ tet_infoline("PREP: Register error message handler");
+ XtAppSetErrorMsgHandler(app_ctext, XtEMH_Proc);
+ tet_infoline("TEST: Create composite widget");
+ test_widget = XtCreateWidget(
+ "Composite",
+ avsCompWidgetClass,
+ topLevel,
+ NULL,
+ 0
+ );
+ tet_infoline("PREP: Create rect obj in it");
+ test_widget2 = XtVaCreateWidget(
+ "RectObj",
+ avsrectObjClass,
+ test_widget,
+ (ArgList)NULL
+ );
+ KROF(pid2);
+ tet_infoline("TEST: Error handler was invoked");
+ status = avs_get_event(1);
+ check_dec(1, status , "handler invocations count");
+ tet_result(TET_PASS);
+>>ASSERTION Good B 0
+A successful call to
+Widget XtVaCreateWidget(name, object_class, parent,...)
+when object_class is not coreWidgetClass or a subclass thereof, the class of
+parent is a subclass of compositeWidgetClass, and the accepts_object
+field in the parent's composite class part extension record is False shall
+issue a fatal error.
+>># >>ASSERTION Good A
+>># A call to
+>># Widget XtVaCreateWidget(name, object_class, parent,...)
+>># shall initialize the resource fields of the widget instance using the resource
+>># values specified in the the CoreClassPart lists for object_class and all
+>># superclasses, overridden by the resource values specified in the varargs
+>># style arguments.
+>># >>CODE
+>># Boolean value_good;
+>># char string[10];
+>># Widget squarew;
+>># Dimension cell_width, cell_height;
+>>#
+>># avs_xt_hier("Tvcrtwdgt2", "XtVaCreateWidget");
+>># tet_infoline("TEST: Create Square Cell widget");
+>># squarew = XtVaCreateWidget("squarew",
+>># squareCellWidgetClass,
+>># boxw1,
+>># 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");
+>># tet_result(TET_PASS);
+>># >>ASSERTION Good A
+>># When parent is a subclass of constraintWidgetClass a successful call to
+>># Widget XtVaCreateWidget(name, object_class, parent,...)
+>># shall initialize the resource fields of the constraints record by
+>># using the constraint resource lists specified for the parent's class and
+>># all superclasses up to constraintWidgetClass, overridden by the resource
+>># values specified in the varags style arguments.
+>># >>CODE
+>># Boolean value_good;
+>># char string[10];
+>># Widget formw_good, labelw_msg;
+>># char *msg = "Failsafe widget";
+>># Widget labelw_good;
+>># Boolean resizable;
+>>#
+>># avs_xt_hier("Tvcrtwdgt3", "XtVaCreateWidget");
+>># tet_infoline("PREP: Create formw_good widget subclass of constraintWidgetClass");
+>># formw_good = (Widget) CreateFormWidget(boxw1);
+>># tet_infoline("PREP: Create failsafe widget in formw_good");
+>># labelw_msg = (Widget) CreateLabelWidget(msg, formw_good);
+>># tet_infoline("TEST: Create labelw_good widget Hello");
+>># labelw_good = XtVaCreateWidget(
+>># "Hello",
+>># labelWidgetClass,
+>># formw_good,
+>># XtNresizable,
+>># TRUE,
+>># NULL
+>># );
+>># tet_infoline("PREP: Create windows for widgets and map them");
+>># XtRealizeWidget(topLevel);
+>># tet_infoline("PREP: Get XtNresizable constraint resource value.");
+>># XtVaGetValues(labelw_good, XtNresizable, &resizable, (char *)NULL);
+>># tet_infoline("TEST: XtNresizable resource value");
+>># check_dec(TRUE, resizable, "XtNresizable resource");
+>># tet_result(TET_PASS);
+>># >>ASSERTION Good A
+>># When parent is a subclass of compositeWidgetClass a successful call to
+>># Widget XtVaCreateWidget(name, object_class, parent,...)
+>># shall call the insert_child procedure of the parent.
+>># >>CODE
+>># Boolean value_good;
+>># char string[10];
+>># Widget widget_good;
+>># Widget formw_good, labelw_msg;
+>># char *msg = "Failsafe widget";
+>># Widget labelw_good;
+>>#
+>># avs_xt_hier("Tvcrtwdgt4", "XtVaCreateWidget");
+>># tet_infoline("PREP: Create formw_good widget subclass of constraintWidgetClass");
+>># formw_good = (Widget) CreateFormWidget(boxw1);
+>># tet_infoline("PREP: Create failsafe widget in formw_good");
+>># labelw_msg = (Widget) CreateLabelWidget(msg, formw_good);
+>># tet_infoline("TEST: Create labelw_good widget Hello");
+>># labelw_good = XtVaCreateWidget(
+>># "Hello",
+>># labelWidgetClass,
+>># formw_good,
+>># NULL
+>># );
+>># tet_infoline("PREP: Create windows for widgets and map them");
+>># XtRealizeWidget(topLevel);
+>># tet_infoline("TEST: Labelw_good widget is child of formw widget");
+>># widget_good = (Widget)XtParent(labelw_good);
+>># if (widget_good == NULL) {
+>># sprintf(ebuf, "ERROR: Expected parent widget instance returned NULL");
+>># tet_infoline(ebuf);
+>># tet_result(TET_FAIL);
+>># }
+>># else
+>># check_str("formw", XtName(widget_good), "parent name");
+>># tet_result(TET_PASS);
+>>ASSERTION Good A
+A successful call to
+Widget XtVaCreateWidget(name, object_class, parent,...)
+shall perform the following actions in the order specified:
+
+- invoke the class_initialize procedure for the class object_class and
+ all superclasses for which this procedure has not been invoked prior to
+ this call, in a superclass-to-subclass order.
+
+- allocate memory for the widget instance.
+
+- if the parent belongs to the class constraintWidgetClass or a
+ subclass thereof, allocate memory for the constraints of parent
+ and store the address of this memory in the constraints field of the
+ widget instance structure.
+
+- initialize the Core non-resource data fields of the widget instance.
+
+- initialize the resource fields of the widget instance using the
+ CoreClassPart resource list specified for object_class and all superclasses,
+ overridden by the resource values specified in the varargs style arguments.
+
+- if parent is a subclass of constraintWidgetClass, initialize the resource
+ fields of the constraints record from the constraint resource list specified
+ for the parent's class and all superclasses up to constraintWidgetClass,
+ overridden by the resource values specified in the varargs style arguments.
+
+- call all the initialize procedures starting at Object on down to the
+ initialize procedure of the widget.
+
+- if parent is a member of compositeWidgetClass, call the insert_child
+ procedure of the parent.
+
+- if parent belongs to the class contraintWidgetClass or a subclass thereof,
+ call all the ConstraintClassPart initialize procedures starting at
+ constraintWidgetClass on down to the initialize procedure of the parent.
+>>CODE
+Boolean value_good;
+char string[10];
+Widget squarew;
+Dimension cell_width, cell_height;
+Widget widget_good;
+Widget formw_good, labelw_msg;
+char *msg = "Failsafe widget";
+Widget labelw_good;
+Boolean resizable;
+pid_t pid2;
+
+ /*combination of earlier tests, needs enhancement*/
+ FORK(pid2);
+ avs_xt_hier("Tvcrtwdgt2", "XtVaCreateWidget");
+ tet_infoline("TEST: Create Square Cell widget");
+ squarew = XtVaCreateWidget("squarew",
+ squareCellWidgetClass,
+ boxw1,
+ 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);
+ FORK(pid2);
+ avs_xt_hier("Tvcrtwdgt3", "XtVaCreateWidget");
+ tet_infoline("PREP: Create formw_good widget subclass of constraintWidgetClass");
+ formw_good = (Widget) CreateFormWidget(boxw1);
+ tet_infoline("PREP: Create failsafe widget in formw_good");
+ labelw_msg = (Widget) CreateLabelWidget(msg, formw_good);
+ tet_infoline("TEST: Create labelw_good widget Hello");
+ labelw_good = XtVaCreateWidget(
+ "Hello",
+ labelWidgetClass,
+ formw_good,
+ XtNresizable,
+ TRUE,
+ NULL
+ );
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("PREP: Get XtNresizable constraint resource value.");
+ XtVaGetValues(labelw_good, XtNresizable, &resizable, (char *)NULL);
+ tet_infoline("TEST: XtNresizable resource value");
+ check_dec(TRUE, resizable, "XtNresizable resource");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ FORK(pid2);
+ avs_xt_hier("Tvcrtwdgt4", "XtVaCreateWidget");
+ tet_infoline("PREP: Create formw_good widget subclass of constraintWidgetClass");
+ formw_good = (Widget) CreateFormWidget(boxw1);
+ tet_infoline("PREP: Create failsafe widget in formw_good");
+ labelw_msg = (Widget) CreateLabelWidget(msg, formw_good);
+ tet_infoline("TEST: Create labelw_good widget Hello");
+ labelw_good = XtVaCreateWidget(
+ "Hello",
+ labelWidgetClass,
+ formw_good,
+ NULL
+ );
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Labelw_good widget is child of formw widget");
+ widget_good = (Widget)XtParent(labelw_good);
+ if (widget_good == NULL) {
+ sprintf(ebuf, "ERROR: Expected parent widget instance returned NULL");
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ else
+ check_str("formw", XtName(widget_good), "parent name");
+ LKROF(pid2, AVSXTTIMEOUT-2);
+ tet_result(TET_PASS);
+>>ASSERTION Good B 0
+A successful call to
+Widget XtVaCreateWidget(name, object_class, parent,...)
+when the varargs style argument specifies the name XtVaTypedArg in place
+of a resource name and the second argument following this name is XtRString
+shall initialize the resource specified by the first argument following the
+XtVaTypedArg name to the string pointed to by the third argument of a length
+specified by the fourth argument following the XtVaTypedArg name argument.
+>>ASSERTION Good B 0
+A successful call to
+Widget XtVaCreateWidget(name, object_class, parent,...)
+when the varargs style argument specifies the name XtVaTypedArg in place of
+a resource name, the second argument following this name is not XtRString, and
+the fourth argument is less than sizeof(XtArgVal) shall
+initialize the resource specified by the first argument following the
+XtVaTypedArg name to the value specified in the third argument following the
+XtVaTypedArg name argument.
+>>ASSERTION Good B 0
+A successful call to
+Widget XtVaCreateWidget(name, object_class, parent,...)
+when the varargs style argument specifies the name XtVaTypedArg in place of
+a resource name, the second argument following this argument is not XtRString,
+and the fourth argument is more than sizeof(XtArgVal) shall initialize the
+resource specified by the first argument following the XtVaTypedArg name to
+the value pointed to by the third argument following the XtVaTypedArg name
+argument.
+>>ASSERTION Good B 0
+A call to
+Widget XtVaCreateWidget(name, object_class, parent,...)
+when the varargs style argument specifies the name XtVaTypedArg in place of
+a resource name and the type conversion fails during the resource initialization
+using the arguments following the XtVaTypedArg argument shall issue a warning
+message.
diff --git a/xts5/Xt4/XtWidgetToApplicationContext/XtWidgetToApplicationContext.m b/xts5/Xt4/XtWidgetToApplicationContext/XtWidgetToApplicationContext.m
new file mode 100644
index 00000000..c486b5b8
--- /dev/null
+++ b/xts5/Xt4/XtWidgetToApplicationContext/XtWidgetToApplicationContext.m
@@ -0,0 +1,98 @@
+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/Xt4/XtWidgetToApplicationContext/XtWidgetToApplicationContext.m,v 1.1 2005-02-12 14:38:13 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/Xt4/XtWidgetToApplicationContext/XtWidgetToApplicationContext.m
+>>#
+>># Description:
+>># Tests for XtWidgetToApplicationContext()
+>>#
+>># Modifications:
+>># $Log: twdgttappl.m,v $
+>># Revision 1.1 2005-02-12 14:38:13 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:17 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:06 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:27:28 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:02 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:15:42 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:19: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;
+>>TITLE XtWidgetToApplicationContext Xt4
+XtAppContext
+XtWidgetToApplicationContext(w)
+>>ASSERTION Good A
+A call to XtAppContext XtWidgetToApplicationContext(w) shall return the
+application context of the widget w.
+>>CODE
+XtAppContext app_ctext_ret;
+
+ avs_xt_hier("Twdgttappl1", "XtWidgetToApplicationContext");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Returns widget's application context");
+ app_ctext_ret = XtWidgetToApplicationContext(topLevel);
+ if (app_ctext_ret == NULL) {
+ tet_infoline("ERROR: Expected valid application context returned NULL");
+ tet_result(TET_FAIL);
+ }
+ if (app_ctext_ret != app_ctext) {
+ tet_infoline("ERROR: Incorrect application context returned");
+ tet_result(TET_FAIL);
+ }
+
+ app_ctext_ret = XtWidgetToApplicationContext(labelw);
+ if (app_ctext_ret == NULL) {
+ tet_infoline("ERROR: Expected valid application context returned NULL");
+ tet_result(TET_FAIL);
+ }
+
+ if (app_ctext_ret != app_ctext) {
+ tet_infoline("ERROR: Incorrect application context returned");
+ tet_result(TET_FAIL);
+ }
+ tet_result(TET_PASS);
diff --git a/xts5/Xt4/XtWindow/XtWindow.m b/xts5/Xt4/XtWindow/XtWindow.m
new file mode 100644
index 00000000..d23f5583
--- /dev/null
+++ b/xts5/Xt4/XtWindow/XtWindow.m
@@ -0,0 +1,89 @@
+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/Xt4/XtWindow/XtWindow.m,v 1.1 2005-02-12 14:38:13 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/Xt4/XtWindow/XtWindow.m
+>>#
+>># Description:
+>># Tests for XtWindow()
+>>#
+>># Modifications:
+>># $Log: twindow.m,v $
+>># Revision 1.1 2005-02-12 14:38:13 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:29 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:19 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:27:39 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:13 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:16:22 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:20: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;
+>>TITLE XtWindow Xt4
+Window
+XtWindow(w)
+>>ASSERTION Good A
+A call to Window XtWindow(w) shall return the window of the widget w.
+>>CODE
+Window window_good;
+Widget widget_good, labelw_good;
+Display *display_good;
+
+ avs_xt_hier("Twindow1", "XtWindow");
+ tet_infoline("PREP: Create test label widget `Hello' in box widget");
+ labelw_good = (Widget) CreateLabelWidget("Hello", boxw1);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: XtWindow shall return the window of the test label widget");
+ if ((window_good = XtWindow(labelw_good)) <= 0) {
+ sprintf(ebuf, "ERROR: Expected Valid window id returned %d", window_good);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: The window id is indeed of label widget Hello");
+ display_good = XtDisplay(labelw_good);
+ widget_good = XtWindowToWidget(display_good, window_good);
+ check_str("Hello", XtName(widget_good), "widget name");
+ tet_result(TET_PASS);
diff --git a/xts5/Xt4/XtWindowOfObject/XtWindowOfObject.m b/xts5/Xt4/XtWindowOfObject/XtWindowOfObject.m
new file mode 100644
index 00000000..f385336c
--- /dev/null
+++ b/xts5/Xt4/XtWindowOfObject/XtWindowOfObject.m
@@ -0,0 +1,113 @@
+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/Xt4/XtWindowOfObject/XtWindowOfObject.m,v 1.1 2005-02-12 14:38:13 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/Xt4/XtWindowOfObject/XtWindowOfObject.m
+>>#
+>># Description:
+>># Tests for XtWindowOfObject()
+>>#
+>># Modifications:
+>># $Log: twindwofo.m,v $
+>># Revision 1.1 2005-02-12 14:38:13 anderson
+>># Initial revision
+>>#
+>># Revision 8.0 1998/12/23 23:36:31 mar
+>># Branch point for Release 5.0.2
+>>#
+>># Revision 7.0 1998/10/30 22:59:21 mar
+>># Branch point for Release 5.0.2b1
+>>#
+>># Revision 6.0 1998/03/02 05:27:40 tbr
+>># Branch point for Release 5.0.1
+>>#
+>># Revision 5.0 1998/01/26 03:24:14 tbr
+>># Branch point for Release 5.0.1b1
+>>#
+>># Revision 4.0 1995/12/15 09:16:24 tbr
+>># Branch point for Release 5.0.0
+>>#
+>># Revision 3.1 1995/12/15 01:20:20 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 XtWindowOfObject Xt4
+Window
+XtWindowOfObject(object)
+>>ASSERTION Good A
+A call to Window XtWindowOfObject(object) when object is a widget shall
+return the window for the widget.
+>>CODE
+Window window_good;
+Widget widget_good, labelw_good;
+Display *display_good;
+
+ avs_xt_hier("Twindwofo2", "XtWindowOfObject");
+ tet_infoline("PREP: Create test label widget `Hello' in box widget");
+ labelw_good = (Widget) CreateLabelWidget("Hello", boxw1);
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Call XtWindowOfObject for label widget Hello");
+ if ((window_good = XtWindow(labelw_good)) <= 0) {
+ sprintf(ebuf, "ERROR: Expected Valid window id returned %d", window_good);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: The window id is indeed of label widget Hello");
+ display_good = XtDisplay(labelw_good);
+ widget_good = XtWindowToWidget(display_good, window_good);
+ check_str("Hello", XtName(widget_good), "widget name");
+ tet_result(TET_PASS);
+>>ASSERTION Good A
+A call to Window XtWindowOfObject(object) when object is not a widget
+shall return the window of the nearest ancestor of object that
+belongs to class widget or a subclass thereof.
+>>CODE
+Widget widget_good;
+Display *display_good;
+Window window_good;
+
+ avs_xt_hier("Twindwofo2", "XtWindowToWidget");
+ tet_infoline("PREP: Create windows for widgets and map them");
+ XtRealizeWidget(topLevel);
+ tet_infoline("TEST: Call XtWindow for push button gadget");
+ if ((window_good = XtWindowOfObject(click_quit)) <= 0) {
+ sprintf(ebuf, "ERROR: Expected valid window id returned %d",window_good);
+ tet_infoline(ebuf);
+ tet_result(TET_FAIL);
+ }
+ tet_infoline("TEST: Window id is valid for specified rowcol widget");
+ display_good = XtDisplayOfObject(click_quit);
+ widget_good = XtWindowToWidget(display_good, window_good);
+ check_str("Quit", XtName(widget_good), "widget name");
+ tet_result(TET_PASS);