diff options
Diffstat (limited to 'client/test')
-rw-r--r-- | client/test/testlineedit.cc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/client/test/testlineedit.cc b/client/test/testlineedit.cc index 577e0da..e8c9e40 100644 --- a/client/test/testlineedit.cc +++ b/client/test/testlineedit.cc @@ -2,6 +2,9 @@ #include <QtTest/QtTest> #include "util.h" #include "lineedit.h" +#include <QApplication> +#include <QWidget> +#include <QLineEdit> static QString xml = "<lineedit name=\"mylineedit\"/>\n"; @@ -40,6 +43,40 @@ private slots: QTest::keyClicks(le.qwidget(), "h"); QCOMPARE(spy.count(), 1); } + + void tabOut() + { + QDomDocument doc; doc.setContent(xml); + QDomElement e = doc.documentElement(); + QWidget main; + LineEdit le(e, createMacroWindow()); + le.qwidget()->setParent(&main); + QLineEdit qle(&main); + main.show(); + + QApplication::processEvents(); + + QTest::mouseClick(le.qwidget(), Qt::LeftButton); + QApplication::processEvents(); + QCOMPARE(QApplication::focusWidget(), le.qwidget()); + QTest::keyClick(le.qwidget(), Qt::Key_Enter); + QApplication::processEvents(); + QVERIFY(QApplication::focusWidget() != le.qwidget()); + + QTest::mouseClick(le.qwidget(), Qt::LeftButton); + QApplication::processEvents(); + QCOMPARE(QApplication::focusWidget(), le.qwidget()); + QTest::keyClick(le.qwidget(), Qt::Key_Return); + QApplication::processEvents(); + QVERIFY(QApplication::focusWidget() != le.qwidget()); + + QTest::mouseClick(le.qwidget(), Qt::LeftButton); + QApplication::processEvents(); + QCOMPARE(QApplication::focusWidget(), le.qwidget()); + QTest::keyClick(le.qwidget(), Qt::Key_Tab); + QApplication::processEvents(); + QVERIFY(QApplication::focusWidget() != le.qwidget()); + } }; QTEST_MAIN(TestLineEdit) |