diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-02-26 14:20:47 +0100 |
---|---|---|
committer | Qt CI Bot <qt_ci_bot@qt-project.org> | 2021-03-05 00:04:34 +0000 |
commit | 9fb81fc28774cd4aa01a8b29d59150e1a7de8fd8 (patch) | |
tree | 72726af1fac352e2ced75e82de2b66acaea4ff24 /tests | |
parent | 26b53173d6b1a238c75864565f651f74028a50f0 (diff) | |
parent | 01c55405fa55add25a469bdaee8c562ab3ab8941 (diff) |
Merge "Add QColorSpace::description"
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp b/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp index bc26552311..ce21dbe9b7 100644 --- a/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp +++ b/tests/auto/gui/painting/qcolorspace/tst_qcolorspace.cpp @@ -80,6 +80,8 @@ private slots: void changePrimaries(); void transferFunctionTable(); + + void description(); }; tst_QColorSpace::tst_QColorSpace() @@ -225,7 +227,7 @@ void tst_QColorSpace::fromIccProfile() QCOMPARE(fileColorSpace, namedColorSpace); QCOMPARE(fileColorSpace.transferFunction(), transferFunction); - QCOMPARE(QColorSpacePrivate::get(fileColorSpace)->description, description); + QCOMPARE(fileColorSpace.description(), description); } void tst_QColorSpace::imageConversion_data() @@ -616,5 +618,24 @@ void tst_QColorSpace::transferFunctionTable() QCOMPARE(customSRgb, QColorSpace::SRgbLinear); } +void tst_QColorSpace::description() +{ + QColorSpace srgb(QColorSpace::SRgb); + QCOMPARE(srgb.description(), QLatin1String("sRGB")); + + srgb.setTransferFunction(QColorSpace::TransferFunction::ProPhotoRgb); + QCOMPARE(srgb.description(), QString()); // No longer sRGB + srgb.setTransferFunction(QColorSpace::TransferFunction::Linear); + QCOMPARE(srgb.description(), QLatin1String("Linear sRGB")); // Auto-detect + + srgb.setTransferFunction(QColorSpace::TransferFunction::ProPhotoRgb); + srgb.setDescription(QStringLiteral("My custom sRGB")); + QCOMPARE(srgb.description(), QLatin1String("My custom sRGB")); + srgb.setTransferFunction(QColorSpace::TransferFunction::Linear); + QCOMPARE(srgb.description(), QLatin1String("My custom sRGB")); // User given name not reset + srgb.setDescription(QString()); + QCOMPARE(srgb.description(), QLatin1String("Linear sRGB")); // Set to empty returns default behavior +} + QTEST_MAIN(tst_QColorSpace) #include "tst_qcolorspace.moc" |