コード例 #1
0
ファイル: test_utils.py プロジェクト: epon93/qutebrowser
 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
コード例 #2
0
ファイル: test_utils.py プロジェクト: eknowledger/qutebrowser
 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
コード例 #3
0
ファイル: test_utils.py プロジェクト: phansch/qutebrowser
 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
コード例 #4
0
ファイル: test_utils.py プロジェクト: mgoral/qutebrowser
 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
コード例 #5
0
 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
コード例 #6
0
ファイル: test_utils.py プロジェクト: phansch/qutebrowser
 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
コード例 #7
0
 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
コード例 #8
0
 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)
コード例 #9
0
 def test_invalid_colorspace(self, colors):
     """Test an invalid colorspace."""
     with pytest.raises(ValueError):
         utils.interpolate_color(colors.white, colors.black, 10,
                                 QColor.Cmyk)
コード例 #10
0
 def test_invalid_percentage(self, colors, perc):
     """Test an invalid percentage."""
     with pytest.raises(ValueError):
         utils.interpolate_color(colors.white, colors.white, perc)
コード例 #11
0
 def test_invalid_end(self, colors):
     """Test an invalid end color."""
     with pytest.raises(qtutils.QtValueError):
         utils.interpolate_color(colors.white, Color(), 0)
コード例 #12
0
 def test_invalid_start(self, colors):
     """Test an invalid start color."""
     with pytest.raises(qtutils.QtValueError):
         utils.interpolate_color(Color(), colors.white, 0)
コード例 #13
0
ファイル: test_utils.py プロジェクト: phansch/qutebrowser
 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)
コード例 #14
0
ファイル: test_utils.py プロジェクト: epon93/qutebrowser
 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)
コード例 #15
0
ファイル: test_utils.py プロジェクト: phansch/qutebrowser
 def test_invalid_colorspace(self, colors):
     """Test an invalid colorspace."""
     with pytest.raises(ValueError):
         utils.interpolate_color(colors.white, colors.black, 10,
                                 QColor.Cmyk)
コード例 #16
0
ファイル: test_utils.py プロジェクト: phansch/qutebrowser
 def test_invalid_percentage(self, colors, perc):
     """Test an invalid percentage."""
     with pytest.raises(ValueError):
         utils.interpolate_color(colors.white, colors.white, perc)
コード例 #17
0
ファイル: test_utils.py プロジェクト: phansch/qutebrowser
 def test_invalid_end(self, colors):
     """Test an invalid end color."""
     with pytest.raises(qtutils.QtValueError):
         utils.interpolate_color(colors.white, Color(), 0)
コード例 #18
0
ファイル: test_utils.py プロジェクト: phansch/qutebrowser
 def test_invalid_start(self, colors):
     """Test an invalid start color."""
     with pytest.raises(qtutils.QtValueError):
         utils.interpolate_color(Color(), colors.white, 0)
コード例 #19
0
ファイル: test_utils.py プロジェクト: vyp/qutebrowser
 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)
コード例 #20
0
 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)
コード例 #21
0
ファイル: test_utils.py プロジェクト: phansch/qutebrowser
 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)