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

Gamelab: enable custom marshaling of SpriteSheet #24796

Merged
merged 2 commits into from
Sep 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/src/gamelab/GameLabP5.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ GameLabP5.prototype.getCustomMarshalObjectList = function () {
{ instance: window.p5 },
{ instance: this.p5.Camera },
{ instance: this.p5.Animation },
{ instance: this.p5.SpriteSheet },
{ instance: window.p5.Vector },
{ instance: window.p5.Color },
{ instance: window.p5.Image },
Expand Down
31 changes: 31 additions & 0 deletions apps/test/integration/levelSolutions/gamelab/custom_marshal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import {gamelabLevelDefinition} from '../../gamelabLevelDefinition';
import {testAsyncProgramGameLab} from '../../util/levelTestHelpers';

// These tests force us to custom marshal p5 objects properly, and are
// written to fail if they are improperly marshaled.
module.exports = {
app: "gamelab",
skinId: "gamelab",
levelDefinition: gamelabLevelDefinition,
tests: [
testAsyncProgramGameLab(
'Game Lab custom marshal SpriteSheet returned from loadSpriteSheet()',
`
// create empty SpriteSheet with no images or frames
var spriteSheet = loadSpriteSheet();
// loadAnimation() will error out if we try to pass in an improperly
// marshaled SpriteSheet object.
var animation = loadAnimation(spriteSheet);
console.log('done');
`,
function isProgramDone() {
const debugOutput = document.getElementById('debug-output').textContent;
return debugOutput.includes('done');
},
function validateResult(assert) {
const debugOutput = document.getElementById('debug-output').textContent;
assert.notInclude(debugOutput, 'function');
}
),
]
};