Add test for designspaceLib.types.Range dataclass

test for https://github.com/fonttools/fonttools/pull/2597
This commit is contained in:
Cosimo Lupo 2022-04-26 10:50:36 +01:00
parent 62eaac651e
commit 619e55d72a
2 changed files with 11 additions and 1 deletions

View File

@ -1,5 +1,6 @@
- [designspaceLib] Fixed typo in ``deepcopyExceptFonts`` method, preventing font
references to be transferred (#2600).
references to be transferred (#2600). Fixed another typo in the name of ``Range``
dataclass's ``__post_init__`` magic method (#2597).
4.33.2 (released 2022-04-22)
----------------------------

View File

@ -18,6 +18,7 @@ from fontTools.designspaceLib import (
posix,
processRules,
)
from fontTools.designspaceLib.types import Range
from fontTools.misc import plistlib
@ -1055,3 +1056,11 @@ def test_deepcopyExceptFonts():
assert ds.tostring() == ds_copy.tostring()
assert ds.sources[0].font is ds_copy.sources[0].font
assert ds.sources[1].font is ds_copy.sources[1].font
def test_Range_post_init():
# test min and max are sorted and default is clamped to either min/max
r = Range(minimum=2, maximum=-1, default=-2)
assert r.minimum == -1
assert r.maximum == 2
assert r.default == -1