Example #1
0
 def test_do_not_continue_stroke_automatically(self):
     result = []
     word = self.make_text(tl.Stroke.UNDERLINE, result)
     space = tl.Space(width=0.5)
     tl.render_text_strokes([word, space, word])
     assert len(result) == 2
     assert result[0] == "STROKE(UNDERLINE, 3.0)", "do not continue stroke"
Example #2
0
 def render_text(stroke, result):
     text = tl.Text(width=3,
                    height=1,
                    stroke=stroke,
                    renderer=StrokeRender("STROKE", result))
     text.place(0, 0)
     tl.render_text_strokes([text])
Example #3
0
 def test_continue_stroke_across_one_space(self):
     result = []
     word = self.make_text(tl.Stroke.UNDERLINE + tl.Stroke.CONTINUE, result)
     space = tl.Space(width=0.5)
     tl.render_text_strokes([word, space, word])
     assert len(result) == 2
     assert result[
         0] == "STROKE(UNDERLINE, 3.5)", "space should be included"
     assert result[1] == "STROKE(UNDERLINE, 3.0)", "no following space"
Example #4
0
 def test_continue_stroke_across_multiple_spaces(self):
     result = []
     word = self.make_text(tl.Stroke.UNDERLINE + tl.Stroke.CONTINUE, result)
     space = tl.Space(width=0.5)
     nbsp = tl.NonBreakingSpace(width=0.5)
     tl.render_text_strokes([word, space, nbsp, space, word])
     assert len(result) == 2
     assert (result[0] == "STROKE(UNDERLINE, 4.5)"
             ), "3 spaces should be included"
     assert result[1] == "STROKE(UNDERLINE, 3.0)", "no following spaces"