Initial import of the CDE 2.1.30 sources from the Open Group.
This commit is contained in:
51
cde/programs/dtterm/tests/curmove/Imakefile
Normal file
51
cde/programs/dtterm/tests/curmove/Imakefile
Normal file
@@ -0,0 +1,51 @@
|
||||
XCOMM $XConsortium: Imakefile /main/8 1996/10/09 14:09:45 drk $
|
||||
PROGRAMS = curmove
|
||||
|
||||
INCLUDES = -I. -I$(DTINCLUDESRC)
|
||||
LOCAL_INCLUDES = -I../shared -I$(TOP)/lib/
|
||||
SYS_LIBRARIES = -lm
|
||||
|
||||
EXTRA_DEFINES = -DLOG -DSYNLIB
|
||||
|
||||
#if defined(ApolloArchitecture)
|
||||
EXTRA_DEFINES = -Dapollo -D_CMDINV
|
||||
#if defined(SHLIB)
|
||||
LOCAL_LIBRARIES = -A inlib,$(XLIB)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(SunArchitecture)
|
||||
SYS_LIBRARIES = -lm -ldl -lgen -lC
|
||||
SYNLIB=$(TOP)/lib/synlib/libsynlibTst.a
|
||||
XTST=/usr/openwin/lib/libXtst.a
|
||||
#endif
|
||||
|
||||
#if defined(USLArchitecture)
|
||||
SYS_LIBRARIES = -lm -ldl -lgen
|
||||
#endif
|
||||
|
||||
#if defined(UXPArchitecture)
|
||||
SYS_LIBRARIES = -lm -ldl -lgen
|
||||
#endif
|
||||
|
||||
LOCAL_LIBRARIES = ../shared/libtermtest.a $(SYNLIB) $(XTST) $(XEXT) $(XLIB)
|
||||
|
||||
SRCS = curmove.c
|
||||
|
||||
OBJS = curmove.o
|
||||
|
||||
NormalLibraryObjectRule()
|
||||
ComplexProgramTarget($(PROGRAMS))
|
||||
|
||||
saber_src: $(SRCS)
|
||||
XCOMM setopt load_flags $(CFLAGS)
|
||||
XCOMM load $(SRCS) $(LOCAL_LIBRARIES)
|
||||
|
||||
unsaber_src:
|
||||
XCOMM unload $(SRCS)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
32
cde/programs/dtterm/tests/curmove/README
Normal file
32
cde/programs/dtterm/tests/curmove/README
Normal file
@@ -0,0 +1,32 @@
|
||||
/* $XConsortium: README /main/2 1996/07/15 14:26:14 drk $ */
|
||||
TestName: curmove
|
||||
|
||||
Description: This program tests the cursor movement functionality of dtterm.
|
||||
The following escape sequences are tested
|
||||
|
||||
"\033[A"
|
||||
"\033[%dA"
|
||||
"\033[B"
|
||||
"\033[%dB"
|
||||
"\033[%dC"
|
||||
"\033[%dD"
|
||||
"\033[%d;%dH"
|
||||
"\033[%d;%df"
|
||||
"\033[%dF"
|
||||
"\033[%dG"
|
||||
"\033[6n"
|
||||
"\033[%d;%dR"
|
||||
|
||||
note: %d means a parameter
|
||||
|
||||
and recordes or compares the image. the result of the test
|
||||
is logged in file term.log
|
||||
|
||||
How to run: invoke dtterm and run the program with any of the following
|
||||
option
|
||||
|
||||
commandline: -o dtterm.object
|
||||
-o dtterm.object -r -save (for recording)
|
||||
-o dtterm.object -compare -save (for comparing)
|
||||
|
||||
|
||||
149
cde/programs/dtterm/tests/curmove/curmove.c
Normal file
149
cde/programs/dtterm/tests/curmove/curmove.c
Normal file
@@ -0,0 +1,149 @@
|
||||
/* $XConsortium: curmove.c /main/3 1995/10/31 11:56:15 rswiston $ */
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "synvar.h"
|
||||
#include "common.h"
|
||||
|
||||
#ifdef LOG
|
||||
FILE *TermLog;
|
||||
#define SAVELOG fclose(TermLog); TermLog = fopen("term.log", "a");
|
||||
#endif
|
||||
|
||||
char LogStr[200];
|
||||
|
||||
#define InitArr(Arr, NumCols, NumLines) \
|
||||
{ \
|
||||
for (i=0; i < NumCols; i++) \
|
||||
for (j=0; j < NumLines; j++) Arr[i][j] = 0; \
|
||||
}
|
||||
|
||||
void TestCurMove(WinName)
|
||||
char *WinName;
|
||||
{
|
||||
|
||||
int i,j, Count=0, Position, Arr[200][100];
|
||||
int CurrX, CurrY, PrevX, PrevY, GotX, GotY;
|
||||
int Relative=1, Wrap=0, NumLines, NumCols;
|
||||
char Str[IMAGE_FILE_LEN];
|
||||
|
||||
START(1,0,0,0,0);
|
||||
if (CheckTermStatus() == -1)
|
||||
{printf("terminal emulator malfunctioning\n"); DONE(); return;}
|
||||
GetWinSize(&NumLines, &NumCols);
|
||||
#ifdef DEBUG
|
||||
sprintf(LogStr, "WINDOW Size Cols: %d Lines: %d \n", NumCols, NumLines);
|
||||
LogError(LogStr);
|
||||
#endif
|
||||
ClearScreen(); InitArr(Arr, NumCols, NumLines);
|
||||
PrevX = 0; PrevY = 0;
|
||||
while (1) {
|
||||
CurrX = (int) (rand() % NumCols);
|
||||
CurrY = (int) (rand() % NumLines);
|
||||
if (Arr[CurrX][CurrY] == 1) continue;
|
||||
if ((CurrX == PrevX) && (CurrY == PrevY)) continue;
|
||||
if (Relative == 1) RelativeGoToXY(PrevX, PrevY, CurrX, CurrY);
|
||||
else if (Relative == 2) AbsoluteGoToXY(CurrX+1, CurrY+1);
|
||||
else AbsoluteGoToXY_HVP(CurrX+1, CurrY+1);
|
||||
Arr[CurrX][CurrY] = 1;
|
||||
if (CurrX != (NumCols - 1))
|
||||
{WRITETEST("0"); CursorBack(1);}
|
||||
else {
|
||||
WRITETEST("0");
|
||||
if (Wrap == 1) AbsoluteGoToXY(CurrX+1, CurrY+1);
|
||||
}
|
||||
GetCursorPosn(&GotX, &GotY);
|
||||
if ((CurrX != (GotX - 1)) || (CurrY != (GotY -1))) {
|
||||
if (Relative == 1) printf("Relative :");
|
||||
else printf("Absolute:");
|
||||
sprintf(LogStr, "Expeted X Y: %3d %3d Got X Y: %3d %3d \n",
|
||||
CurrX+1, CurrY+1, GotX, GotY);
|
||||
printf("%s", LogStr); LogError(LogStr);
|
||||
DONE(); return;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
sprintf(LogStr, "CurrX: %3d CurrY: %3d GotX: %3d GotY: %3d \n",
|
||||
CurrX+1, CurrY+1, GotX, GotY);
|
||||
LogError(LogStr);
|
||||
#endif
|
||||
PrevX= CurrX; PrevY = CurrY;
|
||||
Count++;
|
||||
if (Count >= ( NumLines *NumCols)) {
|
||||
#ifdef SYNLIB
|
||||
sprintf(Str, "%scurmove%d", IMAGE_DIR, Relative);
|
||||
MatchWindows(WinName, Str);
|
||||
#endif
|
||||
if ((Relative == 1) || (Relative == 2)) {
|
||||
ClearScreen(); InitArr(Arr, NumCols, NumLines);
|
||||
Relative += 1; Count = 0;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
}
|
||||
DONE();
|
||||
}
|
||||
|
||||
#define STARLEN 120
|
||||
|
||||
void TestCurColLine(WinName)
|
||||
char *WinName;
|
||||
{
|
||||
int i, Cols, Lines;
|
||||
char Str[STARLEN];
|
||||
START(1,0,0,0,0);
|
||||
if (CheckTermStatus() == -1)
|
||||
{printf("terminal emulator malfunctioning\n"); DONE(); return;}
|
||||
GetWinSize(&Lines, &Cols);
|
||||
ClearScreen(); HomeUp();
|
||||
CursorDown(Lines);
|
||||
CursorPrevLine(Lines/2 + 1);
|
||||
CursorColumn(Cols/10);
|
||||
for (i=0; i < (STARLEN/2); i++) Str[i] = '*';
|
||||
Str[STARLEN/2] = NULLCHAR;
|
||||
WRITETEST(Str);
|
||||
NextLine();
|
||||
CursorColumn(Cols/10);
|
||||
WRITETEST("*");
|
||||
CursorColumn(((Cols/10) + (STARLEN/2) - 1));
|
||||
WRITETEST("*");
|
||||
NextLine();
|
||||
CursorColumn(Cols/10);
|
||||
WRITETEST(Str);
|
||||
CursorPrevLine(1);
|
||||
CursorColumn((Cols/10) + (Cols/20));
|
||||
WRITETEST("DO YOU SEE A BOX USING * IN THE CENTER ENCLOSING THIS");
|
||||
#ifdef SYNLIB
|
||||
sprintf(Str, "%scurmove4", IMAGE_DIR);
|
||||
MatchWindows(WinName, Str);
|
||||
#endif
|
||||
DONE();
|
||||
}
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
|
||||
#ifdef LOG
|
||||
if ((TermLog = fopen("term.log", "a")) == NULL) {
|
||||
if ((TermLog = fopen("term.log", "w")) == NULL)
|
||||
{printf("Logfile could not be opened \n"); exit(-1);}
|
||||
}
|
||||
fprintf(TermLog, "**************************************************\n");
|
||||
LogTime();
|
||||
fprintf(TermLog, "TestName: <%s> STARTS\n", argv[0]);
|
||||
#endif
|
||||
#ifdef SYNLIB
|
||||
InitTest(argc, argv);
|
||||
AssignWinName("TermWin", TERM_EMU);
|
||||
#endif
|
||||
TestCurMove("TermWin");
|
||||
TestCurColLine("TermWin");
|
||||
#ifdef SYNLIB
|
||||
CloseTest(False);
|
||||
#endif
|
||||
#ifdef LOG
|
||||
fprintf(TermLog, "TestName: <%s> ENDS\n", argv[0]);
|
||||
fclose(TermLog);
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user