Reverted part of "Refactor input context tests"
authorPekka Vuorela <pekka.ta.vuorela@nokia.com>
Thu, 23 Feb 2012 13:49:11 +0000 (15:49 +0200)
committerQt by Nokia <qt-info@nokia.com>
Fri, 24 Feb 2012 01:38:04 +0000 (02:38 +0100)
This commit reverts partly 7401832a7d45de99562b94340375393a39267f41

There is something wrong with DummyWindow/XCB/Metacity, Metacity
crashes quite often when QWindow is activated.

Change-Id: I611af2678814f41c941cb697054135f561a77878
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp

index c906eba..bc364e3 100644 (file)
@@ -212,18 +212,12 @@ void tst_qinputmethod::cursorRectangle()
 {
     QCOMPARE(qApp->inputMethod()->cursorRectangle(), QRectF());
 
-    DummyWindow window;
-    window.show();
-    QTest::qWaitForWindowShown(&window);
-    window.requestActivateWindow();
-    QTRY_COMPARE(qApp->focusWindow(), &window);
-    window.setFocusObject(&m_inputItem);
-
     QTransform transform;
     transform.translate(10, 10);
     transform.scale(2, 2);
     transform.shear(2, 2);
     qApp->inputMethod()->setInputItemTransform(transform);
+    qApp->inputMethod()->setInputItem(&m_inputItem);
 
     QCOMPARE(qApp->inputMethod()->cursorRectangle(), transform.mapRect(QRectF(1, 2, 3, 4)));
 
@@ -232,6 +226,7 @@ void tst_qinputmethod::cursorRectangle()
 
     // reset
     m_inputItem.cursorRectangle = QRectF(1, 2, 3, 4);
+    qApp->inputMethod()->setInputItem(0);
     qApp->inputMethod()->setInputItemTransform(QTransform());
 }
 
@@ -269,13 +264,6 @@ void tst_qinputmethod::commit()
 
 void tst_qinputmethod::update()
 {
-    DummyWindow window;
-    window.show();
-    QTest::qWaitForWindowShown(&window);
-    window.requestActivateWindow();
-    QTRY_COMPARE(qApp->focusWindow(), &window);
-    window.setFocusObject(&m_inputItem);
-
     QCOMPARE(m_platformInputContext.m_updateCallCount, 0);
     QCOMPARE(int(m_platformInputContext.m_lastQueries), int(Qt::ImhNone));
 
@@ -288,6 +276,9 @@ void tst_qinputmethod::update()
     QCOMPARE(int(m_platformInputContext.m_lastQueries), int(Qt::ImQueryAll));
 
     QCOMPARE(qApp->inputMethod()->keyboardRectangle(), QRectF(10, 20, 30, 40));
+
+    // reset
+    qApp->inputMethod()->setInputItem(0);
 }
 
 void tst_qinputmethod::query()