mirror of
https://gitlab.com/ita1024/waf.git
synced 2024-11-22 01:46:15 +01:00
Rework "qt5 demo: add example of unit testing using QtTest"
This commit is contained in:
parent
31da55afb9
commit
82afd0a0e4
@ -3,6 +3,7 @@
|
||||
|
||||
#include "foo.h"
|
||||
#include <QtTest/QtTest>
|
||||
#include <qtest_widgets.h>
|
||||
|
||||
class TestQt5Test: public QObject {
|
||||
Q_OBJECT
|
||||
@ -16,7 +17,7 @@ class TestQt5Test: public QObject {
|
||||
// Test of the UI by simulating a button click and button label reading
|
||||
void TestQt5Test::testGui() {
|
||||
QCOMPARE(myFoo.m_button->text(), QString("Foo Button"));
|
||||
QTest::mouseClick(myFoo.m_button,Qt::LeftButton,Qt::NoModifier,QPoint(5,5),0);
|
||||
QTest::mouseClick(myFoo.m_button, Qt::LeftButton,Qt::NoModifier, QPoint(5,5), 0);
|
||||
QCOMPARE(myFoo.m_button->text(), QString("Button Foo"));
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,8 @@ def build(bld):
|
||||
# Example of integration of Qt5 Unit tests using Qt5Test using waf_unit_test
|
||||
bld(
|
||||
features = 'qt5 cxx cxxprogram test',
|
||||
use = 'QT5CORE QT5WIDGETS QT5TEST',
|
||||
use = 'QT5CORE QT5GUI QT5WIDGETS QT5TEST',
|
||||
defines = 'QT_WIDGETS_LIB',
|
||||
source = 'foo.cpp testqt5.cpp',
|
||||
moc = 'foo.h',
|
||||
target = 'footest',
|
||||
|
Loading…
Reference in New Issue
Block a user