diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-01-14 09:51:07 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-01-14 09:51:07 (GMT) |
commit | d8cadc2c9333f5b797fab87c1aa9fc9952603935 (patch) | |
tree | 859201f9ec18ca1e73b22f418afec78ec6b353c3 /tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp | |
parent | f17aeadf56818e5f20e20eb91450e66adb88c99b (diff) | |
parent | cf74ef2ca9163ac6e15b6a218ef284f6104cdcab (diff) | |
download | Qt-d8cadc2c9333f5b797fab87c1aa9fc9952603935.zip Qt-d8cadc2c9333f5b797fab87c1aa9fc9952603935.tar.gz Qt-d8cadc2c9333f5b797fab87c1aa9fc9952603935.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Fix rules for recreating the Makefile in a subdir
Disable some tests that require high floating point precision.
Replace the truncate function with fuzzierCompare().
Rework how Qt handles GL extensions.
More changelog additions for QtWebKit
Make compile on symbian/Linux
Removed pointless image comparison in raster colorize filter.
Improved performance of translating device coordinate graphics effects.
Diffstat (limited to 'tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp')
-rw-r--r-- | tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp index 95de70e..51e2a57 100644 --- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp @@ -70,6 +70,7 @@ private slots: void grayscale(); void colorize(); void drawPixmapItem(); + void deviceCoordinateTranslateCaching(); }; void tst_QGraphicsEffect::initTestCase() @@ -514,6 +515,51 @@ void tst_QGraphicsEffect::drawPixmapItem() QTRY_VERIFY(effect->repaints >= 2); } +class DeviceEffect : public QGraphicsEffect +{ +public: + QRectF boundingRectFor(const QRectF &rect) const + { return rect; } + + void draw(QPainter *painter) + { + QPoint offset; + QPixmap pixmap = sourcePixmap(Qt::DeviceCoordinates, &offset, QGraphicsEffect::NoPad); + + if (pixmap.isNull()) + return; + + painter->save(); + painter->setWorldTransform(QTransform()); + painter->drawPixmap(offset, pixmap); + painter->restore(); + } +}; + +void tst_QGraphicsEffect::deviceCoordinateTranslateCaching() +{ + QGraphicsScene scene; + CustomItem *item = new CustomItem(0, 0, 10, 10); + scene.addItem(item); + scene.setSceneRect(0, 0, 50, 0); + + item->setGraphicsEffect(new DeviceEffect); + item->setPen(Qt::NoPen); + item->setBrush(Qt::red); + + QGraphicsView view(&scene); + view.show(); + QTest::qWaitForWindowShown(&view); + + QTRY_VERIFY(item->numRepaints >= 1); + int numRepaints = item->numRepaints; + + item->translate(10, 0); + QTest::qWait(50); + + QVERIFY(item->numRepaints == numRepaints); +} + QTEST_MAIN(tst_QGraphicsEffect) #include "tst_qgraphicseffect.moc" |