diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2019-01-22 13:26:02 +0100 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2019-02-05 22:47:33 +0000 |
commit | 01f090e9e45399f72b8bc73793797d44a69b2a2e (patch) | |
tree | 703d8dcc8ff02dc92ce526c5a68630bebbffbe0d /tests/auto/gui | |
parent | 66c3a71e91edefdf5bc5c8efb009fb5f0f330cd1 (diff) |
Fix QColor::toCmyk() for rgb(0, 0, 0)
We translate all pure gray colors into cmyk having c,m,y=0 and only
the k value expressing the darkness. But a fix introduced to avoid
division by 0 caused rgb(0, 0, 0) to be an exception to this; it ended
up being translated as c,m,y,k=1 instead.
Fix by catching the potential div-by-0 situation earlier and directly
set the orthodox cmyk translation: c,m,y=0,k=1.
Fixes: QTBUG-73171
Change-Id: I3774eaf9d96e096ac5c47c55d28881bea2bd1309
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests/auto/gui')
-rw-r--r-- | tests/auto/gui/painting/qcolor/tst_qcolor.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp index 72bad03a6a..17289e0b85 100644 --- a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp +++ b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp @@ -1291,7 +1291,7 @@ void tst_QColor::toCmyk_data() << QColor::fromHslF(180./360., 1., 0.5, 1.0); QTest::newRow("data1") - << QColor::fromCmyk(255, 255, 255, 255) + << QColor::fromCmyk(0, 0, 0, 255) << QColor::fromRgb(0, 0, 0) << QColor::fromRgb(0, 0, 0).toHsv() << QColor::fromRgb(0, 0, 0).toHsl(); |