diff options
author | Liang Qi <liang.qi@qt.io> | 2016-10-31 20:09:14 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-11-01 06:02:55 +0100 |
commit | a732576a66ff2bbd9c0b41cd5f3505a4d2fbf043 (patch) | |
tree | d09875c3543ad837fbfaaf10bd4eef1d3de42941 /tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp | |
parent | cd9de59177ccbeb7fdfacf8716af7bb20112c880 (diff) | |
parent | 8e20daae9fee5f3b999daffce0d7156015ee974b (diff) |
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
config.tests/win/msvc_version.cpp
configure.pri
mkspecs/macx-ios-clang/features/default_post.prf
mkspecs/macx-ios-clang/features/resolve_config.prf
mkspecs/features/uikit/default_post.prf
mkspecs/features/uikit/resolve_config.prf
src/corelib/io/qsettings_mac.cpp
src/corelib/json/qjsondocument.cpp
src/plugins/platforms/cocoa/qcocoawindow.h
src/plugins/platforms/cocoa/qcocoawindow.mm
src/plugins/platforms/cocoa/qnswindowdelegate.h
src/plugins/platforms/cocoa/qnswindowdelegate.mm
src/plugins/platforms/ios/ios.pro
src/plugins/platforms/ios/kernel.pro
src/plugins/platforms/ios/qiosintegration.h
src/plugins/platforms/minimalegl/qminimaleglintegration.cpp
tests/auto/gui/painting/qpainter/tst_qpainter.cpp
tools/configure/environment.cpp
Change-Id: I654845e54e40f5951fb78aab349ca667e9f27843
Diffstat (limited to 'tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp')
-rw-r--r-- | tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 76e3b43ce2..96a76d885d 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -833,14 +833,14 @@ void tst_QGraphicsItem::parentItem() void tst_QGraphicsItem::setParentItem() { QGraphicsScene scene; - QGraphicsItem *item = scene.addRect(QRectF(0, 0, 10, 10)); + const QScopedPointer<QGraphicsItem> item(scene.addRect(QRectF(0, 0, 10, 10))); QCOMPARE(item->scene(), &scene); - QGraphicsRectItem *child = new QGraphicsRectItem; + const QScopedPointer<QGraphicsRectItem> child(new QGraphicsRectItem); QCOMPARE(child->scene(), (QGraphicsScene *)0); // This implicitly adds the item to the parent's scene - child->setParentItem(item); + child->setParentItem(item.data()); QCOMPARE(child->scene(), &scene); // This just makes it a toplevel @@ -848,8 +848,8 @@ void tst_QGraphicsItem::setParentItem() QCOMPARE(child->scene(), &scene); // Add the child back to the parent, then remove the parent from the scene - child->setParentItem(item); - scene.removeItem(item); + child->setParentItem(item.data()); + scene.removeItem(item.data()); QCOMPARE(child->scene(), (QGraphicsScene *)0); } @@ -947,19 +947,19 @@ void tst_QGraphicsItem::flags() QCOMPARE(item->pos(), QPointF(10, 10)); } { - QGraphicsItem* clippingParent = new QGraphicsRectItem; + const QScopedPointer<QGraphicsItem> clippingParent(new QGraphicsRectItem); clippingParent->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); - QGraphicsItem* nonClippingParent = new QGraphicsRectItem; + const QScopedPointer<QGraphicsItem> nonClippingParent(new QGraphicsRectItem); nonClippingParent->setFlag(QGraphicsItem::ItemClipsChildrenToShape, false); - QGraphicsItem* child = new QGraphicsRectItem(nonClippingParent); + QGraphicsItem* child = new QGraphicsRectItem(nonClippingParent.data()); QVERIFY(!child->isClipped()); - child->setParentItem(clippingParent); + child->setParentItem(clippingParent.data()); QVERIFY(child->isClipped()); - child->setParentItem(nonClippingParent); + child->setParentItem(nonClippingParent.data()); QVERIFY(!child->isClipped()); } } @@ -3118,7 +3118,8 @@ void tst_QGraphicsItem::isAncestorOf() void tst_QGraphicsItem::commonAncestorItem() { - QGraphicsItem *ancestor = new QGraphicsRectItem; + QGraphicsRectItem ancestorItem; + QGraphicsItem *ancestor = &ancestorItem; QGraphicsItem *grandMa = new QGraphicsRectItem; QGraphicsItem *grandPa = new QGraphicsRectItem; QGraphicsItem *brotherInLaw = new QGraphicsRectItem; @@ -3618,7 +3619,7 @@ void tst_QGraphicsItem::setGroup() QGraphicsItemGroup group1; QGraphicsItemGroup group2; - QGraphicsRectItem *rect = new QGraphicsRectItem; + const QScopedPointer<QGraphicsRectItem> rect(new QGraphicsRectItem); QCOMPARE(rect->group(), (QGraphicsItemGroup *)0); QCOMPARE(rect->parentItem(), (QGraphicsItem *)0); rect->setGroup(&group1); @@ -6813,8 +6814,8 @@ void tst_QGraphicsItem::opacity() QFETCH(qreal, c2_effectiveOpacity); QFETCH(qreal, c3_effectiveOpacity); - QGraphicsRectItem *p = new QGraphicsRectItem; - QGraphicsRectItem *c1 = new QGraphicsRectItem(p); + const QScopedPointer<QGraphicsRectItem> p(new QGraphicsRectItem); + QGraphicsRectItem *c1 = new QGraphicsRectItem(p.data()); QGraphicsRectItem *c2 = new QGraphicsRectItem(c1); QGraphicsRectItem *c3 = new QGraphicsRectItem(c2); @@ -7202,11 +7203,12 @@ void tst_QGraphicsItem::sceneTransformCache() // Test that an item's scene transform is updated correctly when the // parent is transformed. QGraphicsScene scene; - QGraphicsRectItem *rect = scene.addRect(0, 0, 100, 100); + + const QScopedPointer<QGraphicsRectItem> rect(scene.addRect(0, 0, 100, 100)); rect->setPen(QPen(Qt::black, 0)); QGraphicsRectItem *rect2 = scene.addRect(0, 0, 100, 100); rect2->setPen(QPen(Qt::black, 0)); - rect2->setParentItem(rect); + rect2->setParentItem(rect.data()); rect2->setTransform(QTransform().rotate(90), true); rect->setTransform(QTransform::fromTranslate(0, 50), true); QGraphicsView view(&scene); @@ -7218,7 +7220,7 @@ void tst_QGraphicsItem::sceneTransformCache() x.rotate(90); QCOMPARE(rect2->sceneTransform(), x); - scene.removeItem(rect); + scene.removeItem(rect.data()); //Crazy use case : rect4 child of rect3 so the transformation of rect4 will be cached.Good! //We remove rect4 from the scene, then the validTransform bit flag is set to 0 and the index of the cache @@ -10674,7 +10676,7 @@ void tst_QGraphicsItem::scenePosChange() { ScenePosChangeTester* root = new ScenePosChangeTester; ScenePosChangeTester* child1 = new ScenePosChangeTester(root); - ScenePosChangeTester* grandChild1 = new ScenePosChangeTester(child1); + const QScopedPointer<ScenePosChangeTester> grandChild1(new ScenePosChangeTester(child1)); ScenePosChangeTester* child2 = new ScenePosChangeTester(root); ScenePosChangeTester* grandChild2 = new ScenePosChangeTester(child2); @@ -10726,7 +10728,7 @@ void tst_QGraphicsItem::scenePosChange() QCOMPARE(grandChild2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 3); // remove - scene.removeItem(grandChild1); + scene.removeItem(grandChild1.data()); delete grandChild2; grandChild2 = 0; QCoreApplication::processEvents(); // QGraphicsScenePrivate::_q_updateScenePosDescendants() root->moveBy(1.0, 1.0); |