summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-10-24 18:05:42 +0200
committerLiang Qi <liang.qi@qt.io>2018-11-12 22:18:43 +0000
commit2393551665a6dc608aa495d032d7408bd4b38297 (patch)
tree0023fd017e8bb54ebafe92e9d06677dee9839033 /tests
parent8c685b765bf4ceba3c4cf8fdd9c9d680f338b7a9 (diff)
Fix precision in parsing hex format QColors
We document being able to parse more than 8-bit per color, but were ignoring everything after the first 8 bits. Change-Id: Ic85ab04b0836e6979a623e294eebd5084c1a9478 Fixes: QTBUG-71373 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/painting/qcolor/tst_qcolor.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
index ece7a30830..72bad03a6a 100644
--- a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
+++ b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
@@ -318,6 +318,9 @@ void tst_QColor::namehex_data()
QTest::newRow("global color darkCyan") << "#008080" << QColor(Qt::darkCyan);
QTest::newRow("global color darkMagenta") << "#800080" << QColor(Qt::darkMagenta);
QTest::newRow("global color darkYellow") << "#808000" << QColor(Qt::darkYellow);
+ QTest::newRow("#RGB") << "#888" << QColor(0x88, 0x88, 0x88);
+ QTest::newRow("#RRRGGGBBB") << "#80F80F80F" << QColor(qRgba64(0x80f8, 0x80f8, 0x80f8, 0xffff));
+ QTest::newRow("#RRRRGGGGBBBB") << "#808180818081" << QColor(qRgba64(0x8081, 0x8081, 0x8081, 0xffff));
QTest::newRow("transparent red") << "#66ff0000" << QColor(255, 0, 0, 102);
QTest::newRow("invalid red") << "#gg0000" << QColor();
QTest::newRow("invalid transparent") << "#gg00ff00" << QColor();