Add test for designspaceLib.types.Range dataclass
test for https://github.com/fonttools/fonttools/pull/2597
This commit is contained in:
parent
62eaac651e
commit
619e55d72a
3
NEWS.rst
3
NEWS.rst
@ -1,5 +1,6 @@
|
|||||||
- [designspaceLib] Fixed typo in ``deepcopyExceptFonts`` method, preventing font
|
- [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)
|
4.33.2 (released 2022-04-22)
|
||||||
----------------------------
|
----------------------------
|
||||||
|
@ -18,6 +18,7 @@ from fontTools.designspaceLib import (
|
|||||||
posix,
|
posix,
|
||||||
processRules,
|
processRules,
|
||||||
)
|
)
|
||||||
|
from fontTools.designspaceLib.types import Range
|
||||||
from fontTools.misc import plistlib
|
from fontTools.misc import plistlib
|
||||||
|
|
||||||
|
|
||||||
@ -1055,3 +1056,11 @@ def test_deepcopyExceptFonts():
|
|||||||
assert ds.tostring() == ds_copy.tostring()
|
assert ds.tostring() == ds_copy.tostring()
|
||||||
assert ds.sources[0].font is ds_copy.sources[0].font
|
assert ds.sources[0].font is ds_copy.sources[0].font
|
||||||
assert ds.sources[1].font is ds_copy.sources[1].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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user