diff options
Diffstat (limited to 'tests/auto/gui')
27 files changed, 338 insertions, 112 deletions
diff --git a/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp b/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp index 2dbb078ae0..fe12175081 100644 --- a/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp +++ b/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp @@ -164,7 +164,7 @@ void tst_QIcoImageFormat::imageCount_data() QTest::newRow("16px,32px - 16 colors") << "valid/TIMER01.ICO" << 2; QTest::newRow("16px16c, 32px32c, 32px256c 1") << "valid/WORLD.ico" << 3; QTest::newRow("16px16c, 32px32c, 32px256c 2") << "valid/WORLDH.ico" << 3; - QTest::newRow("invalid floppy (first 8 bytes = 0xff)") << "invalid/35floppy.ico" << 0; + QTest::newRow("invalid floppy (first 8 bytes = 0xff)") << "invalid/35floppy.ico" << -1; QTest::newRow("includes 32BPP w/alpha") << "valid/semitransparent.ico" << 9; QTest::newRow("PNG compression") << "valid/Qt.ico" << 4; QTest::newRow("CUR file") << "valid/yellow.cur" << 1; @@ -177,7 +177,6 @@ void tst_QIcoImageFormat::imageCount() QImageReader reader(m_IconPath + QLatin1Char('/') + fileName); QCOMPARE(reader.imageCount(), count); - } void tst_QIcoImageFormat::jumpToNextImage_data() @@ -218,7 +217,7 @@ void tst_QIcoImageFormat::loopCount_data() QTest::addColumn<int>("count"); QTest::newRow("floppy (16px,32px - 16 colors)") << "valid/35FLOPPY.ICO" << 0; - QTest::newRow("invalid floppy (first 8 bytes = 0xff)") << "invalid/35floppy.ico" << 0; + QTest::newRow("invalid floppy (first 8 bytes = 0xff)") << "invalid/35floppy.ico" << -1; } void tst_QIcoImageFormat::loopCount() @@ -228,6 +227,7 @@ void tst_QIcoImageFormat::loopCount() QImageReader reader(m_IconPath + QLatin1Char('/') + fileName); QCOMPARE(reader.loopCount(), count); + QCOMPARE(reader.canRead(), count < 0 ? false : true); } void tst_QIcoImageFormat::nextImageDelay_data() @@ -256,7 +256,7 @@ void tst_QIcoImageFormat::nextImageDelay() QImageReader reader(m_IconPath + QLatin1Char('/') + fileName); if (count == -1) { - QCOMPARE(reader.nextImageDelay(), 0); + QCOMPARE(reader.nextImageDelay(), -1); } else { int i; for (i = 0; i < count; i++) { diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp index d17a171728..8b42b139a3 100644 --- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp @@ -30,6 +30,7 @@ #include <QtTest/QtTest> #include <QBuffer> +#include <QColorSpace> #include <QDebug> #include <QImage> #include <QImageReader> @@ -158,6 +159,9 @@ private slots: void saveFormat_data(); void saveFormat(); + void saveColorSpace_data(); + void saveColorSpace(); + void readText_data(); void readText(); @@ -1883,6 +1887,33 @@ void tst_QImageReader::saveFormat() QCOMPARE(stored, converted); } +void tst_QImageReader::saveColorSpace_data() +{ + QTest::addColumn<QColorSpace::ColorSpaceId>("colorspaceId"); + + QTest::newRow("Undefined") << QColorSpace::Undefined; + QTest::newRow("sRGB") << QColorSpace::SRgb; + QTest::newRow("sRGB(linear)") << QColorSpace::SRgbLinear; + QTest::newRow("AdobeRGB") << QColorSpace::AdobeRgb; + QTest::newRow("DisplayP3") << QColorSpace::DisplayP3; + QTest::newRow("ProPhotoRgb") << QColorSpace::ProPhotoRgb; +} + +void tst_QImageReader::saveColorSpace() +{ + QFETCH(QColorSpace::ColorSpaceId, colorspaceId); + + QImage orig(":/images/kollada.png"); + + orig.setColorSpace(colorspaceId); + QBuffer buf; + buf.open(QIODevice::WriteOnly); + QVERIFY(orig.save(&buf, "png")); + buf.close(); + QImage stored = QImage::fromData(buf.buffer(), "png"); + + QCOMPARE(stored, orig); +} void tst_QImageReader::readText_data() { diff --git a/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp b/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp index 158530428d..3158883ef5 100644 --- a/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp +++ b/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp @@ -104,18 +104,28 @@ void tst_QPixmapCache::cacheLimit() void tst_QPixmapCache::setCacheLimit() { + QPixmap res; QPixmap *p1 = new QPixmap(2, 3); QPixmapCache::insert("P1", *p1); +#if QT_DEPRECATED_SINCE(5, 13) QVERIFY(QPixmapCache::find("P1") != 0); +#endif + QVERIFY(QPixmapCache::find("P1", &res)); delete p1; QPixmapCache::setCacheLimit(0); +#if QT_DEPRECATED_SINCE(5, 13) QVERIFY(!QPixmapCache::find("P1")); +#endif + QVERIFY(!QPixmapCache::find("P1", &res)); p1 = new QPixmap(2, 3); QPixmapCache::setCacheLimit(1000); QPixmapCache::insert("P1", *p1); +#if QT_DEPRECATED_SINCE(5, 13) QVERIFY(QPixmapCache::find("P1") != 0); +#endif + QVERIFY(QPixmapCache::find("P1", &res)); delete p1; @@ -200,6 +210,7 @@ void tst_QPixmapCache::find() QVERIFY(QPixmapCache::insert("P1", p1)); QPixmap p2; +#if QT_DEPRECATED_SINCE(5, 13) QVERIFY(QPixmapCache::find("P1", p2)); QCOMPARE(p2.width(), 10); QCOMPARE(p2.height(), 10); @@ -209,6 +220,12 @@ void tst_QPixmapCache::find() QPixmap *p3 = QPixmapCache::find("P1"); QVERIFY(p3); QCOMPARE(p1, *p3); +#endif + + QVERIFY(QPixmapCache::find("P1", &p2)); + QCOMPARE(p2.width(), 10); + QCOMPARE(p2.height(), 10); + QCOMPARE(p1, p2); //The int part of the API QPixmapCache::Key key = QPixmapCache::insert(p1); @@ -261,6 +278,7 @@ void tst_QPixmapCache::insert() } int num = 0; +#if QT_DEPRECATED_SINCE(5, 13) for (int k = 0; k < numberOfKeys; ++k) { if (QPixmapCache::find(QString::number(k))) ++num; @@ -268,6 +286,16 @@ void tst_QPixmapCache::insert() if (QPixmapCache::find("0")) ++num; + num = 0; +#endif + QPixmap res; + for (int k = 0; k < numberOfKeys; ++k) { + if (QPixmapCache::find(QString::number(k), &res)) + ++num; + } + + if (QPixmapCache::find("0", &res)) + ++num; QVERIFY(num <= estimatedNum); QPixmap p3; @@ -340,17 +368,17 @@ void tst_QPixmapCache::remove() p1.fill(Qt::yellow); QPixmap p2; - QVERIFY(QPixmapCache::find("red", p2)); + QVERIFY(QPixmapCache::find("red", &p2)); QVERIFY(p1.toImage() != p2.toImage()); QVERIFY(p1.toImage() == p1.toImage()); // sanity check QPixmapCache::remove("red"); - QVERIFY(!QPixmapCache::find("red")); + QVERIFY(!QPixmapCache::find("red", &p2)); QPixmapCache::remove("red"); - QVERIFY(!QPixmapCache::find("red")); + QVERIFY(!QPixmapCache::find("red", &p2)); QPixmapCache::remove("green"); - QVERIFY(!QPixmapCache::find("green")); + QVERIFY(!QPixmapCache::find("green", &p2)); //The int part of the API QPixmapCache::clear(); @@ -392,7 +420,7 @@ void tst_QPixmapCache::remove() key = QPixmapCache::insert(p1); QPixmapCache::remove(key); QVERIFY(QPixmapCache::find(key, &p1) == 0); - QVERIFY(QPixmapCache::find("red") != 0); + QVERIFY(QPixmapCache::find("red", &p1) != 0); } void tst_QPixmapCache::clear() @@ -408,14 +436,14 @@ void tst_QPixmapCache::clear() const int numberOfKeys = estimatedNum + 1000; for (int i = 0; i < numberOfKeys; ++i) - QVERIFY(QPixmapCache::find("x" + QString::number(i)) == 0); + QVERIFY(!QPixmapCache::find("x" + QString::number(i), &p1)); for (int j = 0; j < numberOfKeys; ++j) QPixmapCache::insert(QString::number(j), p1); int num = 0; for (int k = 0; k < numberOfKeys; ++k) { - if (QPixmapCache::find(QString::number(k), p1)) + if (QPixmapCache::find(QString::number(k), &p1)) ++num; } QVERIFY(num > 0); @@ -423,7 +451,7 @@ void tst_QPixmapCache::clear() QPixmapCache::clear(); for (int k = 0; k < numberOfKeys; ++k) - QVERIFY(!QPixmapCache::find(QString::number(k))); + QVERIFY(!QPixmapCache::find(QString::number(k), &p1)); //The int part of the API QPixmap p2(10, 10); diff --git a/tests/auto/gui/kernel/qdrag/tst_qdrag.cpp b/tests/auto/gui/kernel/qdrag/tst_qdrag.cpp index 68852f5a3f..d67b17fd43 100644 --- a/tests/auto/gui/kernel/qdrag/tst_qdrag.cpp +++ b/tests/auto/gui/kernel/qdrag/tst_qdrag.cpp @@ -68,10 +68,17 @@ void tst_QDrag::getSetCheck() QCOMPARE((QMimeData *)0, obj1.mimeData()); // delete var1; // No delete, since QDrag takes ownership - Qt::DropAction result = obj1.start(); + Qt::DropAction result = obj1.exec(); + QCOMPARE(result, Qt::IgnoreAction); + result = obj1.exec(Qt::MoveAction | Qt::LinkAction); + QCOMPARE(result, Qt::IgnoreAction); + +#if QT_DEPRECATED_SINCE(5, 13) + result = obj1.start(); QCOMPARE(result, Qt::IgnoreAction); result = obj1.start(Qt::MoveAction | Qt::LinkAction); QCOMPARE(result, Qt::IgnoreAction); +#endif } QTEST_MAIN(tst_QDrag) diff --git a/tests/auto/gui/kernel/qguiapplication/BLACKLIST b/tests/auto/gui/kernel/qguiapplication/BLACKLIST index 9a670237b7..e6ffe78ae3 100644 --- a/tests/auto/gui/kernel/qguiapplication/BLACKLIST +++ b/tests/auto/gui/kernel/qguiapplication/BLACKLIST @@ -1,4 +1,3 @@ [focusObject] -opensuse -opensuse-leap -ubuntu +ubuntu-16.04 +opensuse-42.3 diff --git a/tests/auto/gui/kernel/qguieventdispatcher/BLACKLIST b/tests/auto/gui/kernel/qguieventdispatcher/BLACKLIST index b1590a5ccf..d2c51922a8 100644 --- a/tests/auto/gui/kernel/qguieventdispatcher/BLACKLIST +++ b/tests/auto/gui/kernel/qguieventdispatcher/BLACKLIST @@ -1,5 +1,3 @@ -[sendPostedEvents] -windows [registerTimer] -windows winrt + diff --git a/tests/auto/gui/kernel/qguieventloop/BLACKLIST b/tests/auto/gui/kernel/qguieventloop/BLACKLIST deleted file mode 100644 index 03acb2f5b0..0000000000 --- a/tests/auto/gui/kernel/qguieventloop/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[testQuitLock] -osx-10.12 diff --git a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp index b2572188b9..3ce65a6785 100644 --- a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp +++ b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp @@ -191,7 +191,7 @@ template<> struct TestValueFactory<QMetaType::QTextLength> { static QTextLength *create() { return new QTextLength(QTextLength::PercentageLength, 50); } }; template<> struct TestValueFactory<QMetaType::QTextFormat> { - static QTextFormat *create() { return new QTextFormat(QTextFormat::TableFormat); } + static QTextFormat *create() { return new QTextFormat(QTextFormat::FrameFormat); } }; template<> struct TestValueFactory<QMetaType::QMatrix> { static QMatrix *create() { return new QMatrix(10, 20, 30, 40, 50, 60); } diff --git a/tests/auto/gui/kernel/qguitimer/BLACKLIST b/tests/auto/gui/kernel/qguitimer/BLACKLIST new file mode 100644 index 0000000000..6ab715b922 --- /dev/null +++ b/tests/auto/gui/kernel/qguitimer/BLACKLIST @@ -0,0 +1,8 @@ +[basic_chrono] +osx-10.13 +[remainingTime] +osx-10.12 +windows-10 msvc-2015 +osx-10.14 +osx-10.13 + diff --git a/tests/auto/gui/kernel/qtouchevent/BLACKLIST b/tests/auto/gui/kernel/qtouchevent/BLACKLIST index 8e78d7e41f..dcda77bce7 100644 --- a/tests/auto/gui/kernel/qtouchevent/BLACKLIST +++ b/tests/auto/gui/kernel/qtouchevent/BLACKLIST @@ -1,6 +1,2 @@ -[basicRawEventTranslation] -linux [multiPointRawEventTranslationOnTouchScreen] -linux -[multiPointRawEventTranslationOnTouchPad] -linux +ubuntu-16.04 diff --git a/tests/auto/gui/kernel/qwindow/BLACKLIST b/tests/auto/gui/kernel/qwindow/BLACKLIST index 1820499a53..1bb3917948 100644 --- a/tests/auto/gui/kernel/qwindow/BLACKLIST +++ b/tests/auto/gui/kernel/qwindow/BLACKLIST @@ -1,3 +1,7 @@ +[positioning] +opensuse-leap +ubuntu-16.04 +opensuse-42.3 [positioning:default] linux osx-10.12 ci @@ -6,38 +10,25 @@ winrt osx-10.12 ci [modalWithChildWindow] ubuntu-16.04 -# QTBUG-66851 -opensuse opensuse-leap +# QTBUG-66851 # QTBUG-69160 -android +opensuse-42.3 [setVisible] # QTBUG-69154 android [modalWindowEnterEventOnHide_QTBUG35109] ubuntu-16.04 -osx ci +osx-10.11 +osx-10.13 +osx-10.14 +osx-10.12 [spuriousMouseMove] -windows ci # QTBUG-69162 -android -[modalDialogClosingOneOfTwoModal] -osx -[modalWindowModallity] -osx -# QTBUG-69163 -android -[visibility] -osx-10.12 ci - +windows-10 msvc-2015 +windows-10 msvc-2017 [testInputEvents] rhel-7.4 -[isActive] -# QTBUG-67768 -ubuntu -# QTBUG-69157 -android - [exposeEventOnShrink_QTBUG54040] # QTBUG-69155 android diff --git a/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp b/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp index 96d983c8f7..e19f76d830 100644 --- a/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp +++ b/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp @@ -2861,8 +2861,10 @@ void tst_QMatrixNxN::convertGeneric() QMatrix4x4 m4(m1); QVERIFY(isSame(m4, unique4x4)); +#if QT_DEPRECATED_SINCE(5, 0) QMatrix4x4 m5 = qGenericMatrixToMatrix4x4(m1); QVERIFY(isSame(m5, unique4x4)); +#endif static float const conv4x4[12] = { 1.0f, 2.0f, 3.0f, 4.0f, @@ -2874,8 +2876,10 @@ void tst_QMatrixNxN::convertGeneric() QMatrix4x3 m10 = m9.toGenericMatrix<4, 3>(); QVERIFY(isSame(m10, conv4x4)); +#if QT_DEPRECATED_SINCE(5, 0) QMatrix4x3 m11 = qGenericMatrixFromMatrix4x4<4, 3>(m9); QVERIFY(isSame(m11, conv4x4)); +#endif } // Copy of "flagBits" in qmatrix4x4.h. diff --git a/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp b/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp index 097dd111d3..8041fb5439 100644 --- a/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp +++ b/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp @@ -778,7 +778,10 @@ void tst_QQuaternion::conjugate() QQuaternion v1(w1, x1, y1, z1); QQuaternion v2(w1, -x1, -y1, -z1); +#if QT_DEPRECATED_SINCE(5, 5) QCOMPARE(v1.conjugate(), v2); +#endif + QCOMPARE(v1.conjugated(), v2); } // Test quaternion creation from an axis and an angle. diff --git a/tests/auto/gui/painting/qcolorspace/resources/HP_ZR30w.icc b/tests/auto/gui/painting/qcolorspace/resources/HP_ZR30w.icc Binary files differnew file mode 100644 index 0000000000..b3f860714c --- /dev/null +++ b/tests/auto/gui/painting/qcolorspace/resources/HP_ZR30w.icc diff --git a/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp b/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp index 7a88eb18b2..bc1a45013c 100644 --- a/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp +++ b/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp @@ -36,7 +36,7 @@ #include <private/qcolorspace_p.h> Q_DECLARE_METATYPE(QColorSpace::ColorSpaceId) -Q_DECLARE_METATYPE(QColorSpace::Gamut) +Q_DECLARE_METATYPE(QColorSpace::Primaries) Q_DECLARE_METATYPE(QColorSpace::TransferFunction) class tst_QColorSpace : public QObject @@ -53,6 +53,7 @@ private slots: void toIccProfile_data(); void toIccProfile(); + void fromIccProfile_data(); void fromIccProfile(); void imageConversion_data(); @@ -60,11 +61,14 @@ private slots: void loadImage(); - void gamut(); + void primaries(); void primariesXyz(); void primaries2_data(); void primaries2(); void invalidPrimaries(); + + void changeTransferFunction(); + void changePrimaries(); }; tst_QColorSpace::tst_QColorSpace() @@ -74,33 +78,33 @@ tst_QColorSpace::tst_QColorSpace() void tst_QColorSpace::namedColorSpaces_data() { QTest::addColumn<QColorSpace::ColorSpaceId>("colorSpaceId"); - QTest::addColumn<QColorSpace::Gamut>("gamutId"); + QTest::addColumn<QColorSpace::Primaries>("primariesId"); QTest::addColumn<QColorSpace::TransferFunction>("transferFunctionId"); QTest::newRow("sRGB") << QColorSpace::SRgb - << QColorSpace::Gamut::SRgb + << QColorSpace::Primaries::SRgb << QColorSpace::TransferFunction::SRgb; QTest::newRow("sRGB Linear") << QColorSpace::SRgbLinear - << QColorSpace::Gamut::SRgb + << QColorSpace::Primaries::SRgb << QColorSpace::TransferFunction::Linear; QTest::newRow("Adobe RGB") << QColorSpace::AdobeRgb - << QColorSpace::Gamut::AdobeRgb + << QColorSpace::Primaries::AdobeRgb << QColorSpace::TransferFunction::Gamma; QTest::newRow("Display-P3") << QColorSpace::DisplayP3 - << QColorSpace::Gamut::DciP3D65 + << QColorSpace::Primaries::DciP3D65 << QColorSpace::TransferFunction::SRgb; QTest::newRow("ProPhoto RGB") << QColorSpace::ProPhotoRgb - << QColorSpace::Gamut::ProPhotoRgb + << QColorSpace::Primaries::ProPhotoRgb << QColorSpace::TransferFunction::ProPhotoRgb; QTest::newRow("BT.2020") << QColorSpace::Bt2020 - << QColorSpace::Gamut::Bt2020 + << QColorSpace::Primaries::Bt2020 << QColorSpace::TransferFunction::Bt2020; } void tst_QColorSpace::namedColorSpaces() { QFETCH(QColorSpace::ColorSpaceId, colorSpaceId); - QFETCH(QColorSpace::Gamut, gamutId); + QFETCH(QColorSpace::Primaries, primariesId); QFETCH(QColorSpace::TransferFunction, transferFunctionId); QColorSpace colorSpace = colorSpaceId; @@ -108,7 +112,7 @@ void tst_QColorSpace::namedColorSpaces() QVERIFY(colorSpace.isValid()); QCOMPARE(colorSpace.colorSpaceId(), colorSpaceId); - QCOMPARE(colorSpace.gamut(), gamutId); + QCOMPARE(colorSpace.primaries(), primariesId); QCOMPARE(colorSpace.transferFunction(), transferFunctionId); } @@ -121,10 +125,10 @@ void tst_QColorSpace::toIccProfile_data() void tst_QColorSpace::toIccProfile() { QFETCH(QColorSpace::ColorSpaceId, colorSpaceId); - QFETCH(QColorSpace::Gamut, gamutId); + QFETCH(QColorSpace::Primaries, primariesId); QFETCH(QColorSpace::TransferFunction, transferFunctionId); - Q_UNUSED(gamutId); + Q_UNUSED(primariesId); Q_UNUSED(transferFunctionId); QColorSpace colorSpace = colorSpaceId; @@ -142,21 +146,38 @@ void tst_QColorSpace::toIccProfile() QCOMPARE(iccProfile2, iccProfile); } -void tst_QColorSpace::fromIccProfile() +void tst_QColorSpace::fromIccProfile_data() { - // Read the official sRGB ICCv2 profile: + QTest::addColumn<QString>("testProfile"); + QTest::addColumn<QColorSpace::ColorSpaceId>("colorSpaceId"); + QTest::addColumn<QColorSpace::TransferFunction>("transferFunction"); + QTest::addColumn<QString>("description"); + QString prefix = QFINDTESTDATA("resources/"); - QFile file(prefix + "sRGB2014.icc"); + // Read the official sRGB ICCv2 profile: + QTest::newRow("sRGB2014 (ICCv2)") << prefix + "sRGB2014.icc" << QColorSpace::SRgb + << QColorSpace::TransferFunction::SRgb << QString("sRGB2014"); + // My monitor's profile: + QTest::newRow("HP ZR30w (ICCv4)") << prefix + "HP_ZR30w.icc" << QColorSpace::Unknown + << QColorSpace::TransferFunction::Gamma << QString("HP Z30i"); +} + +void tst_QColorSpace::fromIccProfile() +{ + QFETCH(QString, testProfile); + QFETCH(QColorSpace::ColorSpaceId, colorSpaceId); + QFETCH(QColorSpace::TransferFunction, transferFunction); + QFETCH(QString, description); + + QFile file(testProfile); file.open(QIODevice::ReadOnly); QByteArray iccProfile = file.readAll(); - QColorSpace stdSRgb = QColorSpace::fromIccProfile(iccProfile); - QVERIFY(stdSRgb.isValid()); - - QCOMPARE(stdSRgb.gamut(), QColorSpace::Gamut::SRgb); - QCOMPARE(stdSRgb.transferFunction(), QColorSpace::TransferFunction::SRgb); - QCOMPARE(stdSRgb.colorSpaceId(), QColorSpace::SRgb); + QColorSpace fileColorSpace = QColorSpace::fromIccProfile(iccProfile); + QVERIFY(fileColorSpace.isValid()); - QCOMPARE(stdSRgb, QColorSpace(QColorSpace::SRgb)); + QCOMPARE(fileColorSpace.colorSpaceId(), colorSpaceId); + QCOMPARE(fileColorSpace.transferFunction(), transferFunction); + QCOMPARE(QColorSpacePrivate::get(fileColorSpace)->description, description); } void tst_QColorSpace::imageConversion_data() @@ -262,7 +283,7 @@ void tst_QColorSpace::loadImage() QVERIFY(maxBlue2 > maxBlue); } -void tst_QColorSpace::gamut() +void tst_QColorSpace::primaries() { QColor black = QColor::fromRgbF(0.0, 0.0, 0.0); QColor white = QColor::fromRgbF(1.0, 1.0, 1.0); @@ -304,30 +325,30 @@ void tst_QColorSpace::primariesXyz() QColorSpace bt2020 = QColorSpace::Bt2020; // Check if our calculated matrices, match the precalculated ones. - QCOMPARE(sRgb.d_func()->toXyz, QColorMatrix::toXyzFromSRgb()); - QCOMPARE(adobeRgb.d_func()->toXyz, QColorMatrix::toXyzFromAdobeRgb()); - QCOMPARE(displayP3.d_func()->toXyz, QColorMatrix::toXyzFromDciP3D65()); - QCOMPARE(proPhotoRgb.d_func()->toXyz, QColorMatrix::toXyzFromProPhotoRgb()); - QCOMPARE(bt2020.d_func()->toXyz, QColorMatrix::toXyzFromBt2020()); + QCOMPARE(QColorSpacePrivate::get(sRgb)->toXyz, QColorMatrix::toXyzFromSRgb()); + QCOMPARE(QColorSpacePrivate::get(adobeRgb)->toXyz, QColorMatrix::toXyzFromAdobeRgb()); + QCOMPARE(QColorSpacePrivate::get(displayP3)->toXyz, QColorMatrix::toXyzFromDciP3D65()); + QCOMPARE(QColorSpacePrivate::get(proPhotoRgb)->toXyz, QColorMatrix::toXyzFromProPhotoRgb()); + QCOMPARE(QColorSpacePrivate::get(bt2020)->toXyz, QColorMatrix::toXyzFromBt2020()); } void tst_QColorSpace::primaries2_data() { - QTest::addColumn<QColorSpace::Gamut>("gamut"); + QTest::addColumn<QColorSpace::Primaries>("primariesId"); - QTest::newRow("sRGB") << QColorSpace::Gamut::SRgb; - QTest::newRow("DCI-P3 (D65)") << QColorSpace::Gamut::DciP3D65; - QTest::newRow("Adobe RGB (1998)") << QColorSpace::Gamut::AdobeRgb; - QTest::newRow("ProPhoto RGB") << QColorSpace::Gamut::ProPhotoRgb; - QTest::newRow("BT.2020") << QColorSpace::Gamut::Bt2020; + QTest::newRow("sRGB") << QColorSpace::Primaries::SRgb; + QTest::newRow("DCI-P3 (D65)") << QColorSpace::Primaries::DciP3D65; + QTest::newRow("Adobe RGB (1998)") << QColorSpace::Primaries::AdobeRgb; + QTest::newRow("ProPhoto RGB") << QColorSpace::Primaries::ProPhotoRgb; + QTest::newRow("BT.2020") << QColorSpace::Primaries::Bt2020; } void tst_QColorSpace::primaries2() { - QFETCH(QColorSpace::Gamut, gamut); - QColorSpacePrimaries primaries(gamut); + QFETCH(QColorSpace::Primaries, primariesId); + QColorSpacePrimaries primaries(primariesId); - QColorSpace original(gamut, QColorSpace::TransferFunction::Linear); + QColorSpace original(primariesId, QColorSpace::TransferFunction::Linear); QColorSpace custom1(primaries.whitePoint, primaries.redPoint, primaries.greenPoint, primaries.bluePoint, QColorSpace::TransferFunction::Linear); QCOMPARE(original, custom1); @@ -357,5 +378,49 @@ void tst_QColorSpace::invalidPrimaries() QCOMPARE(custom.colorSpaceId(), QColorSpace::Undefined); } +void tst_QColorSpace::changeTransferFunction() +{ + QColorSpace sRgb = QColorSpace::SRgb; + + QColorSpace sRgbLinear = sRgb.withTransferFunction(QColorSpace::TransferFunction::Linear); + QCOMPARE(sRgbLinear.transferFunction(), QColorSpace::TransferFunction::Linear); + QCOMPARE(sRgbLinear.gamma(), 1.0f); + QCOMPARE(sRgbLinear.primaries(), QColorSpace::Primaries::SRgb); + QCOMPARE(sRgbLinear.colorSpaceId(), QColorSpace::SRgbLinear); + QCOMPARE(sRgbLinear, QColorSpace(QColorSpace::SRgbLinear)); + QVERIFY(sRgbLinear != sRgb); + QCOMPARE(sRgbLinear.withTransferFunction(QColorSpace::TransferFunction::SRgb), sRgb); + + QColorSpace aRgb = QColorSpace::AdobeRgb; + aRgb.setTransferFunction(QColorSpace::TransferFunction::SRgb); + QCOMPARE(aRgb.transferFunction(), QColorSpace::TransferFunction::SRgb); + QCOMPARE(aRgb.primaries(), QColorSpace::Primaries::AdobeRgb); + QCOMPARE(aRgb.colorSpaceId(), QColorSpace::Unknown); + QVERIFY(aRgb != QColorSpace(QColorSpace::AdobeRgb)); + QVERIFY(aRgb != sRgb); + QCOMPARE(aRgb.withTransferFunction(QColorSpace::TransferFunction::Gamma, 2.2f), + QColorSpace(QColorSpace::AdobeRgb)); + QVERIFY(aRgb != QColorSpace(QColorSpace::AdobeRgb)); + aRgb.setTransferFunction(QColorSpace::TransferFunction::Gamma, 2.2f); + QVERIFY(aRgb == QColorSpace(QColorSpace::AdobeRgb)); + + QColorSpace undefined; + QCOMPARE(undefined.withTransferFunction(QColorSpace::TransferFunction::Linear), undefined); + undefined.setTransferFunction(QColorSpace::TransferFunction::SRgb); + QCOMPARE(undefined, QColorSpace()); +} + +void tst_QColorSpace::changePrimaries() +{ + QColorSpace cs = QColorSpace::SRgb; + cs.setPrimaries(QColorSpace::Primaries::DciP3D65); + QVERIFY(cs.isValid()); + QCOMPARE(cs, QColorSpace(QColorSpace::DisplayP3)); + cs.setTransferFunction(QColorSpace::TransferFunction::Linear); + cs.setPrimaries(QPointF(0.3127, 0.3290), QPointF(0.640, 0.330), + QPointF(0.3000, 0.6000), QPointF(0.150, 0.060)); + QCOMPARE(cs, QColorSpace(QColorSpace::SRgbLinear)); +} + QTEST_MAIN(tst_QColorSpace) #include "tst_qcolorspace.moc" diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index 2b53169a45..0efeb9b356 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -123,14 +123,18 @@ private slots: void drawPath2(); void drawPath3(); +#if QT_DEPRECATED_SINCE(5, 13) void drawRoundRect_data() { fillData(); } void drawRoundRect(); +#endif + void drawRoundedRect_data() { fillData(); } + void drawRoundedRect(); void qimageFormats_data(); void qimageFormats(); void textOnTransparentImage(); -#ifndef QT_NO_WIDGETS +#if !defined(QT_NO_WIDGETS) && QT_DEPRECATED_SINCE(5, 13) void initFrom(); #endif @@ -679,12 +683,14 @@ static QRect getPaintedSize(const QPixmap &pm, const QColor &background) } #ifndef QT_NO_WIDGETS + +#if QT_DEPRECATED_SINCE(5, 13) void tst_QPainter::initFrom() { QWidget *widget = new QWidget(); QPalette pal = widget->palette(); - pal.setColor(QPalette::Foreground, QColor(255, 0, 0)); - pal.setBrush(QPalette::Background, QColor(0, 255, 0)); + pal.setColor(QPalette::WindowText, QColor(255, 0, 0)); + pal.setBrush(QPalette::Window, QColor(0, 255, 0)); widget->setPalette(pal); widget->show(); @@ -698,11 +704,12 @@ void tst_QPainter::initFrom() p.initFrom(widget); QCOMPARE(p.font(), font); - QCOMPARE(p.pen().color(), pal.color(QPalette::Foreground)); + QCOMPARE(p.pen().color(), pal.color(QPalette::WindowText)); QCOMPARE(p.background(), pal.window()); delete widget; } +#endif void tst_QPainter::drawBorderPixmap() { @@ -1546,6 +1553,7 @@ void tst_QPainter::drawClippedEllipse() } +#if QT_DEPRECATED_SINCE(5, 13) void tst_QPainter::drawRoundRect() { QFETCH(QRect, rect); @@ -1580,6 +1588,42 @@ void tst_QPainter::drawRoundRect() QCOMPARE(painted.height(), rect.height() + increment); } } +#endif + +void tst_QPainter::drawRoundedRect() +{ + QFETCH(QRect, rect); + QFETCH(bool, usePen); + +#ifdef Q_OS_DARWIN + if (QTest::currentDataTag() == QByteArray("rect(6, 12, 3, 14) with pen") || + QTest::currentDataTag() == QByteArray("rect(6, 17, 3, 25) with pen") || + QTest::currentDataTag() == QByteArray("rect(10, 6, 10, 3) with pen") || + QTest::currentDataTag() == QByteArray("rect(10, 12, 10, 14) with pen") || + QTest::currentDataTag() == QByteArray("rect(13, 45, 17, 80) with pen") || + QTest::currentDataTag() == QByteArray("rect(13, 50, 17, 91) with pen") || + QTest::currentDataTag() == QByteArray("rect(17, 6, 24, 3) with pen") || + QTest::currentDataTag() == QByteArray("rect(24, 12, 38, 14) with pen")) + QSKIP("The Mac paint engine is off-by-one on certain rect sizes"); +#endif + QPixmap pixmap(rect.x() + rect.width() + 10, + rect.y() + rect.height() + 10); + { + pixmap.fill(Qt::white); + QPainter p(&pixmap); + p.setRenderHint(QPainter::Qt4CompatiblePainting); + p.setPen(usePen ? QPen(Qt::black) : QPen(Qt::NoPen)); + p.setBrush(Qt::black); + p.drawRoundedRect(rect, 25, 25, Qt::RelativeSize); + p.end(); + + int increment = usePen ? 1 : 0; + + const QRect painted = getPaintedSize(pixmap, Qt::white); + QCOMPARE(painted.width(), rect.width() + increment); + QCOMPARE(painted.height(), rect.height() + increment); + } +} void tst_QPainter::qimageFormats_data() { @@ -1662,9 +1706,13 @@ void tst_QPainter::combinedMatrix() p.translate(0.5, 0.5); + QTransform ct = p.combinedTransform(); +#if QT_DEPRECATED_SINCE(5, 13) QMatrix cm = p.combinedMatrix(); + QCOMPARE(cm, ct.toAffine()); +#endif - QPointF pt = QPointF(0, 0) * cm; + QPointF pt = QPointF(0, 0) * ct.toAffine(); QCOMPARE(pt.x(), 48.0); QCOMPARE(pt.y(), 16.0); @@ -1979,7 +2027,7 @@ void tst_QPainter::clippedFillPath_data() << pen2; path = QPainterPath(); - path.addRoundRect(QRect(15, 15, 50, 50), 20); + path.addRoundedRect(QRect(15, 15, 50, 50), 20, Qt::RelativeSize); QTest::newRow("round rect 0") << QSize(100, 100) << path << QRect(15, 15, 49, 49) << QBrush(Qt::NoBrush) @@ -4088,14 +4136,18 @@ void tst_QPainter::inactivePainter() p.setClipRegion(region); p.setClipping(true); +#if QT_DEPRECATED_SINCE(5, 13) p.combinedMatrix(); +#endif p.combinedTransform(); p.compositionMode(); p.setCompositionMode(QPainter::CompositionMode_Plus); p.device(); +#if QT_DEPRECATED_SINCE(5, 13) p.deviceMatrix(); +#endif p.deviceTransform(); p.font(); @@ -4119,7 +4171,9 @@ void tst_QPainter::inactivePainter() p.setRenderHint(QPainter::Antialiasing, true); p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, false); +#if QT_DEPRECATED_SINCE(5, 13) p.resetMatrix(); +#endif p.resetTransform(); p.rotate(1); p.scale(2, 2); @@ -4135,8 +4189,10 @@ void tst_QPainter::inactivePainter() p.window(); p.setWindow(QRect(10, 10, 620, 460)); +#if QT_DEPRECATED_SINCE(5, 13) p.worldMatrix(); p.setWorldMatrix(QMatrix().translate(43, 21), true); +#endif p.setWorldMatrixEnabled(true); p.transform(); diff --git a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp index c90348e91a..67cf9a321a 100644 --- a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp +++ b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp @@ -161,10 +161,18 @@ void tst_QPainterPath::clear() p1.clear(); QCOMPARE(p1, p2); + p1.lineTo(50, 50); + QPainterPath p3; + QCOMPARE(p1.elementCount(), 2); + p3.lineTo(50, 50); + QCOMPARE(p1, p3); + QCOMPARE(p1.fillRule(), Qt::OddEvenFill); p1.setFillRule(Qt::WindingFill); + QVERIFY(p1 != p3); p1.clear(); - QCOMPARE(p1.fillRule(), Qt::WindingFill); + QCOMPARE(p1.fillRule(), Qt::OddEvenFill); + QCOMPARE(p1, p2); } void tst_QPainterPath::reserveAndCapacity() diff --git a/tests/auto/gui/painting/qpathclipper/paths.cpp b/tests/auto/gui/painting/qpathclipper/paths.cpp index 077527e1a0..1328befd1b 100644 --- a/tests/auto/gui/painting/qpathclipper/paths.cpp +++ b/tests/auto/gui/painting/qpathclipper/paths.cpp @@ -578,7 +578,7 @@ QPainterPath Paths::node() m_rect.setHeight(100); QPainterPath shape; - shape.addRoundRect(m_rect, 25); + shape.addRoundedRect(m_rect, 25, Qt::RelativeSize); const int conWidth = 10; const int xOffset = 7; diff --git a/tests/auto/gui/qopengl/BLACKLIST b/tests/auto/gui/qopengl/BLACKLIST index a036106c57..10e0520bd9 100644 --- a/tests/auto/gui/qopengl/BLACKLIST +++ b/tests/auto/gui/qopengl/BLACKLIST @@ -1,10 +1,2 @@ -[fboRendering] -windows -[QTBUG15621_triangulatingStrokerDivZero] -windows -[imageFormatPainting] -windows -[openGLPaintDevice] -windows [wglContextWrap] windows diff --git a/tests/auto/gui/text/qfont/BLACKLIST b/tests/auto/gui/text/qfont/BLACKLIST deleted file mode 100644 index 42cb8408f4..0000000000 --- a/tests/auto/gui/text/qfont/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[defaultFamily] -b2qt diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp index 901284e131..96f3b1c1d7 100644 --- a/tests/auto/gui/text/qfont/tst_qfont.cpp +++ b/tests/auto/gui/text/qfont/tst_qfont.cpp @@ -58,7 +58,9 @@ private slots: void insertAndRemoveSubstitutions(); void serialize_data(); void serialize(); +#if QT_DEPRECATED_SINCE(5, 13) void lastResortFont(); +#endif void styleName(); void defaultFamily_data(); void defaultFamily(); @@ -484,6 +486,7 @@ void tst_QFont::serialize() } } +#if QT_DEPRECATED_SINCE(5, 13) // QFont::lastResortFont() may abort with qFatal() on QWS/QPA // if absolutely no font is found. Just as ducumented for QFont::lastResortFont(). // This happens on our CI machines which run QWS autotests. @@ -494,6 +497,7 @@ void tst_QFont::lastResortFont() QFont font; QVERIFY(!font.lastResortFont().isEmpty()); } +#endif void tst_QFont::styleName() { diff --git a/tests/auto/gui/text/qglyphrun/BLACKLIST b/tests/auto/gui/text/qglyphrun/BLACKLIST index d8dbdabb4b..57f32c683d 100644 --- a/tests/auto/gui/text/qglyphrun/BLACKLIST +++ b/tests/auto/gui/text/qglyphrun/BLACKLIST @@ -1,4 +1,3 @@ [mixedScripts] ubuntu-18.04 b2qt -windows diff --git a/tests/auto/gui/text/qtextdocumentlayout/BLACKLIST b/tests/auto/gui/text/qtextdocumentlayout/BLACKLIST index b13b2497d3..5c81e74aa0 100644 --- a/tests/auto/gui/text/qtextdocumentlayout/BLACKLIST +++ b/tests/auto/gui/text/qtextdocumentlayout/BLACKLIST @@ -1,2 +1,4 @@ [imageAtRightAlignedTab] -linux +rhel-6.6 +rhel-7.4 +rhel-7.6 diff --git a/tests/auto/gui/text/qtextmarkdownwriter/BLACKLIST b/tests/auto/gui/text/qtextmarkdownwriter/BLACKLIST index fc9e5a9efe..0ce46130ce 100644 --- a/tests/auto/gui/text/qtextmarkdownwriter/BLACKLIST +++ b/tests/auto/gui/text/qtextmarkdownwriter/BLACKLIST @@ -1,3 +1,2 @@ [rewriteDocument] -winrt # QTBUG-54623 - +winrt diff --git a/tests/auto/gui/text/qtexttable/qtexttable.pro b/tests/auto/gui/text/qtexttable/qtexttable.pro index 2faadfcb0d..73e94d5735 100644 --- a/tests/auto/gui/text/qtexttable/qtexttable.pro +++ b/tests/auto/gui/text/qtexttable/qtexttable.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qtexttable -QT += testlib +QT += testlib gui-private qtHaveModule(widgets): QT += widgets SOURCES += tst_qtexttable.cpp diff --git a/tests/auto/gui/text/qtexttable/tst_qtexttable.cpp b/tests/auto/gui/text/qtexttable/tst_qtexttable.cpp index 22f00c677d..f21b969aa7 100644 --- a/tests/auto/gui/text/qtexttable/tst_qtexttable.cpp +++ b/tests/auto/gui/text/qtexttable/tst_qtexttable.cpp @@ -44,6 +44,7 @@ #include <QPainter> #include <QPaintEngine> #endif +#include <private/qpagedpaintdevice_p.h> typedef QList<int> IntList; @@ -91,7 +92,7 @@ private slots: void QTBUG11282_insertBeforeMergedEnding(); #endif void QTBUG22011_insertBeforeRowSpan(); -#ifndef QT_NO_PRINTER +#if !defined(QT_NO_PRINTER) && defined(QT_BUILD_INTERNAL) void QTBUG31330_renderBackground(); #endif @@ -1025,7 +1026,7 @@ void tst_QTextTable::QTBUG22011_insertBeforeRowSpan() QCOMPARE(table->columns(), 6); } -#ifndef QT_NO_PRINTER +#if !defined(QT_NO_PRINTER) && defined(QT_BUILD_INTERNAL) namespace { class QTBUG31330_PaintDevice : public QPagedPaintDevice { @@ -1065,11 +1066,46 @@ public: {} }; + class QDummyPagedPaintDevicePrivate : public QPagedPaintDevicePrivate + { + bool setPageLayout(const QPageLayout &newPageLayout) override + { + m_pageLayout = newPageLayout; + return m_pageLayout.isEquivalentTo(newPageLayout); + } + + bool setPageSize(const QPageSize &pageSize) override + { + m_pageLayout.setPageSize(pageSize); + return m_pageLayout.pageSize().isEquivalentTo(pageSize); + } + + bool setPageOrientation(QPageLayout::Orientation orientation) override + { + m_pageLayout.setOrientation(orientation); + return m_pageLayout.orientation() == orientation; + } + + bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units) override + { + m_pageLayout.setUnits(units); + m_pageLayout.setMargins(margins); + return m_pageLayout.margins() == margins && m_pageLayout.units() == units; + } + + QPageLayout pageLayout() const override + { + return m_pageLayout; + } + + QPageLayout m_pageLayout; + }; + int pages; QPaintEngine* engine; QTBUG31330_PaintDevice(QPaintEngine* engine) - : pages(1), engine(engine) + : QPagedPaintDevice(new QDummyPagedPaintDevicePrivate), pages(1), engine(engine) { QPageLayout layout = pageLayout(); layout.setUnits(QPageLayout::Point); diff --git a/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp b/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp index add23d46cf..4d95345de9 100644 --- a/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp +++ b/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp @@ -39,7 +39,9 @@ class tst_qdesktopservices : public QObject private slots: void openUrl(); void handlers(); +#if QT_DEPRECATED_SINCE(5, 0) void testDataLocation(); +#endif }; void tst_qdesktopservices::openUrl() @@ -89,6 +91,7 @@ void tst_qdesktopservices::handlers() #define Q_XDG_PLATFORM #endif +#if QT_DEPRECATED_SINCE(5, 0) void tst_qdesktopservices::testDataLocation() { // This is the one point where QDesktopServices and QStandardPaths differ. @@ -115,6 +118,7 @@ void tst_qdesktopservices::testDataLocation() #endif } } +#endif QTEST_MAIN(tst_qdesktopservices) |