aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/pressandhold
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2016-02-12 13:40:20 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2016-02-12 13:56:03 +0000
commit572d7011f123324e70dde4c75260f32cd696f709 (patch)
tree8b57b4b19c51bc69aa2bdc15f0a3d1a12e9bd174 /tests/auto/pressandhold
parent17614b700e313648839885ae9814e7f62682be88 (diff)
Test and fix AbstractButton::pressAndHold()
Using the same auto test that already exists for TextField and TextArea nicely exposed some difference in the behavior: - the signal wasn't canceled on second press - the signal was canceled right away on any tiny move. now it allows the same little threshold than TextField and TextArea Change-Id: I6b9bd19c614b36dd0ec7b232f821af3aa929d02a Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'tests/auto/pressandhold')
-rw-r--r--tests/auto/pressandhold/tst_pressandhold.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/auto/pressandhold/tst_pressandhold.cpp b/tests/auto/pressandhold/tst_pressandhold.cpp
index 33d93cc0..8c4cf673 100644
--- a/tests/auto/pressandhold/tst_pressandhold.cpp
+++ b/tests/auto/pressandhold/tst_pressandhold.cpp
@@ -54,14 +54,17 @@ private slots:
void tst_PressAndHold::pressAndHold_data()
{
QTest::addColumn<QByteArray>("data");
+ QTest::addColumn<QByteArray>("signal");
- QTest::newRow("TextField") << QByteArray("import Qt.labs.controls 1.0; TextField { text: 'TextField' }");
- QTest::newRow("TextArea") << QByteArray("import Qt.labs.controls 1.0; TextArea { text: 'TextArea' }");
+ QTest::newRow("Button") << QByteArray("import Qt.labs.controls 1.0; Button { text: 'Button' }") << QByteArray(SIGNAL(pressAndHold()));
+ QTest::newRow("TextField") << QByteArray("import Qt.labs.controls 1.0; TextField { text: 'TextField' }") << QByteArray(SIGNAL(pressAndHold(QQuickMouseEvent*)));
+ QTest::newRow("TextArea") << QByteArray("import Qt.labs.controls 1.0; TextArea { text: 'TextArea' }") << QByteArray(SIGNAL(pressAndHold(QQuickMouseEvent*)));
}
void tst_PressAndHold::pressAndHold()
{
QFETCH(QByteArray, data);
+ QFETCH(QByteArray, signal);
QQmlEngine engine;
QQmlComponent component(&engine);
@@ -71,8 +74,8 @@ void tst_PressAndHold::pressAndHold()
QScopedPointer<QObject> waitControl(component.create());
QVERIFY(!control.isNull() && !waitControl.isNull());
- QSignalSpy spy(control.data(), SIGNAL(pressAndHold(QQuickMouseEvent*)));
- QSignalSpy waitSpy(waitControl.data(), SIGNAL(pressAndHold(QQuickMouseEvent*)));
+ QSignalSpy spy(control.data(), signal);
+ QSignalSpy waitSpy(waitControl.data(), signal);
QVERIFY(spy.isValid() && waitSpy.isValid());
int startDragDistance = QGuiApplication::styleHints()->startDragDistance();