diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-02-15 15:23:31 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-02-22 11:04:57 +0000 |
commit | 004f9dca05215659b5a201c18648580898c2445e (patch) | |
tree | 792091bdf51b89c0d7dbe7961e8219286de73ac9 /tests/auto/pressandhold | |
parent | 068fe79f31fd5d9e055eade37e75df44496818a0 (diff) |
Speedup tst_pressandhold
Before, running the test took 8032ms. After the patch it takes 1375ms.
The test has been implemented without timers. It creates one control
instance for testing signal emission/cancellation, and another just for
waiting for the signal. By the time the second control emits, the first
control has had to emit or cancel the signal. Thus, for the test, the
exact press and hold interval does not matter.
Change-Id: I3016217c2422cb8d79e56b0b51a11eaeef08865a
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'tests/auto/pressandhold')
-rw-r--r-- | tests/auto/pressandhold/tst_pressandhold.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/auto/pressandhold/tst_pressandhold.cpp b/tests/auto/pressandhold/tst_pressandhold.cpp index 8c4cf673..f61c9f56 100644 --- a/tests/auto/pressandhold/tst_pressandhold.cpp +++ b/tests/auto/pressandhold/tst_pressandhold.cpp @@ -37,13 +37,14 @@ #include <QtTest> #include <QtQuick> -// TODO: add QStyleHints::setMousePressAndHoldInterval() to speedup the test - class tst_PressAndHold : public QObject { Q_OBJECT private slots: + void initTestCase(); + void cleanupTestCase(); + void pressAndHold_data(); void pressAndHold(); @@ -51,6 +52,16 @@ private slots: void keepSelection(); }; +void tst_PressAndHold::initTestCase() +{ + QGuiApplication::styleHints()->setMousePressAndHoldInterval(100); +} + +void tst_PressAndHold::cleanupTestCase() +{ + QGuiApplication::styleHints()->setMousePressAndHoldInterval(-1); +} + void tst_PressAndHold::pressAndHold_data() { QTest::addColumn<QByteArray>("data"); |