Return a QColor for qtutils.interpolate_color.
This broke the tests for older PyQt versions because the test had a test_utils.Color(test_utils.Color(...)) object (double-wrapped), and the comparisons failed there for some reason.
This commit is contained in:
parent
34cc2870f4
commit
883febe243
@ -174,9 +174,9 @@ def interpolate_color(start, end, percent, colorspace=QColor.Rgb):
|
|||||||
|
|
||||||
if colorspace is None:
|
if colorspace is None:
|
||||||
if percent == 100:
|
if percent == 100:
|
||||||
return end
|
return QColor(*end.getRgb())
|
||||||
else:
|
else:
|
||||||
return start
|
return QColor(*start.getRgb())
|
||||||
|
|
||||||
out = QColor()
|
out = QColor()
|
||||||
if colorspace == QColor.Rgb:
|
if colorspace == QColor.Rgb:
|
||||||
|
@ -347,6 +347,7 @@ class TestInterpolateColor:
|
|||||||
"""Test an interpolation with a gradient turned off."""
|
"""Test an interpolation with a gradient turned off."""
|
||||||
color = utils.interpolate_color(Color(0, 0, 0), Color(255, 255, 255),
|
color = utils.interpolate_color(Color(0, 0, 0), Color(255, 255, 255),
|
||||||
percentage, None)
|
percentage, None)
|
||||||
|
assert isinstance(color, QColor)
|
||||||
assert Color(color) == Color(*expected)
|
assert Color(color) == Color(*expected)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user