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: Rvisualbell.c /main/3 1995/10/31 11:55:11 rswiston $ */
31 #define SAVELOG fclose(TermLog); TermLog = fopen("term.log", "a");
37 void TestVisualbell(WinName, TestNum)
41 char Str[IMAGE_FILE_LEN];
44 PressCtrlGKey(WinName);
45 if ((TestNum % 2) == 0)
46 PrintTermString(WinName, "You should have heard beep");
48 PrintTermString(WinName, "You should have seen screen flashing");
53 static char *OptionArr[] = {
55 /*1*/ " -xrm 'visualBell: False' -vb",
57 /*3*/ " -xrm 'visualBell: True' +vb"
60 static char *LogAction[] = {
61 /*0*/ " Testing Option: -vb ",
62 /*1*/ " Testing Option: -xrm 'visualBell: False' -vb",
63 /*2*/ " Testing Option: +vb ",
64 /*3*/ " Testing Option: -xrm 'visualBell: True' +vb"
67 static char *ResourceArr[] = {
68 /*0*/ "visualBell True",
69 /*1*/ "visualBell False ",
70 /*2*/ "visualBell on ",
71 /*3*/ "visualBell off "
74 int MakeResourceFile(ResArr)
79 char Resource[50], Value[50];
81 if ((ResFile = fopen("res", "w")) == NULL)
82 {LogError("Resource File Creation fail"); return(-1);}
83 for (i=0; i < 50; i++) Resource[i] = BLANK;
84 for (i=0; i < 50; i++) Value[i] = BLANK;
85 Len = strlen(ResArr); i=0;
88 while (ResArr[i] != BLANK) Resource[j++] = ResArr[i++];
89 Resource[j] = NULLCHAR;
91 while ((ResArr[i] != BLANK) && (ResArr[i] != NULLCHAR))
92 Value[j++] = ResArr[i++];
95 fprintf(ResFile, "%s*%s: %s\n", TERM_EMU, Resource, Value);
101 #define ArrCount (int) (sizeof(ResourceArr) / sizeof(char *))
108 char Command[NEED_LEN];
112 if ((TermLog = fopen("term.log", "a")) == NULL) {
113 if ((TermLog = fopen("term.log", "w")) == NULL)
114 {printf("Logfile could not be opened \n"); exit(-1);}
116 LogError("****************************************************************************");
118 sprintf(Command, "TestName: <%s> STARTS\n", argv[0]);
121 InitTest(argc, argv);
122 for (i=0; i < ArrCount; i++) {
124 ExecCommand("xrdb -load xrdb.out");
125 MakeResourceFile(ResourceArr[i]);
126 LogError(LogAction[i]);
127 strcpy(Command, "xrdb -merge res; ");
128 strcat(Command, TERM_EMU);
130 ExecCommand(Command);
131 if (WaitWinMap("TermWin") < 0) continue;
132 AssignWinName("TermWin", TERM_EMU);
133 TestVisualbell("TermWin", i+1);
134 WaitWinUnMap("TermWin", 60L);
137 ExecCommand("xrdb -load xrdb.out");
140 sprintf(Command, "TestName: <%s> ENDS\n", argv[0]);
142 LogError("****************************************************************************");