File indexing completed on 2024-06-16 04:13:39
0001 /* 0002 * SPDX-License-Identifier: GPL-3.0-or-later 0003 */ 0004 0005 #include "TestKoColorSpaceMaths.h" 0006 #include "KoIntegerMaths.h" 0007 #include "KoColorSpaceMaths.h" 0008 0009 #include <simpletest.h> 0010 0011 void TestKoColorSpaceMaths::testColorSpaceMathsTraits() 0012 { 0013 QCOMPARE(KoColorSpaceMathsTraits<quint8>::channelValueType, KoChannelInfo::UINT8); 0014 QCOMPARE(KoColorSpaceMathsTraits<quint16>::channelValueType, KoChannelInfo::UINT16); 0015 QCOMPARE(KoColorSpaceMathsTraits<qint16>::channelValueType, KoChannelInfo::INT16); 0016 QCOMPARE(KoColorSpaceMathsTraits<quint32>::channelValueType, KoChannelInfo::UINT32); 0017 QCOMPARE(KoColorSpaceMathsTraits<float>::channelValueType, KoChannelInfo::FLOAT32); 0018 #ifdef HAVE_OPENEXR 0019 QCOMPARE(KoColorSpaceMathsTraits<half>::channelValueType, KoChannelInfo::FLOAT16); 0020 #endif 0021 } 0022 0023 void TestKoColorSpaceMaths::testScaleToA() 0024 { 0025 for (int i = 0; i < 256; ++i) { 0026 quint16 opacity = KoColorSpaceMaths<quint8, quint16 >::scaleToA(i); 0027 quint8 opacity8 = UINT16_TO_UINT8(opacity); 0028 QVERIFY(opacity8 == i); 0029 } 0030 } 0031 0032 QTEST_GUILESS_MAIN(TestKoColorSpaceMaths)