mirror of
https://github.com/danbulant/node-x11
synced 2026-05-19 04:18:35 +00:00
CreateWindow test
This commit is contained in:
parent
3eaaadd0da
commit
e631e6fac6
1 changed files with 47 additions and 0 deletions
47
test/core-CreateWindow.js
Normal file
47
test/core-CreateWindow.js
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
var x11 = require('../lib/x11');
|
||||
var should = require('should');
|
||||
var assert = require('assert');
|
||||
|
||||
describe('CreateWindow request', function() {
|
||||
|
||||
// keep for a while: this snippet helps to track global leak
|
||||
//global.__defineSetter__('a', function(v) {
|
||||
// console.trace();
|
||||
//});
|
||||
|
||||
var display;
|
||||
var X;
|
||||
beforeEach(function(done) {
|
||||
var client = x11.createClient(function(dpy) {
|
||||
display=dpy;
|
||||
X = display.client;
|
||||
done();
|
||||
});
|
||||
client.on('error', done);
|
||||
});
|
||||
|
||||
afterEach(function(done) {
|
||||
X.terminate();
|
||||
X.on('end', done);
|
||||
X = null;
|
||||
display = null;
|
||||
});
|
||||
|
||||
it('should exist as client member', function(done) {
|
||||
should.exist(X.CreateWindow);
|
||||
assert.equal(typeof X.CreateWindow, 'function');
|
||||
done();
|
||||
});
|
||||
|
||||
it('result should present in windows tree', function(done) {
|
||||
var wid = X.AllocID();
|
||||
X.CreateWindow(wid, display.screen[0].root, 0, 0, 1, 1); // 1x1 pixel window
|
||||
X.QueryTree(display.screen[0].root, function(err, list) {
|
||||
if (err)
|
||||
done(err);
|
||||
assert(list.children.indexOf(wid) != -1, 'can\'t find created window');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
Loading…
Reference in a new issue