summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/painting/qcolor/tst_qcolor.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
index f8502c1e2f..5bbf60ea79 100644
--- a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
+++ b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
@@ -106,6 +106,8 @@ private slots:
void achromaticHslHue();
+ void equality();
+
void premultiply();
void unpremultiply_sse4();
void qrgba64();
@@ -1682,6 +1684,24 @@ void tst_QColor::achromaticHslHue()
QCOMPARE(hsl.hslHue(), -1);
}
+void tst_QColor::equality()
+{
+ QColor red = Qt::red;
+ QColor black = Qt::black;
+
+ QCOMPARE(red, red);
+ QCOMPARE(black, black);
+ QVERIFY(red != black);
+
+ // Encodings must match
+ QVERIFY(red != red.toHsv());
+ QVERIFY(black.toHsl() != black);
+
+ // Except for ExtendedRgb and Rgb, as it can be an automatic upgrade.
+ QCOMPARE(red, red.toExtendedRgb());
+ QCOMPARE(black.toExtendedRgb(), black);
+}
+
void tst_QColor::premultiply()
{
// Tests that qPremultiply(qUnpremultiply(x)) returns x.