Skip to content

Commit 6fed844

Browse files
committed
Added SpriteSheetLoader tests.
1 parent ec0bef0 commit 6fed844

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

_assets/static/grantp.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
grantp(
2+
{
3+
"frames": {
4+
"width": 200,
5+
"numFrames": 64,
6+
"regX": 2,
7+
"regY": 2,
8+
"height": 361
9+
},
10+
"animations": {"jump": [26, 63], "run": [0, 25]},
11+
"images": ["../_assets/art/runningGrant.png"]
12+
}
13+
)

tests/spec/LoadQueueSpec.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,33 @@ describe("PreloadJS.LoadQueue", function () {
301301
});
302302
});
303303

304+
it("a SpriteSheetLoader should load a SpriteSheet uinsg JSON", function(done) {
305+
var _this = this;
306+
this.queue.addEventListener("complete", function (evt) {
307+
expect(_this.queue.getResult("foo")).toEqual(jasmine.any(createjs.SpriteSheet));
308+
done();
309+
});
310+
this.loadFile({
311+
id:"foo",
312+
src: "static/grant.json",
313+
type: createjs.AbstractLoader.SPRITESHEET
314+
});
315+
});
316+
317+
it("a SpriteSheetLoader should load a SpriteSheet using JSONp", function(done) {
318+
var _this = this;
319+
this.queue.addEventListener("complete", function (evt) {
320+
expect(_this.queue.getResult("foo")).toEqual(jasmine.any(createjs.SpriteSheet));
321+
done();
322+
});
323+
this.loadFile({
324+
id:"foo",
325+
src: "static/grantp.json",
326+
callback:"grantp",
327+
type: createjs.AbstractLoader.SPRITESHEET
328+
});
329+
});
330+
304331
it("should send progress events.", function (done) {
305332
var _this = this;
306333
var callback = function (evt) {

0 commit comments

Comments
 (0)