diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-09-17 17:07:55 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-09-17 17:07:55 (GMT) |
commit | 4f33dbd5361c0875f39518b762a764478f04dd30 (patch) | |
tree | 0ac6715405dba0e08cefa5a3d07241fe01a93445 /tests | |
parent | 502f0e852b7e4ef00162246568d7cb7e2dfcae58 (diff) | |
parent | fa373ee165b32b712690656a5f69f862292a2c1e (diff) | |
download | Qt-4f33dbd5361c0875f39518b762a764478f04dd30.zip Qt-4f33dbd5361c0875f39518b762a764478f04dd30.tar.gz Qt-4f33dbd5361c0875f39518b762a764478f04dd30.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:
Export qt_directfb_.* functions in plugin as well
Added autotest for QPixmap::size() with null pixmaps.
Update Symbian def files.
QGraphicsItem::childrenBoundingRect behavior breaks QGraphicsEffect::sourceBoundingRect().
Wrong bounding rect returned by QGraphicsEffect::boundingRect().
Compile on Mac
Ensure building of WebKit and QtConcurrent are disabled with SunCC.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp | 52 | ||||
-rw-r--r-- | tests/auto/qpixmap/tst_qpixmap.cpp | 5 |
2 files changed, 57 insertions, 0 deletions
diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp index e1bfb79..07fa630 100644 --- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp @@ -66,6 +66,7 @@ private slots: void source(); void boundingRectFor(); void boundingRect(); + void boundingRect2(); void draw(); void opacity(); void grayscale(); @@ -264,6 +265,57 @@ void tst_QGraphicsEffect::boundingRect() delete item; } +void tst_QGraphicsEffect::boundingRect2() +{ + CustomEffect *effect = new CustomEffect; + QGraphicsRectItem *root = new QGraphicsRectItem; + root->setGraphicsEffect(effect); + + QGraphicsRectItem *child = new QGraphicsRectItem; + QRectF childRect(0, 0, 100, 100); + child->setFlag(QGraphicsItem::ItemClipsChildrenToShape); + child->setRect(childRect); + child->setParentItem(root); + + QGraphicsRectItem *grandChild = new QGraphicsRectItem; + QRectF grandChildRect(0, 0, 200, 200); + grandChild->setRect(grandChildRect); + grandChild->setParentItem(child); + + // Make sure the effect's bounding rect is clipped to the child's bounding rect. + QCOMPARE(effect->boundingRect(), effect->boundingRectFor(childRect)); + + // Disable ItemClipsChildrenToShape; effect's bounding rect is no longer clipped. + child->setFlag(QGraphicsItem::ItemClipsChildrenToShape, false); + QCOMPARE(effect->boundingRect(), effect->boundingRectFor(childRect | grandChildRect)); + + // Add root item to a scene, do the same tests as above. Results should be the same. + QGraphicsScene scene; + scene.addItem(root); + + child->setFlag(QGraphicsItem::ItemClipsChildrenToShape); + QCOMPARE(effect->boundingRect(), effect->boundingRectFor(childRect)); + + child->setFlag(QGraphicsItem::ItemClipsChildrenToShape, false); + QCOMPARE(effect->boundingRect(), effect->boundingRectFor(childRect | grandChildRect)); + + // Now add the scene to a view, results should be the same. + QGraphicsView view(&scene); + + child->setFlag(QGraphicsItem::ItemClipsChildrenToShape); + QCOMPARE(effect->boundingRect(), effect->boundingRectFor(childRect)); + + child->setFlag(QGraphicsItem::ItemClipsChildrenToShape, false); + QCOMPARE(effect->boundingRect(), effect->boundingRectFor(childRect | grandChildRect)); + + CustomEffect *childEffect = new CustomEffect; + child->setGraphicsEffect(childEffect); + QCOMPARE(effect->boundingRect(), effect->boundingRectFor(childEffect->boundingRectFor(childRect | grandChildRect))); + + child->setGraphicsEffect(0); + QCOMPARE(effect->boundingRect(), effect->boundingRectFor(childRect | grandChildRect)); +} + void tst_QGraphicsEffect::draw() { QGraphicsScene scene; diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 7e0f466..8005ec5 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -742,6 +742,11 @@ void tst_QPixmap::testMetrics() QCOMPARE(bitmap.width(), 100); QCOMPARE(bitmap.height(), 100); QCOMPARE(bitmap.depth(), 1); + + QPixmap null; + + QCOMPARE(null.size().width(), null.width()); + QCOMPARE(null.size().height(), null.height()); } void tst_QPixmap::createMaskFromColor() |