diff options
Diffstat (limited to 'tests/auto/gui/painting')
44 files changed, 866 insertions, 104 deletions
diff --git a/tests/auto/gui/painting/CMakeLists.txt b/tests/auto/gui/painting/CMakeLists.txt index 2c23cfab07..b49a80b180 100644 --- a/tests/auto/gui/painting/CMakeLists.txt +++ b/tests/auto/gui/painting/CMakeLists.txt @@ -10,7 +10,9 @@ add_subdirectory(qpagelayout) add_subdirectory(qpageranges) add_subdirectory(qpagesize) add_subdirectory(qpainter) -add_subdirectory(qpdfwriter) +if (QT_FEATURE_pdf) + add_subdirectory(qpdfwriter) +endif() add_subdirectory(qpen) add_subdirectory(qpaintengine) add_subdirectory(qtransform) diff --git a/tests/auto/gui/painting/qbrush/CMakeLists.txt b/tests/auto/gui/painting/qbrush/CMakeLists.txt index cbb4e07134..313bce20a4 100644 --- a/tests/auto/gui/painting/qbrush/CMakeLists.txt +++ b/tests/auto/gui/painting/qbrush/CMakeLists.txt @@ -5,6 +5,12 @@ ## tst_qbrush Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qbrush LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qbrush SOURCES tst_qbrush.cpp diff --git a/tests/auto/gui/painting/qbrush/tst_qbrush.cpp b/tests/auto/gui/painting/qbrush/tst_qbrush.cpp index 64513b89c6..678c8d9b32 100644 --- a/tests/auto/gui/painting/qbrush/tst_qbrush.cpp +++ b/tests/auto/gui/painting/qbrush/tst_qbrush.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> diff --git a/tests/auto/gui/painting/qcolor/CMakeLists.txt b/tests/auto/gui/painting/qcolor/CMakeLists.txt index 2ca7bbead5..52e551855c 100644 --- a/tests/auto/gui/painting/qcolor/CMakeLists.txt +++ b/tests/auto/gui/painting/qcolor/CMakeLists.txt @@ -5,6 +5,12 @@ ## tst_qcolor Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qcolor LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qcolor SOURCES tst_qcolor.cpp diff --git a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp index 60a63fadcb..f592db5544 100644 --- a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp +++ b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2020 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> @@ -73,7 +73,7 @@ private slots: void toCmykNonDestructive(); void toHsl_data(); - void toHsl();; + void toHsl(); void toHslNonDestructive(); void convertTo(); diff --git a/tests/auto/gui/painting/qcolorspace/CMakeLists.txt b/tests/auto/gui/painting/qcolorspace/CMakeLists.txt index a6565b57e7..383c1bb890 100644 --- a/tests/auto/gui/painting/qcolorspace/CMakeLists.txt +++ b/tests/auto/gui/painting/qcolorspace/CMakeLists.txt @@ -5,6 +5,12 @@ ## tst_qcolorspace Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qcolorspace LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + # Collect test data file(GLOB_RECURSE test_data RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/tests/auto/gui/painting/qcolorspace/resources/CGATS001Compat-v2-micro.icc b/tests/auto/gui/painting/qcolorspace/resources/CGATS001Compat-v2-micro.icc Binary files differnew file mode 100644 index 0000000000..b5a73495bf --- /dev/null +++ b/tests/auto/gui/painting/qcolorspace/resources/CGATS001Compat-v2-micro.icc diff --git a/tests/auto/gui/painting/qcolorspace/resources/Rec. ITU-R BT.2100 PQ.icc b/tests/auto/gui/painting/qcolorspace/resources/Rec. ITU-R BT.2100 PQ.icc Binary files differnew file mode 100644 index 0000000000..e0ceaa12f8 --- /dev/null +++ b/tests/auto/gui/painting/qcolorspace/resources/Rec. ITU-R BT.2100 PQ.icc diff --git a/tests/auto/gui/painting/qcolorspace/resources/VideoHD.icc b/tests/auto/gui/painting/qcolorspace/resources/VideoHD.icc Binary files differnew file mode 100644 index 0000000000..b96eb68136 --- /dev/null +++ b/tests/auto/gui/painting/qcolorspace/resources/VideoHD.icc diff --git a/tests/auto/gui/painting/qcolorspace/resources/sGrey-v4.icc b/tests/auto/gui/painting/qcolorspace/resources/sGrey-v4.icc Binary files differnew file mode 100644 index 0000000000..2187b6786a --- /dev/null +++ b/tests/auto/gui/painting/qcolorspace/resources/sGrey-v4.icc diff --git a/tests/auto/gui/painting/qcolorspace/resources/sRGB_ICC_v4_Appearance.icc b/tests/auto/gui/painting/qcolorspace/resources/sRGB_ICC_v4_Appearance.icc Binary files differnew file mode 100644 index 0000000000..30da950907 --- /dev/null +++ b/tests/auto/gui/painting/qcolorspace/resources/sRGB_ICC_v4_Appearance.icc diff --git a/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp b/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp index 08f45a2552..6c103ce4f3 100644 --- a/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp +++ b/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> @@ -42,7 +42,12 @@ private slots: void imageConversionOverLargerGamut(); void imageConversionOverLargerGamut2_data(); void imageConversionOverLargerGamut2(); - + void imageConversionOverAnyGamutFP_data(); + void imageConversionOverAnyGamutFP(); + void imageConversionOverAnyGamutFP2_data(); + void imageConversionOverAnyGamutFP2(); + void imageConversionOverNonThreeComponentMatrix_data(); + void imageConversionOverNonThreeComponentMatrix(); void loadImage(); void primaries(); @@ -61,6 +66,13 @@ private slots: void transferFunctionTable(); void description(); + void whitePoint_data(); + void whitePoint(); + void setWhitePoint(); + void grayColorSpace(); + void grayColorSpaceEffectivelySRgb(); + + void scaleAlphaValue(); }; tst_QColorSpace::tst_QColorSpace() @@ -111,6 +123,15 @@ void tst_QColorSpace::namedColorSpaces_data() QTest::newRow("ProPhoto RGB") << QColorSpace::ProPhotoRgb << true << QColorSpace::Primaries::ProPhotoRgb << QColorSpace::TransferFunction::ProPhotoRgb; + QTest::newRow("BT.2020") << QColorSpace::Bt2020 << true + << QColorSpace::Primaries::Bt2020 + << QColorSpace::TransferFunction::Bt2020; + QTest::newRow("BT.2100 PQ") << QColorSpace::Bt2100Pq << true + << QColorSpace::Primaries::Bt2020 + << QColorSpace::TransferFunction::St2084; + QTest::newRow("BT.2100 HLG") << QColorSpace::Bt2100Hlg << true + << QColorSpace::Primaries::Bt2020 + << QColorSpace::TransferFunction::Hlg; QTest::newRow("0") << QColorSpace::NamedColorSpace(0) << false << QColorSpace::Primaries::Custom @@ -178,15 +199,46 @@ void tst_QColorSpace::fromIccProfile_data() QTest::addColumn<QString>("testProfile"); QTest::addColumn<QColorSpace::NamedColorSpace>("namedColorSpace"); QTest::addColumn<QColorSpace::TransferFunction>("transferFunction"); + QTest::addColumn<QColorSpace::TransformModel>("transformModel"); + QTest::addColumn<QColorSpace::ColorModel>("colorModel"); QTest::addColumn<QString>("description"); QString prefix = QFINDTESTDATA("resources/"); // Read the official sRGB ICCv2 profile: QTest::newRow("sRGB2014 (ICCv2)") << prefix + "sRGB2014.icc" << QColorSpace::SRgb - << QColorSpace::TransferFunction::SRgb << QString("sRGB2014"); + << QColorSpace::TransferFunction::SRgb + << QColorSpace::TransformModel::ThreeComponentMatrix + << QColorSpace::ColorModel::Rgb << QString("sRGB2014"); // My monitor's profile: QTest::newRow("HP ZR30w (ICCv4)") << prefix + "HP_ZR30w.icc" << QColorSpace::NamedColorSpace(0) - << QColorSpace::TransferFunction::Gamma << QString("HP Z30i"); + << QColorSpace::TransferFunction::Gamma + << QColorSpace::TransformModel::ThreeComponentMatrix + << QColorSpace::ColorModel::Rgb << QString("HP Z30i"); + // A profile to HD TV + QTest::newRow("VideoHD") << prefix + "VideoHD.icc" << QColorSpace::NamedColorSpace(0) + << QColorSpace::TransferFunction::Custom + << QColorSpace::TransformModel::ElementListProcessing + << QColorSpace::ColorModel::Rgb << QString("HDTV (Rec. 709)"); + // sRGB on PCSLab format + QTest::newRow("sRGB ICCv4 Appearance") << prefix + "sRGB_ICC_v4_Appearance.icc" << QColorSpace::NamedColorSpace(0) + << QColorSpace::TransferFunction::Custom + << QColorSpace::TransformModel::ElementListProcessing + << QColorSpace::ColorModel::Rgb << QString("sRGB_ICC_v4_Appearance.icc"); + // Grayscale profile + QTest::newRow("sGrey-v4") << prefix + "sGrey-v4.icc" << QColorSpace::NamedColorSpace(0) + << QColorSpace::TransferFunction::SRgb + << QColorSpace::TransformModel::ThreeComponentMatrix + << QColorSpace::ColorModel::Gray << QString("sGry"); + // CMYK profile + QTest::newRow("CGATS compat") << prefix + "CGATS001Compat-v2-micro.icc" << QColorSpace::NamedColorSpace(0) + << QColorSpace::TransferFunction::Custom + << QColorSpace::TransformModel::ElementListProcessing + << QColorSpace::ColorModel::Cmyk << QString("uCMY"); + // BT.2100 PQ profile + QTest::newRow("BT.2100 PQ") << prefix + "Rec. ITU-R BT.2100 PQ.icc" << QColorSpace::Bt2100Pq + << QColorSpace::TransferFunction::St2084 + << QColorSpace::TransformModel::ThreeComponentMatrix + << QColorSpace::ColorModel::Rgb << QString("Rec. ITU-R BT.2100 PQ"); } void tst_QColorSpace::fromIccProfile() @@ -194,10 +246,12 @@ void tst_QColorSpace::fromIccProfile() QFETCH(QString, testProfile); QFETCH(QColorSpace::NamedColorSpace, namedColorSpace); QFETCH(QColorSpace::TransferFunction, transferFunction); + QFETCH(QColorSpace::TransformModel, transformModel); + QFETCH(QColorSpace::ColorModel, colorModel); QFETCH(QString, description); QFile file(testProfile); - file.open(QIODevice::ReadOnly); + QVERIFY(file.open(QIODevice::ReadOnly)); QByteArray iccProfile = file.readAll(); QColorSpace fileColorSpace = QColorSpace::fromIccProfile(iccProfile); QVERIFY(fileColorSpace.isValid()); @@ -206,7 +260,23 @@ void tst_QColorSpace::fromIccProfile() QCOMPARE(fileColorSpace, namedColorSpace); QCOMPARE(fileColorSpace.transferFunction(), transferFunction); + QCOMPARE(fileColorSpace.transformModel(), transformModel); + QCOMPARE(fileColorSpace.colorModel(), colorModel); QCOMPARE(fileColorSpace.description(), description); + + QByteArray iccProfile2 = fileColorSpace.iccProfile(); + QCOMPARE(iccProfile, iccProfile2); + QColorSpace fileColorSpace2 = QColorSpace::fromIccProfile(iccProfile2); + QCOMPARE(fileColorSpace2, fileColorSpace); + + // Change description to force generation of new icc profile data. + fileColorSpace2.setDescription("Hello my QTest description"); + iccProfile2 = fileColorSpace2.iccProfile(); + QCOMPARE_NE(iccProfile, iccProfile2); + fileColorSpace2 = QColorSpace::fromIccProfile(iccProfile2); + QVERIFY(fileColorSpace2.isValid()); + // Note, we do not currently compare description in color space equality + QCOMPARE(fileColorSpace2, fileColorSpace); } void tst_QColorSpace::imageConversion_data() @@ -217,9 +287,10 @@ void tst_QColorSpace::imageConversion_data() QTest::newRow("sRGB -> Display-P3") << QColorSpace::SRgb << QColorSpace::DisplayP3 << 0; QTest::newRow("sRGB -> Adobe RGB") << QColorSpace::SRgb << QColorSpace::AdobeRgb << 2; - QTest::newRow("Display-P3 -> sRGB") << QColorSpace::DisplayP3 << QColorSpace::SRgb << 0; QTest::newRow("Adobe RGB -> sRGB") << QColorSpace::AdobeRgb << QColorSpace::SRgb << 2; + QTest::newRow("Adobe RGB -> Display-P3") << QColorSpace::AdobeRgb << QColorSpace::DisplayP3 << 4; QTest::newRow("Display-P3 -> Adobe RGB") << QColorSpace::DisplayP3 << QColorSpace::AdobeRgb << 2; + QTest::newRow("Display-P3 -> sRGB") << QColorSpace::DisplayP3 << QColorSpace::SRgb << 0; QTest::newRow("sRGB -> sRGB Linear") << QColorSpace::SRgb << QColorSpace::SRgbLinear << 0; QTest::newRow("sRGB Linear -> sRGB") << QColorSpace::SRgbLinear << QColorSpace::SRgb << 0; } @@ -246,9 +317,9 @@ void tst_QColorSpace::imageConversion() int lastBlue = 0; for (int i = 0; i < 256; ++i) { QRgb p = testImage.pixel(i, 0); - QVERIFY(qRed(p) >= lastRed); - QVERIFY(qGreen(p) >= lastGreen); - QVERIFY(qBlue(p) >= lastBlue); + QCOMPARE_GE(qRed(p), lastRed); + QCOMPARE_GE(qGreen(p), lastGreen); + QCOMPARE_GE(qBlue(p), lastBlue); lastRed = qRed(p); lastGreen = qGreen(p); lastBlue = qBlue(p); @@ -261,11 +332,12 @@ void tst_QColorSpace::imageConversion() QCOMPARE(testImage.colorSpace(), QColorSpace(fromColorSpace)); for (int i = 0; i < 256; ++i) { QRgb p = testImage.pixel(i, 0); - QVERIFY(qAbs(qRed(p) - qGreen(p)) <= tolerance); - QVERIFY(qAbs(qRed(p) - qBlue(p)) <= tolerance); - QVERIFY((lastRed - qRed(p)) <= (tolerance / 2)); - QVERIFY((lastGreen - qGreen(p)) <= (tolerance / 2)); - QVERIFY((lastBlue - qBlue(p)) <= (tolerance / 2)); + QCOMPARE_LE(qAbs(qRed(p) - qBlue(p)), tolerance); + QCOMPARE_LE(qAbs(qRed(p) - qGreen(p)), tolerance); + QCOMPARE_LE(qAbs(qGreen(p) - qBlue(p)), tolerance); + QCOMPARE_LE(lastRed - qRed(p), tolerance / 2); + QCOMPARE_LE(lastBlue - qBlue(p), tolerance / 2); + QCOMPARE_LE(lastGreen - qGreen(p), tolerance / 2); lastRed = qRed(p); lastGreen = qGreen(p); lastBlue = qBlue(p); @@ -306,9 +378,9 @@ void tst_QColorSpace::imageConversion64() int lastBlue = 0; for (int i = 0; i < 256; ++i) { QRgb p = testImage.pixel(i, 0); - QVERIFY(qRed(p) >= lastRed); - QVERIFY(qGreen(p) >= lastGreen); - QVERIFY(qBlue(p) >= lastBlue); + QCOMPARE_GE(qRed(p), lastRed); + QCOMPARE_GE(qGreen(p), lastGreen); + QCOMPARE_GE(qBlue(p), lastBlue); lastRed = qRed(p); lastGreen = qGreen(p); lastBlue = qBlue(p); @@ -323,9 +395,9 @@ void tst_QColorSpace::imageConversion64() QRgb p = testImage.pixel(i, 0); QCOMPARE(qRed(p), qGreen(p)); QCOMPARE(qRed(p), qBlue(p)); - QVERIFY((lastRed - qRed(p)) <= 0); - QVERIFY((lastGreen - qGreen(p)) <= 0); - QVERIFY((lastBlue - qBlue(p)) <= 0); + QCOMPARE_GE(qRed(p), lastRed); + QCOMPARE_GE(qGreen(p), lastGreen); + QCOMPARE_GE(qBlue(p), lastBlue); lastRed = qRed(p); lastGreen = qGreen(p); lastBlue = qBlue(p); @@ -349,8 +421,10 @@ void tst_QColorSpace::imageConversion64PM() for (int j = 0; j < 16; ++j) { int a = j * 15; - for (int i = 0; i < 256; ++i) - testImage.setPixel(i, j, qPremultiply(qRgba(i, i, i, a))); + for (int i = 0; i < 256; ++i) { + QRgba64 color = QRgba64::fromRgba(i, i, i, a); + testImage.setPixelColor(i, j, QColor::fromRgba64(color)); + } } testImage.setColorSpace(fromColorSpace); @@ -366,17 +440,17 @@ void tst_QColorSpace::imageConversion64PM() const int expectedAlpha = j * 15; for (int i = 0; i < 256; ++i) { QRgb p = testImage.pixel(i, j); - QVERIFY(qRed(p) >= lastRed); - QVERIFY(qGreen(p) >= lastGreen); - QVERIFY(qBlue(p) >= lastBlue); + QCOMPARE_GE(qRed(p), lastRed); + QCOMPARE_GE(qGreen(p), lastGreen); + QCOMPARE_GE(qBlue(p), lastBlue); QCOMPARE(qAlpha(p), expectedAlpha); lastRed = qRed(p); lastGreen = qGreen(p); lastBlue = qBlue(p); } - QVERIFY(lastRed <= expectedAlpha); - QVERIFY(lastGreen <= expectedAlpha); - QVERIFY(lastBlue <= expectedAlpha); + QCOMPARE_LE(lastRed, expectedAlpha); + QCOMPARE_LE(lastGreen, expectedAlpha); + QCOMPARE_LE(lastBlue, expectedAlpha); lastRed = 0; lastGreen = 0; lastBlue = 0; @@ -389,15 +463,15 @@ void tst_QColorSpace::imageConversion64PM() for (int i = 0; i < 256; ++i) { QRgb expected = qPremultiply(qRgba(i, i, i, expectedAlpha)); QRgb p = testImage.pixel(i, j); - QCOMPARE(qRed(p), qGreen(p)); - QCOMPARE(qRed(p), qBlue(p)); + QCOMPARE_LE(qAbs(qRed(p) - qGreen(p)), 1); + QCOMPARE_LE(qAbs(qRed(p) - qBlue(p)), 1); QCOMPARE(qAlpha(p), expectedAlpha); - QVERIFY((lastRed - qRed(p)) <= 0); - QVERIFY((lastGreen - qGreen(p)) <= 0); - QVERIFY((lastBlue - qBlue(p)) <= 0); - QVERIFY(qAbs(qRed(p) - qRed(expected)) <= 1); - QVERIFY(qAbs(qGreen(p) - qGreen(expected)) <= 1); - QVERIFY(qAbs(qBlue(p) - qBlue(expected)) <= 1); + QCOMPARE_GE(qRed(p), lastRed); + QCOMPARE_GE(qGreen(p), lastGreen); + QCOMPARE_GE(qBlue(p), lastBlue); + QCOMPARE_LE(qAbs(qRed(p) - qRed(expected)), 1); + QCOMPARE_LE(qAbs(qGreen(p) - qGreen(expected)), 1); + QCOMPARE_LE(qAbs(qBlue(p) - qBlue(expected)), 1); lastRed = qRed(p); lastGreen = qGreen(p); lastBlue = qBlue(p); @@ -437,14 +511,14 @@ void tst_QColorSpace::imageConversionOverLargerGamut() testImage.setColorSpace(csfrom); for (int y = 0; y < 256; ++y) for (int x = 0; x < 256; ++x) - testImage.setPixel(x, y, qRgb(x, y, 0)); + testImage.setPixel(x, y, qRgb(x, y, qAbs(x - y))); QImage resultImage = testImage.convertedToColorSpace(csto); for (int y = 0; y < 256; ++y) { int lastRed = 0; for (int x = 0; x < 256; ++x) { QRgb p = resultImage.pixel(x, y); - QVERIFY(qRed(p) >= lastRed); + QCOMPARE_GE(qRed(p), lastRed); lastRed = qRed(p); } } @@ -452,7 +526,7 @@ void tst_QColorSpace::imageConversionOverLargerGamut() int lastGreen = 0; for (int y = 0; y < 256; ++y) { QRgb p = resultImage.pixel(x, y); - QVERIFY(qGreen(p) >= lastGreen); + QCOMPARE_GE(qGreen(p), lastGreen); lastGreen = qGreen(p); } } @@ -515,6 +589,138 @@ void tst_QColorSpace::imageConversionOverLargerGamut2() QVERIFY(resultImage.pixelColor(0, 255).greenF() > 1.0f); } +void tst_QColorSpace::imageConversionOverAnyGamutFP_data() +{ + QTest::addColumn<QColorSpace::NamedColorSpace>("fromColorSpace"); + QTest::addColumn<QColorSpace::NamedColorSpace>("toColorSpace"); + + QTest::newRow("sRGB -> Display-P3") << QColorSpace::SRgb << QColorSpace::DisplayP3; + QTest::newRow("sRGB -> Adobe RGB") << QColorSpace::SRgb << QColorSpace::AdobeRgb; + QTest::newRow("sRGB -> ProPhoto RGB") << QColorSpace::SRgb << QColorSpace::ProPhotoRgb; + QTest::newRow("Adobe RGB -> sRGB") << QColorSpace::AdobeRgb << QColorSpace::SRgb; + QTest::newRow("Adobe RGB -> Display-P3") << QColorSpace::AdobeRgb << QColorSpace::DisplayP3; + QTest::newRow("Adobe RGB -> ProPhoto RGB") << QColorSpace::AdobeRgb << QColorSpace::ProPhotoRgb; + QTest::newRow("Display-P3 -> sRGB") << QColorSpace::DisplayP3 << QColorSpace::SRgb; + QTest::newRow("Display-P3 -> Adobe RGB") << QColorSpace::DisplayP3 << QColorSpace::AdobeRgb; + QTest::newRow("Display-P3 -> ProPhoto RGB") << QColorSpace::DisplayP3 << QColorSpace::ProPhotoRgb; +} + +void tst_QColorSpace::imageConversionOverAnyGamutFP() +{ + QFETCH(QColorSpace::NamedColorSpace, fromColorSpace); + QFETCH(QColorSpace::NamedColorSpace, toColorSpace); + + QColorSpace csfrom(fromColorSpace); + QColorSpace csto(toColorSpace); + csfrom.setTransferFunction(QColorSpace::TransferFunction::Linear); + csto.setTransferFunction(QColorSpace::TransferFunction::Linear); + + QImage testImage(256, 256, QImage::Format_RGBX32FPx4); + testImage.setColorSpace(csfrom); + for (int y = 0; y < 256; ++y) + for (int x = 0; x < 256; ++x) + testImage.setPixel(x, y, qRgb(x, y, 0)); + + QImage resultImage = testImage.convertedToColorSpace(csto); + resultImage.convertToColorSpace(csfrom); + + for (int y = 0; y < 256; ++y) { + for (int x = 0; x < 256; ++x) { + QCOMPARE(resultImage.pixel(x, y), testImage.pixel(x, y)); + } + } +} + +void tst_QColorSpace::imageConversionOverAnyGamutFP2_data() +{ + imageConversionOverAnyGamutFP_data(); +} + +void tst_QColorSpace::imageConversionOverAnyGamutFP2() +{ + QFETCH(QColorSpace::NamedColorSpace, fromColorSpace); + QFETCH(QColorSpace::NamedColorSpace, toColorSpace); + + // Same as imageConversionOverAnyGamutFP but using format switching transform + QColorSpace csfrom(fromColorSpace); + QColorSpace csto(toColorSpace); + csfrom.setTransferFunction(QColorSpace::TransferFunction::Linear); + csto.setTransferFunction(QColorSpace::TransferFunction::Linear); + + QImage testImage(256, 256, QImage::Format_RGB32); + testImage.setColorSpace(csfrom); + for (int y = 0; y < 256; ++y) + for (int x = 0; x < 256; ++x) + testImage.setPixel(x, y, qRgb(x, y, 0)); + + QImage resultImage = testImage.convertedToColorSpace(csto, QImage::Format_RGBX32FPx4); + resultImage.convertToColorSpace(csfrom, QImage::Format_RGB32); + + for (int y = 0; y < 256; ++y) { + for (int x = 0; x < 256; ++x) { + QCOMPARE(resultImage.pixel(x, y), testImage.pixel(x, y)); + } + } +} + +void tst_QColorSpace::imageConversionOverNonThreeComponentMatrix_data() +{ + QTest::addColumn<QColorSpace>("fromColorSpace"); + QTest::addColumn<QColorSpace>("toColorSpace"); + + QString prefix = QFINDTESTDATA("resources/"); + QFile file1(prefix + "VideoHD.icc"); + QFile file2(prefix + "sRGB_ICC_v4_Appearance.icc"); + QVERIFY(file1.open(QFile::ReadOnly)); + QVERIFY(file2.open(QFile::ReadOnly)); + QByteArray iccProfile1 = file1.readAll(); + QByteArray iccProfile2 = file2.readAll(); + QColorSpace hdtvColorSpace = QColorSpace::fromIccProfile(iccProfile1); + QColorSpace srgbPcsColorSpace = QColorSpace::fromIccProfile(iccProfile2); + + QTest::newRow("sRGB PCSLab -> sRGB") << srgbPcsColorSpace << QColorSpace(QColorSpace::SRgb); + QTest::newRow("sRGB -> sRGB PCSLab") << QColorSpace(QColorSpace::SRgb) << srgbPcsColorSpace; + QTest::newRow("HDTV -> sRGB") << hdtvColorSpace << QColorSpace(QColorSpace::SRgb); + QTest::newRow("sRGB -> HDTV") << QColorSpace(QColorSpace::SRgb) << hdtvColorSpace; + QTest::newRow("sRGB PCSLab -> HDTV") << srgbPcsColorSpace << hdtvColorSpace; + QTest::newRow("HDTV -> sRGB PCSLab") << hdtvColorSpace << srgbPcsColorSpace; +} + +void tst_QColorSpace::imageConversionOverNonThreeComponentMatrix() +{ + QFETCH(QColorSpace, fromColorSpace); + QFETCH(QColorSpace, toColorSpace); + QVERIFY(fromColorSpace.isValid()); + QVERIFY(toColorSpace.isValidTarget()); + + QVERIFY(!fromColorSpace.transformationToColorSpace(toColorSpace).isIdentity()); + + QImage testImage(256, 256, QImage::Format_RGBX64); + testImage.setColorSpace(fromColorSpace); + for (int y = 0; y < 256; ++y) + for (int x = 0; x < 256; ++x) + testImage.setPixel(x, y, qRgb(x, y, 0)); + + QImage resultImage = testImage.convertedToColorSpace(toColorSpace); + QCOMPARE(resultImage.size(), testImage.size()); + for (int y = 0; y < 256; ++y) { + int lastRed = 0; + for (int x = 0; x < 256; ++x) { + QRgb p = resultImage.pixel(x, y); + QVERIFY(qRed(p) >= lastRed); + lastRed = qRed(p); + } + } + for (int x = 0; x < 256; ++x) { + int lastGreen = 0; + for (int y = 0; y < 256; ++y) { + QRgb p = resultImage.pixel(x, y); + QVERIFY(qGreen(p) >= lastGreen); + lastGreen = qGreen(p); + } + } +} + void tst_QColorSpace::loadImage() { QString prefix = QFINDTESTDATA("resources/"); @@ -692,10 +898,28 @@ void tst_QColorSpace::changePrimaries() cs.setPrimaries(QColorSpace::Primaries::DciP3D65); QVERIFY(cs.isValid()); QCOMPARE(cs, QColorSpace(QColorSpace::DisplayP3)); + QCOMPARE(cs.transformModel(), QColorSpace::TransformModel::ThreeComponentMatrix); 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)); + + + QFile iccFile(QFINDTESTDATA("resources/") + "VideoHD.icc"); + QVERIFY(iccFile.open(QFile::ReadOnly)); + QByteArray iccData = iccFile.readAll(); + QColorSpace hdtvColorSpace = QColorSpace::fromIccProfile(iccData); + QVERIFY(hdtvColorSpace.isValid()); + QCOMPARE(hdtvColorSpace.transformModel(), QColorSpace::TransformModel::ElementListProcessing); + QCOMPARE(hdtvColorSpace.primaries(), QColorSpace::Primaries::Custom); + QCOMPARE(hdtvColorSpace.transferFunction(), QColorSpace::TransferFunction::Custom); + // Unsets both primaries and transferfunction because they were inseparable in element list processing + hdtvColorSpace.setPrimaries(QColorSpace::Primaries::SRgb); + QVERIFY(!hdtvColorSpace.isValid()); + hdtvColorSpace.setTransferFunction(QColorSpace::TransferFunction::SRgb); + QVERIFY(hdtvColorSpace.isValid()); + QCOMPARE(hdtvColorSpace.transformModel(), QColorSpace::TransformModel::ThreeComponentMatrix); + QCOMPARE(hdtvColorSpace, QColorSpace(QColorSpace::SRgb)); } void tst_QColorSpace::transferFunctionTable() @@ -744,5 +968,101 @@ void tst_QColorSpace::description() QCOMPARE(srgb.description(), QLatin1String("Linear sRGB")); // Set to empty returns default behavior } +void tst_QColorSpace::whitePoint_data() +{ + QTest::addColumn<QColorSpace::NamedColorSpace>("namedColorSpace"); + QTest::addColumn<QPointF>("whitePoint"); + + QTest::newRow("sRGB") << QColorSpace::SRgb << QColorVector::D65Chromaticity(); + QTest::newRow("Adobe RGB") << QColorSpace::AdobeRgb << QColorVector::D65Chromaticity(); + QTest::newRow("Display-P3") << QColorSpace::DisplayP3 << QColorVector::D65Chromaticity(); + QTest::newRow("ProPhoto RGB") << QColorSpace::ProPhotoRgb << QColorVector::D50Chromaticity(); +} + +void tst_QColorSpace::whitePoint() +{ + QFETCH(QColorSpace::NamedColorSpace, namedColorSpace); + QFETCH(QPointF, whitePoint); + + QColorSpace colorSpace(namedColorSpace); + QPointF wpt = colorSpace.whitePoint(); + QCOMPARE_LE(qAbs(wpt.x() - whitePoint.x()), 0.0000001); + QCOMPARE_LE(qAbs(wpt.y() - whitePoint.y()), 0.0000001); +} + +void tst_QColorSpace::setWhitePoint() +{ + QColorSpace colorSpace(QColorSpace::SRgb); + colorSpace.setWhitePoint(QPointF(0.33, 0.33)); + QCOMPARE_NE(colorSpace, QColorSpace(QColorSpace::SRgb)); + colorSpace.setWhitePoint(QColorVector::D65Chromaticity()); + // Check our matrix manipulations returned us to where we came from + QCOMPARE(colorSpace, QColorSpace(QColorSpace::SRgb)); +} + +void tst_QColorSpace::grayColorSpace() +{ + QColorSpace spc; + QCOMPARE(spc.colorModel(), QColorSpace::ColorModel::Undefined); + QVERIFY(!spc.isValid()); + spc.setWhitePoint(QColorVector::D65Chromaticity()); + spc.setTransferFunction(QColorSpace::TransferFunction::SRgb); + QVERIFY(spc.isValid()); + QCOMPARE(spc.colorModel(), QColorSpace::ColorModel::Gray); + + QColorSpace spc2(QColorVector::D65Chromaticity(), QColorSpace::TransferFunction::SRgb); + QVERIFY(spc2.isValid()); + QCOMPARE(spc2.colorModel(), QColorSpace::ColorModel::Gray); + QCOMPARE(spc, spc2); + + QImage rgbImage(1, 8, QImage::Format_RGB32); + QImage grayImage(1, 255, QImage::Format_Grayscale8); + // RGB images can not have gray color space + rgbImage.setColorSpace(spc2); + grayImage.setColorSpace(spc2); + QCOMPARE_NE(rgbImage.colorSpace(), spc2); + QCOMPARE(grayImage.colorSpace(), spc2); + // But gray images can have RGB color space + rgbImage.setColorSpace(QColorSpace::SRgb); + grayImage.setColorSpace(QColorSpace::SRgb); + QCOMPARE(rgbImage.colorSpace(), QColorSpace(QColorSpace::SRgb)); + QCOMPARE(grayImage.colorSpace(), QColorSpace(QColorSpace::SRgb)); + + // While we can not set a grayscale color space on rgb image, we can convert to one + QImage grayImage2 = rgbImage.convertedToColorSpace(spc2); + QCOMPARE(grayImage2.colorSpace(), spc2); + QCOMPARE(grayImage2.format(), QImage::Format_Grayscale8); +} + +void tst_QColorSpace::grayColorSpaceEffectivelySRgb() +{ + // Test grayscale colorspace conversion by making a gray color space that should act like sRGB on gray values. + QColorSpace sRgb(QColorSpace::SRgb); + QColorSpace sRgbGray(QColorVector::D65Chromaticity(), QColorSpace::TransferFunction::SRgb); + + QImage grayImage1(256, 1, QImage::Format_Grayscale8); + QImage grayImage2(256, 1, QImage::Format_Grayscale8); + for (int i = 0; i < 256; ++i) { + grayImage1.bits()[i] = i; + grayImage2.bits()[i] = i; + } + grayImage1.setColorSpace(sRgb); + grayImage2.setColorSpace(sRgbGray); + + QImage rgbImage1 = grayImage1.convertedTo(QImage::Format_RGB32); + QImage rgbImage2 = grayImage2.convertedToColorSpace(sRgb, QImage::Format_RGB32); + + QCOMPARE(rgbImage1, rgbImage2); +} + +void tst_QColorSpace::scaleAlphaValue() +{ + QImage image(1, 1, QImage::Format_ARGB32); + image.setPixel(0, 0, qRgba(255, 255, 255, 125)); + image.setColorSpace(QColorSpace::SRgb); + image.convertToColorSpace(QColorSpace::SRgbLinear, QImage::Format_RGBA64); + QCOMPARE(reinterpret_cast<const QRgba64 *>(image.constBits())->alpha(), 257 * 125); +} + QTEST_MAIN(tst_QColorSpace) #include "tst_qcolorspace.moc" diff --git a/tests/auto/gui/painting/qcolortransform/CMakeLists.txt b/tests/auto/gui/painting/qcolortransform/CMakeLists.txt index 061902f175..4aa4a8bc4a 100644 --- a/tests/auto/gui/painting/qcolortransform/CMakeLists.txt +++ b/tests/auto/gui/painting/qcolortransform/CMakeLists.txt @@ -5,6 +5,12 @@ ## tst_qcolortransform Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qcolortransform LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qcolortransform SOURCES tst_qcolortransform.cpp diff --git a/tests/auto/gui/painting/qcolortransform/tst_qcolortransform.cpp b/tests/auto/gui/painting/qcolortransform/tst_qcolortransform.cpp index 06e8db3e71..7a976b5f5e 100644 --- a/tests/auto/gui/painting/qcolortransform/tst_qcolortransform.cpp +++ b/tests/auto/gui/painting/qcolortransform/tst_qcolortransform.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2022 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> @@ -182,21 +182,21 @@ void tst_QColorTransform::mapRGBAFP16x4() else QVERIFY(result != testColor); - testColor = QRgbaFloat16{0.0f, 0.0f, 0.0f, 1.0f}; + testColor = QRgbaFloat16{qfloat16(0.0f), qfloat16(0.0f), qfloat16(0.0f), qfloat16(1.0f)}; result = transform.map(testColor); QCOMPARE(result, testColor); - testColor = QRgbaFloat16{1.0f, 1.0f, 1.0f, 1.0f}; + testColor = QRgbaFloat16{qfloat16(1.0f), qfloat16(1.0f), qfloat16(1.0f), qfloat16(1.0f)}; result = transform.map(testColor); QCOMPARE(result, testColor); - testColor = QRgbaFloat16{1.0f, 1.0f, 0.0f, 1.0f}; + testColor = QRgbaFloat16{qfloat16(1.0f), qfloat16(1.0f), qfloat16(1.0f), qfloat16(1.0f)}; result = transform.map(testColor); QCOMPARE(result.alpha(), 1.0f); if (sharesRed) QCOMPARE(result.red(), 1.0f); - testColor = QRgbaFloat16{0.0f, 1.0f, 1.0f, 1.0f}; + testColor = QRgbaFloat16{qfloat16(0.0f), qfloat16(1.0f), qfloat16(1.0f), qfloat16(1.0f)}; result = transform.map(testColor); // QRgbaFloat16 might overflow blue if we convert to a smaller gamut: QCOMPARE(result.blue16(), 65535); diff --git a/tests/auto/gui/painting/qpagelayout/CMakeLists.txt b/tests/auto/gui/painting/qpagelayout/CMakeLists.txt index 129b9a67b8..b19568592b 100644 --- a/tests/auto/gui/painting/qpagelayout/CMakeLists.txt +++ b/tests/auto/gui/painting/qpagelayout/CMakeLists.txt @@ -5,6 +5,12 @@ ## tst_qpagelayout Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qpagelayout LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qpagelayout SOURCES tst_qpagelayout.cpp diff --git a/tests/auto/gui/painting/qpagelayout/tst_qpagelayout.cpp b/tests/auto/gui/painting/qpagelayout/tst_qpagelayout.cpp index 123663a0e3..4490877e87 100644 --- a/tests/auto/gui/painting/qpagelayout/tst_qpagelayout.cpp +++ b/tests/auto/gui/painting/qpagelayout/tst_qpagelayout.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2014 John Layt <jlayt@kde.org> -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> #include <QtGui/qpagelayout.h> @@ -12,6 +12,9 @@ private slots: void invalid(); void basics(); void setGetMargins(); + void setGetClampedMargins(); + void setUnits_data(); + void setUnits(); }; void tst_QPageLayout::invalid() @@ -88,12 +91,14 @@ void tst_QPageLayout::basics() QCOMPARE(tenpoint.margins(QPageLayout::Millimeter), QMarginsF(3.53, 3.53, 3.53, 3.53)); QCOMPARE(tenpoint.marginsPoints(), QMargins(10, 10, 10, 10)); QCOMPARE(tenpoint.marginsPixels(72), QMargins(10, 10, 10, 10)); + QCOMPARE(tenpoint.marginsPixels(600), QMargins(83, 83, 83, 83)); QCOMPARE(tenpoint.minimumMargins(), QMarginsF(0, 0, 0, 0)); QCOMPARE(tenpoint.maximumMargins(), QMarginsF(595, 842, 595, 842)); QCOMPARE(tenpoint.fullRect(), QRectF(0, 0, 595, 842)); QCOMPARE(tenpoint.fullRect(QPageLayout::Millimeter), QRectF(0, 0, 210, 297)); QCOMPARE(tenpoint.fullRectPoints(), QRect(0, 0, 595, 842)); QCOMPARE(tenpoint.fullRectPixels(72), QRect(0, 0, 595, 842)); + QCOMPARE(tenpoint.fullRectPixels(600), QRect(0, 0, 4958, 7016)); QCOMPARE(tenpoint.paintRect(), QRectF(10, 10, 575, 822)); QCOMPARE(tenpoint.paintRect(QPageLayout::Millimeter), QRectF(3.53, 3.53, 202.94, 289.94)); QCOMPARE(tenpoint.paintRect(QPageLayout::Millimeter).x(), 3.53); @@ -106,6 +111,7 @@ void tst_QPageLayout::basics() QCOMPARE(tenpoint.paintRect(QPageLayout::Millimeter).bottom(), 293.47); QCOMPARE(tenpoint.paintRectPoints(), QRect(10, 10, 575, 822)); QCOMPARE(tenpoint.paintRectPixels(72), QRect(10, 10, 575, 822)); + QCOMPARE(tenpoint.paintRectPixels(600), QRect(83, 83, 4792, 6850)); // Change orientation tenpoint.setOrientation(QPageLayout::Landscape); @@ -117,10 +123,12 @@ void tst_QPageLayout::basics() QCOMPARE(tenpoint.fullRect(QPageLayout::Millimeter), QRectF(0, 0, 297, 210)); QCOMPARE(tenpoint.fullRectPoints(), QRect(0, 0, 842, 595)); QCOMPARE(tenpoint.fullRectPixels(72), QRect(0, 0, 842, 595)); + QCOMPARE(tenpoint.fullRectPixels(600), QRect(0, 0, 7016, 4958)); QCOMPARE(tenpoint.paintRect(), QRectF(10, 10, 822, 575)); QCOMPARE(tenpoint.paintRect(QPageLayout::Millimeter), QRectF(3.53, 3.53, 289.94, 202.94)); QCOMPARE(tenpoint.paintRectPoints(), QRect(10, 10, 822, 575)); QCOMPARE(tenpoint.paintRectPixels(72), QRect(10, 10, 822, 575)); + QCOMPARE(tenpoint.paintRectPixels(600), QRect(83, 83, 6850, 4792)); // Change mode QCOMPARE(tenpoint.mode(), QPageLayout::StandardMode); @@ -134,15 +142,82 @@ void tst_QPageLayout::basics() QCOMPARE(tenpoint.fullRect(QPageLayout::Millimeter), QRectF(0, 0, 297, 210)); QCOMPARE(tenpoint.fullRectPoints(), QRect(0, 0, 842, 595)); QCOMPARE(tenpoint.fullRectPixels(72), QRect(0, 0, 842, 595)); + QCOMPARE(tenpoint.fullRectPixels(600), QRect(0, 0, 7016, 4958)); QCOMPARE(tenpoint.paintRect(), QRectF(0, 0, 842, 595)); QCOMPARE(tenpoint.paintRect(QPageLayout::Millimeter), QRectF(0, 0, 297, 210)); QCOMPARE(tenpoint.paintRectPoints(), QRect(0, 0, 842, 595)); QCOMPARE(tenpoint.paintRectPixels(72), QRect(0, 0, 842, 595)); + QCOMPARE(tenpoint.paintRectPixels(600), QRect(0, 0, 7016, 4958)); + + // A4, 8.4pt margins + QPageLayout fraction = QPageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, QMarginsF(8.4, 8.4, 8.4, 8.4)); + QCOMPARE(fraction.isValid(), true); + QCOMPARE(fraction.margins(), QMarginsF(8.4, 8.4, 8.4, 8.4)); + QCOMPARE(fraction.margins(QPageLayout::Millimeter), QMarginsF(2.96, 2.96, 2.96, 2.96)); + QCOMPARE(fraction.marginsPoints(), QMarginsF(8, 8, 8, 8)); + QCOMPARE(fraction.marginsPixels(72), QMargins(8, 8, 8, 8)); + QCOMPARE(fraction.marginsPixels(600), QMargins(70, 70, 70, 70)); + QCOMPARE(fraction.minimumMargins(), QMarginsF(0, 0, 0, 0)); + QCOMPARE(fraction.maximumMargins(), QMarginsF(595, 842, 595, 842)); + QCOMPARE(fraction.fullRect(), QRectF(0, 0, 595, 842)); + QCOMPARE(fraction.fullRect(QPageLayout::Millimeter), QRectF(0, 0, 210, 297)); + QCOMPARE(fraction.fullRectPoints(), QRect(0, 0, 595, 842)); + QCOMPARE(fraction.fullRectPixels(72), QRect(0, 0, 595, 842)); + QCOMPARE(fraction.fullRectPixels(600), QRect(0, 0, 4958, 7016)); + QCOMPARE(fraction.paintRect(), QRectF(8.4, 8.4, 578.2, 825.2)); + QCOMPARE(fraction.paintRect(QPageLayout::Millimeter), QRectF(2.96, 2.96, 204.08, 291.08)); + QCOMPARE(fraction.paintRect(QPageLayout::Millimeter).x(), 2.96); + QCOMPARE(fraction.paintRect(QPageLayout::Millimeter).y(), 2.96); + QCOMPARE(fraction.paintRect(QPageLayout::Millimeter).width(), 204.08); + QCOMPARE(fraction.paintRect(QPageLayout::Millimeter).height(), 291.08); + QCOMPARE(fraction.paintRect(QPageLayout::Millimeter).left(), 2.96); + QCOMPARE(fraction.paintRect(QPageLayout::Millimeter).right(), 207.04); + QCOMPARE(fraction.paintRect(QPageLayout::Millimeter).top(), 2.96); + QCOMPARE(fraction.paintRect(QPageLayout::Millimeter).bottom(), 294.04); + QCOMPARE(fraction.paintRectPoints(), QRect(8, 8, 579, 826)); + QCOMPARE(fraction.paintRectPixels(72), QRect(8, 8, 579, 826)); + QCOMPARE(fraction.paintRectPixels(600), QRect(70, 70, 4818, 6876)); + + // Change orientation + fraction.setOrientation(QPageLayout::Landscape); + QCOMPARE(fraction.orientation(), QPageLayout::Landscape); + QCOMPARE(fraction.margins(), QMarginsF(8.4, 8.4, 8.4, 8.4)); + QCOMPARE(fraction.minimumMargins(), QMarginsF(0, 0, 0, 0)); + QCOMPARE(fraction.maximumMargins(), QMarginsF(842, 595, 842, 595)); + QCOMPARE(fraction.fullRect(), QRectF(0, 0, 842, 595)); + QCOMPARE(fraction.fullRect(QPageLayout::Millimeter), QRectF(0, 0, 297, 210)); + QCOMPARE(fraction.fullRectPoints(), QRect(0, 0, 842, 595)); + QCOMPARE(fraction.fullRectPixels(72), QRect(0, 0, 842, 595)); + QCOMPARE(fraction.fullRectPixels(600), QRect(0, 0, 7016, 4958)); + QCOMPARE(fraction.paintRect(), QRectF(8.4, 8.4, 825.2, 578.2)); + QCOMPARE(fraction.paintRect(QPageLayout::Millimeter), QRectF(2.96, 2.96, 291.08, 204.08)); + QCOMPARE(fraction.paintRectPoints(), QRect(8, 8, 826, 579)); + QCOMPARE(fraction.paintRectPixels(72), QRect(8, 8, 826, 579)); + QCOMPARE(fraction.paintRectPixels(600), QRect(70, 70, 6876, 4818)); + + // Change mode + QCOMPARE(fraction.mode(), QPageLayout::StandardMode); + fraction.setMode(QPageLayout::FullPageMode); + QCOMPARE(fraction.mode(), QPageLayout::FullPageMode); + QCOMPARE(fraction.orientation(), QPageLayout::Landscape); + QCOMPARE(fraction.margins(), QMarginsF(8.4, 8.4, 8.4, 8.4)); + QCOMPARE(fraction.minimumMargins(), QMarginsF(0, 0, 0, 0)); + QCOMPARE(fraction.maximumMargins(), QMarginsF(842, 595, 842, 595)); + QCOMPARE(fraction.fullRect(), QRectF(0, 0, 842, 595)); + QCOMPARE(fraction.fullRect(QPageLayout::Millimeter), QRectF(0, 0, 297, 210)); + QCOMPARE(fraction.fullRectPoints(), QRect(0, 0, 842, 595)); + QCOMPARE(fraction.fullRectPixels(72), QRect(0, 0, 842, 595)); + QCOMPARE(fraction.fullRectPixels(600), QRect(0, 0, 7016, 4958)); + QCOMPARE(fraction.paintRect(), QRectF(0, 0, 842, 595)); + QCOMPARE(fraction.paintRect(QPageLayout::Millimeter), QRectF(0, 0, 297, 210)); + QCOMPARE(fraction.paintRectPoints(), QRect(0, 0, 842, 595)); + QCOMPARE(fraction.paintRectPixels(72), QRect(0, 0, 842, 595)); + QCOMPARE(fraction.paintRectPixels(600), QRect(0, 0, 7016, 4958)); } void tst_QPageLayout::setGetMargins() { - // A4, 20pt margins + // A4, 10pt margins QMarginsF margins = QMarginsF(10, 10, 10, 10); QMarginsF min = QMarginsF(10, 10, 10, 10); QMarginsF max = QMarginsF(585, 832, 585, 832); @@ -155,7 +230,7 @@ void tst_QPageLayout::setGetMargins() QCOMPARE(change.minimumMargins(), min); QCOMPARE(change.maximumMargins(), max); - // Set magins within min/max ok + // Set margins within min/max ok margins = QMarginsF(20, 20, 20, 20); change.setMargins(margins); QCOMPARE(change.margins(QPageLayout::Millimeter), QMarginsF(7.06, 7.06, 7.06, 7.06)); @@ -215,7 +290,7 @@ void tst_QPageLayout::setGetMargins() fullPage.setMargins(margins); QCOMPARE(fullPage.margins(), margins); - // Set margins all above max is rejected + // Set margins all above max is accepted margins = QMarginsF(1000, 1000, 1000, 1000); fullPage.setMargins(margins); QCOMPARE(fullPage.margins(), margins); @@ -238,6 +313,174 @@ void tst_QPageLayout::setGetMargins() QCOMPARE(fullPage.maximumMargins(), max); } +void tst_QPageLayout::setGetClampedMargins() +{ + // A4, 10pt margins + QMarginsF margins = QMarginsF(10, 10, 10, 10); + QMarginsF min = QMarginsF(10, 10, 10, 10); + QMarginsF max = QMarginsF(585, 832, 585, 832); + QPageLayout change = QPageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, margins, QPageLayout::Point, min); + QCOMPARE(change.isValid(), true); + + // Clamp margins within min/max ok + margins = QMarginsF(20, 20, 20, 20); + change.setMargins(margins, QPageLayout::OutOfBoundsPolicy::Clamp); + QCOMPARE(change.margins(QPageLayout::Millimeter), QMarginsF(7.06, 7.06, 7.06, 7.06)); + QCOMPARE(change.marginsPoints(), QMargins(20, 20, 20, 20)); + QCOMPARE(change.marginsPixels(72), QMargins(20, 20, 20, 20)); + QCOMPARE(change.margins(), margins); + + // Clamp margins all below min + change.setMargins(QMarginsF(0, 0, 0, 0), QPageLayout::OutOfBoundsPolicy::Clamp); + QCOMPARE(change.margins(), change.minimumMargins()); + + // Clamp margins all above max + change.setMargins(QMarginsF(1000, 1000, 1000, 1000), QPageLayout::OutOfBoundsPolicy::Clamp); + QCOMPARE(change.margins(), change.maximumMargins()); + + // Only 1 wrong, clamp still works + change.setMargins(QMarginsF(50, 50, 50, 0), QPageLayout::OutOfBoundsPolicy::Clamp); + QCOMPARE(change.margins(), QMarginsF(50, 50, 50, change.minimumMargins().bottom())); + + // A4, 20pt margins + margins = QMarginsF(20, 20, 20, 20); + min = QMarginsF(10, 10, 10, 10); + max = QMarginsF(585, 832, 585, 832); + QPageLayout fullPage = QPageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, margins, QPageLayout::Point, min); + fullPage.setMode(QPageLayout::FullPageMode); + QCOMPARE(fullPage.isValid(), true); + QCOMPARE(fullPage.margins(), margins); + QCOMPARE(fullPage.minimumMargins(), min); + QCOMPARE(fullPage.maximumMargins(), max); + + // Clamp margins within min/max ok + margins = QMarginsF(50, 50, 50, 50); + fullPage.setMargins(margins, QPageLayout::OutOfBoundsPolicy::Clamp); + QCOMPARE(fullPage.margins(), margins); + + // Clamp margins all below min, no clamping + margins = QMarginsF(0, 0, 0, 0); + fullPage.setMargins(margins, QPageLayout::OutOfBoundsPolicy::Clamp); + QCOMPARE(fullPage.margins(), margins); + + // Clamp margins all above max, no clamping + margins = QMarginsF(1000, 1000, 1000, 1000); + fullPage.setMargins(margins, QPageLayout::OutOfBoundsPolicy::Clamp); + QCOMPARE(fullPage.margins(), margins); + + // Only 1 wrong, no clamping + margins = QMarginsF(50, 50, 50, 0); + fullPage.setMargins(margins, QPageLayout::OutOfBoundsPolicy::Clamp); + QCOMPARE(fullPage.margins(), margins); + + // Set page size, sets min/max, clamps existing margins + margins = QMarginsF(20, 500, 20, 500); + fullPage.setMargins(margins, QPageLayout::OutOfBoundsPolicy::Clamp); + QCOMPARE(fullPage.margins(), margins); + min = QMarginsF(30, 30, 30, 30); + max = QMarginsF(267, 390, 267, 390); + fullPage.setPageSize(QPageSize(QPageSize::A6)); + fullPage.setMinimumMargins(min); + QCOMPARE(fullPage.margins(), margins); + QCOMPARE(fullPage.minimumMargins(), min); + QCOMPARE(fullPage.maximumMargins(), max); + + // Test set* API calls + min = QMarginsF(1, 2, 3, 4); + max = QMarginsF(595 - min.right(), 842 - min.bottom(), 595 - min.left(), 842 - min.top()); + change = QPageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, margins, QPageLayout::Point, min); + QCOMPARE(change.minimumMargins(), min); + QCOMPARE(change.maximumMargins(), max); + + // Test setLeftMargin + change.setLeftMargin(0, QPageLayout::OutOfBoundsPolicy::Clamp); + QCOMPARE(change.margins().left(), min.left()); + change.setLeftMargin(change.fullRectPoints().width(), QPageLayout::OutOfBoundsPolicy::Clamp); + QCOMPARE(change.margins().left(), max.left()); + change.setLeftMargin(min.left(), QPageLayout::OutOfBoundsPolicy::Clamp); + QCOMPARE(change.margins().left(), min.left()); + change.setLeftMargin(max.left(), QPageLayout::OutOfBoundsPolicy::Clamp); + QCOMPARE(change.margins().left(), max.left()); + + // Test setTopMargin + change.setTopMargin(0, QPageLayout::OutOfBoundsPolicy::Clamp); + QCOMPARE(change.margins().top(), min.top()); + change.setTopMargin(change.fullRectPoints().height(), QPageLayout::OutOfBoundsPolicy::Clamp); + QCOMPARE(change.margins().top(), max.top()); + change.setTopMargin(min.top(), QPageLayout::OutOfBoundsPolicy::Clamp); + QCOMPARE(change.margins().top(), min.top()); + change.setTopMargin(max.top(), QPageLayout::OutOfBoundsPolicy::Clamp); + QCOMPARE(change.margins().top(), max.top()); + + // Test setRightMargin + change.setRightMargin(0, QPageLayout::OutOfBoundsPolicy::Clamp); + QCOMPARE(change.margins().right(), min.right()); + change.setRightMargin(change.fullRectPoints().width(), QPageLayout::OutOfBoundsPolicy::Clamp); + QCOMPARE(change.margins().right(), max.right()); + change.setRightMargin(min.right(), QPageLayout::OutOfBoundsPolicy::Clamp); + QCOMPARE(change.margins().right(), min.right()); + change.setRightMargin(max.right(), QPageLayout::OutOfBoundsPolicy::Clamp); + QCOMPARE(change.margins().right(), max.right()); + + // Test setBottomMargin + change.setBottomMargin(0, QPageLayout::OutOfBoundsPolicy::Clamp); + QCOMPARE(change.margins().bottom(), min.bottom()); + change.setBottomMargin(change.fullRectPoints().height(), QPageLayout::OutOfBoundsPolicy::Clamp); + QCOMPARE(change.margins().bottom(), max.bottom()); + change.setBottomMargin(min.bottom(), QPageLayout::OutOfBoundsPolicy::Clamp); + QCOMPARE(change.margins().bottom(), min.bottom()); + change.setBottomMargin(max.bottom(), QPageLayout::OutOfBoundsPolicy::Clamp); + QCOMPARE(change.margins().bottom(), max.bottom()); +} + +void tst_QPageLayout::setUnits_data() +{ + QTest::addColumn<QPageLayout::Unit>("units"); + QTest::newRow("Millimeter") << QPageLayout::Millimeter; + QTest::newRow("Point") << QPageLayout::Point; + QTest::newRow("Inch") << QPageLayout::Inch; + QTest::newRow("Pica") << QPageLayout::Pica; + QTest::newRow("Didot") << QPageLayout::Didot; + QTest::newRow("Cicero") << QPageLayout::Cicero; +} + +void tst_QPageLayout::setUnits() +{ + QFETCH(QPageLayout::Unit, units); + QPageLayout pageLayout = QPageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, QMarginsF(), units); + int maxLeftX100 = qFloor(pageLayout.maximumMargins().left() * 100); + QVERIFY(maxLeftX100 > 0); + for (int i = 1; i <= maxLeftX100; ++i) { + const qreal margin = i / 100.; + const QMarginsF unitsMargins = QMarginsF(margin, margin, margin, margin); + pageLayout.setMargins(unitsMargins); + pageLayout.setUnits(QPageLayout::Point); + const QMarginsF pointsMargins = pageLayout.margins(); + if (units == QPageLayout::Point) { + QCOMPARE(pointsMargins, unitsMargins); + } else { + QCOMPARE_GT(pointsMargins.left(), unitsMargins.left()); + QCOMPARE_GT(pointsMargins.top(), unitsMargins.top()); + QCOMPARE_GT(pointsMargins.right(), unitsMargins.right()); + QCOMPARE_GT(pointsMargins.bottom(), unitsMargins.bottom()); + } + pageLayout.setUnits(units); + const QMarginsF convertedUnitsMargins = pageLayout.margins(); + if (units == QPageLayout::Didot) { + // When using Didot units, the small multiplier and ceiling function in conversion + // may cause the converted units to not match the original exactly. However, we + // can verify that the converted margins are always greater than or equal to the + // original. + QCOMPARE_GE(convertedUnitsMargins.left(), unitsMargins.left()); + QCOMPARE_GE(convertedUnitsMargins.top(), unitsMargins.top()); + QCOMPARE_GE(convertedUnitsMargins.right(), unitsMargins.right()); + QCOMPARE_GE(convertedUnitsMargins.bottom(), unitsMargins.bottom()); + } else { + QCOMPARE(convertedUnitsMargins, unitsMargins); + } + } +} + QTEST_APPLESS_MAIN(tst_QPageLayout) #include "tst_qpagelayout.moc" diff --git a/tests/auto/gui/painting/qpageranges/CMakeLists.txt b/tests/auto/gui/painting/qpageranges/CMakeLists.txt index b779b51618..99ab477eae 100644 --- a/tests/auto/gui/painting/qpageranges/CMakeLists.txt +++ b/tests/auto/gui/painting/qpageranges/CMakeLists.txt @@ -5,6 +5,12 @@ ## tst_qpageranges Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qpageranges LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qpageranges SOURCES tst_qpageranges.cpp diff --git a/tests/auto/gui/painting/qpageranges/tst_qpageranges.cpp b/tests/auto/gui/painting/qpageranges/tst_qpageranges.cpp index 4677399b3f..d2dbf990e3 100644 --- a/tests/auto/gui/painting/qpageranges/tst_qpageranges.cpp +++ b/tests/auto/gui/painting/qpageranges/tst_qpageranges.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2019 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> #include <qpageranges.h> diff --git a/tests/auto/gui/painting/qpagesize/CMakeLists.txt b/tests/auto/gui/painting/qpagesize/CMakeLists.txt index 009272aeff..b16cd2714a 100644 --- a/tests/auto/gui/painting/qpagesize/CMakeLists.txt +++ b/tests/auto/gui/painting/qpagesize/CMakeLists.txt @@ -5,6 +5,12 @@ ## tst_qpagesize Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qpagesize LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qpagesize SOURCES tst_qpagesize.cpp diff --git a/tests/auto/gui/painting/qpagesize/tst_qpagesize.cpp b/tests/auto/gui/painting/qpagesize/tst_qpagesize.cpp index bac7e9cdf8..de9b799902 100644 --- a/tests/auto/gui/painting/qpagesize/tst_qpagesize.cpp +++ b/tests/auto/gui/painting/qpagesize/tst_qpagesize.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> #include <QtGlobal> @@ -49,11 +49,13 @@ void tst_QPageSize::basics() QCOMPARE(a4.size(QPageSize::Pica), QSizeF(49.58, 70.17)); QCOMPARE(a4.sizePoints(), QSize(595, 842)); QCOMPARE(a4.sizePixels(72), QSize(595, 842)); + QCOMPARE(a4.sizePixels(600), QSize(4958, 7016)); // Rounded down QCOMPARE(a4.rect(QPageSize::Millimeter), QRectF(0, 0, 210, 297)); QCOMPARE(a4.rect(QPageSize::Inch), QRectF(0, 0, 8.27, 11.69)); QCOMPARE(a4.rect(QPageSize::Pica), QRectF(0, 0, 49.58, 70.17)); QCOMPARE(a4.rectPoints(), QRect(0, 0, 595, 842)); QCOMPARE(a4.rectPixels(72), QRect(0, 0, 595, 842)); + QCOMPARE(a4.rectPixels(600), QRect(0, 0, 4958, 7016)); // Rounded down // Simple QPageSize::PaperSizeId later in list QPageSize folio = QPageSize(QPageSize::Folio); diff --git a/tests/auto/gui/painting/qpaintengine/CMakeLists.txt b/tests/auto/gui/painting/qpaintengine/CMakeLists.txt index bb34f49bee..4cd0151a01 100644 --- a/tests/auto/gui/painting/qpaintengine/CMakeLists.txt +++ b/tests/auto/gui/painting/qpaintengine/CMakeLists.txt @@ -5,6 +5,12 @@ ## tst_qpaintengine Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qpaintengine LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qpaintengine SOURCES tst_qpaintengine.cpp diff --git a/tests/auto/gui/painting/qpaintengine/tst_qpaintengine.cpp b/tests/auto/gui/painting/qpaintengine/tst_qpaintengine.cpp index 24e13c2821..02441de54c 100644 --- a/tests/auto/gui/painting/qpaintengine/tst_qpaintengine.cpp +++ b/tests/auto/gui/painting/qpaintengine/tst_qpaintengine.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> diff --git a/tests/auto/gui/painting/qpainter/CMakeLists.txt b/tests/auto/gui/painting/qpainter/CMakeLists.txt index 31a59dedcd..261e1eb2cf 100644 --- a/tests/auto/gui/painting/qpainter/CMakeLists.txt +++ b/tests/auto/gui/painting/qpainter/CMakeLists.txt @@ -5,6 +5,12 @@ ## tst_qpainter Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qpainter LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + # Collect test data file(GLOB_RECURSE test_data_glob RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index 92c3ea4a5a..92b28f65bd 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -1,6 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> #include <qpainter.h> @@ -62,6 +61,7 @@ private slots: #endif void drawPixmapFragments(); void drawPixmapNegativeScale(); + void drawPixmapRounding(); void drawLine_data(); void drawLine(); @@ -170,6 +170,7 @@ private slots: void radialGradientRgb30(); #endif + void radialGradient_QTBUG120332_ubsan(); void fpe_pixmapTransform(); void fpe_zeroLengthLines(); void fpe_divByZero(); @@ -747,6 +748,16 @@ void tst_QPainter::drawPixmapNegativeScale() QVERIFY(resultImage.pixel(12, 8) == qRgba(0, 0, 0, 255)); // and right strip is now black } +void tst_QPainter::drawPixmapRounding() +{ + // Just test that we don't assert + QBitmap bm(8, 8); + QImage out(64, 64, QImage::Format_RGB32); + QPainter p(&out); + qreal y = 26.499999999999996; + p.drawPixmap(QPointF(0, y), bm); +} + void tst_QPainter::drawLine_data() { QTest::addColumn<QLine>("line"); @@ -2082,21 +2093,22 @@ void tst_QPainter::clippedLines_data() QPen pen2(QColor(223, 223, 0, 223)); pen2.setWidth(2); - QList<QLineF> lines; - lines << QLineF(15, 15, 65, 65) - << QLineF(14, 14, 66, 66) - << QLineF(16, 16, 64, 64) - << QLineF(65, 65, 15, 15) - << QLineF(66, 66, 14, 14) - << QLineF(64, 64, 14, 14) - << QLineF(15, 50, 15, 64) - << QLineF(15, 50, 15, 65) - << QLineF(15, 50, 15, 66) - << QLineF(15, 50, 64, 50) - << QLineF(15, 50, 65, 50) - << QLineF(15, 50, 66, 50); - - foreach (QLineF line, lines) { + const auto lines = { + QLineF(15, 15, 65, 65), + QLineF(14, 14, 66, 66), + QLineF(16, 16, 64, 64), + QLineF(65, 65, 15, 15), + QLineF(66, 66, 14, 14), + QLineF(64, 64, 14, 14), + QLineF(15, 50, 15, 64), + QLineF(15, 50, 15, 65), + QLineF(15, 50, 15, 66), + QLineF(15, 50, 64, 50), + QLineF(15, 50, 65, 50), + QLineF(15, 50, 66, 50), + }; + + for (QLineF line : lines) { const QByteArray desc = "line (" + QByteArray::number(line.x1()) + ", " + QByteArray::number(line.y1()) + ", " + QByteArray::number(line.x2()) + ", " + QByteArray::number(line.y2()) @@ -2497,6 +2509,12 @@ void tst_QPainter::drawhelper_blend_untransformed_data() setOpacity_data(); } +static const auto &defaultOpacities() +{ + static const std::array opacities = {qreal(0.0), 0.1 , 0.01, 0.4, 0.5, 0.6, 0.9, 1.0}; + return opacities; +} + void tst_QPainter::drawhelper_blend_untransformed() { QFETCH(QImage::Format, destFormat); @@ -2517,9 +2535,7 @@ void tst_QPainter::drawhelper_blend_untransformed() p.fillRect(paintRect, srcColor); p.end(); - QList<qreal> opacities = (QList<qreal>() << 0.0 << 0.1 << 0.01 << 0.4 - << 0.5 << 0.6 << 0.9 << 1.0); - foreach (qreal opacity, opacities) { + for (qreal opacity : defaultOpacities()) { p.begin(&dest); p.fillRect(paintRect, destColor); @@ -2574,9 +2590,7 @@ void tst_QPainter::drawhelper_blend_tiled_untransformed() const QBrush brush(src); - QList<qreal> opacities = (QList<qreal>() << 0.0 << 0.1 << 0.01 << 0.4 - << 0.5 << 0.6 << 0.9 << 1.0); - foreach (qreal opacity, opacities) { + for (qreal opacity : defaultOpacities()) { p.begin(&dest); p.fillRect(paintRect, destColor); @@ -2770,7 +2784,7 @@ void tst_QPainter::monoImages() for (int i = 1; i < QImage::NImageFormats; ++i) { for (int j = 0; j < numColorPairs; ++j) { const QImage::Format format = QImage::Format(i); - if (format == QImage::Format_Indexed8) + if (format == QImage::Format_Indexed8 || format == QImage::Format_CMYK8888) continue; QImage img(2, 2, format); @@ -3540,9 +3554,13 @@ void tst_QPainter::drawImage_data() for (int srcFormat = QImage::Format_Mono; srcFormat < QImage::NImageFormats; ++srcFormat) { for (int dstFormat = QImage::Format_Mono; dstFormat < QImage::NImageFormats; ++dstFormat) { - // Indexed8 can't be painted to, and Alpha8 can't hold a color. - if (dstFormat == QImage::Format_Indexed8 || dstFormat == QImage::Format_Alpha8) + // Indexed8 and CMYK8888 can't be painted to, and Alpha8 can't hold a color. + if (dstFormat == QImage::Format_Indexed8 || + dstFormat == QImage::Format_CMYK8888 || + dstFormat == QImage::Format_Alpha8) { continue; + } + for (int odd_x = 0; odd_x <= 1; ++odd_x) { for (int odd_width = 0; odd_width <= 1; ++odd_width) { QTest::addRow("srcFormat %d, dstFormat %d, odd x: %d, odd width: %d", @@ -3785,10 +3803,10 @@ static QLinearGradient inverseGradient(QLinearGradient g) { QLinearGradient g2 = g; - QGradientStops stops = g.stops(); + const QGradientStops stops = g.stops(); QGradientStops inverse; - foreach (QGradientStop stop, stops) + for (const QGradientStop &stop : stops) inverse << QGradientStop(1 - stop.first, stop.second); g2.setStops(inverse); @@ -3894,6 +3912,21 @@ void tst_QPainter::gradientPixelFormat() QCOMPARE(a, b.convertToFormat(QImage::Format_ARGB32_Premultiplied)); } +void tst_QPainter::radialGradient_QTBUG120332_ubsan() +{ + // Check if Radial Gradient will cause division by zero or not when + // the center point coincide with the focal point. + QImage image(8, 8, QImage::Format_ARGB32_Premultiplied); + QPainter painter(&image); + + QPointF center(0.5, 0.5); + QPointF focal(0.5, 0.5); + QRadialGradient gradient(center, 0.5, focal, 0.5); + gradient.setColorAt(0, Qt::blue); + gradient.setColorAt(1, Qt::red); + painter.fillRect(image.rect(), QBrush(gradient)); +} + void tst_QPainter::gradientInterpolation() { QImage image(256, 8, QImage::Format_ARGB32_Premultiplied); @@ -4897,10 +4930,7 @@ void tst_QPainter::QTBUG25153_drawLine() { QImage image(2, 2, QImage::Format_RGB32); - QList<Qt::PenCapStyle> styles; - styles << Qt::FlatCap << Qt::SquareCap << Qt::RoundCap; - - foreach (Qt::PenCapStyle style, styles) { + for (Qt::PenCapStyle style : {Qt::FlatCap, Qt::SquareCap, Qt::RoundCap}) { image.fill(0xffffffff); QPainter p(&image); p.setPen(QPen(Qt::black, 0, Qt::SolidLine, style)); diff --git a/tests/auto/gui/painting/qpainter/utils/createImages/main.cpp b/tests/auto/gui/painting/qpainter/utils/createImages/main.cpp index 092986045a..7cb9e74216 100644 --- a/tests/auto/gui/painting/qpainter/utils/createImages/main.cpp +++ b/tests/auto/gui/painting/qpainter/utils/createImages/main.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <qapplication.h> diff --git a/tests/auto/gui/painting/qpainterpath/CMakeLists.txt b/tests/auto/gui/painting/qpainterpath/CMakeLists.txt index 7e77c1012f..1da6e25511 100644 --- a/tests/auto/gui/painting/qpainterpath/CMakeLists.txt +++ b/tests/auto/gui/painting/qpainterpath/CMakeLists.txt @@ -5,6 +5,12 @@ ## tst_qpainterpath Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qpainterpath LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qpainterpath SOURCES tst_qpainterpath.cpp diff --git a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp index 20ee6e07c7..c00dc3a78a 100644 --- a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp +++ b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> @@ -81,6 +81,8 @@ private slots: void intersectionEquality(); void intersectionPointOnEdge(); + + void boundsAtStartPoint(); }; void tst_QPainterPath::cleanupTestCase() @@ -763,6 +765,21 @@ void tst_QPainterPath::testOperatorDatastream() } QCOMPARE(other, path); + + // Check reset & detach + QPainterPath p3; + p3.lineTo(1, 1); + QCOMPARE(p3.elementCount(), 2); + QPainterPath p4 = p3; + QCOMPARE(p4.elementCount(), 2); + { + QFile data(tempDir.path() + "/data"); + QVERIFY(data.open(QFile::ReadOnly)); + QDataStream stream(&data); + stream >> p3; + } + QCOMPARE(p3.elementCount(), path.elementCount()); + QCOMPARE(p4.elementCount(), 2); } void tst_QPainterPath::closing() @@ -1442,6 +1459,32 @@ void tst_QPainterPath::intersectionPointOnEdge() QVERIFY(p.intersects(r)); } +void tst_QPainterPath::boundsAtStartPoint() +{ + const QPointF startPoint(10, 10); + const QPainterPath constructedPath(startPoint); + { + const auto boundingRect = constructedPath.boundingRect(); + const auto topLeft = boundingRect.topLeft(); + QCOMPARE(topLeft, startPoint); + QCOMPARE(topLeft, constructedPath.elementAt(0)); + QCOMPARE(boundingRect, constructedPath.controlPointRect()); + } + + QPainterPath defaultPath; + defaultPath.moveTo(startPoint); + { + const auto boundingRect = defaultPath.boundingRect(); + const auto topLeft = boundingRect.topLeft(); + QCOMPARE(topLeft, startPoint); + QCOMPARE(topLeft, defaultPath.elementAt(0)); + QCOMPARE(boundingRect, defaultPath.controlPointRect()); + } + + QCOMPARE(constructedPath.boundingRect(), defaultPath.boundingRect()); + QCOMPARE(constructedPath.controlPointRect(), defaultPath.controlPointRect()); +} + QTEST_APPLESS_MAIN(tst_QPainterPath) #include "tst_qpainterpath.moc" diff --git a/tests/auto/gui/painting/qpainterpathstroker/CMakeLists.txt b/tests/auto/gui/painting/qpainterpathstroker/CMakeLists.txt index 7716500534..d30778de3f 100644 --- a/tests/auto/gui/painting/qpainterpathstroker/CMakeLists.txt +++ b/tests/auto/gui/painting/qpainterpathstroker/CMakeLists.txt @@ -5,6 +5,12 @@ ## tst_qpainterpathstroker Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qpainterpathstroker LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qpainterpathstroker SOURCES tst_qpainterpathstroker.cpp diff --git a/tests/auto/gui/painting/qpainterpathstroker/tst_qpainterpathstroker.cpp b/tests/auto/gui/painting/qpainterpathstroker/tst_qpainterpathstroker.cpp index 3a3f8ff89f..ce80019273 100644 --- a/tests/auto/gui/painting/qpainterpathstroker/tst_qpainterpathstroker.cpp +++ b/tests/auto/gui/painting/qpainterpathstroker/tst_qpainterpathstroker.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> diff --git a/tests/auto/gui/painting/qpathclipper/CMakeLists.txt b/tests/auto/gui/painting/qpathclipper/CMakeLists.txt index 3b2d123382..2cf25cfdf2 100644 --- a/tests/auto/gui/painting/qpathclipper/CMakeLists.txt +++ b/tests/auto/gui/painting/qpathclipper/CMakeLists.txt @@ -1,6 +1,12 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: BSD-3-Clause +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qpathclipper LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + if(NOT QT_FEATURE_private_tests) return() endif() diff --git a/tests/auto/gui/painting/qpathclipper/pathcompare.h b/tests/auto/gui/painting/qpathclipper/pathcompare.h index d1207cfdc0..593176686e 100644 --- a/tests/auto/gui/painting/qpathclipper/pathcompare.h +++ b/tests/auto/gui/painting/qpathclipper/pathcompare.h @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef PATHCOMPARE_H #define PATHCOMPARE_H diff --git a/tests/auto/gui/painting/qpathclipper/paths.cpp b/tests/auto/gui/painting/qpathclipper/paths.cpp index e6be402df7..7b1486152b 100644 --- a/tests/auto/gui/painting/qpathclipper/paths.cpp +++ b/tests/auto/gui/painting/qpathclipper/paths.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "paths.h" QPainterPath Paths::rect() diff --git a/tests/auto/gui/painting/qpathclipper/paths.h b/tests/auto/gui/painting/qpathclipper/paths.h index 8c421dec2e..73b41d324a 100644 --- a/tests/auto/gui/painting/qpathclipper/paths.h +++ b/tests/auto/gui/painting/qpathclipper/paths.h @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef PATHS_H #define PATHS_H diff --git a/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp b/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp index 4ecfa24105..c5ef8373fd 100644 --- a/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp +++ b/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "private/qpathclipper_p.h" #include "paths.h" #include "pathcompare.h" @@ -776,7 +776,7 @@ void tst_QPathClipper::testIntersections7() void tst_QPathClipper::testIntersections8() { QPainterPath path1 = Paths::node() * QTransform().translate(100, 50); - QPainterPath path2 = Paths::node() * QTransform().translate(150, 50);; + QPainterPath path2 = Paths::node() * QTransform().translate(150, 50); QVERIFY(path1.intersects(path2)); QVERIFY(path2.intersects(path1)); @@ -824,7 +824,7 @@ void tst_QPathClipper::testIntersections9() QVERIFY(path1.intersects(path2)); QVERIFY(path2.intersects(path1)); - path1 = QPainterPath();; + path1 = QPainterPath(); path2 = QPainterPath(); path1.addRect(QRectF(-1,191, 136, 106)); @@ -832,7 +832,7 @@ void tst_QPathClipper::testIntersections9() QVERIFY(path1.intersects(path2)); QVERIFY(path2.intersects(path1)); - path1 = QPainterPath();; + path1 = QPainterPath(); path2 = QPainterPath(); path1.moveTo(-1 , 143); diff --git a/tests/auto/gui/painting/qpdfwriter/CMakeLists.txt b/tests/auto/gui/painting/qpdfwriter/CMakeLists.txt index 059c0f4fc0..3a42d81600 100644 --- a/tests/auto/gui/painting/qpdfwriter/CMakeLists.txt +++ b/tests/auto/gui/painting/qpdfwriter/CMakeLists.txt @@ -5,6 +5,12 @@ ## tst_qpdfwriter Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qpdfwriter LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qpdfwriter SOURCES tst_qpdfwriter.cpp diff --git a/tests/auto/gui/painting/qpdfwriter/tst_qpdfwriter.cpp b/tests/auto/gui/painting/qpdfwriter/tst_qpdfwriter.cpp index aaa0877625..4d6b1f01b9 100644 --- a/tests/auto/gui/painting/qpdfwriter/tst_qpdfwriter.cpp +++ b/tests/auto/gui/painting/qpdfwriter/tst_qpdfwriter.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> #include <QtGlobal> diff --git a/tests/auto/gui/painting/qpen/CMakeLists.txt b/tests/auto/gui/painting/qpen/CMakeLists.txt index 97aa8c3f80..05fbbfb552 100644 --- a/tests/auto/gui/painting/qpen/CMakeLists.txt +++ b/tests/auto/gui/painting/qpen/CMakeLists.txt @@ -5,6 +5,12 @@ ## tst_qpen Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qpen LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qpen SOURCES tst_qpen.cpp diff --git a/tests/auto/gui/painting/qpen/tst_qpen.cpp b/tests/auto/gui/painting/qpen/tst_qpen.cpp index e13a8e3270..b3ff1c76f9 100644 --- a/tests/auto/gui/painting/qpen/tst_qpen.cpp +++ b/tests/auto/gui/painting/qpen/tst_qpen.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> diff --git a/tests/auto/gui/painting/qpolygon/CMakeLists.txt b/tests/auto/gui/painting/qpolygon/CMakeLists.txt index cae26e0153..42b108efcd 100644 --- a/tests/auto/gui/painting/qpolygon/CMakeLists.txt +++ b/tests/auto/gui/painting/qpolygon/CMakeLists.txt @@ -5,6 +5,12 @@ ## tst_qpolygon Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qpolygon LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qpolygon SOURCES tst_qpolygon.cpp diff --git a/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp b/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp index 512381ab95..cd24135ac6 100644 --- a/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp +++ b/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> diff --git a/tests/auto/gui/painting/qregion/CMakeLists.txt b/tests/auto/gui/painting/qregion/CMakeLists.txt index 39fe5d5c9f..ba580438cd 100644 --- a/tests/auto/gui/painting/qregion/CMakeLists.txt +++ b/tests/auto/gui/painting/qregion/CMakeLists.txt @@ -5,6 +5,12 @@ ## tst_qregion Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qregion LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qregion SOURCES tst_qregion.cpp diff --git a/tests/auto/gui/painting/qregion/tst_qregion.cpp b/tests/auto/gui/painting/qregion/tst_qregion.cpp index 14e210a056..934725844a 100644 --- a/tests/auto/gui/painting/qregion/tst_qregion.cpp +++ b/tests/auto/gui/painting/qregion/tst_qregion.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> @@ -138,12 +138,15 @@ void tst_QRegion::rects() QRegion region(rect); QVERIFY(region.isEmpty()); QCOMPARE(region.begin(), region.end()); + QVERIFY(region.rects().isEmpty()); } { QRect rect(10, -20, 30, 40); QRegion region(rect); QCOMPARE(region.end(), region.begin() + 1); QCOMPARE(*region.begin(), rect); + QCOMPARE(region.rects().size(), 1); + QCOMPARE(region.rects()[0], rect); } { QRect r(QPoint(10, 10), QPoint(40, 40)); @@ -190,6 +193,7 @@ void tst_QRegion::setRects() QCOMPARE(region, QRegion()); QCOMPARE(region.begin(), region.end()); QVERIFY(!region.boundingRect().isValid()); + QVERIFY(region.rects().isEmpty()); } { QRegion region; @@ -197,12 +201,15 @@ void tst_QRegion::setRects() region.setRects(&rect, 1); QCOMPARE(region.begin(), region.end()); QVERIFY(!region.boundingRect().isValid()); + QVERIFY(region.rects().isEmpty()); } { QRegion region; QRect rect(10, -20, 30, 40); region.setRects(&rect, 1); QCOMPARE(region.end(), region.begin() + 1); + QCOMPARE(region.rects().size(), 1); + QCOMPARE(region.rects()[0], rect); QCOMPARE(*region.begin(), rect); } } @@ -316,10 +323,12 @@ void tst_QRegion::emptyPolygonRegion() QRegion r(pa); QTEST(r.isEmpty(), "isEmpty"); QTEST(int(std::distance(r.begin(), r.end())), "numRects"); - QList<QRect> rects; - std::copy(r.begin(), r.end(), std::back_inserter(rects)); + QList<QRect> rects{r.begin(), r.end()}; QTEST(int(rects.size()), "numRects"); QTEST(rects, "rects"); + const auto span = r.rects(); + rects.assign(span.begin(), span.end()); + QTEST(rects, "rects"); } @@ -862,6 +871,7 @@ void tst_QRegion::isEmpty() QCOMPARE(region, QRegion()); QCOMPARE(region.rectCount(), 0); QCOMPARE(region.boundingRect(), QRect()); + QVERIFY(region.rects().isEmpty()); } void tst_QRegion::regionFromPath() @@ -877,6 +887,10 @@ void tst_QRegion::regionFromPath() QCOMPARE(rgn.begin()[0], QRect(0, 0, 10, 10)); QCOMPARE(rgn.begin()[1], QRect(0, 100, 100, 1000)); + QCOMPARE(rgn.rects().size(), 2); + QCOMPARE(rgn.rects()[0], QRect(0, 0, 10, 10)); + QCOMPARE(rgn.rects()[1], QRect(0, 100, 100, 1000)); + QCOMPARE(rgn.boundingRect(), QRect(0, 0, 100, 1100)); } @@ -893,6 +907,12 @@ void tst_QRegion::regionFromPath() QCOMPARE(rgn.begin()[2], QRect(90, 10, 10, 80)); QCOMPARE(rgn.begin()[3], QRect(0, 90, 100, 10)); + QCOMPARE(rgn.rects().size(), 4); + QCOMPARE(rgn.rects()[0], QRect(0, 0, 100, 10)); + QCOMPARE(rgn.rects()[1], QRect(0, 10, 10, 80)); + QCOMPARE(rgn.rects()[2], QRect(90, 10, 10, 80)); + QCOMPARE(rgn.rects()[3], QRect(0, 90, 100, 10)); + QCOMPARE(rgn.boundingRect(), QRect(0, 0, 100, 100)); } } diff --git a/tests/auto/gui/painting/qtransform/CMakeLists.txt b/tests/auto/gui/painting/qtransform/CMakeLists.txt index c4549e9807..557e5fa742 100644 --- a/tests/auto/gui/painting/qtransform/CMakeLists.txt +++ b/tests/auto/gui/painting/qtransform/CMakeLists.txt @@ -5,6 +5,12 @@ ## tst_qtransform Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qtransform LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qtransform SOURCES tst_qtransform.cpp diff --git a/tests/auto/gui/painting/qtransform/tst_qtransform.cpp b/tests/auto/gui/painting/qtransform/tst_qtransform.cpp index ecc8f7e4cc..428174bfc6 100644 --- a/tests/auto/gui/painting/qtransform/tst_qtransform.cpp +++ b/tests/auto/gui/painting/qtransform/tst_qtransform.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> |