Skip to content

Commit

Permalink
fix demo for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Aug 12, 2015
1 parent a48d219 commit 5e6b22b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions demo/js/Demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@

// use the engine tick event to control our view
_sceneEvents.push(
Events.on(_runner, 'beforeTick', function() {
Events.on(_engine, 'beforeTick', function() {
var world = _engine.world,
mouse = _mouseConstraint.mouse,
render = _engine.render,
Expand Down Expand Up @@ -1738,7 +1738,7 @@
Events.off(_world, _sceneEvents[i]);
}

if (_runner.events) {
if (_runner && _runner.events) {
for (i = 0; i < _sceneEvents.length; i++)
Events.off(_runner, _sceneEvents[i]);
}
Expand Down
9 changes: 4 additions & 5 deletions test/browser/TestDemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var update = arg('--update'),
updateAll = typeof arg('--updateAll') !== 'undefined',
diff = arg('--diff');

var resurrect = new Resurrect({ cleanup: true }),
var resurrect = new Resurrect({ cleanup: true, revive: false }),
created = [],
changed = [];

Expand Down Expand Up @@ -60,12 +60,11 @@ var test = function(status) {
}, demo);

var worldEnd = page.evaluate(function(demo, frames) {
var engine = Matter.Demo._engine;
var engine = Matter.Demo._engine,
runner = Matter.Runner.create();

for (var j = 0; j <= frames; j += 1) {
Matter.Events.trigger(engine, 'tick', { timestamp: engine.timing.timestamp });
Matter.Engine.update(engine, engine.timing.delta);
Matter.Events.trigger(engine, 'afterTick', { timestamp: engine.timing.timestamp });
Matter.Runner.tick(runner, engine, j * runner.delta);
}

return engine.world;
Expand Down

0 comments on commit 5e6b22b

Please sign in to comment.