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 . /etc/libcvautomation_funcs set -o errexit #Changing any wrapper parameters should go here TIMEOUT=30 start_libreoffice_writer () { mouse_click_image "screens/gnome-menu.png" "screens/kde-menu.png" mouse_click_image "screens/gnome-officeMenu.png" "screens/kde-officeMenu.png" mouse_hover_image "screens/gnome-LibreOfficeWriter.png" "screens/kde-LibreOfficeWriter.png" mouse_jiggle mouse_click } close_libreoffice_writer() { mouse_click_image "screens/gnome-fileMenu.png" "screens/kde-fileMenu.png" mouse_click_image "screens/gnome-fileExit.png" "screens/kde-fileExit.png" mouse_click_image "screens/gnome-discard.png" "screens/kde-discard.png" } start_libreoffice_writer close_libreoffice_writer
#!/bin/bash #This is an application test involving libcvautomation and libreoffice . /etc/libcvautomation_funcs set -o errexit #Changing any wrapper parameters should go here TIMEOUT=30
locate libcvautomation_funcs to find it on your computer. The wrapper itself is a handful of macros used to make our job easy. set line will abort the test if an error is ever encountered - for example, no images are found. start_libreoffice_writer ()
{
mouse_click_image "screens/gnome-menu.png" "screens/kde-menu.png"
mouse_click_image "screens/gnome-officeMenu.png" "screens/kde-officeMenu.png"
mouse_hover_image "screens/gnome-LibreOfficeWriter.png" "screens/kde-LibreOfficeWriter.png"
mouse_jiggle
mouse_click
}
click_i is a function to click the mouse at an image - in this case, the gnome or kde menu. TOLERANCE specifically) TIMEOUT option to learn how to use this. 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()
{
mouse_click_image "screens/gnome-fileMenu.png" "screens/kde-fileMenu.png"
mouse_click_image "screens/gnome-fileExit.png" "screens/kde-fileExit.png"
mouse_click_image "screens/gnome-discard.png" "screens/kde-discard.png"
}
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
#Changing any wrapper parameters should go here
1.4.7