def test_translation(): pt = PathCanvas() pt.move_to(100, 100) pt.translate(1000, 2000) pt.line_to(10, 20) assert pt.paths == [ Path([Point(100.0, 100.0), Point(1010.0, 2020.0)]), ]
def test_rel_line_to(): pt = PathCanvas() pt.translate(1000, 2000) pt.move_to(0, 0) pt.rel_line_to(100, 200) assert pt.paths == [ Path([Point(1000.0, 2000.0), Point(1100.0, 2200.0)]), ]
def test_save_restore(): pt = PathCanvas() pt.move_to(100, 100) pt.translate(1000, 2000) pt.line_to(10, 20) pt.save() pt.translate(1, 2) pt.move_to(1, 2) pt.line_to(2, 4) pt.restore() pt.move_to(1, 2) pt.line_to(2, 4) assert pt.paths == [ Path([Point(100.0, 100.0), Point(1010.0, 2020.0)]), Path([Point(1002.0, 2004.0), Point(1003.0, 2006.0)]), Path([Point(1001.0, 2002.0), Point(1002.0, 2004.0)]), ]