summaryrefslogtreecommitdiff
path: root/xts5/Xt4/XtAppInitialize/XtAppInitialize.m
blob: bbf7d84380f931f04c31110d4d57ee677438c852 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
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.

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.