Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests for Collage module #162

Closed
jazmit opened this issue Feb 6, 2015 · 2 comments
Closed

Tests for Collage module #162

jazmit opened this issue Feb 6, 2015 · 2 comments

Comments

@jazmit
Copy link
Contributor

jazmit commented Feb 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?

@jazmit jazmit changed the title Testing tool for graphical interfaces Tests for Collage module Feb 6, 2015
@TheSeamau5
Copy link
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 20

Processingjs:

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)

@evancz
Copy link
Member

evancz commented May 11, 2016

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.

@evancz evancz closed this as completed May 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants