Hi,
I want to load an image in a test to compare it against a canvas image data. Therefore I have to make sure images are fully loaded until I proceed with my expectations. In Jasmin 1.x this was pretty straightforward as i could just waitFor img.complete.
How do I accomplish the same thing with the done callbacks of Jasmine 2.x?
Here is an example code snippet, that fails randomly due to image not loaded in time.
it("should display single phase", function () {
var expected = new Image();
expected.src
= "base/test/img/canvas.png";
// wait for the image to load....
var canvas = $('.canvas').get(0);
var actual = canvas.getContext('2d').getImageData(0,0,canvas.width, canvas.height);
expect(actual).toImageDiffEqual(expected, 2);
});
Cheers
Alexander