mirror of
https://github.com/danbulant/node-x11
synced 2026-05-24 12:35:39 +00:00
Add Shape Rectangles test. Fix Shape Mask test
This commit is contained in:
parent
520be559e8
commit
fafa42e6e6
2 changed files with 32 additions and 7 deletions
25
examples/smoketest/shape-rectangles.js
Normal file
25
examples/smoketest/shape-rectangles.js
Normal 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); });
|
||||||
|
|
||||||
|
});
|
||||||
|
|
@ -6,17 +6,17 @@ x11.createClient(function(err, display) {
|
||||||
X.require('shape', function(err, Shape) {
|
X.require('shape', function(err, Shape) {
|
||||||
var win = X.AllocID();
|
var win = X.AllocID();
|
||||||
X.CreateWindow(win, root, 0, 0, 200, 200);
|
X.CreateWindow(win, root, 0, 0, 200, 200);
|
||||||
var gc = X.AllocID();
|
X.MapWindow(win);
|
||||||
X.CreateGC(gc, win);
|
|
||||||
//X.MapWindow(win);
|
|
||||||
Shape.SelectInput(win, 1);
|
Shape.SelectInput(win, 1);
|
||||||
Shape.InputSelected(win, function(err, isSelected) {
|
Shape.InputSelected(win, function(err, isSelected) {
|
||||||
console.log("IsSelected: " + isSelected);
|
console.log("IsSelected: " + isSelected);
|
||||||
});
|
});
|
||||||
//var pid = X.AllocID();
|
var pid = X.AllocID();
|
||||||
//X.CreatePixmap(pid, win, 2, 200, 200);
|
X.CreatePixmap(pid, win, 1, 200, 200);
|
||||||
//X.PolyText8(pid, gc, 0, 0, ['Hello, Node.JS!', ' Hello, world!']);
|
var gc = X.AllocID();
|
||||||
//Shape.Mask(Shape.Op.Set, Shape.Kind.Input, win, 0, 0, pid);
|
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) {
|
X.on('event', function(ev) {
|
||||||
console.log(ev);
|
console.log(ev);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue