Esempio n. 1
0
    def test_absolute(self):
        """Paths can be converted to absolute"""
        ret = Path("M 100 100 l 10 10 10 10 10 10")
        self._assertPath(ret.to_absolute(),
                         "M 100 100 L 110 110 L 120 120 L 130 130")

        ret = Path("M 100 100 h 10 10 10 v 10 10 10")
        self._assertPath(ret.to_absolute(),
                         "M 100 100 H 110 H 120 H 130 V 110 V 120 V 130")

        ret = Path("M 150,150 a 76,55 0 1 1 283,128")
        self._assertPath(ret.to_absolute(), "M 150 150 A 76 55 0 1 1 433 278")

        ret = Path(
            "m 5 5 h 5 v 5 h -5 z M 15 15 l 5 5 z m 10 10 h 5 v 5 h -5 z")
        self._assertPath(
            ret.to_absolute(),
            "M 5 5 H 10 V 10 H 5 Z M 15 15 L 20 20 Z M 25 25 H 30 V 30 H 25 Z")

        ret = Path("m 1 2 h 2 v 1 z m 4 0 h 2 v 1 z m 0 2 h 2 v 1 z")
        self._assertPath(ret.to_absolute(),
                         "M 1 2 H 3 V 3 Z M 5 2 H 7 V 3 Z M 5 4 H 7 V 5 Z")
Esempio n. 2
0
 def test_scale_multiple_zones(self):
     """Zone close returns current position to start of zone (not start of path)"""
     ret = Path("M 100 100 Z M 200 200 Z h 0").scale(1, 1)
     self._assertPath(ret.to_absolute(),
                      "M 100 100 Z M 200 200 Z L 200 200")