From bcab8da6f8022134e93e80fab0466681e4633219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=AE=D1=80=D0=B8?= =?UTF-8?q?=D0=B9?= Date: Tue, 28 Nov 2023 00:54:42 +0300 Subject: [PATCH] 2.0.0 - Material Design 3 Fix test according to the new API. --- kivymd/tests/label/test_font_style.py | 34 ++++++++++++++++++++------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/kivymd/tests/label/test_font_style.py b/kivymd/tests/label/test_font_style.py index 9258d1150..b96cdedbd 100644 --- a/kivymd/tests/label/test_font_style.py +++ b/kivymd/tests/label/test_font_style.py @@ -3,9 +3,9 @@ from kivy.clock import Clock from kivy.core.text import LabelBase from kivy.lang import Builder +from kivy.metrics import sp from kivymd.app import MDApp -from kivymd.font_definitions import theme_font_styles KV = """ MDScreen: @@ -14,6 +14,7 @@ id: label text: "Danger" font_style: "Danger" + role: "large" halign: "center" font_size: "66sp" """ @@ -30,18 +31,33 @@ def build(self): ), ) - theme_font_styles.append("Danger") - self.theme_cls.font_styles["Danger"] = [ - "Danger", - 66, - False, - 0.15, - ] + self.theme_cls.font_styles["Danger"] = { + "large": { + "line-height": 1.64, + "font-name": "Danger", + "font-size": sp(57), + }, + "medium": { + "line-height": 1.52, + "font-name": "Danger", + "font-size": sp(45), + }, + "small": { + "line-height": 1.44, + "font-name": "Danger", + "font-size": sp(36), + }, + } return Builder.load_string(KV) def on_start(self): def on_start(*args): - assert 100 < self.root.ids.label.texture_size[1] + assert ( + sp(57) + == self.theme_cls.font_styles["Danger"][ + self.root.ids.label.role + ]["font-size"] + ) self.stop() Clock.schedule_once(on_start, 2)