I am trying to implement a Qt unit test and I would like to "click" a qtquick Button in QML from C++. I am successfully able to use QCompare on the properties of one of my QML objects in test_case3 but I can't figure out how to create a click event…
I have a GUI with QTreeView and QGraphicsSceneView.
The model used by the tree view supports drag events and graphics scene supports drop events.
I want to simulate user actions with QTest: mousePress, mouseMove, mouseRelease and so on.
I write this…
I have a template function for serializing data to a file and another to retrieve it back using the ID returned by the fist function:
template int serialize(const T &value); //returns id
template T deserialize(int id);
Now I…
I did some survey, if it might be possible to use QtTest to test some of my custom Qt Widgets.
I was able to build and run tests and I was also able to simulate events and check them with QSignalSpy.
The widgets I'm going to tests are not…
I am very new to Qt and I am in the process of validating Qt Test unit testing framework. I am using Qt 5.5.
I am able to create test cases using Qt macros and run them from Qt Creator but I am having issues when running from command prompt.…
In a unit test, I'm trying to send the keyboard shortcut Command+N (on Mac OS), which corresponds to a menu item in my app. I'm using the PySide.QtTest module.
In the code below, I'm using QTest.keyClicks, which doesn't produce what I'm expecting.…
I'm going to achieve the following hierarchy in my QtCreator project based on subdirs template:
Project:
subproject1 - static library
subproject2 - static library
subproject3 - unittests executable
The only one executable will be in subproject3,…
In general, the macros QVERIFY, QCOMPARE, etc. shall not be used outside a test function. The reason is, that in case of a failure, they interrupt the test with a return.
If I want to do tests in a function, I should do them by hand and return false…
Forgive me if the question has already been asked, but I couldn't find the answer anywhere.
I am trying to test a small gui that contains a QListWidget and a QTreeWidget.
More specifically, I want to test the drag and drop behavior from one of the…
I am using QT Test in QT5 and noticed none of the examples in their documentation (https://doc.qt.io/qt-5/qttestlib-tutorial1-example.html#writing-a-test) used a custom (non-QT) namespace, and really not even a QT namespace was referenced.
I tried…
I'm trying to use a superclass to define common constructor, initTestCase(), cleanupTestCase(), init() and cleanup() code for tests.
class BaseTest : public QObject
{
Q_OBJECT
protected slots:
void initTestCase();
void init();
void…
QTest encourages you to organize unit tests as separate executables. There is special macro for this, that generates the main function: QTEST_MAIN.
I found this approach not very clean, it is much more useful to run all tests at once. So i searched…
I have 2 questions:
How can I access a QFileDialog and write the path of a file in the "File name" field using the Qt Test module?
I am asking that because I am developing some GUI tests in Qt and now I need to open a text file. The following code…
Is it possible to detect segmentation faults (SIGSEGV) within the Qt test library?
Within my testXXX() method, a segmentation fault is thrown which causes a core file to be written. The funny thing about that is that the QTest::qExec() method…
I would develop some functional tests for a pyqt application that uses PyQt (or PySide) as GUI library. The tests use Unittest and Qttest library, as reported in many resources, for example this stackoverflow question: Unit and functional testing a…