diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-06-27 03:04:41 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-06-27 03:04:41 (GMT) |
commit | 863733d86e2dd0cd508e2928e5f995b88579ab40 (patch) | |
tree | 79aeb4a18db6e50d84c7934d517eb32f382dd13a /tests | |
parent | 59c58576efd3ceff7add46a359fd99e56a2fb279 (diff) | |
parent | cc75093e3b300a37d05a81921d7811caabbfb449 (diff) | |
download | Qt-863733d86e2dd0cd508e2928e5f995b88579ab40.zip Qt-863733d86e2dd0cd508e2928e5f995b88579ab40.tar.gz Qt-863733d86e2dd0cd508e2928e5f995b88579ab40.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: (21 commits)
EGL plane levels are the same as all other GL backends.
Need to access extensionFuncs in subclasses too.
Export QGLWindowSurface too.
Export the QGLPixmapData so that we can override it in a custom graphics system.
Fixed autotest failure in QPathClipper on N900.
Fixed autotest failure in QPainter::setOpacity when NEON is used.
Fix compilation when configured with -no-xrender
Add a new (internal) flag QGraphicsItem::ItemStopsClickFocusPropagation.
Fixed some potential index-out-of-bounds issues in QImage.
Fixed autotest failure in fillRect_stretchToDeviceMode
Adding a known issue for VC2010 64 bit
Added a note to desupport VC2010 64-bit
Normalize integers when calling glVertexAttribPointer()
Add an implementation of comp_func_solid_SourceOver_neon() with Neon.
Fix the casts of qdrawhelper_sse2
Add a SSE2 implementation of comp_func_solid_SourceOver()
Add a SSE2 version of comp_func_SourceOver()
Fixed missing copy of raster pixmap data after change fb76a872e20bd.
Fixed QPixmap::toImage() bug introduced in fb76a872e20bd.
Optimized sub-rect copying / painting of QPixmaps.
...
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 54 | ||||
-rw-r--r-- | tests/auto/qimage/tst_qimage.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qpainter/tst_qpainter.cpp | 16 |
3 files changed, 66 insertions, 8 deletions
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index fe68c8e..31a6845 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -442,6 +442,7 @@ private slots: void updateMicroFocus(); void textItem_shortcuts(); void scroll(); + void stopClickFocusPropagation(); // task specific tests below me void task141694_textItemEnsureVisible(); @@ -10268,6 +10269,59 @@ void tst_QGraphicsItem::scroll() QCOMPARE(item2->lastExposedRect, expectedItem2Expose); } +void tst_QGraphicsItem::stopClickFocusPropagation() +{ + class MyItem : public QGraphicsRectItem + { + public: + MyItem() : QGraphicsRectItem(0, 0, 100, 100) {} + void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) + { + painter->fillRect(boundingRect(), hasFocus() ? QBrush(Qt::red) : brush()); + } + }; + + QGraphicsScene scene(-50, -50, 400, 400); + scene.setStickyFocus(true); + + QGraphicsRectItem *noFocusOnTop = new MyItem; + noFocusOnTop->setBrush(Qt::yellow); + noFocusOnTop->setFlag(QGraphicsItem::ItemStopsClickFocusPropagation); + + QGraphicsRectItem *focusableUnder = new MyItem; + focusableUnder->setBrush(Qt::blue); + focusableUnder->setFlag(QGraphicsItem::ItemIsFocusable); + focusableUnder->setPos(50, 50); + + QGraphicsRectItem *itemWithFocus = new MyItem; + itemWithFocus->setBrush(Qt::black); + itemWithFocus->setFlag(QGraphicsItem::ItemIsFocusable); + itemWithFocus->setPos(250, 10); + + scene.addItem(noFocusOnTop); + scene.addItem(focusableUnder); + scene.addItem(itemWithFocus); + focusableUnder->stackBefore(noFocusOnTop); + itemWithFocus->setFocus(); + + QGraphicsView view(&scene); + view.show(); + QTest::qWaitForWindowShown(&view); + + QApplication::setActiveWindow(&view); + QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view)); + QVERIFY(itemWithFocus->hasFocus()); + + QPointF mousePressPoint = noFocusOnTop->mapToScene(QPointF()); + mousePressPoint.rx() += 60; + mousePressPoint.ry() += 60; + const QList<QGraphicsItem *> itemsAtMousePressPosition = scene.items(mousePressPoint); + QVERIFY(itemsAtMousePressPosition.contains(focusableUnder)); + + sendMousePress(&scene, mousePressPoint); + QVERIFY(itemWithFocus->hasFocus()); +} + void tst_QGraphicsItem::QTBUG_5418_textItemSetDefaultColor() { struct Item : public QGraphicsTextItem diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp index 16deb03..5052114 100644 --- a/tests/auto/qimage/tst_qimage.cpp +++ b/tests/auto/qimage/tst_qimage.cpp @@ -945,11 +945,11 @@ void tst_QImage::rotate() const int n = original.colorTable().size(); for (int x = 0; x < w; ++x) { original.setPixel(x, 0, x % n); - original.setPixel(x,h - 1, n - (x % n)); + original.setPixel(x, h - 1, n - (x % n) - 1); } for (int y = 0; y < h; ++y) { original.setPixel(0, y, y % n); - original.setPixel(w - 1, y, n - (y % n)); + original.setPixel(w - 1, y, n - (y % n) - 1); } } diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index 701dc2e..27ee6e7 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -2648,12 +2648,16 @@ void tst_QPainter::setOpacity() p.drawImage(imageRect, src, imageRect); p.end(); - QImage expected(imageSize, destFormat); - p.begin(&expected); - p.fillRect(imageRect, QColor(127, 127, 127)); - p.end(); - - QCOMPARE(dest, expected); + QImage actual = dest.convertToFormat(QImage::Format_RGB32); + + for (int y = 0; y < actual.height(); ++y) { + QRgb *p = (QRgb *)actual.scanLine(y); + for (int x = 0; x < actual.width(); ++x) { + QVERIFY(qAbs(qRed(p[x]) - 127) <= 0xf); + QVERIFY(qAbs(qGreen(p[x]) - 127) <= 0xf); + QVERIFY(qAbs(qBlue(p[x]) - 127) <= 0xf); + } + } } void tst_QPainter::drawhelper_blend_untransformed_data() |