mirror of
https://github.com/danbulant/node-x11
synced 2026-05-19 04:18:35 +00:00
46 lines
1.4 KiB
JavaScript
46 lines
1.4 KiB
JavaScript
var x11 = require('../lib');
|
|
var should = require('should');
|
|
|
|
describe('CreateGC', function() {
|
|
before(function(done) {
|
|
var self = this;
|
|
this.client = x11.createClient(function(err, dpy) {
|
|
should.not.exist(err);
|
|
self.X = dpy.client;
|
|
self.root = dpy.screen[0].root;
|
|
self.white = dpy.screen[0].white_pixel;
|
|
self.black = dpy.screen[0].black_pixel;
|
|
self.wid = self.X.AllocID();
|
|
self.X.CreateWindow(self.wid, self.root, 0, 0, 1, 1); // 1x1 pixel window
|
|
self.X.MapWindow(self.wid);
|
|
self.X.QueryTree(self.root, function(err, list) {
|
|
should.not.exist(err);
|
|
list.children.indexOf(self.wid).should.not.equal(-1);
|
|
done();
|
|
});
|
|
});
|
|
});
|
|
|
|
it('should create a Graphic Context correctly', function() {
|
|
var self = this;
|
|
this.client.on('error', function(err) {
|
|
should.not.exist(err);
|
|
});
|
|
|
|
this.gc = this.X.AllocID();
|
|
this.X.CreateGC(this.gc,
|
|
this.wid,
|
|
{
|
|
foreground: this.black,
|
|
background: this.white,
|
|
lineStyle : 0
|
|
}
|
|
);
|
|
});
|
|
|
|
after(function(done) {
|
|
this.X.DestroyWindow(this.wid);
|
|
this.X.on('end', done);
|
|
this.X.terminate();
|
|
});
|
|
});
|