mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add tests for negative number hsl handling, normalise degrees to range 0-1
This commit is contained in:
committed by
Will McGugan
parent
adcce9d58f
commit
9c7d7b703e
@@ -1,5 +1,4 @@
|
||||
import pytest
|
||||
|
||||
from rich.color import Color as RichColor
|
||||
from rich.text import Text
|
||||
|
||||
@@ -136,6 +135,15 @@ def test_color_parse_clamp(input, output):
|
||||
assert Color.parse(input) == output
|
||||
|
||||
|
||||
def test_color_parse_hsl_negative_degrees():
|
||||
assert Color.parse("hsl(-90, 50%, 50%)") == Color.parse("hsl(270, 50%, 50%)")
|
||||
|
||||
|
||||
def test_color_parse_hsla_negative_degrees():
|
||||
assert Color.parse("hsla(-45, 50%, 50%, 0.2)") == Color.parse(
|
||||
"hsla(315, 50%, 50%, 0.2)")
|
||||
|
||||
|
||||
def test_color_parse_color():
|
||||
# as a convenience, if Color.parse is passed a color object, it will return it
|
||||
color = Color(20, 30, 40, 0.5)
|
||||
|
||||
Reference in New Issue
Block a user