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:
Florian Bruhin 2015-10-26 06:45:36 +01:00
parent 34cc2870f4
commit 883febe243
2 changed files with 3 additions and 2 deletions

View File

@ -174,9 +174,9 @@ def interpolate_color(start, end, percent, colorspace=QColor.Rgb):
if colorspace is None:
if percent == 100:
return end
return QColor(*end.getRgb())
else:
return start
return QColor(*start.getRgb())
out = QColor()
if colorspace == QColor.Rgb:

View File

@ -347,6 +347,7 @@ class TestInterpolateColor:
"""Test an interpolation with a gradient turned off."""
color = utils.interpolate_color(Color(0, 0, 0), Color(255, 255, 255),
percentage, None)
assert isinstance(color, QColor)
assert Color(color) == Color(*expected)