diff options
author | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-09-28 13:00:54 (GMT) |
---|---|---|
committer | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-09-28 13:00:54 (GMT) |
commit | f3a36a7e59b24bc388ed15372f941bf649bc5ae4 (patch) | |
tree | 5486e561a12afc189ad0451c4cadf0f85e105328 /tests/auto/qgraphicsview | |
parent | b0885663f2192eb5eb27f8a8032e7e05b19e3736 (diff) | |
parent | f9d6862d13ae38c59ec4a58092c8126620801e0b (diff) | |
download | Qt-f3a36a7e59b24bc388ed15372f941bf649bc5ae4.zip Qt-f3a36a7e59b24bc388ed15372f941bf649bc5ae4.tar.gz Qt-f3a36a7e59b24bc388ed15372f941bf649bc5ae4.tar.bz2 |
Merge commit 'origin/4.5' into 4.6
Reviewed-by: Joao
Conflicts:
src/gui/graphicsview/qgraphicsview.cpp
src/gui/widgets/qspinbox.cpp
tests/auto/qgraphicsview/tst_qgraphicsview.cpp
Diffstat (limited to 'tests/auto/qgraphicsview')
-rw-r--r-- | tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 1aa515c..95a038b 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -224,6 +224,8 @@ private slots: void task253415_reconnectUpdateSceneOnSceneChanged(); void task255529_transformationAnchorMouseAndViewportMargins(); void task259503_scrollingArtifacts(); + void QTBUG_4151_clipAndIgnore_data(); + void QTBUG_4151_clipAndIgnore(); }; void tst_QGraphicsView::initTestCase() @@ -3733,5 +3735,50 @@ void tst_QGraphicsView::task259503_scrollingArtifacts() QTest::qWait(10); } +void tst_QGraphicsView::QTBUG_4151_clipAndIgnore_data() +{ + QTest::addColumn<bool>("clip"); + QTest::addColumn<bool>("ignoreTransformations"); + QTest::addColumn<int>("numItems"); + + QTest::newRow("none") << false << false << 3; + QTest::newRow("clip") << true << false << 3; + QTest::newRow("ignore") << false << true << 3; + QTest::newRow("clip+ignore") << true << true << 3; +} + +void tst_QGraphicsView::QTBUG_4151_clipAndIgnore() +{ + QFETCH(bool, clip); + QFETCH(bool, ignoreTransformations); + QFETCH(int, numItems); + + QGraphicsScene scene; + + QGraphicsRectItem *parent = new QGraphicsRectItem(QRectF(0, 0, 50, 50), 0); + QGraphicsRectItem *child = new QGraphicsRectItem(QRectF(-10, -10, 40, 40), parent); + QGraphicsRectItem *ignore = new QGraphicsRectItem(QRectF(60, 60, 50, 50), 0); + + if (clip) + parent->setFlags(QGraphicsItem::ItemClipsChildrenToShape); + if (ignoreTransformations) + ignore->setFlag(QGraphicsItem::ItemIgnoresTransformations); + + parent->setBrush(Qt::red); + child->setBrush(QColor(0, 0, 255, 128)); + ignore->setBrush(Qt::green); + + scene.addItem(parent); + scene.addItem(ignore); + + QGraphicsView view(&scene); + view.setFrameStyle(0); + view.resize(75, 75); + view.show(); + QTRY_COMPARE(QApplication::activeWindow(), (QWidget *)&view); + + QCOMPARE(view.items(view.rect()).size(), numItems); +} + QTEST_MAIN(tst_QGraphicsView) #include "tst_qgraphicsview.moc" |