nerves-keyboard / xebow

Firmware for the Keybow written in Elixir
40 stars 10 forks source link

Add Engine tests back #122

Closed vanvoljg closed 4 years ago

vanvoljg commented 4 years ago

This adds several tests for the engine back in.

Unregistration tests were slightly tricky because of the GenServer. There is a slight chance that multiple :render messages could be sent to the engine between the time unregister_paintable/1 is called and the time the paintable is actually removed from the engine. This means that possibly more than one frame could still get rendered using a paintable which has been requested for unregistration. This is really only an issue I've seen if an animation is set to render with a 0 delay, though.

I would like to make sure we're all okay with the method I used to test, which accounts for this multiple frame possibility. See engine_test.exs at L229 for usage and L88 for method.

I didn't add tests for configurables because I think those would be better removed from the engine to try and keep it as streamlined as possible. Configurables only get touched when the animation changes, which is more of a Xebow application concern at the moment.

This also removes LEDs from the Engine, so it no longer needs to be started up with the list of LEDs.

Resolves #69