From 2635326b24ef45ccbf6aed47c60eb26ec4a8db2a Mon Sep 17 00:00:00 2001 From: Jonathan Puckey Date: Thu, 17 Feb 2011 16:00:20 +0100 Subject: [PATCH] Add CompoundPath tests. --- test/tests/CompoundPath.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 test/tests/CompoundPath.js diff --git a/test/tests/CompoundPath.js b/test/tests/CompoundPath.js new file mode 100644 index 00000000..4174ef1b --- /dev/null +++ b/test/tests/CompoundPath.js @@ -0,0 +1,22 @@ +module('Compound Path'); + +test('moveTo / lineTo', function() { + var doc = new Doc(canvas); + var path = new CompoundPath(); + + var lists = [ + [new Point(279, 151), new Point(149, 151), new Point(149, 281), new Point(279, 281)], + [new Point(319, 321), new Point(109, 321), new Point(109, 111), new Point(319, 111)] + ]; + + for (var i = 0; i < lists.length; i++) { + var list = lists[i]; + for (var j = 0; j < list.length; j++) { + path[j == 0 ? 'moveTo' : 'lineTo'](list[j]); + } + } + + path.fillColor = 'black'; + + equals(path.children.length, 2); +}); \ No newline at end of file