summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2011-09-19 04:12:35 (GMT)
committerRohan McGovern <rohan.mcgovern@nokia.com>2011-09-19 04:12:35 (GMT)
commit5055f13683dd0670d62a81e61bf097fd220f0d42 (patch)
tree1cf10d701b6d6ba5fffe9a2267ecf894d505e1bd /tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
parentfc602cb1737e58b4b814c4a799fa2a68acb6dbcd (diff)
parent53d9e3620ede7492c141402d9365d5c0dd7c10fd (diff)
downloadQt-5055f13683dd0670d62a81e61bf097fd220f0d42.zip
Qt-5055f13683dd0670d62a81e61bf097fd220f0d42.tar.gz
Qt-5055f13683dd0670d62a81e61bf097fd220f0d42.tar.bz2
Merge remote branch 'origin/4.8' into doc-staging-master
Conflicts: dist/changes-4.8.0
Diffstat (limited to 'tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp')
-rw-r--r--tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp68
1 files changed, 68 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
index b8741fe..8a26323 100644
--- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -290,6 +290,7 @@ private slots:
void taskQT_3674_doNotCrash();
void taskQTBUG_15977_renderWithDeviceCoordinateCache();
void taskQTBUG_16401_focusItem();
+ void taskQTBUG_19680_tabWidgetFocus();
};
void tst_QGraphicsScene::initTestCase()
@@ -4711,5 +4712,72 @@ void tst_QGraphicsScene::taskQTBUG_16401_focusItem()
QVERIFY(!scene.focusItem());
}
+void tst_QGraphicsScene::taskQTBUG_19680_tabWidgetFocus()
+{
+ QTabWidget tabWidget;
+ QGraphicsScene scene1;
+ QGraphicsScene scene2;
+ QGraphicsView view1(&scene1);
+ QGraphicsView view2(&scene2);
+
+ tabWidget.show();
+
+ tabWidget.addTab(&view1, "view1");
+ tabWidget.setCurrentWidget(&view1);
+
+ QGraphicsTextItem *textItem1 = scene1.addText("Text1");
+ textItem1->setFlags(QGraphicsItem::ItemIsFocusable);
+ textItem1->setTextInteractionFlags(Qt::TextEditorInteraction);
+ textItem1->setEnabled(true);
+ textItem1->setFocus();
+
+ tabWidget.addTab(&view2, "view2");
+ tabWidget.setCurrentWidget(&view2);
+
+ QGraphicsTextItem *textItem2 = scene2.addText("Text2");
+ textItem2->setFlags(QGraphicsItem::ItemIsFocusable);
+ textItem2->setTextInteractionFlags(Qt::TextEditorInteraction);
+ textItem2->setEnabled(true);
+ textItem2->setFocus();
+
+ scene2.clearFocus();
+
+ view2.clearFocus();
+ view2.setEnabled(false);
+ view2.setInteractive(false);
+ view2.setVisible(false);
+ view2.setShown(false);
+ view2.hide();
+
+ tabWidget.clearFocus();
+ tabWidget.setEnabled(false);
+ tabWidget.setShown(false);
+ tabWidget.setVisible(false);
+ tabWidget.hide();
+
+ tabWidget.setFocus();
+ tabWidget.setEnabled(true);
+ tabWidget.activateWindow();
+ tabWidget.setShown(true);
+ tabWidget.setVisible(true);
+ tabWidget.show();
+
+ view2.setFocus();
+ view2.setEnabled(true);
+ view2.activateWindow();
+ view2.setInteractive(true);
+ view2.setVisible(true);
+ view2.setShown(true);
+ view2.show();
+
+ QTest::qWaitForWindowShown(&view2);
+ QApplication::setActiveWindow(&tabWidget);
+
+ textItem2->setFocus();
+
+ QVERIFY(scene2.isActive());
+ QVERIFY(textItem2->hasFocus());
+}
+
QTEST_MAIN(tst_QGraphicsScene)
#include "tst_qgraphicsscene.moc"