The CxxTester is able to receive keyboard and mouse activities from  the CxxViewer. In addition the Tester can return resulting data encoded as graphic information. The Viewer convertes the delivered data into the appropriate picture. It is not necessary to decide between textual and graphic testing. The Tester can combine text results and graphic results in the same testcase.

The Viewer allows to switch between text output and graphic output at any time. If CxxTester is used without the Viewer, called from command line, the returned graphic commands will be suppressed.

The example below explains how the keyboard and mousebutton commands are transmitted to the CxxTester. If a key or a mousebutton is activated into the graphic outputwindow of the CxxViewer, this event is send to the Tester  just like a testcase:
 

cxxcall(keypress)
{
   int x      = DIN["x"];
   int y      = DIN["y"];
   char* k = DIN["key"];
   // further evaluation of key and mouseposition x/y
}
cxxcall(buttonpress)
{
   int x = DIN["x"];
   int y = DIN["y"];
   int b = DIN["button"];
   // further evaluation of mousebutton and mouseposition x/y
}

The callback method below, can be used to display a startup graphic without additional testcase execution:

cxxcall(ongraphic)
{
   // called every time when the viewer activates graphic output
}

 

The following interface functions are available to return results as graphic information:

// init background with rgb color, default is a black background
// red, green,blue val: 0..255
int ClearBackground(int red, int green, int blue);

// define rgb color for all following drawing methods, default is white
// red,green,blue val: 0..255
int SetForeground(int red, int green, int blue);

// draw single pixel
// x,y val: absolute window coords
int DrawPoint(int x, int y);

// create line
// xs,ys val: line start in window coords
// dx,dy val: line end in window coords
int DrawLine(int xs, int ys, int dx, int dy);

// create hollow rect
// xs,ys val: an edge of the rect in window coords
// xe,ye val: opponent edge of the rect in window coords
int DrawRect(int xs, int ys, int dx, int dy);

// create filled rect
// xs,ys val: an edge of the rect in window coords
// xe,ye val: opponent edge of the rect in window coords
int FillRect(int xs, int ys, int dx, int dy);

// create a hollow arc,elipse or circle
// xs,ys val: an edge of the bounding rect in window coords
// xe,ye val: opponent edge of the bounding rect in window coords
// angle val: offset angle 0-36000, zero is the positive x-axis
// span  val: sector angle 0-36000, counterclockwise from offset angle
// for a full circle or ellipse let angle and span be zero
int DrawArc(int xs, int ys, int dx, int dy, int angle=0, int span=0);

// create a filled arc,elipse or circle
// xs,ys val: an edge of the bounding rect in window coords
// xe,ye val: opponent edge of the bounding rect in window coords
// angle val: offset angle 0-36000, zero is the positive x-axis
// span  val: sector angle 0-36000, counterclockwise from offset angle
// for a full circle or ellipse let angle and span be zero
int FillArc(int xs, int ys, int dx, int dy, int angle=0, int span=0);

// create a hollow polygon defined by the given coordinate list
// nr val: size of list
// xlist[0..nr-1], ylist[0..nr-1] val: window coords
int DrawPolygon(int nr, int* xlist, int* ylist);

// create a filled polygon defined by the given coordinate list
// nr val: size of coordinate list x/y
// xlist[0..nr-1], ylist[0..nr-1] val: window coords
int FillPolygon(int nr, int* xlist, int* ylist);

// create a text with tiny font and startposition located at x,y
// x,y val: window coords
// str val: ascii text
int DrawTinyString(int x, int y,char* str);

// create a text with medium font and startposition located at x,y
// x,y val: window coords
// str val: ascii text
int DrawMediumString(int x, int y,char* str);

// create a text with large font and startposition located at x,y
// x,y val: window coords
// str val: ascii text
int DrawLargeString(int x, int y,char* str);