本文整理汇总了Python中qutebrowser.utils.interpolate_color函数的典型用法代码示例。如果您正苦于以下问题:Python interpolate_color函数的具体用法?Python interpolate_color怎么用?Python interpolate_color使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了interpolate_color函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_valid_percentages_hsl
def test_valid_percentages_hsl(self):
"""Test 0% and 100% in the HSL colorspace."""
white = utils.interpolate_color(self.white, self.black, 0, QColor.Hsl)
black = utils.interpolate_color(self.white, self.black, 100,
QColor.Hsl)
assert Color(white) == self.white
assert Color(black) == self.black
开发者ID:skinnay,项目名称:qutebrowser,代码行数:7,代码来源:test_utils.py
示例2: test_0_100
def test_0_100(self, colors, colorspace):
"""Test 0% and 100% in different colorspaces."""
white = utils.interpolate_color(colors.white, colors.black, 0,
colorspace)
black = utils.interpolate_color(colors.white, colors.black, 100,
colorspace)
assert Color(white) == colors.white
assert Color(black) == colors.black
开发者ID:phansch,项目名称:qutebrowser,代码行数:8,代码来源:test_utils.py
示例3: test_valid_percentages_hsv
def test_valid_percentages_hsv(self, colors):
"""Test 0% and 100% in the HSV colorspace."""
white = utils.interpolate_color(colors.white, colors.black, 0,
QColor.Hsv)
black = utils.interpolate_color(colors.white, colors.black, 100,
QColor.Hsv)
assert Color(white) == colors.white
assert Color(black) == colors.black
开发者ID:eknowledger,项目名称:qutebrowser,代码行数:8,代码来源:test_utils.py
示例4: test_interpolation_hsl
def test_interpolation_hsl(self):
"""Test an interpolation in the HSL colorspace."""
start = Color()
stop = Color()
start.setHsl(0, 40, 100)
stop.setHsl(0, 20, 200)
color = utils.interpolate_color(start, stop, 50, QColor.Hsl)
expected = Color()
expected.setHsl(0, 30, 150)
assert Color(color) == expected
开发者ID:phansch,项目名称:qutebrowser,代码行数:10,代码来源:test_utils.py
示例5: test_interpolation_none
def test_interpolation_none(self, percentage, expected):
"""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)
开发者ID:phansch,项目名称:qutebrowser,代码行数:6,代码来源:test_utils.py
示例6: test_interpolation_rgb
def test_interpolation_rgb(self):
"""Test an interpolation in the RGB colorspace."""
color = utils.interpolate_color(Color(0, 40, 100), Color(0, 20, 200),
50, QColor.Rgb)
assert Color(color) == Color(0, 30, 150)
开发者ID:phansch,项目名称:qutebrowser,代码行数:5,代码来源:test_utils.py
示例7: test_invalid_colorspace
def test_invalid_colorspace(self, colors):
"""Test an invalid colorspace."""
with pytest.raises(ValueError):
utils.interpolate_color(colors.white, colors.black, 10,
QColor.Cmyk)
开发者ID:phansch,项目名称:qutebrowser,代码行数:5,代码来源:test_utils.py
示例8: test_invalid_percentage
def test_invalid_percentage(self, colors, perc):
"""Test an invalid percentage."""
with pytest.raises(ValueError):
utils.interpolate_color(colors.white, colors.white, perc)
开发者ID:phansch,项目名称:qutebrowser,代码行数:4,代码来源:test_utils.py
示例9: test_invalid_end
def test_invalid_end(self, colors):
"""Test an invalid end color."""
with pytest.raises(qtutils.QtValueError):
utils.interpolate_color(colors.white, Color(), 0)
开发者ID:phansch,项目名称:qutebrowser,代码行数:4,代码来源:test_utils.py
示例10: test_invalid_start
def test_invalid_start(self, colors):
"""Test an invalid start color."""
with pytest.raises(qtutils.QtValueError):
utils.interpolate_color(Color(), colors.white, 0)
开发者ID:phansch,项目名称:qutebrowser,代码行数:4,代码来源:test_utils.py
示例11: test_invalid_percentage
def test_invalid_percentage(self):
"""Test an invalid percentage."""
with pytest.raises(ValueError):
utils.interpolate_color(self.white, self.white, -1)
with pytest.raises(ValueError):
utils.interpolate_color(self.white, self.white, 101)
开发者ID:vyp,项目名称:qutebrowser,代码行数:6,代码来源:test_utils.py
注:本文中的qutebrowser.utils.interpolate_color函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论