mirror of
https://github.com/danbulant/node-x11
synced 2026-06-10 18:20:35 +00:00
src: fix CreateGC attributes encoding
- Every attribute must have 4 byte length. - Add test.
This commit is contained in:
parent
e5be17ac46
commit
28e9343487
2 changed files with 62 additions and 16 deletions
|
|
@ -70,7 +70,7 @@ var valueMask = {
|
|||
CreateGC: {
|
||||
'function' : { // TODO: alias? _function?
|
||||
mask: 0x00000001,
|
||||
format: 'C'
|
||||
format: 'Cxxx'
|
||||
},
|
||||
planeMask : {
|
||||
mask: 0x00000002,
|
||||
|
|
@ -86,27 +86,27 @@ var valueMask = {
|
|||
},
|
||||
lineWidth : {
|
||||
mask: 0x00000010,
|
||||
format: 'S'
|
||||
format: 'Sxx'
|
||||
},
|
||||
lineStyle : {
|
||||
mask: 0x00000020,
|
||||
format: 'C'
|
||||
format: 'Cxxx'
|
||||
},
|
||||
capStyle : {
|
||||
mask: 0x00000040,
|
||||
format: 'C'
|
||||
format: 'Cxxx'
|
||||
},
|
||||
joinStyle : {
|
||||
mask: 0x00000080,
|
||||
format: 'C'
|
||||
format: 'Cxxx'
|
||||
},
|
||||
fillStyle : {
|
||||
mask: 0x00000100,
|
||||
format: 'C'
|
||||
format: 'Cxxx'
|
||||
},
|
||||
fillRule : {
|
||||
mask: 0x00000200,
|
||||
format: 'C'
|
||||
format: 'Cxxx'
|
||||
},
|
||||
tile : {
|
||||
mask: 0x00000400,
|
||||
|
|
@ -118,11 +118,11 @@ var valueMask = {
|
|||
},
|
||||
tileStippleXOrigin : {
|
||||
mask: 0x00001000,
|
||||
format: 's'
|
||||
format: 'sxx'
|
||||
},
|
||||
tileStippleYOrigin : {
|
||||
mask: 0x00002000,
|
||||
format: 's'
|
||||
format: 'sxx'
|
||||
},
|
||||
font : {
|
||||
mask: 0x00004000,
|
||||
|
|
@ -130,19 +130,19 @@ var valueMask = {
|
|||
},
|
||||
subwindowMode : {
|
||||
mask: 0x00008000,
|
||||
format: 'C'
|
||||
format: 'Cxxx'
|
||||
},
|
||||
graphicsExposures : {
|
||||
mask: 0x00010000,
|
||||
format: 'C'
|
||||
format: 'Cxxx'
|
||||
},
|
||||
clipXOrigin : {
|
||||
mask: 0x00020000,
|
||||
format: 'S'
|
||||
format: 'Sxx'
|
||||
},
|
||||
clipYOrigin : {
|
||||
mask: 0x00040000,
|
||||
format: 'S'
|
||||
format: 'Sxx'
|
||||
},
|
||||
clipMask : {
|
||||
mask: 0x00080000,
|
||||
|
|
@ -150,15 +150,15 @@ var valueMask = {
|
|||
},
|
||||
dashOffset : {
|
||||
mask: 0x00100000,
|
||||
format: 'S'
|
||||
format: 'Sxx'
|
||||
},
|
||||
dashes : {
|
||||
mask: 0x00200000,
|
||||
format: 'C'
|
||||
format: 'Cxxx'
|
||||
},
|
||||
arcMode : {
|
||||
mask: 0x00400000,
|
||||
format: 'C'
|
||||
format: 'Cxxx'
|
||||
}
|
||||
},
|
||||
ConfigureWindow: {
|
||||
|
|
|
|||
46
test/createGC.js
Normal file
46
test/createGC.js
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
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();
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue