Skip to content

Commit

Permalink
Add renderForSpecs
Browse files Browse the repository at this point in the history
  • Loading branch information
pjcozzi committed Feb 5, 2014
1 parent 55425da commit 4c28451
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
13 changes: 3 additions & 10 deletions Specs/Scene/ModelSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ defineSuite([

waitsFor(function() {
// Render scene to progressively load the model
scene.initializeFrame();
scene.render();
scene.renderForSpecs();
return duckReadyToRender;
}, 'duckModel.readyToRender', 10000);
});
Expand All @@ -72,16 +71,10 @@ defineSuite([
});

it('renders the duck', function() {
scene.initializeFrame();
scene.render();
expect(scene.getContext().readPixels()).toEqual([0, 0, 0, 255]);
expect(scene.renderForSpecs()).toEqual([0, 0, 0, 255]);

duckModel.show = true;

scene.initializeFrame();
scene.render();
expect(scene.getContext().readPixels()).not.toEqual([0, 0, 0, 255]);

expect(scene.renderForSpecs()).not.toEqual([0, 0, 0, 255]);
duckModel.show = false;
});

Expand Down
11 changes: 10 additions & 1 deletion Specs/createScene.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@ define([
options = clone(defaultValue(options, {}));
options.webgl = clone(defaultValue(options.webgl, {}));
options.webgl.antialias = defaultValue(options.webgl.antialias, false);
return new Scene(createCanvas(), options);
var scene = new Scene(createCanvas(), options);

// Add functions for test
scene.renderForSpecs = function() {
scene.initializeFrame();
scene.render();
return scene.getContext().readPixels();
};

return scene;
}

return createScene;
Expand Down

0 comments on commit 4c28451

Please sign in to comment.