view src/light9/effect/effect_function_library_test.py @ 2376:4556eebe5d73

topdir reorgs; let pdm have its src/ dir; separate vite area from light9/
author drewp@bigasterisk.com
date Sun, 12 May 2024 19:02:10 -0700
parents light9/effect/effect_function_library_test.py@972a54f99b2c
children
line wrap: on
line source

from light9.effect.effect_function_library import EffectFunctionLibrary
from light9.mock_syncedgraph import MockSyncedGraph

PREFIXES = '''
@prefix : <http://light9.bigasterisk.com/> .
@prefix dev: <http://light9.bigasterisk.com/theater/test/device/> .
@prefix effect: <http://light9.bigasterisk.com/effect/> .
@prefix func: <http://light9.bigasterisk.com/effectFunction/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
'''

GRAPH = PREFIXES + '''

    func:scale
        a :EffectFunction;
        rdfs:label "a submaster- scales :deviceSettings";
        :input
            [ :effectAttr :strength; :defaultValue 0.0 ],
            [ :effectAttr :deviceSettings; ] . # e.g. "par2 at color=red; par3 at color=white"

    func:strobe
        a :EffectFunction;
        rdfs:label "blink specified devices";
        :input
            [ :effectAttr :strength; :defaultValue 0.0 ],
            [ :effectAttr :period; :defaultValue 0.5 ],
            [ :effectAttr :onTime; :defaultValue 0.1 ],
            [ :effectAttr :deviceSettings ] .
'''


class TestParsesGraph:

    def test(self):
        g = MockSyncedGraph(GRAPH)
        lib = EffectFunctionLibrary(g)
        assert len(lib.funcs) == 2