node package manager
Easy collaboration. Discover, share, and reuse code in your team. Create a free org »

pixi-tests-tool

Pixi Tests Tool

Renderer for generating integration tests for Pixi.js.

Build Status

Setup

To install dependencies, use NPM:

npm install

To create solutions for tests, launch the application by navigating to the module in Terminal or on a commandline. Then run:

npm start

Creating Tests

The context of running the tests contains a handful of useful properties:

  • this.stage (PIXI.Container) The container rendered with both Canvas and WebGL renderers.
  • this.webgl (PIXI.WebGLRenderer) Instance of WebGL renderer.
  • this.canvas (PIXI.CanvasRenderer) Instance of Canvas renderer.
  • this.hasWebGL (Boolean) If the current context supports WebGL.

Synchronous Example

module.exports = function() {
    this.stage.addChild(new PIXI.Graphics()
        .beginFill(0xFFCC00, 1)
        .drawRect(8, 8, 16, 16)
    );  
};

Asynchronous Example

module.exports.async = function(done) {
    PIXI.loader
     .add('image1', 'image1.png')
     .once('complete', (loader, resources) => {
     this.stage.addChild(PIXI.Sprite.fromFrame('image1'));
     done();
     })
     .load();
};