summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-01-07 20:06:36 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-01-07 20:06:36 (GMT)
commit4ad12bb65aa46b3ba1cd8aa43716c2832842a2ae (patch)
tree6ac745fc40c41b0ee43824a8211847059157299c /tests
parent8acb9028787c75682055afe2a5b494c78b8f944d (diff)
parent8ffb49a4ac68b1c243b25343053e6e99f97ec2e7 (diff)
downloadQt-4ad12bb65aa46b3ba1cd8aa43716c2832842a2ae.zip
Qt-4ad12bb65aa46b3ba1cd8aa43716c2832842a2ae.tar.gz
Qt-4ad12bb65aa46b3ba1cd8aa43716c2832842a2ae.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 crash in QGraphicsItem's destructor. Doc: Fixing typo
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 0b29410..5daafd8 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -65,6 +65,7 @@
#include <QInputContext>
#include <QPushButton>
#include <QLineEdit>
+#include <QGraphicsLinearLayout>
#include "../../shared/util.h"
@@ -469,6 +470,7 @@ private slots:
void itemDiesDuringDraggingOperation();
void QTBUG_12112_focusItem();
void QTBUG_13473_sceneposchange();
+ void QTBUG_16374_crashInDestructor();
private:
QList<QGraphicsItem *> paintedItems;
@@ -11077,5 +11079,56 @@ void tst_QGraphicsItem::QTBUG_13473_sceneposchange()
QCOMPARE(child->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 2);
}
+class MyGraphicsWidget : public QGraphicsWidget {
+Q_OBJECT
+public:
+ MyGraphicsWidget()
+ : QGraphicsWidget(0)
+ {
+ QGraphicsLinearLayout *lay = new QGraphicsLinearLayout(Qt::Vertical);
+ QLatin1String wiseWords("AZ BUKI VEDI");
+ QString sentence(wiseWords);
+ QStringList words = sentence.split(QLatin1Char(' '), QString::SkipEmptyParts);
+ for (int i = 0; i < words.count(); ++i) {
+ QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(this);
+ QLabel *label = new QLabel(words.at(i));
+ proxy->setWidget(label);
+ proxy->setFocusPolicy(Qt::StrongFocus);
+ proxy->setFlag(QGraphicsItem::ItemAcceptsInputMethod, true);
+ if (i%2 == 0)
+ proxy->setVisible(false);
+ proxy->setFocus();
+ lay->addItem(proxy);
+ }
+ setLayout(lay);
+ }
+
+};
+
+class MyWidgetWindow : public QGraphicsWidget
+{
+public:
+ MyWidgetWindow()
+ : QGraphicsWidget(0, Qt::Window)
+ {
+ QGraphicsLinearLayout *lay = new QGraphicsLinearLayout(Qt::Vertical);
+ MyGraphicsWidget *widget = new MyGraphicsWidget();
+ lay->addItem(widget);
+ setLayout(lay);
+ }
+};
+
+void tst_QGraphicsItem::QTBUG_16374_crashInDestructor()
+{
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+
+ MyWidgetWindow win;
+ scene.addItem(&win);
+
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+}
+
QTEST_MAIN(tst_QGraphicsItem)
#include "tst_qgraphicsitem.moc"