La reproducción de nivel inferior también admite el desplazamiento del ratón mediante la rueda.
Es posible que quiera utilizar la reproducción de nivel inferior para resolver las limitaciones del producto o una acción de ratón o teclado oculta. Por ejemplo, si desea dibujar un círculo en un lienzo de un programa, Functional Tester no admite el arrastre circular, aunque sí permite utilizar el método drag() para dibujar líneas rectas. Para resolver una acción oculta de ratón o teclado utilice la reproducción de nivel inferior para reproducir las acciones de ratón que dibujan el círculo.
La clase RootTestObject incluye dos métodos:
Los métodos de fábrica en SubitemFactory para la construcción de LowLevelEvents incluyen:
Los métodos paralelos existen para los botones del ratón derecho y central. El suceso de retardo garantiza un retardo de al menos los milisegundos especificados, y se tiene en cuenta el tiempo que ha tardado el sistema en el suceso anterior.
A continuación, se presenta un ejemplo de Functional Tester, Java™ Scripting para dibujar la letra V en la parte superior izquierda del lienzo de dibujo:
// This routine will draw a "V" in the upper left portion // of the drawing canvas. // First a point in the upper left corner will be clicked, the left mouse // button will be held down for the duration of the action, the mouse // will be moved to the right and down, then to the right and back up, // and finally the left mouse button will be released. Rectangle screenRect = (Rectangle) drawingWindow().getProperty(".screenRectangle"); Point origin = new Point(screenRect.x + 5, screenRect.y + 5); LowLevelEvent llEvents[] = new LowLevelEvent[7]; llEvents[0] = mouseMove(atPoint(origin.x, origin.y)); llEvents[1] = leftMouseButtonDown(); // insert a delay to provide the SUT with time to respond // to the events being delivered to it. llEvents[2] = delay(250); llEvents[3] = mouseMove(atPoint(origin.x + 25, origin.y + 50)); llEvents[4] = delay(250); llEvents[5] = mouseMove(atPoint(origin.x + 50, origin.y)); llEvents[6] = leftMouseButtonUp(); getRootTestObject().emitLowLevelEvent(llEvents);
Este es un ejemplo de Functional Tester, VB.NET Scripting para probar un control TrackBar y confirmar que responde a los sucesos de la rueda del ratón:
' This will test a TrackBar control to make sure ' that it responds to mouse wheel events. TrackBar1Slider().Click(AtPoint(0, 0)) ' Create a Low Level Event representing scrolling ' the mouse wheel down 25 clicks. Dim ScrollDown As LowLevelEvent = MouseWheel(-25) GetRootTestObject().EmitLowLevelEvent(ScrollDown) ' Verify The Results.