2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: Riconic.c /main/3 1995/10/31 11:52:08 rswiston $ */
31 #define SAVELOG fclose(TermLog); TermLog = fopen("term.log", "a");
39 void TestIconify(WinName, String, TestNum)
40 char *WinName, *String;
43 char Str[IMAGE_FILE_LEN];
44 sprintf(Str, "%sriconic%d", IMAGE_DIR, TestNum);
45 MatchWindows(WinName, Str);
47 if (WaitWinMap(WinName) < 0) LogError("Deiconify did not work");
48 PrintTermString(WinName, String);
49 sprintf(Str, "%sriconic%dA", IMAGE_DIR, TestNum);
50 MatchWindows(WinName, Str);
54 void TestIconifyMap(WinName, String, TestNum)
55 char *WinName, *String;
58 char Str[IMAGE_FILE_LEN];
59 sprintf(Str, "%sriconic%d", IMAGE_DIR, TestNum);
60 MatchWindows(WinName, Str);
62 if (WaitWinMap(WinName) < 0) LogError("mapOnOutput: True did not work");
63 PrintTermString(WinName, String);
64 sprintf(Str, "%sriconic%dA", IMAGE_DIR, TestNum);
65 MatchWindows(WinName, Str);
66 PrintTermString(WinName, "1");
70 if (WaitWinMap(WinName) == 0) LogError("mapOnOutput:False did not work");
73 if (WaitWinMap(WinName) < 0) LogError("Deiconify did not work");
80 static char *OptionArr[] = {
82 /*1*/ " -iconic -xrm 'dtterm*iconName: Test' ",
83 /*2*/ " -iconic -map -xrm 'dtterm*mapOnOutputDelay: 5' -e wait5write",
84 /*3*/ " -iconic +map -xrm 'dtterm*mapOnOutputDelay: 5' -e wait5write"
87 static char *ResourceArr[] = {
89 /*1*/ "iconic True iconName test",
90 /*2*/ "iconic True mapOnOutput True mapOnOutputDelay 5",
91 /*3*/ "iconic True mapOnOutput False mapOnOutputDelay 5"
94 static char *LogAction[] = {
95 "Testing Option iconic True ",
96 "Testing Option iconic True iconName Test",
97 "Testing Option iconic True mapOnOutput True mapOnOutputDelay 5",
98 "Testing Option iconic True mapOnOutput False mapOnOutputDelay 5"
101 int MakeResourceFile(ResArr)
106 char Resource[50], Value[50];
108 if ((ResFile = fopen("res", "w")) == NULL)
109 {LogError("Resource File Creation fail"); return(-1);}
110 for (i=0; i < 50; i++) Resource[i] = BLANK;
111 for (i=0; i < 50; i++) Value[i] = BLANK;
112 Len = strlen(ResArr); i=0;
115 while (ResArr[i] != BLANK) Resource[j++] = ResArr[i++];
116 Resource[j] = NULLCHAR;
118 while ((ResArr[i] != BLANK) && (ResArr[i] != NULLCHAR))
119 Value[j++] = ResArr[i++];
122 fprintf(ResFile, "%s*%s: %s\n", TERM_EMU, Resource, Value);
127 #define ArrCount (int) (sizeof(OptionArr) / sizeof(char *))
134 char Command[NEED_LEN];
138 if ((TermLog = fopen("term.log", "a")) == NULL) {
139 if ((TermLog = fopen("term.log", "w")) == NULL)
140 {printf("Logfile could not be opened \n"); exit(-1);}
142 LogError("****************************************************************************");
144 sprintf(Command, "TestName: <%s> STARTS\n", argv[0]);
147 InitTest(argc, argv);
148 for (i=0; i < ArrCount; i++) {
150 ExecCommand("xrdb -load xrdb.out");
151 MakeResourceFile(ResourceArr[i]);
153 strcpy(Command, "xrdb -merge res; ");
154 strcat(Command, TERM_EMU);
155 if (i > 1) strcat(Command, " -e wait5write");
156 ExecCommand(Command);
157 if (WaitWinMap("TermWin") < 0) continue;
158 AssignWinName("TermWin", TERM_EMU);
159 if (i <= 1) TestIconify("TermWin", OptionArr[i], i+1);
160 else TestIconifyMap("TermWin", OptionArr[i], i+1);
161 WaitWinUnMap("TermWin", 60L);
164 ExecCommand("xrdb -load xrdb.out");
167 sprintf(Command, "TestName: <%s> ENDS\n", argv[0]);
169 LogError("****************************************************************************");