Mercurial > code > home > repos > light9
annotate light9/effect/sequencer/eval_faders_test.py @ 2188:9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
and callers have to effect_eval them. Still not sure what SimpleOutputs does.
author | drewp@bigasterisk.com |
---|---|
date | Sat, 20 May 2023 14:49:15 -0700 |
parents | |
children | 51c670ce5d50 |
rev | line source |
---|---|
2188
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
1 from unittest import mock |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
2 from light9.effect.sequencer.eval_faders import FaderEval |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
3 from light9.effect.settings import DeviceSettings |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
4 from light9.mock_syncedgraph import MockSyncedGraph |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
5 from light9.namespaces import L9 |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
6 |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
7 |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
8 PREFIXES = ''' |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
9 @prefix : <http://light9.bigasterisk.com/> . |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
10 @prefix effect: <http://light9.bigasterisk.com/effect/> . |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
11 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
12 @prefix show: <http://light9.bigasterisk.com/show/dance2023/> . |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
13 @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
14 @prefix dev: <http://light9.bigasterisk.com/theater/test/device/> . |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
15 @prefix dmxA: <http://light9.bigasterisk.com/output/dmxA/> . |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
16 ''' |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
17 |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
18 NOTE_GRAPH = PREFIXES + ''' |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
19 :brightness |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
20 a :DeviceAttr; |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
21 rdfs:label "brightness"; |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
22 :dataType :scalar . |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
23 |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
24 :strength |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
25 a :EffectAttr; |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
26 rdfs:label "strength" . |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
27 |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
28 :SimpleDimmer |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
29 a :DeviceClass; |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
30 rdfs:label "SimpleDimmer"; |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
31 :deviceAttr :brightness; |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
32 :attr [ :outputAttr :level; :dmxOffset 0 ] . |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
33 |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
34 :light1 |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
35 a :SimpleDimmer; |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
36 :dmxUniverse dmxA:; |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
37 :dmxBase 178 . |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
38 |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
39 effect:effect1 |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
40 a :EffectClass; |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
41 :setting effect:effect1_set1 . |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
42 effect:effect1_set1 |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
43 :device :light1; |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
44 :deviceAttr :brightness; |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
45 :scaledValue 0.5 . |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
46 :fade1 |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
47 a :Fader; |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
48 :effectClass effect:effect1; |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
49 :effectAttr :strength; |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
50 :value 0.6 . |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
51 |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
52 ''' |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
53 |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
54 class TestFaderEval: |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
55 def test_faderValueScalesEffectSettings(self): |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
56 g = MockSyncedGraph(NOTE_GRAPH) |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
57 sender = mock.MagicMock() |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
58 |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
59 f = FaderEval(g, sender) |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
60 devSettings = f._computeOutput() |
9fc653ee7fff
WIP redoing how Note works. The new Note outputs EffectSettings only,
drewp@bigasterisk.com
parents:
diff
changeset
|
61 assert devSettings == DeviceSettings(g, [(L9['light1'], L9['brightness'], 0.3)]) |