Collection of mostly command line tools / PHP scripts. Somewhat out of date.

⌈⌋ ⎇ branch:  scripts + snippets


Check-in [64ef7120d0]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:more pacing tests
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 64ef7120d08debb9d5449cf8007943bfbe8e54ad
User & Date: mario 2022-10-31 09:37:45
Context
2022-10-31
09:39
changed spline pacing mode: one less iteration to avert last section stuck at 1.0, reset .frame.args.delay just in case (repeat animations, e.g. fg/bg frames) check-in: 483352ece2 user: mario tags: trunk
09:37
more pacing tests check-in: 64ef7120d0 user: mario tags: trunk
2022-10-23
20:02
implement repeatCount, some tests check-in: 58300ed51a user: mario tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to inkscape/pytest.ini.

1
2
3
4
5
6
7
[pytest]
minversion = 1.0
addopts = -ra -q --ignore=test/util.py --ignore=test/_*.py --ignore=test/__*.py  -p no:warnings
testpaths = test/
python_files = *.py
# Yes sure pytest, why not do the obvious thing anyway
python_functions = !_* [a-z]* [A-Z]* !_*


|




1
2
3
4
5
6
7
[pytest]
minversion = 1.0
addopts = -vv -ra -q --ignore=test/util.py --ignore=test/_*.py --ignore=test/__*.py  -p no:warnings
testpaths = test/
python_files = *.py
# Yes sure pytest, why not do the obvious thing anyway
python_functions = !_* [a-z]* [A-Z]* !_*

Changes to inkscape/test/pace.py.

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
























        self.gif = Namespace(
            options = Namespace(
                all_pace = True,
                delay = 10,
            )
        )

@pytest.fixture
def times():
    return [i/10.0 for i in range(0, 11)]

# round result list    
def _roundy(ls):
    return [round(x, 2) for x in ls]


# simple interval 2s-4s within 10s frame
def pace_delay_dur(times):
    anim = AnimTest(begin="2s", dur="4s")
    vary = PaceTest().pace(anim)
    assert _roundy(vary(r) for r in times) == [0.0, 0.0, 0.0, 0.17, 0.33, 0.5, 0.67, 1.0, 1.0, 1.0, 1.0]

# oscillate twice in 10s frame
def pace_repeat(times):
    anim = AnimTest(begin="0s", dur="10s", repeatCount="2")
    vary = PaceTest().pace(anim)
    assert _roundy(vary(r+0.0000) for r in times) == [0.0, 0.2, 0.4, 0.6, 0.8, 0.0, 0.2, 0.4, 0.6, 0.8, 0.0]
    assert _roundy(vary(r-0.0001) for r in times) == [0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 0.2, 0.4, 0.6, 0.8, 1.0]
































<
<
<
|
<
|
|



|


|


|


|
|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
        self.gif = Namespace(
            options = Namespace(
                all_pace = True,
                delay = 10,
            )
        )




# apply callback to r_time list, and round to two decimals

def _roundy_times(vary, max=10, xd=0.0):
    return [round(vary(r/max + xd), 2) for r in range(0, max+1)]


# simple interval 2s-4s within 10s frame
def delay_dur():
    anim = AnimTest(begin="2s", dur="4s")
    vary = PaceTest().pace(anim)
    assert _roundy_times(vary, 10) == [0.0, 0.0, 0.0, 0.17, 0.33, 0.5, 0.67, 1.0, 1.0, 1.0, 1.0]

# oscillate twice in 10s frame
def repeat():
    anim = AnimTest(begin="0s", dur="10s", repeatCount="2")
    vary = PaceTest().pace(anim)
    assert _roundy_times(vary, 10, +0.0000) == [0.0, 0.2, 0.4, 0.6, 0.8, 0.0, 0.2, 0.4, 0.6, 0.8, 0.0]
    assert _roundy_times(vary, 10, -0.0001) == [0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 0.2, 0.4, 0.6, 0.8, 1.0]

# combine both
def combo():
    anim = AnimTest(begin="5s", dur="10s", repeatCount="5")
    vary = PaceTest().pace(anim)
    assert _roundy_times(vary, 10) == [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.33, 0.67, 0.0, 0.33, 0.67]

# paced curve
def paced_curve():
    anim = AnimTest(calcMode="paced")
    vary = PaceTest().pace(anim)
    assert _roundy_times(vary, 10) == [0.01, 0.02, 0.05, 0.12, 0.25, 0.45, 0.67, 0.83, 0.92, 0.97, 0.99]

# keytimes, spline
def spline_times():
    anim = AnimTest(calcMode="spline", keyTimes="0; 0.1; 0.8; 1.0")  # a third per ascent 10%+70%+20%, (or back to len+1?)
    vary = PaceTest().pace(anim)
    #print(_roundy_times(vary, 100))
    assert _roundy_times(vary, 100) == [
        0.0, 0.0, 0.01, 0.01, 0.01, 0.02, 0.02, 0.02, 0.02, 0.03, 0.03, 0.03, 0.04, 0.04, 0.04, 0.05, 0.05, 0.05, 0.05, 0.06, 0.06, 0.06, 0.07, 0.07, 0.07, 0.08, 0.08, 0.08, 0.08, 0.09, 0.09, 0.09,
        0.1, 0.1, 0.11, 0.14, 0.16, 0.18, 0.2, 0.22, 0.24, 0.26, 0.28, 0.3, 0.32, 0.35, 0.37, 0.39, 0.41, 0.43, 0.45, 0.47, 0.49, 0.51, 0.53, 0.56, 0.58, 0.6, 0.62, 0.64, 0.66, 0.68, 0.7, 0.72, 0.74, 0.77, 0.79,
        0.8, 0.81, 0.81, 0.82, 0.83, 0.83, 0.84, 0.84, 0.85, 0.86, 0.86, 0.87, 0.87, 0.88, 0.89, 0.89, 0.9, 0.9, 0.91, 0.92, 0.92, 0.93, 0.93, 0.94, 0.95, 0.95, 0.96, 0.96, 0.97, 0.98, 0.98, 0.99, 0.99, 1.0
    ]