diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-02-26 14:20:47 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-03-04 22:37:08 +0100 |
commit | 01c55405fa55add25a469bdaee8c562ab3ab8941 (patch) | |
tree | 4164c6e25692f685e050676db9dd1d6a3a83da54 /tests | |
parent | 3ae67b44341aea644b4e568c0eea6e972588da44 (diff) |
Add QColorSpace::description
A way to read the description of the profile from ICC, or set one
yourself.
Change-Id: I68622e30ee209cac99c41f3df934712c3548c0de
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
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" |