20 #include <qpa/qwindowsysteminterface.h>
21 #include <QtGui/QGuiApplication>
23 TestUtil::TestUtil(QObject *parent)
35 TestUtil::isInstanceOf(QObject *obj, QString name)
37 if (!obj)
return false;
38 bool result = obj->inherits(name.toUtf8());
40 const QMetaObject *metaObject = obj->metaObject();
41 while (!result && metaObject) {
42 const QString className = metaObject->className();
43 const QString qmlName = className.left(className.indexOf(
"_QMLTYPE_"));
44 result = qmlName == name;
45 metaObject = metaObject->superClass();
51 TouchEventSequenceWrapper *TestUtil::touchEvent()
56 return new TouchEventSequenceWrapper(
57 QTest::touchEvent(m_targetWindow, m_touchDevice,
false));
60 void TestUtil::ensureTargetWindow()
63 m_targetWindow = QGuiApplication::topLevelWindows()[0];
66 void TestUtil::ensureTouchDevice()
69 m_touchDevice =
new QTouchDevice;
70 m_touchDevice->setType(QTouchDevice::TouchScreen);
71 QWindowSystemInterface::registerTouchDevice(m_touchDevice);