Commit 2819ad66 authored by Wolthera van Hövell's avatar Wolthera van Hövell 🛍

Add softproofing to the lcms conversion tests

I am not fully sure if I understand the softproofing function, but the alarm works.
parent bb84192a
......@@ -170,4 +170,45 @@ void TestKoLcmsColorProfile::testConversion()
}
void TestKoLcmsColorProfile::testProofingConversion()
{
const KoColorSpace *sRgb = KoColorSpaceRegistry::instance()->rgb16("sRGB built-in");
Q_ASSERT(sRgb);
const KoColorSpace *lab = KoColorSpaceRegistry::instance()->lab16();//there's only one lab profile, replace with it's name.
Q_ASSERT(lab);
quint16 src[4];//the following ought to give us a purple only possible in lab. I can't seem to proof this away, somehow...
src[0] = 32896;
src[1] = 65535;
src[2] = 0;
src[3] = 65535;
quint16 dst[4];
memset(&dst, 0, 8);
cmsHPROFILE sRgbProfile = cmsCreate_sRGBProfile();
cmsHPROFILE LabProfile = cmsCreateLab4Profile(NULL);
quint16 alarm[4];//cyan!
alarm[0] = 65535;
alarm[1] = 0;
alarm[2] = 0;
alarm[3] = 65535;
cmsSetAlarmCodes(alarm);
cmsHTRANSFORM tf = cmsCreateProofingTransform(LabProfile,
TYPE_Lab_16,
LabProfile,
TYPE_Lab_16,
sRgbProfile,
INTENT_ABSOLUTE_COLORIMETRIC,
INTENT_ABSOLUTE_COLORIMETRIC,
cmsFLAGS_SOFTPROOFING|cmsFLAGS_GAMUTCHECK);
cmsDoTransform(tf, (quint8 *)&src, (quint8 *)&dst, 1);
qDebug()<<dst[0]<<","<<dst[1]<<","<<dst[2]<<","<<dst[3];
Q_ASSERT(dst[0] != alarm[0]);
}
QTEST_MAIN(TestKoLcmsColorProfile)
......@@ -11,6 +11,8 @@ class TestKoLcmsColorProfile : public QObject
void testProfileCreationFromChromaticities();
private Q_SLOTS:
void testConversion();
void testProofingConversion();
};
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment