From fafa42e6e67b62e84c385521eeab152f7b5bf932 Mon Sep 17 00:00:00 2001 From: Michael J M Thomson Date: Fri, 29 May 2015 14:28:05 +1000 Subject: [PATCH] Add Shape Rectangles test. Fix Shape Mask test --- examples/smoketest/shape-rectangles.js | 25 +++++++++++++++++++++++++ examples/smoketest/shapetest.js | 14 +++++++------- 2 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 examples/smoketest/shape-rectangles.js diff --git a/examples/smoketest/shape-rectangles.js b/examples/smoketest/shape-rectangles.js new file mode 100644 index 0000000..4fb29a5 --- /dev/null +++ b/examples/smoketest/shape-rectangles.js @@ -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); }); + +}); diff --git a/examples/smoketest/shapetest.js b/examples/smoketest/shapetest.js index 31ba286..1ceba00 100644 --- a/examples/smoketest/shapetest.js +++ b/examples/smoketest/shapetest.js @@ -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);