summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-01-26 13:37:45 +0100
committerQt Commercial Integration <QtCommercial@digia.com>2012-01-31 12:24:58 +0200
commit539352106a03d6cbcb56037255ce8913514b7023 (patch)
tree2d0a8cc849715f2b343bea02ee41d8c92557b9f5 /tests
parente483f2c65139d7004ba35768340adecf23319eb8 (diff)
Fixed hslHue / hslHueF returning the wrong value for achromatic QColors.
Made toHsl() work the same way as toHsv(), ensuring the hue gets set to USHRT_MAX and not 0. Task-number: QTBUG-16530 Reviewed-by: Eskil Abrahamsen Blomfeldt
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qcolor/tst_qcolor.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/qcolor/tst_qcolor.cpp b/tests/auto/qcolor/tst_qcolor.cpp
index f0568c74d8..dc577dc94e 100644
--- a/tests/auto/qcolor/tst_qcolor.cpp
+++ b/tests/auto/qcolor/tst_qcolor.cpp
@@ -148,6 +148,8 @@ private slots:
void specConstructor_data();
void specConstructor();
+ void achromaticHslHue();
+
#ifdef Q_WS_X11
void allowX11ColorNames();
void setallowX11ColorNames();
@@ -1459,6 +1461,14 @@ void tst_QColor::specConstructor()
QCOMPARE(color.spec(), spec);
}
+void tst_QColor::achromaticHslHue()
+{
+ QColor color = Qt::black;
+
+ QColor hsl = color.toHsl();
+ QCOMPARE(hsl.hslHue(), -1);
+}
+
#ifdef Q_WS_X11
void tst_QColor::allowX11ColorNames()
{