def test_translate_1(self): """Check that graphic is translated properly.""" graphic = Graphic(etree.parse("arrow.svg").getroot()) graphic.set_position(0, 0) log.info(graphic.get_position()) assert map(lambda x: round(x, 10), graphic.get_position()) == [0, 0], "Position should be 0,0!"
def test_translate_3(self): """Check that graphic is translated properly twice.""" graphic = Graphic(etree.parse("arrow.svg").getroot()) graphic.set_position(500, 237.21) graphic.set_position(11, 32) assert map(lambda x: round(x, 10), graphic.get_position()) == [11, 32], "Position should be 11,32!"
def test_translate_2(self): """Check that graphic is translated properly.""" graphic = Graphic(etree.parse("arrow.svg").getroot()) graphic.set_position(500, 237.21) f = open("out/arrow_%s.svg" % sys._getframe().f_code.co_name, "w") f.write(graphic.get_xml()) f.close() assert map(lambda x: round(x, 10), graphic.get_position()) == [500, 237.21], "Position should be 500,237.21!"
def test_translate_2(self): """Check that graphic is translated properly.""" graphic = Graphic(etree.parse("arrow.svg").getroot()) graphic.set_position(500, 237.21) f = open("out/arrow_%s.svg" % sys._getframe().f_code.co_name, "w") f.write(graphic.get_xml()) f.close() assert map(lambda x: round(x, 10), graphic.get_position()) == [ 500, 237.21 ], "Position should be 500,237.21!"
def test_changed_flag(self): """Check that changed flag works correctly.""" graphic = Graphic(etree.parse("arrow.svg").getroot()) graphic.reset_changed_flag() graphic.set_mirror_x(True) assert graphic.get_changed_flag(), "Changed flag should be set!" graphic.reset_changed_flag() graphic.set_mirror_x(False) assert graphic.get_changed_flag(), "Changed flag should be set!" graphic.reset_changed_flag() graphic.set_scale(2) assert graphic.get_changed_flag(), "Changed flag should be set!" graphic.reset_changed_flag() graphic.set_rotation(2) assert graphic.get_changed_flag(), "Changed flag should be set!" graphic.reset_changed_flag() graphic.set_position(2, 500) assert not graphic.get_changed_flag(), "Changed flag should not be set!" graphic.reset_changed_flag() graphic.set_weedline(True) assert graphic.get_changed_flag(), "Changed flag should be set!"
def test_changed_flag(self): """Check that changed flag works correctly.""" graphic = Graphic(etree.parse("arrow.svg").getroot()) graphic.reset_changed_flag() graphic.set_mirror_x(True) assert graphic.get_changed_flag(), "Changed flag should be set!" graphic.reset_changed_flag() graphic.set_mirror_x(False) assert graphic.get_changed_flag(), "Changed flag should be set!" graphic.reset_changed_flag() graphic.set_scale(2) assert graphic.get_changed_flag(), "Changed flag should be set!" graphic.reset_changed_flag() graphic.set_rotation(2) assert graphic.get_changed_flag(), "Changed flag should be set!" graphic.reset_changed_flag() graphic.set_position(2, 500) assert not graphic.get_changed_flag( ), "Changed flag should not be set!" graphic.reset_changed_flag() graphic.set_weedline(True) assert graphic.get_changed_flag(), "Changed flag should be set!"