Add Shape Rectangles test. Fix Shape Mask test

This commit is contained in:
Michael J M Thomson 2015-05-29 14:28:05 +10:00
parent 520be559e8
commit fafa42e6e6
2 changed files with 32 additions and 7 deletions

View file

@ -0,0 +1,25 @@
var x11 = require('../../lib');
var Expose = 12;
x11.createClient(function(err, display) {
var X = display.client;
var root = display.screen[0].root;
X.require('shape', function(err, Shape) {
var win = X.AllocID();
var black = display.screen[0].black_pixel;
X.CreateWindow(win, root, 0, 0, 200, 200, 0, undefined, X.InputOutput, undefined,
{ backgroundPixel: black });
X.MapWindow(win);
Shape.Rectangles(Shape.Op.Set, Shape.Kind.Bounding, win,
0, 0, [
[40, 40, 40, 40], [120, 40, 40, 40],
[0, 120, 20, 20], [180, 120, 20, 20],
[20, 140, 30, 20], [150, 140, 30, 20],
[50, 160, 100, 20]
]);
});
X.on('error', function(err) { console.log(err); });
});

View file

@ -6,17 +6,17 @@ x11.createClient(function(err, display) {
X.require('shape', function(err, Shape) {
var win = X.AllocID();
X.CreateWindow(win, root, 0, 0, 200, 200);
var gc = X.AllocID();
X.CreateGC(gc, win);
//X.MapWindow(win);
X.MapWindow(win);
Shape.SelectInput(win, 1);
Shape.InputSelected(win, function(err, isSelected) {
console.log("IsSelected: " + isSelected);
});
//var pid = X.AllocID();
//X.CreatePixmap(pid, win, 2, 200, 200);
//X.PolyText8(pid, gc, 0, 0, ['Hello, Node.JS!', ' Hello, world!']);
//Shape.Mask(Shape.Op.Set, Shape.Kind.Input, win, 0, 0, pid);
var pid = X.AllocID();
X.CreatePixmap(pid, win, 1, 200, 200);
var gc = X.AllocID();
X.CreateGC(gc, win);
X.PolyText8(pid, gc, 0, 0, ['Hello, Node.JS!', ' Hello, world!']);
Shape.Mask(Shape.Op.Set, Shape.Kind.Input, win, 0, 0, pid);
X.on('event', function(ev) {
console.log(ev);