summaryrefslogtreecommitdiffstats
path: root/share/extensions/tests/test_pathalongpath.py
blob: ab17a212226538940f46d66f538ab7416dafab41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# coding=utf-8
from pathalongpath import PathAlongPath
from inkex.tester import ComparisonMixin, TestCase
from inkex.tester.filters import CompareNumericFuzzy, CompareWithPathSpace


class TestPathAlongPathBasic(ComparisonMixin, TestCase):
    compare_file = "svg/pattern_along_path.svg"
    compare_filters = [CompareNumericFuzzy(), CompareWithPathSpace()]
    comparisons = [
        # Settings: Repeated, Snake, no distance. Tests a path with fillrule=evenodd
        ("--copymode=Repeated", "--kind=Snake", "--id=g3427", "--id=path2551"),
        # Settings: Repeated, Stretched, Ribbon, Vertical.
        # Tests a group pattern with multiple nested transforms
        (
            "--copymode=Repeated, stretched",
            "--kind=Ribbon",
            "--vertical=True",
            "--id=g3961",
            "--id=path10007",
        ),
        # Settings: Repeated, Stretched, Ribbon
        # Tests a group pattern with multiple nested clones
        (
            "--copymode=Repeated, stretched",
            "--kind=Ribbon",
            "--id=g4054",
            "--id=path4056",
        ),
        # Settings: Single, Stretched, Snake, not duplicated.
        # Tests putting a text (converted to a path) on a path and stretching it to fit on the
        # skeleton path
        (
            "--copymode=Single, stretched",
            "--kind=Snake",
            "--id=text4418",
            "--id=path4412",
        ),
        # Settings: Single, Stretched, Snake.
        # Tests selecting multiple sceleton paths, one consisting of multiple subpaths
        (
            "--copymode=Single, stretched",
            "--kind=Snake",
            "--id=path4585",
            "--id=path4608",
            "--id=path4610",
            "--id=path4612",
        ),
        # Settings: Repeated, Stretched, Snake, Space between copies=5, Normal offset=5.
        # Tests putting a path with multiple subpaths with a gradient on a closed path
        (
            "--copymode=Repeated, stretched",
            "--kind=Snake",
            "--noffset=5",
            "--space=5",
            "--id=path2408",
            "--id=path2405",
        ),
    ]
    effect_class = PathAlongPath


class TestPathAlongPathCloneTransforms(ComparisonMixin, TestCase):
    """Tests for issue https://gitlab.com/inkscape/extensions/-/issues/241"""

    effect_class = PathAlongPath
    compare_file = "svg/pattern_along_path_clone_transform.svg"
    comparisons = [
        # a clone with a transform in a group with a transform
        (
            "--copymode=Single",
            "--duplicate=True",
            "--kind=Snake",
            "--id=g5848",
            "--id=path3336",
        )
    ]