summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-07-14 09:27:44 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-07-14 09:27:44 (GMT)
commit5878027280de47e8b8fc72a4d0d48f5e5f6dc7db (patch)
tree6fb1dc947afcc52447c6b2139be0924ff9ce1ac5 /tests
parentbd7da0db4386608eecdb32792d63ec840c8fe0bf (diff)
parent213eb572f1902550e36f7e677733aba8d066d94b (diff)
downloadQt-5878027280de47e8b8fc72a4d0d48f5e5f6dc7db.zip
Qt-5878027280de47e8b8fc72a4d0d48f5e5f6dc7db.tar.gz
Qt-5878027280de47e8b8fc72a4d0d48f5e5f6dc7db.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Fixes QGraphicsItem::focusItem() returning incorrect value. Fixes crash in QGraphicsScene::addItem().
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp27
-rw-r--r--tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp20
2 files changed, 47 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 1ae3ecf..3634ce9 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -463,6 +463,7 @@ private slots:
void sortItemsWhileAdding();
void doNotMarkFullUpdateIfNotInScene();
void itemDiesDuringDraggingOperation();
+ void QTBUG_12112_focusItem();
private:
QList<QGraphicsItem *> paintedItems;
@@ -10724,5 +10725,31 @@ void tst_QGraphicsItem::itemDiesDuringDraggingOperation()
delete item;
QVERIFY(QGraphicsScenePrivate::get(&scene)->dragDropItem == 0);
}
+
+void tst_QGraphicsItem::QTBUG_12112_focusItem()
+{
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ QGraphicsRectItem *item1 = new QGraphicsRectItem(0, 0, 20, 20);
+ item1->setFlag(QGraphicsItem::ItemIsFocusable);
+ QGraphicsRectItem *item2 = new QGraphicsRectItem(20, 20, 20, 20);
+ item2->setFlag(QGraphicsItem::ItemIsFocusable);
+ item1->setFocus();
+ scene.addItem(item2);
+ scene.addItem(item1);
+
+ view.show();
+ QApplication::setActiveWindow(&view);
+ QTest::qWaitForWindowShown(&view);
+ QTRY_COMPARE(QApplication::activeWindow(), (QWidget *)&view);
+
+ QVERIFY(item1->focusItem());
+ QVERIFY(!item2->focusItem());
+
+ item2->setFocus();
+ QVERIFY(!item1->focusItem());
+ QVERIFY(item2->focusItem());
+}
+
QTEST_MAIN(tst_QGraphicsItem)
#include "tst_qgraphicsitem.moc"
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
index ed8ff04..a771332 100644
--- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -176,6 +176,7 @@ private slots:
void task243004_setStyleCrash();
void task250119_shortcutContext();
void QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems();
+ void QT_BUG_12056_tabFocusFirstUnsetWhenRemovingItems();
};
@@ -3089,6 +3090,25 @@ void tst_QGraphicsWidget::QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems()
//This should not crash
}
+void tst_QGraphicsWidget::QT_BUG_12056_tabFocusFirstUnsetWhenRemovingItems()
+{
+ QGraphicsScene scene;
+ QGraphicsWidget* item1 = new QGraphicsWidget;
+ QGraphicsWidget* item2 = new QGraphicsWidget;
+ QGraphicsWidget* item3 = new QGraphicsWidget;
+
+ scene.addItem(item1);
+ scene.addItem(item2);
+
+ scene.removeItem(item2);
+ scene.removeItem(item1);
+ delete item2;
+ delete item1;
+
+ scene.addItem(item3);
+
+ //This should not crash
+}
QTEST_MAIN(tst_QGraphicsWidget)
#include "tst_qgraphicswidget.moc"