diff options
author | axis <qt-info@nokia.com> | 2010-02-26 09:05:39 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2010-02-26 09:05:39 (GMT) |
commit | 5e9382c018e231c5e2ef49dd8a38eaff535b9837 (patch) | |
tree | 89f13d31d5804c38999fdefd0e2aca39d305f91c /tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | |
parent | 11e54877f87ff97039452f117d40ec17eefbcbff (diff) | |
parent | 53e7dda038e9251ca7380d3717709764c580192e (diff) | |
download | Qt-5e9382c018e231c5e2ef49dd8a38eaff535b9837.zip Qt-5e9382c018e231c5e2ef49dd8a38eaff535b9837.tar.gz Qt-5e9382c018e231c5e2ef49dd8a38eaff535b9837.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public into master-s60
Conflicts:
qmake/generators/symbian/initprojectdeploy_symbian.cpp
qmake/generators/symbian/symmake_abld.h
Diffstat (limited to 'tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp')
-rw-r--r-- | tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index 2ef0419..d37ff76 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -245,6 +245,7 @@ private slots: #endif void render_data(); void render(); + void renderItemsWithNegativeWidthOrHeight(); void contextMenuEvent(); void contextMenuEvent_ItemIgnoresTransformations(); void update(); @@ -2751,6 +2752,41 @@ void tst_QGraphicsScene::render() } } +void tst_QGraphicsScene::renderItemsWithNegativeWidthOrHeight() +{ + QGraphicsScene scene(0, 0, 150, 150); + + // Add item with negative width. + QGraphicsRectItem *item1 = new QGraphicsRectItem(0, 0, -150, 50); + item1->setBrush(Qt::red); + item1->setPos(150, 50); + scene.addItem(item1); + + // Add item with negative height. + QGraphicsRectItem *item2 = new QGraphicsRectItem(0, 0, 50, -150); + item2->setBrush(Qt::blue); + item2->setPos(50, 150); + scene.addItem(item2); + + QGraphicsView view(&scene); + view.setFrameStyle(QFrame::NoFrame); + view.resize(150, 150); + view.show(); + QCOMPARE(view.viewport()->size(), QSize(150, 150)); + + QImage expected(view.viewport()->size(), QImage::Format_RGB32); + view.viewport()->render(&expected); + + // Make sure the scene background is the same as the viewport background. + scene.setBackgroundBrush(view.viewport()->palette().brush(view.viewport()->backgroundRole())); + QImage actual(150, 150, QImage::Format_RGB32); + QPainter painter(&actual); + scene.render(&painter); + painter.end(); + + QCOMPARE(actual, expected); +} + void tst_QGraphicsScene::contextMenuEvent() { QGraphicsScene scene; |