diff options
| author | capellancitizen <thecapellancitizen@gmail.com> | 2024-08-14 19:40:42 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-14 19:40:42 -0400 |
| commit | f3a3cde71e9312d1f07c156033de5b7fb4b99f2d (patch) | |
| tree | ff47b266848c0233bca8eca067944a672c9095b8 /tests/test_lib_svg_svg.py | |
| parent | 744da960b3c96260243fc54a4f837422f6a4c0ac (diff) | |
Clones now also clone commands attached to element and its children. (#3032, #3121) (#3086)
Diffstat (limited to 'tests/test_lib_svg_svg.py')
| -rw-r--r-- | tests/test_lib_svg_svg.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/test_lib_svg_svg.py b/tests/test_lib_svg_svg.py new file mode 100644 index 00000000..1d873fb2 --- /dev/null +++ b/tests/test_lib_svg_svg.py @@ -0,0 +1,40 @@ +from lib.svg.svg import point_upwards + +from inkex import Rectangle, Transform, PathElement +from inkex.tester import TestCase +from inkex.tester.svg import svg + + +class LibSvgSvgTest(TestCase): + def test_point_upwards(self): + root = svg() + rect = root.add(Rectangle(attrib={ + "width": "10", + "height": "10", + "x": "10", + "y": "20" + })) + rect.transform = Transform().add_rotate(-45) + + point_upwards(rect) + + self.assertTransformEqual( + rect.transform, + Transform().add_translate(Transform().add_rotate(-45).apply_to_point((10, 20))), + 4 + ) + + def test_point_upwards_mirrored(self): + root = svg() + rect = root.add(PathElement(attrib={ + "d": "M 0,0 L 10,0 0,5 Z", + })) + rect.transform = Transform().add_rotate(-45).add_scale(-1, 1) + + point_upwards(rect) + + self.assertTransformEqual( + rect.transform, + Transform(), + 4 + ) |
