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 start_libreoffice_writer () { click_i "screens/gnome-1_menu.png" "screens/kde-1_menu.png" click_i "screens/gnome-2_officeMenu.png" "screens/kde-2_officeMenu.png" 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" click_i "screens/gnome-5_fileExit.png" "screens/kde-5_fileExit.png" click_i "screens/gnome-6_discard.png" "screens/kde-6_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
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 () { click_i "screens/gnome-1_menu.png" "screens/kde-1_menu.png" click_i "screens/gnome-2_officeMenu.png" "screens/kde-2_officeMenu.png" 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. 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() { click_i "screens/gnome-4_fileMenu.png" "screens/kde-4_fileMenu.png" click_i "screens/gnome-5_fileExit.png" "screens/kde-5_fileExit.png" click_i "screens/gnome-6_discard.png" "screens/kde-6_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