node-x11/test/xtest.js
Santiago Gimeno 4508f9e93d Change createClient signature
- The new signature is:

  createClient(options, initCB), where
     - options is an optional object that defines different parameters such as
               display, etc.
     - initCB is an optional callback with the signature: function(err, display)
- The initCB is going to be called with an error ONLY if the connection to the X
  server fails. Further errors in the server connection will be 'emitted'.
- Update tests and test-runner.js accordingly.
- Update README.
2012-12-19 09:34:19 +01:00

44 lines
1.1 KiB
JavaScript

var x11 = require('../lib/x11');
var should = require('should');
var assert = require('assert');
var util = require('util');
describe('XTEST extension', function() {
var display;
var X;
var xtest;
before(function(done) {
var client = x11.createClient(function(err, dpy) {
if (!err) {
display = dpy;
X = display.client;
X.require('xtest', function(ext) {
if (util.isError(ext)) {
done(ext);
} else {
xtest = ext;
done();
}
});
} else {
done(err);
}
});
client.on('error', done);
});
describe('GetVersion', function() {
it('should return version 2.2', function(done) {
xtest.GetVersion(2, 2, function(err, version) {
version.should.eql([2, 2]);
done();
});
});
});
after(function(done) {
X.terminate();
X.on('end', done);
});
});