Use QGuiApplication, not QApplication, in tests
authorDamian Jansen <damian.jansen@nokia.com>
Fri, 13 Jan 2012 02:08:20 +0000 (12:08 +1000)
committerQt by Nokia <qt-info@nokia.com>
Fri, 13 Jan 2012 04:36:11 +0000 (05:36 +0100)
Change-Id: I7802293e6cafb90686c103972bc036cf74184714
Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
tests/auto/declarative/qjsengine/tst_qjsengine.cpp
tests/auto/qtquick2/qquickflickable/tst_qquickflickable.cpp
tests/auto/qtquick2/qquickgridview/tst_qquickgridview.cpp
tests/auto/qtquick2/qquickitem/tst_qquickitem.cpp
tests/auto/qtquick2/qquickitem2/tst_qquickitem.cpp
tests/auto/qtquick2/qquicklistview/tst_qquicklistview.cpp
tests/auto/qtquick2/qquickmousearea/tst_qquickmousearea.cpp
tests/auto/qtquick2/qquickpathview/tst_qquickpathview.cpp
tests/auto/qtquick2/qquicktext/tst_qquicktext.cpp
tests/auto/qtquick2/qquicktextinput/tst_qquicktextinput.cpp

index 281d1b8..4b41765 100644 (file)
@@ -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);
 }
 
index fad938a..5281565 100644 (file)
@@ -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();
     }
index fe469b5..9232dc4 100644 (file)
@@ -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();
     }
index 7559b3d..e38dcf4 100644 (file)
@@ -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()
index 2839ebb..556f629 100644 (file)
@@ -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");
index 98d4f49..bd96c6d 100644 (file)
@@ -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();
     }
index 50ab26e..27f3f0a 100644 (file)
@@ -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);
 
index 2d6293c..68bff03 100644 (file)
@@ -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);
index b76f764..0e8eab1 100644 (file)
@@ -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;
index fa81781..e97756f 100644 (file)
@@ -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);