Fix SVGImporter tests for all polygon related code.

#length was used instead of #numberOfItems.
This commit is contained in:
Jürg Lehni 2012-11-02 19:10:58 -07:00
parent 6937d4c3be
commit 905d1106d4
2 changed files with 13 additions and 29 deletions

View file

@ -46,7 +46,7 @@ var SvgImporter = this.SvgImporter = new function() {
points = svg.points,
start = points.getItem(0);
poly.moveTo(start);
for (var i = 1; i < points.length; i++)
for (var i = 1, l = points.numberOfItems; i < l; i++)
poly.lineTo(points.getItem(i));
if (svg.nodeName.toLowerCase() == 'polygon')
poly.closePath();

View file

@ -331,13 +331,9 @@ test('compare polygon values', function() {
var poly = new Path();
var points = shape.points;
var start = points.getItem(0);
var point;
poly.moveTo([start.x, start.y]);
for (var i = 1; i < points.length; i++) {
point = points.getItem(i);
poly.lineTo([point.x, point.y]);
poly.moveTo(points.getItem(0));
for (var i = 1; i < points.numberOfItems; i++) {
poly.lineTo(points.getItem(i));
}
if (shape.nodeName.toLowerCase() == 'polygon') {
poly.closePath();
@ -356,13 +352,9 @@ test('compare negative polygon values', function() {
var poly = new Path();
var points = shape.points;
var start = points.getItem(0);
var point;
poly.moveTo([start.x, start.y]);
for (var i = 1; i < points.length; i++) {
point = points.getItem(i);
poly.lineTo([point.x, point.y]);
poly.moveTo(points.getItem(0));
for (var i = 1; i < points.numberOfItems; i++) {
poly.lineTo(points.getItem(i));
}
if (shape.nodeName.toLowerCase() == 'polygon') {
poly.closePath();
@ -381,13 +373,9 @@ test('compare polyline values', function() {
var poly = new Path();
var points = shape.points;
var start = points.getItem(0);
var point;
poly.moveTo([start.x, start.y]);
for (var i = 1; i < points.length; i++) {
point = points.getItem(i);
poly.lineTo([point.x, point.y]);
poly.moveTo(points.getItem(0));
for (var i = 1; i < points.numberOfItems; i++) {
poly.lineTo(points.getItem(i));
}
if (shape.nodeName.toLowerCase() == 'polygon') {
poly.closePath();
@ -406,13 +394,9 @@ test('compare negative polyline values', function() {
var poly = new Path();
var points = shape.points;
var start = points.getItem(0);
var point;
poly.moveTo([start.x, start.y]);
for (var i = 1; i < points.length; i++) {
point = points.getItem(i);
poly.lineTo([point.x, point.y]);
poly.moveTo(points.getItem(0));
for (var i = 1; i < points.numberOfItems; i++) {
poly.lineTo(points.getItem(i));
}
if (shape.nodeName.toLowerCase() == 'polygon') {
poly.closePath();