Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
ldtp example 1: don't press the red button is an ldtp example.
Sadly, it does not work as expected. Is this due that it is tested under Lububtu?
Technical facts
Application type(s)
Operating system(s) or programming environment(s)
IDE(s):
Project type:
C++ standard:
Compiler(s):
Libraries used:
Qt: version 4.8.4 (32 bit)
STL: GNU ISO C++ Library, version 4.7.3
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TEMPLATE = app
SOURCES += main.cpp\
cppldtpexample1dialog.cpp
HEADERS += cppldtpexample1dialog.h
FORMS += cppldtpexample1dialog.ui
OTHER_FILES += \
CppLdtpExample1Test.py
|
cppldtpexample1dialog.h
cppldtpexample1dialog.cpp
#include "cppldtpexample1dialog.h"
#include <stdexcept>
#include "ui_cppldtpexample1dialog.h"
CppLdtpExample1Dialog::CppLdtpExample1Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::CppLdtpExample1Dialog)
{
ui->setupUi(this);
}
CppLdtpExample1Dialog::~CppLdtpExample1Dialog()
{
delete ui;
}
void CppLdtpExample1Dialog::on_button_1_clicked()
{
ui->button_1->setText("Clicked!");
}
void CppLdtpExample1Dialog::on_button_2_clicked()
{
throw std::logic_error("DON'T PRESS THE RED BUTTON!");
}
|
main.cpp
#include "cppldtpexample1dialog.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
CppLdtpExample1Dialog w;
w.show();
return a.exec();
}
/*
richel@richel-K73E:~/Projects/Test/CppLdtpExample1$ python CppLdtpExample1Test.py
Launching application
Wait until it exists
GTK Accessibility Module initialized
Get window list
Get object list
Traceback (most recent call last):
File "CppLdtpExample1Test.py", line 12, in <module>
ldtp.getobjectlist('CppLdtpExample1Dialog')
File "/usr/lib/python2.7/dist-packages/ldtp/client.py", line 70, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.7/xmlrpclib.py", line 1578, in __request
verbose=self.__verbose
File "/usr/lib/python2.7/dist-packages/ldtp/client.py", line 185, in request
raise LdtpExecutionError(e.faultString.encode('utf-8'))
ldtp.client_exception.LdtpExecutionError: Unable to find window "CppLdtpExample1Dialog"
richel@richel-K73E:~/Projects/Test/CppLdtpExample1$
*/
|
CppLdtpExample1Test.py
# gsettings set org.gnome.desktop.interface toolkit-accessibility true
import ldtp
import ldtputils
print 'Launching application'
ldtp.launchapp ('../build-CppLdtpExample1-Desktop-Debug/CppLdtpExample1')
print 'Wait until it exists'
ldtp.waittillguiexist('CppLdtpExample1Dialog')
print 'Get window list'
ldtp.getwindowlist()
print 'Get object list'
ldtp.getobjectlist('CppLdtpExample1Dialog')
print "Clicking buttons"
ldtp.click('CppLdtpExample1Dialog','btn0')
ldtp.click('CppLdtpExample1Dialog','btn1')
print 'All tests succeeded???'
|
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.

This page has been created by the tool CodeToHtml