summaryrefslogtreecommitdiffstats
path: root/share/extensions/tests/test_interp_att_g.py
blob: 4f07e5224a07b9574567192fe175bd5ce71db69a (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
#!/usr/bin/env python
# coding=utf-8
from interp_att_g import InterpAttG
from inkex.tester import ComparisonMixin, TestCase


class InterpAttGBasicTest(ComparisonMixin, TestCase):
    effect_class = InterpAttG
    comparisons = [("--id=layer1", "--att=style/fill")]


class InterpAttGMultipleSelectedTest(ComparisonMixin, TestCase):
    effect_class = InterpAttG
    comparisons = [("--id=c1", "--id=c2", "--id=c3", "--att=style/fill")]


class InterpAttGColorRoundingTest(ComparisonMixin, TestCase):
    effect_class = InterpAttG
    compare_file = "svg/group_interpolate.svg"
    comparisons = [
        # test for truncating/rounding bug inbox#1892
        ("--id=g53", "--att=style/fill", "--start-val=#181818", "--end-val=#000000"),
        # test for clipping of values <= 1
        ("--id=g53", "--att=style/fill", "--start-val=#050505", "--end-val=#000000"),
    ]


class InterpAttGOtherAttributeTest(ComparisonMixin, TestCase):
    # interpolate other values (test base.arg_class)
    effect_class = InterpAttG
    compare_file = "svg/group_interpolate.svg"
    comparisons = [
        (
            "--id=g53",
            "--att=other",
            "--att-other=width",
            "--start-val=5",
            "--end-val=10",
            "--att-other-type=ValueInterpolator",
        ),
        (
            "--id=g53",
            "--att=other",
            "--att-other=fill",
            "--att-other-where=style",
            "--start-val=red",
            "--end-val=green",
            "--att-other-type=ColorInterpolator",
        ),
    ]


class InterpAttGTransformInterpolateTest(ComparisonMixin, TestCase):
    effect_class = InterpAttG
    compare_file = "svg/group_interpolate.svg"
    comparisons = [
        ("--id=g53", "--att=transform/scale", "--start-val=0.2", "--end-val=0.9"),
        ("--id=g53", "--att=transform/trans-x", "--start-val=0", "--end-val=20"),
    ]


class InterpAttGUnitsTest(ComparisonMixin, TestCase):
    effect_class = InterpAttG
    compare_file = "svg/group_interpolate.svg"
    comparisons = [
        ("--id=g53", "--att=width", "--start-val=0.02", "--end-val=0.1", "--unit=mm")
    ]