Add QPushButton::touchTap autotest
Change-Id: Ibfed43fd4b8fdc3834ee7ca7bd92296504943abe Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
0cd134ed91
commit
d15d9d49ac
@ -63,6 +63,7 @@ private slots:
|
||||
void animateClick();
|
||||
void toggle();
|
||||
void clicked();
|
||||
void touchTap();
|
||||
void toggled();
|
||||
void defaultAndAutoDefault();
|
||||
void sizeHint_data();
|
||||
@ -88,6 +89,7 @@ private:
|
||||
uint release_count;
|
||||
|
||||
QPushButton *testWidget;
|
||||
QPointingDevice *m_touchScreen = QTest::createTouchDevice();
|
||||
};
|
||||
|
||||
// Testing get/set functions
|
||||
@ -393,6 +395,29 @@ void tst_QPushButton::clicked()
|
||||
QCOMPARE( release_count, (uint)10 );
|
||||
}
|
||||
|
||||
void tst_QPushButton::touchTap()
|
||||
{
|
||||
QTest::touchEvent(testWidget, m_touchScreen).press(0, QPoint(10, 10));
|
||||
QVERIFY( press_count == 1 );
|
||||
QVERIFY( release_count == 0 );
|
||||
QTest::touchEvent(testWidget, m_touchScreen).release(0, QPoint(10, 10));
|
||||
QCOMPARE( press_count, (uint)1 );
|
||||
QCOMPARE( release_count, (uint)1 );
|
||||
QCOMPARE( click_count, (uint)1 );
|
||||
|
||||
press_count = 0;
|
||||
release_count = 0;
|
||||
click_count = 0;
|
||||
testWidget->setDown(false);
|
||||
for (uint i = 0; i < 10; i++) {
|
||||
QTest::touchEvent(testWidget, m_touchScreen).press(0, QPoint(10, 10));
|
||||
QTest::touchEvent(testWidget, m_touchScreen).release(0, QPoint(10, 10));
|
||||
}
|
||||
QCOMPARE( press_count, (uint)10 );
|
||||
QCOMPARE( release_count, (uint)10 );
|
||||
QCOMPARE( click_count, (uint)10 );
|
||||
}
|
||||
|
||||
QPushButton *pb = 0;
|
||||
void tst_QPushButton::helperSlotDelete()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user