From a32df45bec6fb414da8bfb6d4424dd3f7a8e3f7d Mon Sep 17 00:00:00 2001 From: Pekka Vuorela Date: Thu, 15 Dec 2011 16:06:27 +0200 Subject: Remove QInputContext based test from QGraphicsItem tests Was basically checking that a method call is a method call and QApplication::setInputContext() sets the input context. Change-Id: Ia8723fe245f2480d503f0140f61078dc074161fc Reviewed-by: Lars Knoll Reviewed-by: Joona Petrell --- .../qgraphicsitem/tst_qgraphicsitem.cpp | 82 ---------------------- 1 file changed, 82 deletions(-) (limited to 'tests/auto/widgets') diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 8474293a54..f5a09b89a0 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -61,7 +61,6 @@ #include #include #include -#include #include #include #include @@ -440,7 +439,6 @@ private slots: void modality_keyEvents(); void itemIsInFront(); void scenePosChange(); - void updateMicroFocus(); void textItem_shortcuts(); void scroll(); void focusHandling_data(); @@ -10436,86 +10434,6 @@ void tst_QGraphicsItem::scenePosChange() QCOMPARE(child2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 0); } -class MyInputContext : public QInputContext -{ -public: - MyInputContext() : nbUpdates(0) {} - ~MyInputContext() {} - - QString identifierName() { return QString(); } - QString language() { return QString(); } - - void reset() {} - - bool isComposing() const { return false; } - - void update() { nbUpdates++; } - - bool nbUpdates; -}; - -class MyInputWidget : public QGraphicsWidget -{ -public: - MyInputWidget() - { - setFlag(QGraphicsItem::ItemIsFocusable, true); - setFlag(QGraphicsItem::ItemAcceptsInputMethod, true); - } - void mousePressEvent(QGraphicsSceneMouseEvent *event) - { - event->accept(); - } - - void doUpdateMicroFocus() - { - if (QWidget *fw = QApplication::focusWidget()) { - if (scene()) { - for (int i = 0 ; i < scene()->views().count() ; ++i) { - if (scene()->views().at(i) == fw) { - if (QInputContext *inputContext = fw->inputContext()) { - inputContext->update(); - } - } - } - } - } - } -}; - -void tst_QGraphicsItem::updateMicroFocus() -{ -#if defined Q_OS_WIN || defined Q_OS_MAC - QSKIP("QTBUG-9578"); -#endif - QGraphicsScene scene; - QWidget parent; - QGridLayout layout; - parent.setLayout(&layout); - QGraphicsView view(&scene); - QGraphicsView view2(&scene); - layout.addWidget(&view, 0, 0); - layout.addWidget(&view2, 0, 1); - MyInputContext *ic = new MyInputContext; - qApp->setInputContext(ic); - MyInputWidget input; - input.setPos(0, 0); - input.resize(150, 150); - scene.addItem(&input); - input.setFocus(); - parent.show(); - view.setFocus(); - qApp->setAutoSipEnabled(true); - QApplication::setActiveWindow(&parent); - QTest::qWaitForWindowShown(&parent); - QTRY_COMPARE(QApplication::activeWindow(), static_cast(&parent)); - //We reset the number of updates that happened previously (initialisation) - ic->nbUpdates = 0; - input.doUpdateMicroFocus(); - QApplication::processEvents(); - QTRY_COMPARE(ic->nbUpdates, 1); -} - void tst_QGraphicsItem::textItem_shortcuts() { QWidget w; -- cgit v1.2.3