summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBenjamin Poulain <benjamin.poulain@nokia.com>2009-05-14 16:40:03 (GMT)
committerBenjamin Poulain <benjamin.poulain@nokia.com>2009-05-14 16:40:03 (GMT)
commitae3f20e9ce7f592c22c23e8dea6bb9feb52c8b90 (patch)
tree5beb13e5ab883f7511a13d97c1752d08fec65828 /tests
parent85f98acaa3a38079071bea711e43c9a86edec1f6 (diff)
downloadQt-ae3f20e9ce7f592c22c23e8dea6bb9feb52c8b90.zip
Qt-ae3f20e9ce7f592c22c23e8dea6bb9feb52c8b90.tar.gz
Qt-ae3f20e9ce7f592c22c23e8dea6bb9feb52c8b90.tar.bz2
QColor::toCmyk() does not convert the color if it is already in CMYK
QColor::toCmyk() converted the color to RGB and then to CMYK. If the color was already in CMYK, this conversion change it. The color is now returned directly if it is in CMYK Reviewed-by: Ariya Task-number: 253625
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qcolor/tst_qcolor.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/qcolor/tst_qcolor.cpp b/tests/auto/qcolor/tst_qcolor.cpp
index 7608a15..684d5b5 100644
--- a/tests/auto/qcolor/tst_qcolor.cpp
+++ b/tests/auto/qcolor/tst_qcolor.cpp
@@ -111,12 +111,15 @@ private slots:
void toRgb_data();
void toRgb();
+ void toRgbNonDestructive();
void toHsv_data();
void toHsv();
+ void toHsvNonDestructive();
void toCmyk_data();
void toCmyk();
+ void toCmykNonDestructive();
void convertTo();
@@ -1124,6 +1127,12 @@ void tst_QColor::toHsv_data()
<< QColor::fromCmykF(0., 1., 1., 0.);
}
+void tst_QColor::toRgbNonDestructive()
+{
+ QColor aColor = QColor::fromRgbF(0.11, 0.22, 0.33, 0.44);
+ QCOMPARE(aColor, aColor.toRgb());
+}
+
void tst_QColor::toHsv()
{
// invalid should remain invalid
@@ -1136,6 +1145,12 @@ void tst_QColor::toHsv()
QCOMPARE(cmykColor.toHsv(), expectedColor);
}
+void tst_QColor::toHsvNonDestructive()
+{
+ QColor aColor = QColor::fromHsvF(0.11, 0.22, 0.33, 0.44);
+ QCOMPARE(aColor, aColor.toHsv());
+}
+
void tst_QColor::toCmyk_data()
{
QTest::addColumn<QColor>("expectedColor");
@@ -1165,6 +1180,12 @@ void tst_QColor::toCmyk()
QCOMPARE(hsvColor.toCmyk(), expectedColor);
}
+void tst_QColor::toCmykNonDestructive()
+{
+ QColor aColor = QColor::fromCmykF(0.11, 0.22, 0.33, 0.44);
+ QCOMPARE(aColor, aColor.toCmyk());
+}
+
void tst_QColor::convertTo()
{
QColor color(Qt::black);