import command from ImageMagick, or something similar. extern "C" style bindings. cva-match and cva-input cva-match and cva-input cva-match allows you to match multiple image files against a root image providing very fine control over how specific the match is cva-input allows you to drive the X11 server using the XTest extension - for example, clicking on a button from image, clicking a key on the keyboard, and more. #include <libcvautomation/libcvautomation.h>
extern "C", and full C++ bindings are not currently planned. Libcvautomation itself is incredibly simple, but interfaces with a few API's (Xlib, libcv) that it is helpful to have an idea of how to use.import command, or any other screenshot program. Additionally, libcvautomation will support any image format that OpenCV does. At the time of writing, these are: *.bmp, *.dib *.jpeg, *.jpg, *.jpe *.jp2 *.png *.pbm, *.pgm, *.ppm *.sr, *.ras *.tiff, *.tif
#!/bin/bash #This is an application test involving libcvautomation and libreoffice . libcvautomation_funcs #Changing any wrapper parameters should go here start_libreoffice_writer () { click_i "screens/gnome-1_menu.png" "screens/kde-1_menu.png" && sleep 1 click_i "screens/gnome-2_officeMenu.png" "screens/kde-2_officeMenu.png" && sleep 1 hover_i "screens/gnome-3_LibreOfficeWriter.png" "screens/kde-3_LibreOfficeWriter.png" jiggle_mouse click sleep 30 } close_libreoffice_writer() { click_i "screens/gnome-4_fileMenu.png" "screens/kde-4_fileMenu.png" && sleep 1 click_i "screens/gnome-5_fileExit.png" "screens/kde-5_fileExit.png" && sleep 1 click_i "screens/gnome-6_discard.png" "screens/kde-6_discard.png" && sleep 1 } start_libreoffice_writer close_libreoffice_writer
#!/bin/bash #This is an application test involving libcvautomation and libreoffice . libcvautomation_funcs #Changing any wrapper parameters should go here
start_libreoffice_writer ()
{
click_i "screens/gnome-1_menu.png" "screens/kde-1_menu.png" && sleep 1
click_i "screens/gnome-2_officeMenu.png" "screens/kde-2_officeMenu.png" && sleep 1
hover_i "screens/gnome-3_LibreOfficeWriter.png" "screens/kde-3_LibreOfficeWriter.png"
jiggle_mouse
click
sleep 30
}
click_i is a function to click the mouse at an image - in this case, the gnome or kde menu. click_i, we make things a bit more readable - the full command line is cva-input -s 'icmouseclick <filename>' hover_i is a function to move the mouse to an image - in this case, move it over the LibreOffice menu item. close_libreoffice_writer()
{
click_i "screens/gnome-4_fileMenu.png" "screens/kde-4_fileMenu.png" && sleep 1
click_i "screens/gnome-5_fileExit.png" "screens/kde-5_fileExit.png" && sleep 1
click_i "screens/gnome-6_discard.png" "screens/kde-6_discard.png" && sleep 1
}
click_i function to close down LibreOffice writer - Find the "File" menu, click "Exit", and then make sure to discard all changes. start_libreoffice_writer close_libreoffice_writer
SEARCH_METHOD TOLERANCE USE_SANE_TOLERANCE INT_MIN to INT_MAX, the sane tolerance accepts values of 1 - 100 (
, and
) USE_SANE_TOLERANCE="<any_value>"
USE_SANE_TOLERANCE=""
USE_CENTER USE_CENTER=""
USE_CENTER="<any_value>"
OUTFILE and ERRFILE /dev/null by default. OUTFILE and ERRFILE, set them to any file you want. For example, the following code will create a temporary file for OUTFILE and ERRFILE, and notify you of what they are: OUTFILE=`mktemp` ERRFILE=`mktemp` echo "OUTFILE location: $OUTFILE" echo "ERRFILE location: $ERRFILE"
#Changing any wrapper parameters should go here
click
click_xy <x-coordinate> <y-coordinate>
clickr_xy <x-increment> <y-increment>
Also, note that a positive x-increment moves the mouse to the right, and a positive y-increment moves the mouse down.
click_i <filename>
filename CENTER, TOLERANCE, and SEARCH_METHOD variables. See Testing the Testing Wrapper for more information on these. image_location <filename>
CENTER, TOLERANCE, and SEARCH_METHOD variables. See Testing the Testing Wrapper for more information on these. hover_xy <x-coordinate> <y-increment>
hoverr_xy <x-increment> <y-increment>
x-increment moves the mouse to the right, and a positive y-increment moves the mouse down. hover_i <filename>
CENTER, TOLERANCE, and SEARCH_METHOD variables. See Testing the Testing Wrapper for more information on these. key_str "<string>"
key_down, key_up, and key_click do. If you pass in "Space", that is exactly what will be typed. key_down "<key-name>"
key_up "<key-name>"
key_click "<key-name>"
run_process "<process-name>"
is_running "<process-name>"
is_running "<process-id>"
1.4.7