background image
<< Extending the test programmatically | Running the extended test >>

Expand the testcase LogMouseMoves

<< Extending the test programmatically | Running the extended test >>
16
Working with Java Applications
·
After the VerifySelText ("Button up") command, add 4Test code to select and verify the two-
digit X coordinate and two-digit Y coordinate of the mouse event recorded as the Button
Down... text string in the Event Log. Below is some sample code which you can copy and
paste line by line into your test script.

In this code, we determine the selection range of the X and Y coordinates in SetSelRange by
counting text characters from left to right in the string Button Down at (xx,yy). We force our
random integers to be two-digit numbers so the selection range will have a constant start and
end value for each coordinate.

Note that we use the str function to convert our integer variables to string arguments that can
be passed to the VerifySelText commands.
DrawingArea.EventLog.SetSelRange (1,17,1,19)
DrawingArea.EventLog.VerifySelText (str(iX))
DrawingArea.EventLog.SetSelRange (1,20,1,22)
DrawingArea.EventLog.VerifySelText (str(iY))
3
Save draw.t, but don't close it.

You're now ready to run the extended testcase LogMouseMoves; continue to Step 10: Running the
extended test.