[previous] [up] [next]     [contents] [index]
Next: Errors Up: Test engine Previous: An example

Actions and completeness

The actions associated with a testing primitive may not have finished when the primitive returns to its caller. Some actions may yield control before they can complete. For example, selecting ``Save As...'' from the ``File'' menu opens a dialog box and will not complete until the ``OK'' or ``Cancel'' button is pushed.

However, all testing functions wait at least a minimum interval before returning to give the action a chance to finish. This interval controls the speed at which the test suite runs, and gives some slack time for events to complete. The default interval is 100 milliseconds. The interval can be queried or set with:

(mred:test:run-interval [msec])
msec :
an exact, non-negative integer (milliseconds)

Supplying the optional argument sets the interval. If the argument is omitted, the current value of the interval is returned.

A primitive action will not return until the run-interval has expired and the action has finished, raised an error, or yielded. The number of incomplete actions is given by:

(mred:test:number-pending-actions)

Note: Once a primitive action is started, it is not possible to undo it or kill its remaining effect. Thus, it is not possible to write a utility that flushes the incomplete actions and resets number-pending-actions to zero.

However, actions which do not complete right away often provide a way to cancel themselves. For example, many dialog boxes have a ``Cancel'' button which will terminate the action with no further effect. But this is accomplished by sending an additional action (the button push), not by undoing the original action.



PLT