Fix tst_qquicktextedit
authorRafael Roquetto <rafael.roquetto.qnx@kdab.com>
Mon, 22 Jul 2013 20:40:22 +0000 (17:40 -0300)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 2 Aug 2013 13:02:47 +0000 (15:02 +0200)
- Use showNormal() instead of show() to keep expected window sizes on
  fullscreen platforms.
- Use consistent point size for hAlignVisual
- Do not query for QQmlComponent::Loading on remoteCursorDelegate: when a new
  connection is established to the test http server, it will setup a single
  shot QTimer with a 500ms timeout that will trigger the reply to be sent
  back, making the call to sendDelayedItem() obsolete and reduntant. Also, it
  means that in some platforms, data will arrive back to the component before
  the check for QQmlComponent::Loading is executed, causing the test to fail
  since at this point the status will already be QQmlComponent::Ready instead.

Change-Id: I6508c28fa55a1aa2ae5861922701a8c322342380
Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
Reviewed-by: Wolfgang Bremer <wbremer@blackberry.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
tests/auto/quick/qquicktextedit/data/hAlignVisual.qml
tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp

index 9c9318d..017bab9 100644 (file)
@@ -9,5 +9,6 @@ Rectangle {
         text: "AA\nBBBBBBB\nCCCCCCCCCCCCCCCC"
         anchors.centerIn: parent
         horizontalAlignment: Text.AlignLeft
+        font.pointSize: 12
     }
 }
index 6e74d84..a5cf916 100644 (file)
@@ -654,7 +654,7 @@ void tst_qquicktextedit::hAlign_RightToLeft()
     QQuickView window(testFileUrl("horizontalAlignment_RightToLeft.qml"));
     QQuickTextEdit *textEdit = window.rootObject()->findChild<QQuickTextEdit*>("text");
     QVERIFY(textEdit != 0);
-    window.show();
+    window.showNormal();
 
     const QString rtlText = textEdit->text();
 
@@ -832,7 +832,7 @@ void tst_qquicktextedit::hAlignVisual()
 {
     QQuickView view(testFileUrl("hAlignVisual.qml"));
     view.setFlags(view.flags() | Qt::WindowStaysOnTopHint); // Prevent being obscured by other windows.
-    view.show();
+    view.showNormal();
     QVERIFY(QTest::qWaitForWindowExposed(&view));
 
     QQuickText *text = view.rootObject()->findChild<QQuickText*>("textItem");
@@ -1262,7 +1262,7 @@ void tst_qquicktextedit::focusOnPress()
     QQuickWindow window;
     window.resize(100, 50);
     textEditObject->setParentItem(window.contentItem());
-    window.show();
+    window.showNormal();
     window.requestActivate();
     QTest::qWaitForWindowActive(&window);
 
@@ -2530,7 +2530,7 @@ void tst_qquicktextedit::remoteCursorDelegate()
 
     view.rootContext()->setContextProperty("contextDelegate", &component);
     view.setSource(testFileUrl("cursorTestRemote.qml"));
-    view.show();
+    view.showNormal();
     view.requestActivate();
     QTest::qWaitForWindowActive(&view);
     QQuickTextEdit *textEditObject = view.rootObject()->findChild<QQuickTextEdit*>("textEditObject");
@@ -2544,10 +2544,6 @@ void tst_qquicktextedit::remoteCursorDelegate()
     textEditObject->setFocus(true);
     QVERIFY(textEditObject->isCursorVisible());
 
-    QCOMPARE(component.status(), QQmlComponent::Loading);
-    QVERIFY(!textEditObject->findChild<QQuickItem*>("cursorInstance"));
-    server.sendDelayedItem();
-
     // Wait for component to load.
     QTRY_COMPARE(component.status(), QQmlComponent::Ready);
     QVERIFY(textEditObject->findChild<QQuickItem*>("cursorInstance"));
@@ -3057,7 +3053,7 @@ void tst_qquicktextedit::openInputPanel()
     inputMethodPrivate->testContext = &platformInputContext;
 
     QQuickView view(testFileUrl("openInputPanel.qml"));
-    view.show();
+    view.showNormal();
     view.requestActivate();
     QTest::qWaitForWindowActive(&view);