summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>2012-04-24 10:57:57 +0300
committerQt by Nokia <qt-info@nokia.com>2012-04-24 19:36:55 +0200
commit63051701b473e6560e315cf9bec255a9e3a0a118 (patch)
tree5f3dcd4a559205c6803b1db418b0a6b550d24131 /src/testlib
parent229343d5fc1dbfcbe4b07674ec030d30e065bf0e (diff)
Add flag in testlib to disable committing the simulated touch
Some declarative tests (e.g. 24319) need more fine-grained control over processing the simulated touch events. Change-Id: Ib163cfd29254016ea16e8d739ad97369b6ccdc90 Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/qtesttouch.h31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/testlib/qtesttouch.h b/src/testlib/qtesttouch.h
index 291a7219b3..6e456f375c 100644
--- a/src/testlib/qtesttouch.h
+++ b/src/testlib/qtesttouch.h
@@ -71,7 +71,8 @@ namespace QTest
public:
~QTouchEventSequence()
{
- commit();
+ if (commitWhenDestroyed)
+ commit();
}
QTouchEventSequence& press(int touchId, const QPoint &pt, QWindow *window = 0)
{
@@ -125,7 +126,7 @@ namespace QTest
}
#endif
- void commit()
+ void commit(bool processEvents = true)
{
if (!points.isEmpty()) {
if (targetWindow)
@@ -139,7 +140,8 @@ namespace QTest
}
#endif
}
- QCoreApplication::processEvents();
+ if (processEvents)
+ QCoreApplication::processEvents();
previousPoints = points;
points.clear();
}
@@ -170,17 +172,17 @@ namespace QTest
private:
#ifdef QT_WIDGETS_LIB
- QTouchEventSequence(QWidget *widget, QTouchDevice *aDevice)
- : targetWidget(widget), targetWindow(0), device(aDevice)
+ QTouchEventSequence(QWidget *widget, QTouchDevice *aDevice, bool autoCommit)
+ : targetWidget(widget), targetWindow(0), device(aDevice), commitWhenDestroyed(autoCommit)
{
}
#endif
- QTouchEventSequence(QWindow *window, QTouchDevice *aDevice)
+ QTouchEventSequence(QWindow *window, QTouchDevice *aDevice, bool autoCommit)
:
#ifdef QT_WIDGETS_LIB
targetWidget(0),
#endif
- targetWindow(window), device(aDevice)
+ targetWindow(window), device(aDevice), commitWhenDestroyed(autoCommit)
{
}
@@ -224,25 +226,28 @@ namespace QTest
#endif
QWindow *targetWindow;
QTouchDevice *device;
+ bool commitWhenDestroyed;
#ifdef QT_WIDGETS_LIB
- friend QTouchEventSequence touchEvent(QWidget *, QTouchDevice*);
+ friend QTouchEventSequence touchEvent(QWidget *, QTouchDevice*, bool);
#endif
- friend QTouchEventSequence touchEvent(QWindow *, QTouchDevice*);
+ friend QTouchEventSequence touchEvent(QWindow *, QTouchDevice*, bool);
};
#ifdef QT_WIDGETS_LIB
inline
QTouchEventSequence touchEvent(QWidget *widget,
- QTouchDevice *device)
+ QTouchDevice *device,
+ bool autoCommit = true)
{
- return QTouchEventSequence(widget, device);
+ return QTouchEventSequence(widget, device, autoCommit);
}
#endif
inline
QTouchEventSequence touchEvent(QWindow *window,
- QTouchDevice *device)
+ QTouchDevice *device,
+ bool autoCommit = true)
{
- return QTouchEventSequence(window, device);
+ return QTouchEventSequence(window, device, autoCommit);
}
}