Skip to content

Commit

Permalink
Fix sprite tests without texture
Browse files Browse the repository at this point in the history
  • Loading branch information
Trufi committed Dec 16, 2015
1 parent 3707831 commit cf46780
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions test/Sprite.spec.js
Expand Up @@ -4,6 +4,7 @@ import sinon from 'sinon';

import SpriteProgram from '../src/programs/SpriteProgram';
import Object3D from '../src/Object3D';
import Texture from '../src/Texture';

import Sprite from '../src/Sprite';

Expand Down Expand Up @@ -79,14 +80,32 @@ describe('Sprite', () => {
assert.deepEqual(oldMatrix, slice(sprite.worldMatrix));
});

it('should call program enable', () => {
it('should\'t call program enable without texture', () => {
const spy = sinon.spy(program, 'enable');
sprite.render(state);
assert.ok(!spy.called);
});

it('should\'t call program disable without texture', () => {
const spy = sinon.spy(program, 'disable');
sprite.render(state);
assert.ok(!spy.called);
});

it('should call program enable with texture', () => {
const spy = sinon.spy(program, 'enable');
const texture = new Texture({});
sprite.program.setTexture(texture);

sprite.render(state);
assert.ok(spy.calledOnce);
});

it('should call program disable', () => {
it('should call program disable with texture', () => {
const spy = sinon.spy(program, 'disable');
const texture = new Texture({});
sprite.program.setTexture(texture);

sprite.render(state);
assert.ok(spy.calledOnce);
});
Expand Down

0 comments on commit cf46780

Please sign in to comment.