mirror of
https://github.com/gumyr/build123d.git
synced 2025-12-05 18:20:46 -08:00
make_text: add enum and ValueError tests
This commit is contained in:
parent
bc13d05c91
commit
d2d979cde0
3 changed files with 13 additions and 2 deletions
|
|
@ -325,7 +325,10 @@ class Compound(Mixin3D, Shape[TopoDS_Compound]):
|
|||
}[font_style]
|
||||
|
||||
if text_align[0] not in [TextAlign.LEFT, TextAlign.CENTER, TextAlign.RIGHT]:
|
||||
raise ValueError("Horizontal TextAlign must be LEFT, CENTER, or RIGHT")
|
||||
raise ValueError(
|
||||
"Horizontal TextAlign must be LEFT, CENTER, or RIGHT. "
|
||||
f"Got {text_align[0]}"
|
||||
)
|
||||
|
||||
if text_align[1] not in [
|
||||
TextAlign.BOTTOM,
|
||||
|
|
@ -334,7 +337,8 @@ class Compound(Mixin3D, Shape[TopoDS_Compound]):
|
|||
TextAlign.TOPFIRSTLINE,
|
||||
]:
|
||||
raise ValueError(
|
||||
"Vertical TextAlign must be BOTTOM, CENTER, TOP, or TOPFIRSTLINE"
|
||||
"Vertical TextAlign must be BOTTOM, CENTER, TOP, or TOPFIRSTLINE. "
|
||||
f"Got {text_align[1]}"
|
||||
)
|
||||
|
||||
horiz_align = {
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ class TestEnumRepr(unittest.TestCase):
|
|||
Side,
|
||||
SortBy,
|
||||
Transition,
|
||||
TextAlign,
|
||||
Unit,
|
||||
Until,
|
||||
]
|
||||
|
|
|
|||
|
|
@ -370,6 +370,12 @@ class TestBuildSketchObjects(unittest.TestCase):
|
|||
self.assertEqual(len(test.sketch.faces()), 4)
|
||||
self.assertEqual(t.faces()[0].normal_at(), Vector(0, 0, 1))
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
Text("test", 2, text_align=(TextAlign.BOTTOM, TextAlign.BOTTOM))
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
Text("test", 2, text_align=(TextAlign.LEFT, TextAlign.LEFT))
|
||||
|
||||
def test_trapezoid(self):
|
||||
with BuildSketch() as test:
|
||||
t = Trapezoid(6, 2, 63.434948823)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue