def test_override_bounds(): # Test that the view box gets set correctly. paper = Paper() paper.override_bounds(0, 0, 8, 11) # The view box is transformed into svg coordinates by flipping the # Y-coordinate and adjusting for height. svg_data = paper.format_svg() assert 'viewBox="0 -11 8 11"' in svg_data paper.override_bounds(-10, -10, 10, 10) svg_data = paper.format_svg() assert 'viewBox="-10 -10 20 20"' in svg_data
def test_text_merge(): p = Pen() p.move_to((0, 0)) p.text('abcd', 1) paper1 = p.paper assert '<text' in paper1.format_svg(0) paper2 = Paper() paper2.merge(paper1) assert '<text' in paper2.format_svg(0) paper3 = Paper() paper3.merge_under(paper1) assert '<text' in paper3.format_svg(0)
def test_format_empty_bounds(): paper = Paper() svg_data = paper.format_svg() assert 'viewBox="-10 -10 20 20"' in svg_data