mirror of
https://github.com/danbulant/node-x11
synced 2026-07-03 10:10:36 +00:00
Merge pull request #77 from santigimeno/value_mask_fixes
src: ignore invalid mask values
This commit is contained in:
commit
ef2c30793a
2 changed files with 21 additions and 6 deletions
|
|
@ -213,13 +213,16 @@ function packValueMask(reqname, values)
|
||||||
if (!reqValueMask)
|
if (!reqValueMask)
|
||||||
throw new Error(reqname + ': no value mask description');
|
throw new Error(reqname + ': no value mask description');
|
||||||
|
|
||||||
for (var v in values)
|
for (var value in values)
|
||||||
{
|
{
|
||||||
var valueBit = reqValueMask[v].mask;
|
var v = reqValueMask[value];
|
||||||
if (!valueBit)
|
if (v) {
|
||||||
throw new Error(reqname + ': incorrect value param ' + v);
|
var valueBit = v.mask;
|
||||||
masksList.push(valueBit);
|
if (!valueBit)
|
||||||
bitmask |= valueBit;
|
throw new Error(reqname + ': incorrect value param ' + value);
|
||||||
|
masksList.push(valueBit);
|
||||||
|
bitmask |= valueBit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* numeric sort */
|
/* numeric sort */
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,19 @@ describe('ConfigureWindow', function() {
|
||||||
this.X.LowerWindow(this.wid);
|
this.X.LowerWindow(this.wid);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should ignore invalid mask values', function(done) {
|
||||||
|
this.X.once('event', function(ev) {
|
||||||
|
ev.x.should.equal(0);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.X.ConfigureWindow(this.wid, { foo : 3, x : 0 }, function(err) {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
after(function(done) {
|
after(function(done) {
|
||||||
|
this.X.removeAllListeners('event');
|
||||||
this.X.DestroyWindow(this.wid);
|
this.X.DestroyWindow(this.wid);
|
||||||
this.X.DestroyWindow(this.wid_helper);
|
this.X.DestroyWindow(this.wid_helper);
|
||||||
this.X.on('end', done);
|
this.X.on('end', done);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue