Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upTests for Collage module #162
Comments
jazmit
changed the title from
Testing tool for graphical interfaces
to
Tests for Collage module
Feb 6, 2015
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
TheSeamau5
Mar 5, 2015
Contributor
I was wondering, and this is a bit out there as an idea, but, Collage reminds me a lot of Processing.
For example, these two should be equivalent:
Elm:
move (200,200) <|
filled red <|
circle 20Processingjs:
noStroke();
fill(255,0,0);
ellipse(200,200,20,20);In theory we could have unit tests (or properties) where we fabricate equivalent calls and send them to two different canvases (of equal dimensions of course). We then compare the pixels. If we assume that processing is super stable and not buggy (which it probably is after all the time it's been around), then any inconsistencies we get must come from the collage API (assuming the tests are correct).
Since this is visual, we can always see the output of the two as an image (and optionally a diff of the two outputs) and see if the output from the tests make sense.
(I think in processing the origin is at the top-left and +y is down, so obviously we would have to correct for that)
|
I was wondering, and this is a bit out there as an idea, but, For example, these two should be equivalent: Elm: move (200,200) <|
filled red <|
circle 20Processingjs: noStroke();
fill(255,0,0);
ellipse(200,200,20,20);In theory we could have unit tests (or properties) where we fabricate equivalent calls and send them to two different canvases (of equal dimensions of course). We then compare the pixels. If we assume that processing is super stable and not buggy (which it probably is after all the time it's been around), then any inconsistencies we get must come from the collage API (assuming the tests are correct). Since this is visual, we can always see the output of the two as an image (and optionally a diff of the two outputs) and see if the output from the tests make sense. (I think in processing the origin is at the top-left and +y is down, so obviously we would have to correct for that) |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
evancz
May 11, 2016
Member
Sorry this did not get attention til now! The Graphics.* modules now live in evancz/elm-graphics so I am trying to get stuff migrated over there.
Not sure if this makes sense. I expect to be focusing on <canvas> for professional users and "friendly graphics" for learning as separate use cases. Progress will be made when those start happening.
|
Sorry this did not get attention til now! The Not sure if this makes sense. I expect to be focusing on |
jazmit commentedFeb 6, 2015
I was pondering how to add tests for
Collage, and came up with the idea of using node-canvas to render a data-url and comparing it to a known url.This would add another test dependency to core, but would add some comfort in making changes to the Native modules.
Perhaps in future it could be combined with a tool to compare the expected DOM output using js-dom or similar and become a general purpose regression testing tool for Elm.
Is this desirable or should we avoid adding extra dependencies to Core?