Newer
Older
pixi.js / tools / integration-tests / test / renders / index.js
@Ivan Popelyshev Ivan Popelyshev on 9 Jan 2018 1 KB Fixes CanvasRenderer (#4588)
const { Renderer } = require('@internal/renders');
const path = require('path');

// TODO: disable for now until we get the canvas version up and running again!
describe('renders', function ()
{
    before(function ()
    {
        this.renderer = new Renderer();
        this.validate = function (id, done)
        {
            const code = path.join(__dirname, 'tests', `${id}.js`);
            const solution = path.join(__dirname, 'solutions', `${id}.json`);

            this.renderer.compare(code, solution, (err, success) =>
            {
                if (err)
                {
                    assert(false, err.message);
                }
                assert(success, 'Render not successful');
                done();
            });
        };
    });

    beforeEach(function ()
    {
        this.renderer.clear();
    });

    after(function ()
    {
        this.renderer.destroy();
        this.renderer = null;
        this.validate = null;
    });

    it('should draw a rectangle', function (done)
    {
        this.validate('graphics-rect', done);
    });

    it('should draw a sprite', function (done)
    {
        this.validate('sprite-new', done);
    });
});