From 01f090e9e45399f72b8bc73793797d44a69b2a2e Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Tue, 22 Jan 2019 13:26:02 +0100 Subject: 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 --- tests/auto/gui/painting/qcolor/tst_qcolor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto') 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(); -- cgit v1.2.3