diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-07-21 19:19:36 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-07-21 19:19:36 (GMT) |
commit | 07f131927faa09402589da7b4bfb516482f59e46 (patch) | |
tree | 9b1c7fdec802bbcb9b183d5644d02d8cc4435da2 /tests/auto | |
parent | 19924c1373e6acdf4ebf8cf61c51f3cdf32978b3 (diff) | |
parent | d00d1bd5423d0bbfea7c85a0411d2b22d97fbe0f (diff) | |
download | Qt-07f131927faa09402589da7b4bfb516482f59e46.zip Qt-07f131927faa09402589da7b4bfb516482f59e46.tar.gz Qt-07f131927faa09402589da7b4bfb516482f59e46.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:
Use aligned load for the blending of RGB32 over RGB32
tst_moc: workaround gcc bug.
Some more change to the changelog
Fix compilation with QT_NO_GRAPHICSVIEW
Updates changes-4.7.0
Fixes the Oracle nchar bug when NLS_CHARSET is different with NLS_NCHAR_CHARSET.
Add a missing file in the config.test for SSE 4.2
Remove the masking when computing qAlpha()
Add support for more vector instructions on x86
Workaround gcc bug, disable test with old version of gcc
Do not crash due to a infinite recursion when using voiceover on MacOS
doc: Fix qdoc errors for text related files
QGraphicsItem: Animation leaves drawing artifacts when clipping is used.
moc: Slot with complex template default value does not compile
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/moc/tst_moc.cpp | 22 | ||||
-rw-r--r-- | tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 73 |
2 files changed, 95 insertions, 0 deletions
diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp index 19f3677..d3a7e03 100644 --- a/tests/auto/moc/tst_moc.cpp +++ b/tests/auto/moc/tst_moc.cpp @@ -491,6 +491,7 @@ private slots: void typenameWithUnsigned(); void warnOnVirtualSignal(); void QTBUG5590_dummyProperty(); + void QTBUG12260_defaultTemplate(); signals: void sigWithUnsignedArg(unsigned foo); void sigWithSignedArg(signed foo); @@ -1340,6 +1341,27 @@ signals: void testSignal(TestTemplate2<const int, const short*>); }; +class QTBUG12260_defaultTemplate_Object : public QObject +{ Q_OBJECT +public slots: +#if !(defined(Q_CC_GNU) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) || defined(Q_MOC_RUN) + void doSomething(QHash<QString, QVariant> values = QHash<QString, QVariant>() ) { Q_UNUSED(values); } +#else + // we want to test the previous function, but gcc < 4.4 seemed to have a bug similar to the one moc has. + typedef QHash<QString, QVariant> WorkaroundGCCBug; + void doSomething(QHash<QString, QVariant> values = WorkaroundGCCBug() ) { Q_UNUSED(values); } +#endif + + void doAnotherThing(bool a = (1 < 3), bool b = (1 > 4)) { Q_UNUSED(a); Q_UNUSED(b); } +}; + + +void tst_Moc::QTBUG12260_defaultTemplate() +{ + QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot("doSomething(QHash<QString,QVariant>)") != -1); + QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot("doAnotherThing(bool,bool)") != -1); +} + QTEST_APPLESS_MAIN(tst_Moc) #include "tst_moc.moc" diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index b8df7f6..1cce687 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -219,6 +219,7 @@ private slots: void update2_data(); void update2(); void update_ancestorClipsChildrenToShape(); + void update_ancestorClipsChildrenToShape2(); void inputMethodSensitivity(); void inputContextReset(); void indirectPainting(); @@ -3815,6 +3816,78 @@ void tst_QGraphicsView::update_ancestorClipsChildrenToShape() #endif } +void tst_QGraphicsView::update_ancestorClipsChildrenToShape2() +{ + QGraphicsScene scene(-150, -150, 300, 300); + + /* + Add two rects: + + +------------------+ + | child | + | +--------------+ | + | | parent | | + | | | | + | | | | + | | | | + | +--------------+ | + +------------------+ + + ... where the parent has no contents and clips the child to shape. + */ + QApplication::processEvents(); // Get rid of pending update. + + QGraphicsRectItem *parent = static_cast<QGraphicsRectItem *>(scene.addRect(-50, -50, 100, 100)); + parent->setBrush(QColor(0, 0, 255, 125)); + parent->setFlag(QGraphicsItem::ItemClipsChildrenToShape); + parent->setFlag(QGraphicsItem::ItemHasNoContents); + + QGraphicsRectItem *child = static_cast<QGraphicsRectItem *>(scene.addRect(-100, -100, 200, 200)); + child->setBrush(QColor(255, 0, 0, 125)); + child->setParentItem(parent); + + CustomView view(&scene); + view.show(); + QTest::qWaitForWindowShown(&view); + QTRY_VERIFY(view.painted); + + view.lastUpdateRegions.clear(); + view.painted = false; + + // Call child->update() and make sure the updated area is within its parent's clip. + QRectF expected = child->deviceTransform(view.viewportTransform()).mapRect(child->boundingRect()); + expected &= parent->deviceTransform(view.viewportTransform()).mapRect(parent->boundingRect()); + + child->update(); + QTRY_VERIFY(view.painted); + +#ifndef QT_MAC_USE_COCOA //cocoa doesn't support drawing regions + QTRY_VERIFY(view.painted); + QCOMPARE(view.lastUpdateRegions.size(), 1); + QCOMPARE(view.lastUpdateRegions.at(0), QRegion(expected.toAlignedRect())); +#endif + + QTest::qWait(50); + + view.lastUpdateRegions.clear(); + view.painted = false; + + // Invalidate the parent's geometry and trigger an update. + // The update area should be clipped to the parent's bounding rect for 'normal' items, + // but in this case the item has no contents (ItemHasNoContents) and its geometry + // is invalidated, which means we cannot clip the child update. So, the expected + // area is exactly the same as the child's bounding rect (adjusted for antialiasing). + parent->setRect(parent->rect().adjusted(-10, -10, -10, -10)); + expected = child->deviceTransform(view.viewportTransform()).mapRect(child->boundingRect()); + expected.adjust(-2, -2, 2, 2); // Antialiasing + +#ifndef QT_MAC_USE_COCOA //cocoa doesn't support drawing regions + QTRY_VERIFY(view.painted); + QCOMPARE(view.lastUpdateRegions.size(), 1); + QCOMPARE(view.lastUpdateRegions.at(0), QRegion(expected.toAlignedRect())); +#endif +} + class FocusItem : public QGraphicsRectItem { public: |