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 background gradient #70

Merged
merged 5 commits into from
Mar 4, 2012

Conversation

SunboX
Copy link

@SunboX SunboX commented Mar 4, 2012

Is this the right way to test gradient generation? Did I miss something?

niklasvh added a commit that referenced this pull request Mar 4, 2012
@niklasvh niklasvh merged commit c6ec656 into niklasvh:master Mar 4, 2012
@niklasvh
Copy link
Owner

niklasvh commented Mar 4, 2012

It doesn't test whether the steps are correct or whether the correct colors are drawn though?

@SunboX
Copy link
Author

SunboX commented Mar 4, 2012

Of curse, this will need to rewrite Generator.Canvas code. Would be the next step i will do. Than it´s possible to write new tests. But this one will check if it renders "something" or fails (blank image). Is this ok by now?
Should this code be moved to a new test,js file? Cause it´s not CSS "module" but "Generator" instead?

@niklasvh
Copy link
Owner

niklasvh commented Mar 4, 2012

I think the test should first check whether it should even be generating a gradient. For example, if you use an IE<=9 browser, it shouldn't even be drawing a gradient, so it should just pass by not doing anything.

Something similar to if (background_image.substring(0,7) === "-webkit" || background_image.substring(0,3) === "-o-" || background_image.substring(0,4) === "-moz") {

(which would be lot better done in regexp to be fair... i'll need to update that check in preload.js :->)

It could be moved to its own file/module as well. Other than that, so far so good :)

@SunboX
Copy link
Author

SunboX commented Mar 4, 2012

Ok, will look into this a bit more

@SunboX
Copy link
Author

SunboX commented Mar 4, 2012

regexp could be:

if (/^(-webkit|-o|-moz|-ms|linear)-/.test(background_image)) {

@niklasvh
Copy link
Owner

niklasvh commented Mar 4, 2012

I updated the tests/preload accordingly. It skips the test now for browsers that don't support gradients

@SunboX
Copy link
Author

SunboX commented Mar 4, 2012

moved Generate tests into own module and fixed some small things:
https://github.com/SunboX/html2canvas/commits/tests-background-gradient

Will look into color-stops this week (+ add some tests)

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

Successfully merging this pull request may close these issues.

2 participants