aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDamian Jansen <damian.jansen@nokia.com>2012-01-13 12:08:20 +1000
committerQt by Nokia <qt-info@nokia.com>2012-01-13 05:36:11 +0100
commit7e973ea4a883a3af8d9d4dab0e125e254305ff23 (patch)
treeff6314d6276901a3465897bbff1fbce2447a10c4 /tests
parent2671fa8bfd555a414f5dedc3866f87a5fa44893a (diff)
Use QGuiApplication, not QApplication, in tests
Change-Id: I7802293e6cafb90686c103972bc036cf74184714 Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qjsengine/tst_qjsengine.cpp6
-rw-r--r--tests/auto/qtquick2/qquickflickable/tst_qquickflickable.cpp6
-rw-r--r--tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp2
-rw-r--r--tests/auto/qtquick2/qquickitem/tst_qquickitem.cpp4
-rw-r--r--tests/auto/qtquick2/qquickitem2/tst_qquickitem.cpp84
-rw-r--r--tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp8
-rw-r--r--tests/auto/qtquick2/qquickmousearea/tst_qquickmousearea.cpp56
-rw-r--r--tests/auto/qtquick2/qquickpathview/tst_qquickpathview.cpp4
-rw-r--r--tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp4
-rw-r--r--tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp10
10 files changed, 92 insertions, 92 deletions
diff --git a/tests/auto/declarative/qjsengine/tst_qjsengine.cpp b/tests/auto/declarative/qjsengine/tst_qjsengine.cpp
index 281d1b8683..4b41765a58 100644
--- a/tests/auto/declarative/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/declarative/qjsengine/tst_qjsengine.cpp
@@ -971,7 +971,7 @@ void tst_QJSEngine::newQObject_ownership()
}
collectGarbage_helper(eng);
if (ptr)
- QApplication::sendPostedEvents(ptr, QEvent::DeferredDelete);
+ QGuiApplication::sendPostedEvents(ptr, QEvent::DeferredDelete);
QVERIFY(ptr == 0);
}
{
@@ -1002,7 +1002,7 @@ void tst_QJSEngine::newQObject_ownership()
collectGarbage_helper(eng);
// no parent, so it should be like ScriptOwnership
if (ptr)
- QApplication::sendPostedEvents(ptr, QEvent::DeferredDelete);
+ QGuiApplication::sendPostedEvents(ptr, QEvent::DeferredDelete);
QVERIFY(ptr == 0);
}
{
@@ -3106,7 +3106,7 @@ void tst_QJSEngine::collectGarbage()
(void)eng.newQObject(ptr);
collectGarbage_helper(eng);
if (ptr)
- QApplication::sendPostedEvents(ptr, QEvent::DeferredDelete);
+ QGuiApplication::sendPostedEvents(ptr, QEvent::DeferredDelete);
QVERIFY(ptr == 0);
}
diff --git a/tests/auto/qtquick2/qquickflickable/tst_qquickflickable.cpp b/tests/auto/qtquick2/qquickflickable/tst_qquickflickable.cpp
index fad938a1fc..5281565220 100644
--- a/tests/auto/qtquick2/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/qtquick2/qquickflickable/tst_qquickflickable.cpp
@@ -359,7 +359,7 @@ void tst_qquickflickable::wheel()
{
QWheelEvent event(QPoint(200, 200), -120, Qt::NoButton, Qt::NoModifier, Qt::Vertical);
event.setAccepted(false);
- QApplication::sendEvent(canvas, &event);
+ QGuiApplication::sendEvent(canvas, &event);
}
QTRY_VERIFY(flick->contentY() > 0);
@@ -371,7 +371,7 @@ void tst_qquickflickable::wheel()
{
QWheelEvent event(QPoint(200, 200), -120, Qt::NoButton, Qt::NoModifier, Qt::Horizontal);
event.setAccepted(false);
- QApplication::sendEvent(canvas, &event);
+ QGuiApplication::sendEvent(canvas, &event);
}
QTRY_VERIFY(flick->contentX() > 0);
@@ -610,7 +610,7 @@ void tst_qquickflickable::flick(QQuickView *canvas, const QPoint &from, const QP
for (int i = 0; i < pointCount; ++i) {
QMouseEvent mv(QEvent::MouseMove, from + (i+1)*diff/pointCount, Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
- QApplication::sendEvent(canvas, &mv);
+ QGuiApplication::sendEvent(canvas, &mv);
QTest::qWait(duration/pointCount);
QCoreApplication::processEvents();
}
diff --git a/tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp b/tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp
index fe469b534f..9232dc46fa 100644
--- a/tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp
+++ b/tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp
@@ -3796,7 +3796,7 @@ void tst_QQuickGridView::flick(QQuickView *canvas, const QPoint &from, const QPo
for (int i = 0; i < pointCount; ++i) {
QMouseEvent mv(QEvent::MouseMove, from + (i+1)*diff/pointCount, Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
- QApplication::sendEvent(canvas, &mv);
+ QGuiApplication::sendEvent(canvas, &mv);
QTest::qWait(duration/pointCount);
QCoreApplication::processEvents();
}
diff --git a/tests/auto/qtquick2/qquickitem/tst_qquickitem.cpp b/tests/auto/qtquick2/qquickitem/tst_qquickitem.cpp
index 7559b3dd41..e38dcf457f 100644
--- a/tests/auto/qtquick2/qquickitem/tst_qquickitem.cpp
+++ b/tests/auto/qtquick2/qquickitem/tst_qquickitem.cpp
@@ -899,7 +899,7 @@ void tst_qquickitem::wheelEvent()
QWheelEvent event(QPoint(100, 50), -120, Qt::NoButton, Qt::NoModifier, Qt::Vertical);
event.setAccepted(false);
- QApplication::sendEvent(canvas, &event);
+ QGuiApplication::sendEvent(canvas, &event);
if (shouldReceiveWheelEvents) {
QVERIFY(event.isAccepted());
@@ -963,7 +963,7 @@ void tst_qquickitem::hoverEvent_data()
static void sendMouseMove(QObject *object, const QPoint &position)
{
QMouseEvent moveEvent(QEvent::MouseMove, position, Qt::NoButton, Qt::NoButton, 0);
- QApplication::sendEvent(object, &moveEvent);
+ QGuiApplication::sendEvent(object, &moveEvent);
}
void tst_qquickitem::hoverEvent()
diff --git a/tests/auto/qtquick2/qquickitem2/tst_qquickitem.cpp b/tests/auto/qtquick2/qquickitem2/tst_qquickitem.cpp
index 2839ebb83e..556f629618 100644
--- a/tests/auto/qtquick2/qquickitem2/tst_qquickitem.cpp
+++ b/tests/auto/qtquick2/qquickitem2/tst_qquickitem.cpp
@@ -222,7 +222,7 @@ void tst_QQuickItem::keys()
QCOMPARE(canvas->rootObject()->property("isEnabled").toBool(), true);
QKeyEvent key(QEvent::KeyPress, Qt::Key_A, Qt::NoModifier, "A", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QCOMPARE(testObject->mKey, int(Qt::Key_A));
QCOMPARE(testObject->mForwardedKey, int(Qt::Key_A));
QCOMPARE(testObject->mText, QLatin1String("A"));
@@ -232,7 +232,7 @@ void tst_QQuickItem::keys()
testObject->reset();
key = QKeyEvent(QEvent::KeyRelease, Qt::Key_A, Qt::ShiftModifier, "A", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QCOMPARE(testObject->mKey, int(Qt::Key_A));
QCOMPARE(testObject->mForwardedKey, int(Qt::Key_A));
QCOMPARE(testObject->mText, QLatin1String("A"));
@@ -242,7 +242,7 @@ void tst_QQuickItem::keys()
testObject->reset();
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QCOMPARE(testObject->mKey, int(Qt::Key_Return));
QCOMPARE(testObject->mForwardedKey, int(Qt::Key_Return));
QCOMPARE(testObject->mText, QLatin1String("Return"));
@@ -252,7 +252,7 @@ void tst_QQuickItem::keys()
testObject->reset();
key = QKeyEvent(QEvent::KeyPress, Qt::Key_0, Qt::NoModifier, "0", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QCOMPARE(testObject->mKey, int(Qt::Key_0));
QCOMPARE(testObject->mForwardedKey, int(Qt::Key_0));
QCOMPARE(testObject->mText, QLatin1String("0"));
@@ -262,7 +262,7 @@ void tst_QQuickItem::keys()
testObject->reset();
key = QKeyEvent(QEvent::KeyPress, Qt::Key_9, Qt::NoModifier, "9", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QCOMPARE(testObject->mKey, int(Qt::Key_9));
QCOMPARE(testObject->mForwardedKey, int(Qt::Key_9));
QCOMPARE(testObject->mText, QLatin1String("9"));
@@ -272,7 +272,7 @@ void tst_QQuickItem::keys()
testObject->reset();
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QCOMPARE(testObject->mKey, int(Qt::Key_Tab));
QCOMPARE(testObject->mForwardedKey, int(Qt::Key_Tab));
QCOMPARE(testObject->mText, QLatin1String("Tab"));
@@ -282,7 +282,7 @@ void tst_QQuickItem::keys()
testObject->reset();
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Backtab, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QCOMPARE(testObject->mKey, int(Qt::Key_Backtab));
QCOMPARE(testObject->mForwardedKey, int(Qt::Key_Backtab));
QCOMPARE(testObject->mText, QLatin1String("Backtab"));
@@ -293,7 +293,7 @@ void tst_QQuickItem::keys()
canvas->rootContext()->setContextProperty("forwardeeVisible", QVariant(false));
key = QKeyEvent(QEvent::KeyPress, Qt::Key_A, Qt::NoModifier, "A", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QCOMPARE(testObject->mKey, int(Qt::Key_A));
QCOMPARE(testObject->mForwardedKey, 0);
QCOMPARE(testObject->mText, QLatin1String("A"));
@@ -306,7 +306,7 @@ void tst_QQuickItem::keys()
QCOMPARE(canvas->rootObject()->property("isEnabled").toBool(), false);
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QCOMPARE(testObject->mKey, 0);
QVERIFY(!key.isAccepted());
@@ -314,7 +314,7 @@ void tst_QQuickItem::keys()
QCOMPARE(canvas->rootObject()->property("isEnabled").toBool(), true);
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QCOMPARE(testObject->mKey, int(Qt::Key_Return));
QVERIFY(key.isAccepted());
@@ -340,7 +340,7 @@ void tst_QQuickItem::keysProcessingOrder()
QVERIFY(testItem);
QKeyEvent key(QEvent::KeyPress, Qt::Key_A, Qt::NoModifier, "A", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QCOMPARE(testObject->mKey, int(Qt::Key_A));
QCOMPARE(testObject->mText, QLatin1String("A"));
QVERIFY(testObject->mModifiers == Qt::NoModifier);
@@ -351,14 +351,14 @@ void tst_QQuickItem::keysProcessingOrder()
testObject->setProcessLast(true);
key = QKeyEvent(QEvent::KeyPress, Qt::Key_A, Qt::NoModifier, "A", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QCOMPARE(testObject->mKey, 0);
QVERIFY(key.isAccepted());
testObject->reset();
key = QKeyEvent(QEvent::KeyPress, Qt::Key_B, Qt::NoModifier, "B", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QCOMPARE(testObject->mKey, int(Qt::Key_B));
QCOMPARE(testObject->mText, QLatin1String("B"));
QVERIFY(testObject->mModifiers == Qt::NoModifier);
@@ -367,7 +367,7 @@ void tst_QQuickItem::keysProcessingOrder()
testObject->reset();
key = QKeyEvent(QEvent::KeyRelease, Qt::Key_B, Qt::NoModifier, "B", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QCOMPARE(testObject->mKey, 0);
QVERIFY(key.isAccepted());
@@ -556,7 +556,7 @@ void tst_QQuickItem::keyNavigation()
// right
QKeyEvent key(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
item = findItem<QQuickItem>(canvas->rootObject(), "item2");
@@ -565,7 +565,7 @@ void tst_QQuickItem::keyNavigation()
// down
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
item = findItem<QQuickItem>(canvas->rootObject(), "item4");
@@ -574,7 +574,7 @@ void tst_QQuickItem::keyNavigation()
// left
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Left, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
item = findItem<QQuickItem>(canvas->rootObject(), "item3");
@@ -583,7 +583,7 @@ void tst_QQuickItem::keyNavigation()
// up
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
item = findItem<QQuickItem>(canvas->rootObject(), "item1");
@@ -592,7 +592,7 @@ void tst_QQuickItem::keyNavigation()
// tab
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
item = findItem<QQuickItem>(canvas->rootObject(), "item2");
@@ -601,7 +601,7 @@ void tst_QQuickItem::keyNavigation()
// backtab
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Backtab, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
item = findItem<QQuickItem>(canvas->rootObject(), "item1");
@@ -632,9 +632,9 @@ void tst_QQuickItem::keyNavigation_RightToLeft()
rootItemPrivate->resolveLayoutMirror();
QEvent wa(QEvent::WindowActivate);
- QApplication::sendEvent(canvas, &wa);
+ QGuiApplication::sendEvent(canvas, &wa);
QFocusEvent fe(QEvent::FocusIn);
- QApplication::sendEvent(canvas, &fe);
+ QGuiApplication::sendEvent(canvas, &fe);
QQuickItem *item = findItem<QQuickItem>(canvas->rootObject(), "item1");
QVERIFY(item);
@@ -647,7 +647,7 @@ void tst_QQuickItem::keyNavigation_RightToLeft()
// right
QKeyEvent key(QEvent::KeyPress, Qt::Key_Left, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
item = findItem<QQuickItem>(canvas->rootObject(), "item2");
@@ -656,7 +656,7 @@ void tst_QQuickItem::keyNavigation_RightToLeft()
// left
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
item = findItem<QQuickItem>(canvas->rootObject(), "item1");
@@ -689,7 +689,7 @@ void tst_QQuickItem::keyNavigation_skipNotVisible()
// right
QKeyEvent key(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
item = findItem<QQuickItem>(canvas->rootObject(), "item1");
@@ -698,7 +698,7 @@ void tst_QQuickItem::keyNavigation_skipNotVisible()
// tab
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
item = findItem<QQuickItem>(canvas->rootObject(), "item3");
@@ -707,7 +707,7 @@ void tst_QQuickItem::keyNavigation_skipNotVisible()
// backtab
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Backtab, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
item = findItem<QQuickItem>(canvas->rootObject(), "item1");
@@ -722,7 +722,7 @@ void tst_QQuickItem::keyNavigation_skipNotVisible()
// tab
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
item = findItem<QQuickItem>(canvas->rootObject(), "item4");
@@ -731,7 +731,7 @@ void tst_QQuickItem::keyNavigation_skipNotVisible()
// backtab
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Backtab, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
item = findItem<QQuickItem>(canvas->rootObject(), "item1");
@@ -753,9 +753,9 @@ void tst_QQuickItem::keyNavigation_implicitSetting()
QTRY_VERIFY(QGuiApplication::focusWindow() == canvas);
QEvent wa(QEvent::WindowActivate);
- QApplication::sendEvent(canvas, &wa);
+ QGuiApplication::sendEvent(canvas, &wa);
QFocusEvent fe(QEvent::FocusIn);
- QApplication::sendEvent(canvas, &fe);
+ QGuiApplication::sendEvent(canvas, &fe);
QQuickItem *item = findItem<QQuickItem>(canvas->rootObject(), "item1");
QVERIFY(item);
@@ -768,7 +768,7 @@ void tst_QQuickItem::keyNavigation_implicitSetting()
// right
QKeyEvent key(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
item = findItem<QQuickItem>(canvas->rootObject(), "item2");
@@ -777,7 +777,7 @@ void tst_QQuickItem::keyNavigation_implicitSetting()
// back to item1
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Left, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
item = findItem<QQuickItem>(canvas->rootObject(), "item1");
@@ -786,7 +786,7 @@ void tst_QQuickItem::keyNavigation_implicitSetting()
// down
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
item = findItem<QQuickItem>(canvas->rootObject(), "item3");
@@ -795,7 +795,7 @@ void tst_QQuickItem::keyNavigation_implicitSetting()
// move to item4
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
item = findItem<QQuickItem>(canvas->rootObject(), "item4");
@@ -804,7 +804,7 @@ void tst_QQuickItem::keyNavigation_implicitSetting()
// left
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Left, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
item = findItem<QQuickItem>(canvas->rootObject(), "item3");
@@ -813,7 +813,7 @@ void tst_QQuickItem::keyNavigation_implicitSetting()
// back to item4
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
item = findItem<QQuickItem>(canvas->rootObject(), "item4");
@@ -822,7 +822,7 @@ void tst_QQuickItem::keyNavigation_implicitSetting()
// up
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
item = findItem<QQuickItem>(canvas->rootObject(), "item2");
@@ -831,7 +831,7 @@ void tst_QQuickItem::keyNavigation_implicitSetting()
// back to item4
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
item = findItem<QQuickItem>(canvas->rootObject(), "item4");
@@ -840,7 +840,7 @@ void tst_QQuickItem::keyNavigation_implicitSetting()
// tab
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
item = findItem<QQuickItem>(canvas->rootObject(), "item1");
@@ -849,7 +849,7 @@ void tst_QQuickItem::keyNavigation_implicitSetting()
// back to item4
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Backtab, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
item = findItem<QQuickItem>(canvas->rootObject(), "item4");
@@ -858,7 +858,7 @@ void tst_QQuickItem::keyNavigation_implicitSetting()
// backtab
key = QKeyEvent(QEvent::KeyPress, Qt::Key_Backtab, Qt::NoModifier, "", false, 1);
- QApplication::sendEvent(canvas, &key);
+ QGuiApplication::sendEvent(canvas, &key);
QVERIFY(key.isAccepted());
item = findItem<QQuickItem>(canvas->rootObject(), "item3");
diff --git a/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp b/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp
index 98d4f49245..bd96c6dd16 100644
--- a/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp
@@ -2154,15 +2154,15 @@ void tst_QQuickListView::sectionsDelegate()
QTest::mousePress(canvas, Qt::LeftButton, 0, QPoint(20,20));
{
QMouseEvent mv(QEvent::MouseMove, QPoint(20,0), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
- QApplication::sendEvent(canvas, &mv);
+ QGuiApplication::sendEvent(canvas, &mv);
}
{
QMouseEvent mv(QEvent::MouseMove, QPoint(20,-50), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
- QApplication::sendEvent(canvas, &mv);
+ QGuiApplication::sendEvent(canvas, &mv);
}
{
QMouseEvent mv(QEvent::MouseMove, QPoint(20,-200), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
- QApplication::sendEvent(canvas, &mv);
+ QGuiApplication::sendEvent(canvas, &mv);
}
QTest::mouseRelease(canvas, Qt::LeftButton, 0, QPoint(20,-200));
// view should settle back at 0
@@ -4539,7 +4539,7 @@ void tst_QQuickListView::flick(QQuickView *canvas, const QPoint &from, const QPo
for (int i = 0; i < pointCount; ++i) {
QMouseEvent mv(QEvent::MouseMove, from + (i+1)*diff/pointCount, Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
- QApplication::sendEvent(canvas, &mv);
+ QGuiApplication::sendEvent(canvas, &mv);
QTest::qWait(duration/pointCount);
QCoreApplication::processEvents();
}
diff --git a/tests/auto/qtquick2/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/qtquick2/qquickmousearea/tst_qquickmousearea.cpp
index 50ab26e6a1..27f3f0abc7 100644
--- a/tests/auto/qtquick2/qquickmousearea/tst_qquickmousearea.cpp
+++ b/tests/auto/qtquick2/qquickmousearea/tst_qquickmousearea.cpp
@@ -218,7 +218,7 @@ void tst_QQuickMouseArea::dragging()
#ifdef OLDWAY
QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
- QApplication::sendEvent(canvas, &pressEvent);
+ QGuiApplication::sendEvent(canvas, &pressEvent);
#else
QTest::mousePress(canvas, Qt::LeftButton, 0, QPoint(100,100));
#endif
@@ -241,7 +241,7 @@ void tst_QQuickMouseArea::dragging()
#ifdef OLDWAY
QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
- QApplication::sendEvent(canvas, &releaseEvent);
+ QGuiApplication::sendEvent(canvas, &releaseEvent);
#else
QTest::mouseRelease(canvas, Qt::LeftButton, 0, QPoint(122,122));
QTest::qWait(50);
@@ -280,7 +280,7 @@ void tst_QQuickMouseArea::updateMouseAreaPosOnClick()
QCOMPARE(mouseRegion->mouseY(), rect->y());
QMouseEvent event(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
- QApplication::sendEvent(canvas, &event);
+ QGuiApplication::sendEvent(canvas, &event);
QCOMPARE(mouseRegion->mouseX(), 100.0);
QCOMPARE(mouseRegion->mouseY(), 100.0);
@@ -309,7 +309,7 @@ void tst_QQuickMouseArea::updateMouseAreaPosOnResize()
QCOMPARE(mouseRegion->mouseY(), 0.0);
QMouseEvent event(QEvent::MouseButtonPress, rect->pos().toPoint(), Qt::LeftButton, Qt::LeftButton, 0);
- QApplication::sendEvent(canvas, &event);
+ QGuiApplication::sendEvent(canvas, &event);
QVERIFY(!mouseRegion->property("emitPositionChanged").toBool());
QVERIFY(mouseRegion->property("mouseMatchesPos").toBool());
@@ -337,7 +337,7 @@ void tst_QQuickMouseArea::noOnClickedWithPressAndHold()
QVERIFY(canvas->rootObject() != 0);
QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
- QApplication::sendEvent(canvas, &pressEvent);
+ QGuiApplication::sendEvent(canvas, &pressEvent);
QVERIFY(!canvas->rootObject()->property("clicked").toBool());
QVERIFY(!canvas->rootObject()->property("held").toBool());
@@ -345,7 +345,7 @@ void tst_QQuickMouseArea::noOnClickedWithPressAndHold()
QTest::qWait(1000);
QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
- QApplication::sendEvent(canvas, &releaseEvent);
+ QGuiApplication::sendEvent(canvas, &releaseEvent);
QVERIFY(!canvas->rootObject()->property("clicked").toBool());
QVERIFY(canvas->rootObject()->property("held").toBool());
@@ -362,14 +362,14 @@ void tst_QQuickMouseArea::noOnClickedWithPressAndHold()
QVERIFY(canvas->rootObject() != 0);
QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
- QApplication::sendEvent(canvas, &pressEvent);
+ QGuiApplication::sendEvent(canvas, &pressEvent);
QVERIFY(!canvas->rootObject()->property("clicked").toBool());
QTest::qWait(1000);
QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
- QApplication::sendEvent(canvas, &releaseEvent);
+ QGuiApplication::sendEvent(canvas, &releaseEvent);
QVERIFY(canvas->rootObject()->property("clicked").toBool());
@@ -394,7 +394,7 @@ void tst_QQuickMouseArea::onMousePressRejected()
QVERIFY(!canvas->rootObject()->property("mr2_canceled").toBool());
QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
- QApplication::sendEvent(canvas, &pressEvent);
+ QGuiApplication::sendEvent(canvas, &pressEvent);
QVERIFY(canvas->rootObject()->property("mr1_pressed").toBool());
QVERIFY(!canvas->rootObject()->property("mr1_released").toBool());
@@ -406,7 +406,7 @@ void tst_QQuickMouseArea::onMousePressRejected()
QTest::qWait(200);
QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
- QApplication::sendEvent(canvas, &releaseEvent);
+ QGuiApplication::sendEvent(canvas, &releaseEvent);
QVERIFY(canvas->rootObject()->property("mr1_released").toBool());
QVERIFY(!canvas->rootObject()->property("mr1_canceled").toBool());
@@ -426,7 +426,7 @@ void tst_QQuickMouseArea::pressedCanceledOnWindowDeactivate()
QVERIFY(!canvas->rootObject()->property("released").toBool());
QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
- QApplication::sendEvent(canvas, &pressEvent);
+ QGuiApplication::sendEvent(canvas, &pressEvent);
QVERIFY(canvas->rootObject()->property("pressed").toBool());
QVERIFY(!canvas->rootObject()->property("canceled").toBool());
@@ -435,7 +435,7 @@ void tst_QQuickMouseArea::pressedCanceledOnWindowDeactivate()
QTest::qWait(200);
QEvent windowDeactivateEvent(QEvent::WindowDeactivate);
- QApplication::sendEvent(canvas, &windowDeactivateEvent);
+ QGuiApplication::sendEvent(canvas, &windowDeactivateEvent);
QVERIFY(!canvas->rootObject()->property("pressed").toBool());
QVERIFY(canvas->rootObject()->property("canceled").toBool());
QVERIFY(!canvas->rootObject()->property("released").toBool());
@@ -443,7 +443,7 @@ void tst_QQuickMouseArea::pressedCanceledOnWindowDeactivate()
QTest::qWait(200);
//press again
- QApplication::sendEvent(canvas, &pressEvent);
+ QGuiApplication::sendEvent(canvas, &pressEvent);
QVERIFY(canvas->rootObject()->property("pressed").toBool());
QVERIFY(!canvas->rootObject()->property("canceled").toBool());
QVERIFY(!canvas->rootObject()->property("released").toBool());
@@ -452,7 +452,7 @@ void tst_QQuickMouseArea::pressedCanceledOnWindowDeactivate()
//release
QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
- QApplication::sendEvent(canvas, &releaseEvent);
+ QGuiApplication::sendEvent(canvas, &releaseEvent);
QVERIFY(!canvas->rootObject()->property("pressed").toBool());
QVERIFY(!canvas->rootObject()->property("canceled").toBool());
QVERIFY(canvas->rootObject()->property("released").toBool());
@@ -468,17 +468,17 @@ void tst_QQuickMouseArea::doubleClick()
QVERIFY(canvas->rootObject() != 0);
QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
- QApplication::sendEvent(canvas, &pressEvent);
+ QGuiApplication::sendEvent(canvas, &pressEvent);
QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
- QApplication::sendEvent(canvas, &releaseEvent);
+ QGuiApplication::sendEvent(canvas, &releaseEvent);
QCOMPARE(canvas->rootObject()->property("released").toInt(), 1);
pressEvent = QMouseEvent(QEvent::MouseButtonDblClick, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
- QApplication::sendEvent(canvas, &pressEvent);
+ QGuiApplication::sendEvent(canvas, &pressEvent);
- QApplication::sendEvent(canvas, &releaseEvent);
+ QGuiApplication::sendEvent(canvas, &releaseEvent);
QCOMPARE(canvas->rootObject()->property("clicked").toInt(), 1);
QCOMPARE(canvas->rootObject()->property("doubleClicked").toInt(), 1);
@@ -497,20 +497,20 @@ void tst_QQuickMouseArea::clickTwice()
QVERIFY(canvas->rootObject() != 0);
QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
- QApplication::sendEvent(canvas, &pressEvent);
+ QGuiApplication::sendEvent(canvas, &pressEvent);
QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
- QApplication::sendEvent(canvas, &releaseEvent);
+ QGuiApplication::sendEvent(canvas, &releaseEvent);
QCOMPARE(canvas->rootObject()->property("pressed").toInt(), 1);
QCOMPARE(canvas->rootObject()->property("released").toInt(), 1);
QCOMPARE(canvas->rootObject()->property("clicked").toInt(), 1);
pressEvent = QMouseEvent(QEvent::MouseButtonDblClick, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
- QApplication::sendEvent(canvas, &pressEvent);
+ QGuiApplication::sendEvent(canvas, &pressEvent);
- QApplication::sendEvent(canvas, &pressEvent);
- QApplication::sendEvent(canvas, &releaseEvent);
+ QGuiApplication::sendEvent(canvas, &pressEvent);
+ QGuiApplication::sendEvent(canvas, &releaseEvent);
QCOMPARE(canvas->rootObject()->property("pressed").toInt(), 2);
QCOMPARE(canvas->rootObject()->property("released").toInt(), 2);
@@ -530,16 +530,16 @@ void tst_QQuickMouseArea::pressedOrdering()
QCOMPARE(canvas->rootObject()->property("value").toString(), QLatin1String("base"));
QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
- QApplication::sendEvent(canvas, &pressEvent);
+ QGuiApplication::sendEvent(canvas, &pressEvent);
QCOMPARE(canvas->rootObject()->property("value").toString(), QLatin1String("pressed"));
QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0);
- QApplication::sendEvent(canvas, &releaseEvent);
+ QGuiApplication::sendEvent(canvas, &releaseEvent);
QCOMPARE(canvas->rootObject()->property("value").toString(), QLatin1String("toggled"));
- QApplication::sendEvent(canvas, &pressEvent);
+ QGuiApplication::sendEvent(canvas, &pressEvent);
QCOMPARE(canvas->rootObject()->property("value").toString(), QLatin1String("pressed"));
@@ -794,13 +794,13 @@ void tst_QQuickMouseArea::hoverPropagation()
QCOMPARE(root->property("point2").toBool(), false);
QMouseEvent moveEvent(QEvent::MouseMove, QPoint(32, 32), Qt::NoButton, Qt::NoButton, 0);
- QApplication::sendEvent(canvas, &moveEvent);
+ QGuiApplication::sendEvent(canvas, &moveEvent);
QCOMPARE(root->property("point1").toBool(), true);
QCOMPARE(root->property("point2").toBool(), false);
QMouseEvent moveEvent2(QEvent::MouseMove, QPoint(232, 32), Qt::NoButton, Qt::NoButton, 0);
- QApplication::sendEvent(canvas, &moveEvent2);
+ QGuiApplication::sendEvent(canvas, &moveEvent2);
QCOMPARE(root->property("point1").toBool(), false);
QCOMPARE(root->property("point2").toBool(), true);
diff --git a/tests/auto/qtquick2/qquickpathview/tst_qquickpathview.cpp b/tests/auto/qtquick2/qquickpathview/tst_qquickpathview.cpp
index 2d6293c6e8..68bff03207 100644
--- a/tests/auto/qtquick2/qquickpathview/tst_qquickpathview.cpp
+++ b/tests/auto/qtquick2/qquickpathview/tst_qquickpathview.cpp
@@ -1328,11 +1328,11 @@ void tst_QQuickPathView::mouseDrag()
{
QMouseEvent mv(QEvent::MouseMove, QPoint(30,100), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
- QApplication::sendEvent(canvas, &mv);
+ QGuiApplication::sendEvent(canvas, &mv);
}
{
QMouseEvent mv(QEvent::MouseMove, QPoint(90,100), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
- QApplication::sendEvent(canvas, &mv);
+ QGuiApplication::sendEvent(canvas, &mv);
}
QVERIFY(pathview->currentIndex() != current);
diff --git a/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp b/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp
index b76f764cce..0e8eab18be 100644
--- a/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp
+++ b/tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp
@@ -558,7 +558,7 @@ void tst_qquicktext::alignments()
canvas->show();
canvas->requestActivateWindow();
QTest::qWait(50);
- QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(canvas));
+ QTRY_COMPARE(QGuiApplication::activeWindow(), static_cast<QWidget *>(canvas));
QObject *ob = canvas->rootObject();
QVERIFY(ob != 0);
@@ -571,7 +571,7 @@ void tst_qquicktext::alignments()
canvas->render(&p);
QImage expect(expectfile);
- if (QApplicationPrivate::graphics_system_name == "raster" || QApplicationPrivate::graphics_system_name == "") {
+ if (QGuiApplicationPrivate::graphics_system_name == "raster" || QGuiApplicationPrivate::graphics_system_name == "") {
QCOMPARE(actual,expect);
}
delete canvas;
diff --git a/tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp
index fa81781404..e97756f330 100644
--- a/tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp
+++ b/tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp
@@ -619,7 +619,7 @@ void tst_qquicktextinput::selection()
QList<QInputMethodEvent::Attribute> attributes;
attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 12, 5, QVariant());
QInputMethodEvent event("", attributes);
- QApplication::sendEvent(textinputObject, &event);
+ QGuiApplication::sendEvent(textinputObject, &event);
}
QCOMPARE(selectionSpy.count(), 1);
QCOMPARE(textinputObject->selectionStart(), 12);
@@ -1734,19 +1734,19 @@ void tst_qquicktextinput::inputMethods()
QList<QInputMethodEvent::Attribute> attributes;
QInputMethodEvent preeditEvent("test", attributes);
preeditEvent.setTentativeCommitString("test");
- QApplication::sendEvent(input, &preeditEvent);
+ QGuiApplication::sendEvent(input, &preeditEvent);
QCOMPARE(input->text(), QString("test"));
// tentative commit not allowed present in surrounding text
QInputMethodQueryEvent queryEvent(Qt::ImSurroundingText);
- QApplication::sendEvent(input, &queryEvent);
+ QGuiApplication::sendEvent(input, &queryEvent);
QCOMPARE(queryEvent.value(Qt::ImSurroundingText).toString(), QString(""));
// if text with tentative commit does not validate, not allowed to be part of text property
input->setText(""); // ensure input state is reset
QValidator *validator = new QIntValidator(0, 100);
input->setValidator(validator);
- QApplication::sendEvent(input, &preeditEvent);
+ QGuiApplication::sendEvent(input, &preeditEvent);
QCOMPARE(input->text(), QString(""));
input->setValidator(0);
delete validator;
@@ -2777,7 +2777,7 @@ void tst_qquicktextinput::inputContextMouseHandler()
QPoint position = QPointF(x, y).toPoint();
QInputMethodEvent inputEvent(text.mid(0, 5), QList<QInputMethodEvent::Attribute>());
- QApplication::sendEvent(input, &inputEvent);
+ QGuiApplication::sendEvent(input, &inputEvent);
QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, position);
QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position);