Skip to content

Commit

Permalink
Merge pull request #124 from GreyRook/fix-scale-container-test
Browse files Browse the repository at this point in the history
Fix scale container test to load image async
  • Loading branch information
brean authored Oct 4, 2018
2 parents 62c06b1 + 9151b5e commit 3f8824c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions test/utils/ScaleContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@ describe("test scalable/tilable container", function() {
}).throw();
});

it("make sure calculations are correct", function() {
it("make sure calculations are correct", async function() {
var image = new Image();

var loader = GOWN.loader;
async function loadImage(){
return new Promise(function(resolve, reject){
image.onload = resolve;
image.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAIAAAAmdTLBAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3wMCCxAuWFRGfgAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAAOElEQVQ4y2P8z4APMP6HYJyAiYEyMKp/ZOtnYWDAl7z+MzDiTX4MjP8bGvBIN9ZD8Gj4j+qniX4AnXcKKJynPUsAAAAASUVORK5CYII=";
})
}

await loadImage()

var image = new Image();
image.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAIAAAAmdTLBAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3wMCCxAuWFRGfgAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAAOElEQVQ4y2P8z4APMP6HYJyAiYEyMKp/ZOtnYWDAl7z+MzDiTX4MjP8bGvBIN9ZD8Gj4j+qniX4AnXcKKJynPUsAAAAASUVORK5CYII=";

var baseTexture = new PIXI.BaseTexture(image);
var texture = new PIXI.Texture(baseTexture);
Expand All @@ -39,7 +45,6 @@ describe("test scalable/tilable container", function() {
expect(scale.cm.width).equal(80);
expect(scale.cm.height).equal(180);


//TODO: also use imagediff to check images
});

Expand Down

0 comments on commit 3f8824c

Please sign in to comment.