aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qtquick2/qquickitem2
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/auto/qtquick2/qquickitem2
parent2671fa8bfd555a414f5dedc3866f87a5fa44893a (diff)
Use QGuiApplication, not QApplication, in tests
Change-Id: I7802293e6cafb90686c103972bc036cf74184714 Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
Diffstat (limited to 'tests/auto/qtquick2/qquickitem2')
-rw-r--r--tests/auto/qtquick2/qquickitem2/tst_qquickitem.cpp84
1 files changed, 42 insertions, 42 deletions
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");