Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.



libcvautomation example 6: test a simple Qt desktop application is a
libcvautomation example with a simple Qt desktop application and a
libcvautomation test script. The application is called from the script, and has three
buttons: two labeled 'Press me' and one labeled 'DON'T PRESS ME'. The test presses both 'Press me' buttons (their text will change
to 'OK') and then click the 'DON'T PRESS ME' button, which causes an error.
For the testing script, I have supplied part of screenshots of the application. I guess that would I change my desktop theme (for example: using
a black theme), the test will not find the buttons anymore.
Technical facts
Application type(s)
Operating system(s) or programming environment(s)
IDE(s):
Project type:
C++ standard:
Compiler(s):
Libraries used:
Qt: version 5.4.1 (32 bit)
STL: GNU ISO C++ Library, version 4.9.2
Qt project file: ./CppLibcvautomationExample6/CppLibcvautomationExample6.pro
#-------------------------------------------------
#
# Project created by QtCreator 2013-07-10T21:02:16
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TEMPLATE = app
SOURCES += main.cpp\
dialog.cpp
HEADERS += dialog.h
FORMS += dialog.ui
|
./CppLibcvautomationExample6/dialog.h
./CppLibcvautomationExample6/dialog.cpp
./CppLibcvautomationExample6/main.cpp
./CppLibcvautomationExample6/CppLibcvautomationExample6.sh
#!/bin/sh
#Start the testing program in the background
./../build-CppLibcvautomationExample6-Desktop-Debug/CppLibcvautomationExample6 &
#Wait for the application to appear
sleep 1
./../../Libraries/libcvautomation/examples/cva-input -s "wait_for CppLibcvautomationExample6_pressme.png"
./../../Libraries/libcvautomation/examples/cva-input -s "icmouseclick CppLibcvautomationExample6_pressme.png"
#sleep 1
./../../Libraries/libcvautomation/examples/cva-input -s "wait_for CppLibcvautomationExample6_pressme.png"
./../../Libraries/libcvautomation/examples/cva-input -s "icmouseclick CppLibcvautomationExample6_pressme.png"
#sleep 1
./../../Libraries/libcvautomation/examples/cva-input -s "wait_for CppLibcvautomationExample6_dontpressme.png"
./../../Libraries/libcvautomation/examples/cva-input -s "icmouseclick CppLibcvautomationExample6_dontpressme.png"
sleep 1
#Alternative:
#
# 1) Move the cursor to the 'DO NOT PRESS' button
#
# ./../../Libraries/libcvautomation/examples/cva-input -s "mousexy 800 450"
#
# 2) Gives you one second to move the mouse cursor
#
# sleep 1
#
# 3) Click
#
# ./../../Libraries/libcvautomation/examples/cva-input -s "mouseclick"
|
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.

This page has been created by the tool CodeToHtml