From 62d2151db08a97f049db14efaa0945b17a2c32a1 Mon Sep 17 00:00:00 2001 From: Darren Burns Date: Mon, 28 Oct 2024 15:19:14 +0000 Subject: [PATCH] Fix some tests --- src/textual/color.py | 27 --------------------------- tests/test_markdown.py | 2 +- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/src/textual/color.py b/src/textual/color.py index d567e79c2c..2de8aa1bf5 100644 --- a/src/textual/color.py +++ b/src/textual/color.py @@ -584,33 +584,6 @@ def lighten(self, amount: float, alpha: float | None = None) -> Color: """ return self.darken(-amount, alpha) - @lru_cache(maxsize=1024) - def tint(self, color: Color) -> Color: - """Apply a tint to a color. - - Similar to blend, but preserves the alpha of the original. - - Args: - color: A color with alpha component. - - Returns: - New color - """ - if color.ansi is not None: - return color - r2, g2, b2, a2, _ = color - if a2 <= 0: - return self - if a2 >= 1: - return color - r1, g1, b1, a1, _ = self - return Color( - int(r1 * a1 + (r2 - r1) * a2), - int(g1 * a1 + (g2 - g1) * a2), - int(b1 * a1 + (b2 - b1) * a2), - max(1.0, a1 + a2), - ) - @lru_cache(maxsize=1024) def get_contrast_text(self, alpha: float = 0.95) -> Color: """Get a light or dark color that best contrasts this color, for use with text. diff --git a/tests/test_markdown.py b/tests/test_markdown.py index 01ee498a5c..4d1214c0d8 100644 --- a/tests/test_markdown.py +++ b/tests/test_markdown.py @@ -213,5 +213,5 @@ def on_markdown_link_clicked(self, message: Markdown.LinkClicked): app = MyApp() async with app.run_test() as pilot: - await pilot.click(Markdown, offset=(0, 0)) + await pilot.click(Markdown, offset=(3, 0)) assert links == ["tété"]