Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / programs / dtterm / tests / Cscrolltitle / Cscrolltitle.c
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
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)
10  * any later version.
11  *
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
16  * details.
17  *
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
22  */
23 /* $XConsortium: Cscrolltitle.c /main/3 1995/10/31 11:49:44 rswiston $ */
24 #include <stdio.h>
25 #include <math.h>
26 #include  "synvar.h"
27
28 #ifdef LOG
29 FILE *TermLog;
30 #define SAVELOG  fclose(TermLog); TermLog = fopen("term.log", "a");
31 #endif
32
33 char LogStr[200];
34
35
36 void TestScrollbar(WinName, String, TestNum)
37 char *WinName, *String;
38 int TestNum;
39 {
40   char Str[IMAGE_FILE_LEN];
41      PrintTermString(WinName, String);
42      sprintf(Str, "%sscrollbar%d", IMAGE_DIR, TestNum);
43      MatchWindows(WinName, Str);
44      CloseTerm(WinName);
45 }
46
47 static char *OptionArr[] = { 
48 /*0*/ " -sb -title TITLE1",
49 /*1*/ " +sb -title title2",
50 /*2*/ " -xrm 'dtterm*scrollBar: False' -sb -title TITLE3",
51 /*3*/ " -xrm 'dtterm*scrollBar: True' +sb -title title4"
52 };
53
54 static char *LogAction[] = { 
55 /*0*/ "Testing Option -sb ",
56 /*1*/ "Testing Option +sb ",
57 /*2*/ "Testing Option -xrm 'dtterm*scrollBar: False' -sb",
58 /*3*/ "Testing Option -xrm 'dtterm*scrollBar: True' +sb"
59 };
60
61 #define ArrCount    (int) (sizeof(OptionArr) / sizeof(char *))
62
63 main(argc, argv)
64 int argc;
65 char *argv[];
66 {
67    SynStatus Result;
68    char Command[NEED_LEN];
69    int i;
70      
71 #ifdef LOG
72 if ((TermLog = fopen("term.log", "a")) == NULL) {
73    if ((TermLog = fopen("term.log", "w")) == NULL)
74       {printf("Logfile could not be opened \n"); exit(-1);}
75 }
76 LogError("****************************************************************************");
77 LogTime();
78 sprintf(Command, "TestName: <%s> STARTS\n", argv[0]);
79 LogError(Command);
80 #endif 
81      InitTest(argc, argv);
82      for (i=0; i < ArrCount; i++) {
83        strcpy(Command, TERM_EMU);  
84        strcat(Command, OptionArr[i]);
85        CheckCapsLock();
86        LogError(LogAction[i]);
87        ExecCommand(Command);
88        if (WaitWinMap("TermWin") < 0) continue;
89        AssignWinName("TermWin", TERM_EMU);
90        TestScrollbar("TermWin", OptionArr[i], i+1);
91        WaitWinUnMap("TermWin", 60L);
92      }
93      CloseTest(False);
94 #ifdef LOG
95 sprintf(Command, "TestName: <%s> ENDS\n", argv[0]);
96 LogError(Command);
97 LogError("****************************************************************************");
98 fclose(TermLog);
99 #endif
100 }
101