diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-02-23 16:46:31 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-02-23 16:46:31 (GMT) |
commit | 05402ac27bd669c371e4ba08763ba45d6b31edc4 (patch) | |
tree | 0bbec8bbb858a8764b1f9dcb2aea8d025b4f2fa8 /tests | |
parent | 0d02bf894a1f3f494a4787ddfaf0e3bcd02affa2 (diff) | |
parent | 541ca25dc71545e1b55ad31cffe7df4b49214a48 (diff) | |
download | Qt-05402ac27bd669c371e4ba08763ba45d6b31edc4.zip Qt-05402ac27bd669c371e4ba08763ba45d6b31edc4.tar.gz Qt-05402ac27bd669c371e4ba08763ba45d6b31edc4.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2: (33 commits)
Skip complex FBO tests if combined depth-stencil isn't supported
Make tst_QGL::glWidgetRendering use same test as FBO autotest
Updated WebKit from /home/jturcott/dev/webkit to qtwebkit-4.7-merged ( 9303f6d67fb964b71ed3e7361367c3ccfaba5e0a )
Updated WebKit from /home/jturcott/dev/webkit to qtwebkit-4.7-merged ( 5381ceeb37d97365cfb2f037650dbb4e495bca4e )
Adjust the mkdist-webkit script before the importation of WebKit.
Make mediaservices use existing GStreamer qmake vars
Detect GStreamer even when we're not building phonon
Fix build on systems without XVideo headers
Make the XVideo configure test actually pass if XV is present
Add a configure test for XVideo support
Fixed cosmetic glitch in QTabBar label's rendering
improve sql support for mingw64
improve 64 bit support on windows
Made the qDrawPixmaps() API public (with modifications).
Fix GL viewports under -graphicssystem raster.
QSortFilterProxyModel: Sorting occured unnecessarily when the dynamicSortFilter is turned off
Fix test with gcc 4.0 where QT_USE_FAST_CONCATENATION cannot be enabled.
Fix build with wingw
Imporve win64 support for mingw
Compile
...
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qgl/tst_qgl.cpp | 103 | ||||
-rw-r--r-- | tests/auto/qpainter/tst_qpainter.cpp | 48 | ||||
-rw-r--r-- | tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp | 38 | ||||
-rw-r--r-- | tests/auto/qstatictext/qstatictext.pro | 2 | ||||
-rw-r--r-- | tests/auto/qstringbuilder1/stringbuilder.cpp | 14 |
5 files changed, 155 insertions, 50 deletions
diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index 1bf7850..280c6c8 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -978,6 +978,47 @@ void tst_QGL::glWidgetWithAlpha() delete w; } + +bool qt_opengl_draw_test_pattern(QPainter* painter, int width, int height) +{ + QPainterPath intersectingPath; + intersectingPath.moveTo(0, 0); + intersectingPath.lineTo(100, 0); + intersectingPath.lineTo(0, 100); + intersectingPath.lineTo(100, 100); + intersectingPath.closeSubpath(); + + QPainterPath trianglePath; + trianglePath.moveTo(50, 0); + trianglePath.lineTo(100, 100); + trianglePath.lineTo(0, 100); + trianglePath.closeSubpath(); + + painter->setTransform(QTransform()); // reset xform + painter->fillRect(-1, -1, width+2, height+2, Qt::red); // Background + painter->translate(14, 14); + painter->fillPath(intersectingPath, Qt::blue); // Test stencil buffer works + painter->translate(128, 0); + painter->setClipPath(trianglePath); // Test depth buffer works + painter->setTransform(QTransform()); // reset xform ready for fill + painter->fillRect(-1, -1, width+2, height+2, Qt::green); +} + +void qt_opengl_check_test_pattern(const QImage& img) +{ + // As we're doing more than trivial painting, we can't just compare to + // an image rendered with raster. Instead, we sample at well-defined + // test-points: + QFUZZY_COMPARE_PIXELS(img.pixel(39, 64), QColor(Qt::red).rgb()); + QFUZZY_COMPARE_PIXELS(img.pixel(89, 64), QColor(Qt::red).rgb()); + QFUZZY_COMPARE_PIXELS(img.pixel(64, 39), QColor(Qt::blue).rgb()); + QFUZZY_COMPARE_PIXELS(img.pixel(64, 89), QColor(Qt::blue).rgb()); + + QFUZZY_COMPARE_PIXELS(img.pixel(167, 39), QColor(Qt::red).rgb()); + QFUZZY_COMPARE_PIXELS(img.pixel(217, 39), QColor(Qt::red).rgb()); + QFUZZY_COMPARE_PIXELS(img.pixel(192, 64), QColor(Qt::green).rgb()); +} + class GLWidget : public QGLWidget { public: @@ -992,9 +1033,7 @@ public: QPaintEngine* pe = p.paintEngine(); engineType = pe->type(); - // This test only ensures it's possible to paint onto a QGLWidget. Full - // paint engine feature testing is way out of scope! - p.fillRect(-1, -1, width()+2, height()+2, Qt::red); + qt_opengl_draw_test_pattern(&p, width(), height()); // No p.end() or swap buffers, should be done automatically } @@ -1007,7 +1046,7 @@ void tst_QGL::glWidgetRendering() #ifdef Q_WS_QWS w.setWindowFlags(Qt::FramelessWindowHint); #endif - w.setGeometry(100, 100, 200, 200); + w.resize(256, 128); w.show(); #ifdef Q_WS_X11 @@ -1018,11 +1057,8 @@ void tst_QGL::glWidgetRendering() QVERIFY(w.beginOk); QVERIFY(w.engineType == QPaintEngine::OpenGL || w.engineType == QPaintEngine::OpenGL2); - QImage fb = w.grabFrameBuffer(false).convertToFormat(QImage::Format_RGB32); - QImage reference(fb.size(), QImage::Format_RGB32); - reference.fill(0xffff0000); - - QFUZZY_COMPARE_IMAGES(fb, reference); + QImage fb = w.grabFrameBuffer(false); + qt_opengl_check_test_pattern(fb); } void tst_QGL::glFBOSimpleRendering() @@ -1075,46 +1111,23 @@ void tst_QGL::glFBORendering() // Don't complicate things by using NPOT: QGLFramebufferObject *fbo = new QGLFramebufferObject(256, 128, fboFormat); + if (fbo->attachment() != QGLFramebufferObject::CombinedDepthStencil) { + delete fbo; + QSKIP("FBOs missing combined depth~stencil support", SkipSingle); + } + QPainter fboPainter; bool painterBegun = fboPainter.begin(fbo); QVERIFY(painterBegun); - QPainterPath intersectingPath; - intersectingPath.moveTo(0, 0); - intersectingPath.lineTo(100, 0); - intersectingPath.lineTo(0, 100); - intersectingPath.lineTo(100, 100); - intersectingPath.closeSubpath(); - - QPainterPath trianglePath; - trianglePath.moveTo(50, 0); - trianglePath.lineTo(100, 100); - trianglePath.lineTo(0, 100); - trianglePath.closeSubpath(); + qt_opengl_draw_test_pattern(&fboPainter, fbo->width(), fbo->height()); - fboPainter.fillRect(0, 0, fbo->width(), fbo->height(), Qt::red); // Background - fboPainter.translate(14, 14); - fboPainter.fillPath(intersectingPath, Qt::blue); // Test stencil buffer works - fboPainter.translate(128, 0); - fboPainter.setClipPath(trianglePath); // Test depth buffer works - fboPainter.setTransform(QTransform()); // reset xform - fboPainter.fillRect(0, 0, fbo->width(), fbo->height(), Qt::green); fboPainter.end(); QImage fb = fbo->toImage().convertToFormat(QImage::Format_RGB32); delete fbo; - // As we're doing more than trivial painting, we can't just compare to - // an image rendered with raster. Instead, we sample at well-defined - // test-points: - QFUZZY_COMPARE_PIXELS(fb.pixel(39, 64), QColor(Qt::red).rgb()); - QFUZZY_COMPARE_PIXELS(fb.pixel(89, 64), QColor(Qt::red).rgb()); - QFUZZY_COMPARE_PIXELS(fb.pixel(64, 39), QColor(Qt::blue).rgb()); - QFUZZY_COMPARE_PIXELS(fb.pixel(64, 89), QColor(Qt::blue).rgb()); - - QFUZZY_COMPARE_PIXELS(fb.pixel(167, 39), QColor(Qt::red).rgb()); - QFUZZY_COMPARE_PIXELS(fb.pixel(217, 39), QColor(Qt::red).rgb()); - QFUZZY_COMPARE_PIXELS(fb.pixel(192, 64), QColor(Qt::green).rgb()); + qt_opengl_check_test_pattern(fb); } @@ -1137,6 +1150,16 @@ void tst_QGL::multipleFBOInterleavedRendering() QGLFramebufferObject *fbo2 = new QGLFramebufferObject(256, 128, fboFormat); QGLFramebufferObject *fbo3 = new QGLFramebufferObject(256, 128, fboFormat); + if ( (fbo1->attachment() != QGLFramebufferObject::CombinedDepthStencil) || + (fbo2->attachment() != QGLFramebufferObject::CombinedDepthStencil) || + (fbo3->attachment() != QGLFramebufferObject::CombinedDepthStencil) ) + { + delete fbo1; + delete fbo2; + delete fbo3; + QSKIP("FBOs missing combined depth~stencil support", SkipSingle); + } + QPainter fbo1Painter; QPainter fbo2Painter; QPainter fbo3Painter; @@ -1242,7 +1265,7 @@ protected: QPainter widgetPainter; widgetPainterBeginOk = widgetPainter.begin(this); QGLFramebufferObjectFormat fboFormat; - fboFormat.setAttachment(QGLFramebufferObject::CombinedDepthStencil); + fboFormat.setAttachment(QGLFramebufferObject::NoAttachment); QGLFramebufferObject *fbo = new QGLFramebufferObject(128, 128, fboFormat); QPainter fboPainter; diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index beb83a1..a03b2c7 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -107,6 +107,7 @@ private slots: void saveAndRestore(); void drawBorderPixmap(); + void drawPixmapFragments(); void drawLine_data(); void drawLine(); @@ -994,6 +995,49 @@ void tst_QPainter::drawBorderPixmap() QTileRules(Qt::StretchTile,Qt::StretchTile), 0); } +void tst_QPainter::drawPixmapFragments() +{ + QPixmap origPixmap(20, 20); + QPixmap resPixmap(20, 20); + QPainter::Fragment fragments[4] = { {15, 15, 0, 0, 10, 10, 1, 1, 0, 1}, + { 5, 15, 10, 0, 10, 10, 1, 1, 0, 1}, + {15, 5, 0, 10, 10, 10, 1, 1, 0, 1}, + { 5, 5, 10, 10, 10, 10, 1, 1, 0, 1} }; + { + QPainter p(&origPixmap); + p.fillRect(0, 0, 10, 10, Qt::red); + p.fillRect(10, 0, 10, 10, Qt::green); + p.fillRect(0, 10, 10, 10, Qt::blue); + p.fillRect(10, 10, 10, 10, Qt::yellow); + } + { + QPainter p(&resPixmap); + p.drawPixmapFragments(fragments, 4, origPixmap); + } + + QImage origImage = origPixmap.toImage().convertToFormat(QImage::Format_ARGB32); + QImage resImage = resPixmap.toImage().convertToFormat(QImage::Format_ARGB32); + + QVERIFY(resImage.size() == resPixmap.size()); + QVERIFY(resImage.pixel(5, 5) == origImage.pixel(15, 15)); + QVERIFY(resImage.pixel(5, 15) == origImage.pixel(15, 5)); + QVERIFY(resImage.pixel(15, 5) == origImage.pixel(5, 15)); + QVERIFY(resImage.pixel(15, 15) == origImage.pixel(5, 5)); + + + QPainter::Fragment fragment = QPainter::Fragment::create(QPointF(20, 20), QRectF(30, 30, 2, 2)); + QVERIFY(fragment.x == 20); + QVERIFY(fragment.y == 20); + QVERIFY(fragment.sourceLeft == 30); + QVERIFY(fragment.sourceTop == 30); + QVERIFY(fragment.width == 2); + QVERIFY(fragment.height == 2); + QVERIFY(fragment.scaleX == 1); + QVERIFY(fragment.scaleY == 1); + QVERIFY(fragment.rotation == 0); + QVERIFY(fragment.opacity == 1); +} + void tst_QPainter::drawLine_data() { QTest::addColumn<QLine>("line"); @@ -3443,8 +3487,8 @@ bool verifyOutlineFillConsistency(const QImage &img, QRgb outside, QRgb inside, if ((dx == 0) == (dy == 0)) continue; QRgb neighbor = img.pixel(p.x() + dx, p.y() + dy); - if (pixel == inside && neighbor == outside || - pixel == outside && neighbor == inside) + if ((pixel == inside && neighbor == outside) || + (pixel == outside && neighbor == inside)) return false; } } diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index 5b2b0cf..56eaf25 100644 --- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -137,6 +137,7 @@ private slots: void task255652_removeRowsRecursive(); void taskQTBUG_6205_doubleProxySelectionSetSourceModel(); void taskQTBUG_7537_appearsAndSort(); + void taskQTBUG_7716_unnecessaryDynamicSorting(); protected: void buildHierarchy(const QStringList &data, QAbstractItemModel *model); @@ -918,15 +919,16 @@ void tst_QSortFilterProxyModel::removeRows() QStandardItemModel model; QSortFilterProxyModel proxy; proxy.setSourceModel(&model); - if (sortOrder != -1) - proxy.sort(0, static_cast<Qt::SortOrder>(sortOrder)); - if (!filter.isEmpty()) - proxy.setFilterRegExp(QRegExp(filter)); // prepare model foreach (QString s, initial) model.appendRow(new QStandardItem(s)); + if (sortOrder != -1) + proxy.sort(0, static_cast<Qt::SortOrder>(sortOrder)); + if (!filter.isEmpty()) + proxy.setFilterRegExp(QRegExp(filter)); + // remove the rows QCOMPARE(proxy.removeRows(position, count, QModelIndex()), success); QCOMPARE(model.rowCount(QModelIndex()), expectedSource.count()); @@ -2419,6 +2421,7 @@ void tst_QSortFilterProxyModel::sortColumnTracking2() { QStandardItemModel model; QSortFilterProxyModel proxyModel; + proxyModel.setDynamicSortFilter(true); proxyModel.setSourceModel(&model); proxyModel.sort(0); @@ -2921,5 +2924,32 @@ void tst_QSortFilterProxyModel::taskQTBUG_7537_appearsAndSort() QCOMPARE(spyChanged2.count(), 1); } +void tst_QSortFilterProxyModel::taskQTBUG_7716_unnecessaryDynamicSorting() +{ + QStringListModel model; + const QStringList initial = QString("bravo charlie delta echo").split(" "); + model.setStringList(initial); + QSortFilterProxyModel proxy; + proxy.setDynamicSortFilter(false); + proxy.setSourceModel(&model); + proxy.sort(Qt::AscendingOrder); + + //append two rows + int maxrows = proxy.rowCount(QModelIndex()); + model.insertRows(maxrows, 2); + model.setData(model.index(maxrows, 0), QString("alpha")); + model.setData(model.index(maxrows + 1, 0), QString("fondue")); + + //append new items to the initial string list and compare with model + QStringList expected = initial; + expected << QString("alpha") << QString("fondue"); + + //if bug 7716 is present, new rows were prepended, when they should have been appended + for (int row = 0; row < proxy.rowCount(QModelIndex()); ++row) { + QModelIndex index = proxy.index(row, 0, QModelIndex()); + QCOMPARE(proxy.data(index, Qt::DisplayRole).toString(), expected.at(row)); + } +} + QTEST_MAIN(tst_QSortFilterProxyModel) #include "tst_qsortfilterproxymodel.moc" diff --git a/tests/auto/qstatictext/qstatictext.pro b/tests/auto/qstatictext/qstatictext.pro index a759a90..0f1ca68 100644 --- a/tests/auto/qstatictext/qstatictext.pro +++ b/tests/auto/qstatictext/qstatictext.pro @@ -1,4 +1,4 @@ load(qttest_p4) -QT = core gui opengl +QT = core gui SOURCES += tst_qstatictext.cpp diff --git a/tests/auto/qstringbuilder1/stringbuilder.cpp b/tests/auto/qstringbuilder1/stringbuilder.cpp index 8e95818..e9ae7a6 100644 --- a/tests/auto/qstringbuilder1/stringbuilder.cpp +++ b/tests/auto/qstringbuilder1/stringbuilder.cpp @@ -44,6 +44,14 @@ // "some literal", but replacing all vocals by their umlauted UTF-8 string :) #define UTF8_LITERAL "s\xc3\xb6m\xc3\xab l\xc3\xaft\xc3\xabr\xc3\xa4l" + +//fix for gcc4.0: if the operator+ does not exist without QT_USE_FAST_OPERATOR_PLUS +#ifndef QT_USE_FAST_CONCATENATION +#define Q % +#else +#define Q P +#endif + void runScenario() { // set codec for C strings to 0, enforcing Latin1 @@ -59,13 +67,13 @@ void runScenario() QString r; QByteArray ba(LITERAL); - r = l1literal P l1literal; + r = l1literal Q l1literal; QCOMPARE(r, r2); r = string P string; QCOMPARE(r, r2); - r = stringref P stringref; + r = stringref Q stringref; QCOMPARE(r, QString(stringref.toString() + stringref.toString())); - r = string P l1literal; + r = string Q l1literal; QCOMPARE(r, r2); r = string P l1string; QCOMPARE(r, r2); |