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: erase.c /main/3 1995/10/31 11:57:36 rswiston $ */
29 #define SAVELOG fclose(TermLog); TermLog = fopen("term.log", "a");
34 void FillScreen(Lines, Cols, Ch)
38 int i, j; char Str[10];
40 sprintf(Str, "%c", Ch);
41 for (i=0; i < Lines; i++)
42 for (j=0; j < Cols; j++)
46 void EraseLnTest(Lines, Cols, WinName)
50 int i; char Str[IMAGE_FILE_LEN];
51 FillScreen(Lines, Cols, 'X');
54 for (i=0; i < Lines; i++) {
55 CursorForward(1); EraseLnFromCur(); CursorDown(1);
57 sleep(1); FLUSHTEST();
61 sprintf(Str, "%serase1", IMAGE_DIR);
62 MatchWindows(WinName, Str);
65 FillScreen(Lines, Cols, 'M');
68 for (i=0; i < Lines; i++) {
69 CursorForward(1); EraseLnToCur(); CursorDown(1);
71 sleep(1); FLUSHTEST();
75 sprintf(Str, "%serase2", IMAGE_DIR);
76 MatchWindows(WinName, Str);
79 FillScreen(Lines, Cols, 'M');
82 for (i=0; i < (Lines/2); i++) {
83 CursorForward(2); EraseLnAll(); CursorDown(2);
85 sleep(1); FLUSHTEST();
89 sprintf(Str, "%serase3", IMAGE_DIR);
90 MatchWindows(WinName, Str);
96 void EraseScrTest(Lines, Cols, WinName)
101 char Str[IMAGE_FILE_LEN];
102 FillScreen(Lines, Cols, 'R');
104 Count = Lines / MoveBy;
105 for (i=0; i < Count; i++) {
106 CursorBack(((Cols-MoveBy) /Count)); CursorUp(MoveBy);
109 sleep(2); FLUSHTEST();
112 sprintf(Str, "%serase4", IMAGE_DIR);
114 MatchWindows(WinName, Str);
117 FillScreen(Lines, Cols, 'M');
120 for (i=0; i < Count; i++) {
121 CursorForward(((Cols-MoveBy) /Count)); CursorDown(MoveBy);
124 sleep(2); FLUSHTEST();
128 sprintf(Str, "%serase5", IMAGE_DIR);
129 MatchWindows(WinName, Str);
134 void EraseCharTest(Lines, Cols, WinName)
139 char Str[IMAGE_FILE_LEN];
140 FillScreen(Lines, Cols, 'R');
143 CursorForward(Cols/2);
144 for (i=0; i < Lines; i++) {
145 CursorBack(1); EraseChars(i*2+1); CursorDown(1);
147 sleep(1); FLUSHTEST();
151 sprintf(Str, "%serase6", IMAGE_DIR);
152 MatchWindows(WinName, Str);
156 void TestAllErase(WinName)
160 int Lines, Cols, TabSpace, TabCount;
161 char Str[IMAGE_FILE_LEN];
163 START(1, 0, 0, 0, 0);
165 if (CheckTermStatus() == -1)
166 {printf("terminal emulator malfunctioning\n"); exit(-1);}
169 GetWinSize(&Lines, &Cols);
171 fprintf(TermLog, "WINDOW Size Cols: %d Lines: %d \n", Cols, Lines);
174 EraseLnTest(Lines, Cols, WinName);
175 EraseScrTest(Lines, Cols, WinName);
176 EraseCharTest(Lines, Cols, WinName);
186 if ((TermLog = fopen("term.log", "a")) == NULL) {
187 if ((TermLog = fopen("term.log", "w")) == NULL)
188 {printf("Logfile could not be opened \n"); exit(-1);}
190 fprintf(TermLog, "**************************************************\n");
192 fprintf(TermLog, "TestName: <%s> STARTS\n", argv[0]);
195 InitTest(argc, argv);
196 AssignWinName("TermWin", TERM_EMU);
198 TestAllErase("TermWin");
203 fprintf(TermLog, "TestName: <%s> ENDS\n", argv[0]);