Initial import of the CDE 2.1.30 sources from the Open Group.
This commit is contained in:
52
cde/programs/dtterm/tests/edittest/Imakefile
Normal file
52
cde/programs/dtterm/tests/edittest/Imakefile
Normal file
@@ -0,0 +1,52 @@
|
||||
XCOMM $XConsortium: Imakefile /main/8 1996/10/09 14:10:03 drk $
|
||||
PROGRAMS = edittest
|
||||
|
||||
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 = edittest.c
|
||||
|
||||
OBJS = edittest.o
|
||||
|
||||
NormalLibraryObjectRule()
|
||||
ComplexProgramTarget($(PROGRAMS))
|
||||
|
||||
saber_src: $(SRCS)
|
||||
XCOMM setopt load_flags $(CFLAGS)
|
||||
XCOMM load $(SRCS) $(LOCAL_LIBRARIES)
|
||||
|
||||
unsaber_src:
|
||||
XCOMM unload $(SRCS)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
28
cde/programs/dtterm/tests/edittest/README
Normal file
28
cde/programs/dtterm/tests/edittest/README
Normal file
@@ -0,0 +1,28 @@
|
||||
/* $XConsortium: README /main/2 1996/07/15 14:27:09 drk $ */
|
||||
TestName: edittest
|
||||
|
||||
Description: This program tests the character attibutes functionality of dtterm.
|
||||
The following escape sequences are tested
|
||||
|
||||
"\033D"
|
||||
"\033M"
|
||||
"\033E"
|
||||
"\033[%dL"
|
||||
"\033[%d@"
|
||||
"\033[%dM"
|
||||
"\033[%dP"
|
||||
"\033[4h"
|
||||
"\033[4l"
|
||||
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)
|
||||
|
||||
|
||||
312
cde/programs/dtterm/tests/edittest/edittest.c
Normal file
312
cde/programs/dtterm/tests/edittest/edittest.c
Normal file
@@ -0,0 +1,312 @@
|
||||
/* $XConsortium: edittest.c /main/3 1995/10/31 11:57:08 rswiston $ */
|
||||
#include <stdio.h>
|
||||
#include "synvar.h"
|
||||
|
||||
#ifdef LOG
|
||||
FILE *TermLog;
|
||||
#define SAVELOG fclose(TermLog); TermLog = fopen("term.log", "a");
|
||||
#endif
|
||||
|
||||
char LogStr[200];
|
||||
|
||||
void FillScrLnNumbers(Lines, Cols)
|
||||
int Lines, Cols;
|
||||
{
|
||||
int i, j;
|
||||
char Str[10];
|
||||
HomeUp(); ClearScreen();
|
||||
for (i=0; i < Lines; i++) {
|
||||
sprintf(Str, "%x", (i % 15) +1);
|
||||
for (j=0; j < Cols; j++) WRITETEST(Str);
|
||||
}
|
||||
}
|
||||
|
||||
void FillHalfScrLnNumbers(Lines, Cols)
|
||||
int Lines, Cols;
|
||||
{
|
||||
int i, j;
|
||||
char Str[10];
|
||||
HomeUp(); ClearScreen();
|
||||
for (i=0; i < Lines; i++) {
|
||||
sprintf(Str, "%x", (i % 15) +1);
|
||||
for (j=0; j < Cols/2; j++) WRITETEST(Str);
|
||||
if (i != (Lines-1)) NextLine();
|
||||
}
|
||||
}
|
||||
|
||||
void InsertTest(Lines, Cols)
|
||||
int Lines, Cols;
|
||||
{
|
||||
int i, Count=5; char Str[100];
|
||||
|
||||
for (i=0; i < Count; i++) NextLine();
|
||||
#ifdef SLOW
|
||||
sleep(5);
|
||||
#endif
|
||||
InsertLines(1);
|
||||
#ifdef SLOW
|
||||
sleep(5);
|
||||
#endif
|
||||
sprintf(Str,"CameDown by %d Lines and inserted this line", Count);
|
||||
WRITETEST(Str);
|
||||
#ifdef SLOW
|
||||
sleep(5);
|
||||
#endif
|
||||
Count = 10;
|
||||
for (i=0; i < Count; i++) NextLine();
|
||||
InsertLines(2);
|
||||
sprintf(Str,"CameDown by %d Lines and inserted two lines ", Count);
|
||||
WRITETEST(Str);
|
||||
#ifdef SLOW
|
||||
sleep(5);
|
||||
#endif
|
||||
}
|
||||
|
||||
void IndexTest(Lines)
|
||||
int Lines;
|
||||
{
|
||||
int i; char Str[100];
|
||||
HomeUp();
|
||||
for (i=0; i < Lines; i++) Index();
|
||||
InsertLines(1);
|
||||
#ifdef SLOW
|
||||
sleep(5);
|
||||
#endif
|
||||
sprintf(Str,"Screen Should have scrolled by a line; let me scroll two more");
|
||||
WRITETEST(Str);
|
||||
#ifdef SLOW
|
||||
sleep(5);
|
||||
#endif
|
||||
Index(); Index();
|
||||
#ifdef SLOW
|
||||
sleep(5);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ReverseIndexTest(Lines, Cols)
|
||||
int Lines, Cols;
|
||||
{
|
||||
int i, Count; char Str[100];
|
||||
for (i=0; i < Lines; i++) ReverseIndex();
|
||||
#ifdef SLOW
|
||||
sleep(5);
|
||||
#endif
|
||||
Count = 1;
|
||||
for (i=0; i < Count; i++) ReverseIndex();
|
||||
InsertLines(1); CursorBack(Cols);
|
||||
sprintf(Str,"Screen should have scrolled down by 3 lines;");
|
||||
WRITETEST(Str);
|
||||
#ifdef SLOW
|
||||
sleep(5);
|
||||
#endif
|
||||
Count = 2;
|
||||
ReverseIndex();
|
||||
CursorBack(Cols);
|
||||
sprintf(Str,"Let me scroll %d more ", Count);
|
||||
WRITETEST(Str);
|
||||
#ifdef SLOW
|
||||
sleep(5);
|
||||
#endif
|
||||
for (i=0; i < Count; i++) ReverseIndex();
|
||||
#ifdef SLOW
|
||||
sleep(5);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DeleteLnTest(Lines, Cols)
|
||||
int Lines, Cols;
|
||||
{
|
||||
int i, Count=10; char Str[100];
|
||||
sleep(2);
|
||||
FLUSHTEST();
|
||||
CursorBack(Cols);
|
||||
sleep(5);
|
||||
FLUSHTEST();
|
||||
CursorUp(Count);
|
||||
sleep(5);
|
||||
FLUSHTEST();
|
||||
DeleteLines(2);
|
||||
sleep(5);
|
||||
FLUSHTEST();
|
||||
InsertLines(1);
|
||||
sprintf(Str,"CameUp by %d Lines and deleted two lines ", Count);
|
||||
WRITETEST(Str);
|
||||
sleep(5);
|
||||
FLUSHTEST();
|
||||
#ifdef SLOW
|
||||
sleep(5);
|
||||
#endif
|
||||
CursorBack(Cols);
|
||||
Count = 5;
|
||||
CursorUp(Count);
|
||||
DeleteLines(1);
|
||||
InsertLines(1);
|
||||
sprintf(Str,"CameUp by %d Lines and deleted a line ", Count);
|
||||
WRITETEST(Str);
|
||||
#ifdef SLOW
|
||||
sleep(5);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DeleteCharTest()
|
||||
{
|
||||
int i, Count=3; char Str[100];
|
||||
CursorUp(Count);
|
||||
CursorBack(20);
|
||||
DeleteChars(10); NextLine();
|
||||
InsertLines(1);
|
||||
sprintf(Str, "Came Up %d lines and deleted ten charactes; ", Count);
|
||||
WRITETEST(Str);
|
||||
#ifdef SLOW
|
||||
sleep(5);
|
||||
#endif
|
||||
Count = 2;
|
||||
CursorBack(20);
|
||||
CursorUp(Count);
|
||||
DeleteChars(90); NextLine();
|
||||
InsertLines(1);
|
||||
sprintf(Str,"Came Up %d lines and tried to delete 90 chars", Count);
|
||||
WRITETEST(Str);
|
||||
#ifdef SLOW
|
||||
sleep(5);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void InsertCharTest(Lines, Cols)
|
||||
int Lines, Cols;
|
||||
{
|
||||
int i, Count;
|
||||
FillScrLnNumbers(Lines, Cols);
|
||||
FLUSHTEST();
|
||||
HomeUp();
|
||||
CursorForward(Cols/2);
|
||||
for (i=0; i < Lines; i++) {
|
||||
CursorBack(1); DeleteChars(i*2+1);
|
||||
#ifdef SLOW
|
||||
FLUSHTEST(); sleep(1);
|
||||
#endif
|
||||
InsertBlanks(i*2+1); CursorDown(1);
|
||||
#ifdef SLOW
|
||||
FLUSHTEST(); sleep(1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void InsertReplTest(Lines, Cols)
|
||||
int Lines, Cols;
|
||||
{
|
||||
int i;
|
||||
FillHalfScrLnNumbers(Lines, Cols);
|
||||
FLUSHTEST();
|
||||
HomeUp();
|
||||
for (i=0; i < (Lines/2); i++) {
|
||||
CursorForward(2*i+1);
|
||||
SetInsertMode();
|
||||
WRITETEST("Now In Insert Mode");
|
||||
NextLine(); CursorBack(Cols);
|
||||
CursorForward(2*i+1);
|
||||
SetReplaceMode();
|
||||
WRITETEST("Now In Repalce Mode");
|
||||
if (i != ((Lines/2) -1)) {NextLine(); CursorBack(Cols);}
|
||||
}
|
||||
FLUSHTEST();
|
||||
}
|
||||
|
||||
#define FILLSCR \
|
||||
sleep(5); \
|
||||
FillScrLnNumbers(Lines, Cols); \
|
||||
FLUSHTEST(); \
|
||||
sleep(5);
|
||||
|
||||
|
||||
void TestAllEdit(WinName)
|
||||
char *WinName;
|
||||
{
|
||||
int i,j,k, l, Wrap;
|
||||
int Lines, Cols, TabSpace, TabCount;
|
||||
char Str[IMAGE_FILE_LEN];
|
||||
|
||||
START(1, 0, 0, 0,0);
|
||||
if (CheckTermStatus() == -1)
|
||||
{printf("terminal emulator malfunctioning\n"); exit(-1);}
|
||||
ClearScreen();
|
||||
GetWinSize(&Lines, &Cols);
|
||||
#ifdef DEBUG
|
||||
fprintf(TermLog, "WINDOW Size Cols: %d Lines: %d \n", Cols, Lines);
|
||||
SAVELOG;
|
||||
#endif
|
||||
FILLSCR;
|
||||
HomeUp();
|
||||
InsertTest(Lines, Cols);
|
||||
#ifdef SYNLIB
|
||||
sprintf(Str, "%sedit1", IMAGE_DIR);
|
||||
MatchWindows(WinName, Str);
|
||||
#endif
|
||||
FILLSCR;
|
||||
IndexTest(Lines);
|
||||
#ifdef SYNLIB
|
||||
sprintf(Str, "%sedit2", IMAGE_DIR);
|
||||
MatchWindows(WinName, Str);
|
||||
#endif
|
||||
FILLSCR;
|
||||
DeleteLnTest(Lines, Cols);
|
||||
#ifdef SYNLIB
|
||||
sprintf(Str, "%sedit3", IMAGE_DIR);
|
||||
MatchWindows(WinName, Str);
|
||||
#endif
|
||||
FILLSCR;
|
||||
DeleteCharTest();
|
||||
#ifdef SYNLIB
|
||||
sprintf(Str, "%sedit4", IMAGE_DIR);
|
||||
MatchWindows(WinName, Str);
|
||||
#endif
|
||||
FILLSCR;
|
||||
ReverseIndexTest(Lines, Cols);
|
||||
#ifdef SYNLIB
|
||||
sprintf(Str, "%sedit5", IMAGE_DIR);
|
||||
MatchWindows(WinName, Str);
|
||||
#endif
|
||||
FILLSCR;
|
||||
InsertCharTest(Lines, Cols);
|
||||
#ifdef SYNLIB
|
||||
sprintf(Str, "%sedit6", IMAGE_DIR);
|
||||
MatchWindows(WinName, Str);
|
||||
#endif
|
||||
FILLSCR;
|
||||
InsertReplTest(Lines, Cols);
|
||||
#ifdef SYNLIB
|
||||
sprintf(Str, "%sedit7", 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
|
||||
TestAllEdit("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