Rename ImportSvg to SvgImporter, and ExportSvg to SvgExporter.

This commit is contained in:
Jürg Lehni 2012-11-02 17:40:07 -07:00
parent ab02023adf
commit 1ce332756e
24 changed files with 80 additions and 80 deletions

View file

@ -28,7 +28,7 @@
var path = new Path.Circle(new Point(50, 50), 25); var path = new Path.Circle(new Point(50, 50), 25);
path.fillColor = 'red'; path.fillColor = 'red';
var output = ExportSvg.exportProject(paper.project); var output = SvgExporter.exportProject(paper.project);
console.log(output); console.log(output);
var test = document.getElementById('svg') var test = document.getElementById('svg')
test.innerHTML = ""; test.innerHTML = "";

View file

@ -22,7 +22,7 @@
var path2 = new Path(segments); var path2 = new Path(segments);
path2.strokeColor = 'yellow'; path2.strokeColor = 'yellow';
var output = ExportSvg.exportProject(paper.project); var output = SvgExporter.exportProject(paper.project);
console.log(output); console.log(output);
var test = document.getElementById('svg') var test = document.getElementById('svg')
test.innerHTML = ""; test.innerHTML = "";

View file

@ -37,7 +37,7 @@
line3.strokeColor = "yellow"; line3.strokeColor = "yellow";
line3.strokeWidth = "5"; line3.strokeWidth = "5";
var output = ExportSvg.exportProject(paper.project); var output = SvgExporter.exportProject(paper.project);
console.log(output); console.log(output);
var test = document.getElementById('svg') var test = document.getElementById('svg')
test.innerHTML = ""; test.innerHTML = "";

View file

@ -35,7 +35,7 @@
var path = new Path.Star(center, points, radius1, radius2); var path = new Path.Star(center, points, radius1, radius2);
path.fillColor = 'black'; path.fillColor = 'black';
var output = ExportSvg.exportProject(paper.project); var output = SvgExporter.exportProject(paper.project);
console.log(output); console.log(output);
var test = document.getElementById('svg') var test = document.getElementById('svg')
test.innerHTML = ""; test.innerHTML = "";

View file

@ -49,7 +49,7 @@
path4.strokeColor= 'yellow'; path4.strokeColor= 'yellow';
path4.fillColor='purple'; path4.fillColor='purple';
var output = ExportSvg.exportProject(paper.project); var output = SvgExporter.exportProject(paper.project);
console.log(output); console.log(output);
var test = document.getElementById('svg') var test = document.getElementById('svg')
test.innerHTML = ""; test.innerHTML = "";

View file

@ -35,7 +35,7 @@
c.fillColor = colors[i]; c.fillColor = colors[i];
} }
var output = ExportSvg.exportProject(paper.project); var output = SvgExporter.exportProject(paper.project);
var test = document.getElementById('svg') var test = document.getElementById('svg')
test.innerHTML = ""; test.innerHTML = "";
test.appendChild (output); test.appendChild (output);

View file

@ -25,7 +25,7 @@
clonedPath.rotate(angle * i, circlePath.bounds.topLeft); clonedPath.rotate(angle * i, circlePath.bounds.topLeft);
}; };
var output = ExportSvg.exportProject(paper.project); var output = SvgExporter.exportProject(paper.project);
console.log(output); console.log(output);
var test = document.getElementById('svg') var test = document.getElementById('svg')
test.innerHTML = ""; test.innerHTML = "";

View file

@ -21,7 +21,7 @@
copy.strokeColor = 'red'; copy.strokeColor = 'red';
copy.rotate(-45); copy.rotate(-45);
copy.scale(0.5); copy.scale(0.5);
var output = ExportSvg.exportProject(paper.project); var output = SvgExporter.exportProject(paper.project);
var test = document.getElementById('svg') var test = document.getElementById('svg')
test.innerHTML = ""; test.innerHTML = "";
test.appendChild (output); test.appendChild (output);

View file

@ -11,7 +11,7 @@
// strokeWidth: 2, // strokeWidth: 2,
// strokeCap: 'round' // strokeCap: 'round'
}; };
ImportSvg.importSvg(document.getElementById('svg')); SvgImporter.importSvg(document.getElementById('svg'));
</script> </script>
</head> </head>
<body> <body>

View file

@ -11,7 +11,7 @@
// strokeWidth: 2, // strokeWidth: 2,
// strokeCap: 'round' // strokeCap: 'round'
}; };
ImportSvg.importSvg(document.getElementById('svg')); SvgImporter.importSvg(document.getElementById('svg'));
</script> </script>
</head> </head>
<body> <body>

View file

@ -11,7 +11,7 @@
// strokeWidth: 2, // strokeWidth: 2,
// strokeCap: 'round' // strokeCap: 'round'
}; };
ImportSvg.importSvg(document.getElementById('svg')); SvgImporter.importSvg(document.getElementById('svg'));
</script> </script>
</head> </head>
<body> <body>

View file

@ -11,7 +11,7 @@
// strokeWidth: 2, // strokeWidth: 2,
// strokeCap: 'round' // strokeCap: 'round'
}; };
ImportSvg.importSvg(document.getElementById('svg')); SvgImporter.importSvg(document.getElementById('svg'));
</script> </script>
</head> </head>
<body> <body>

View file

@ -12,7 +12,7 @@
// strokeWidth: 2, // strokeWidth: 2,
// strokeCap: 'round' // strokeCap: 'round'
}; };
ImportSvg.importSvg(document.getElementById('svg')); SvgImporter.importSvg(document.getElementById('svg'));
</script> </script>
</head> </head>
<body> <body>

View file

@ -11,7 +11,7 @@
// strokeWidth: 2, // strokeWidth: 2,
// strokeCap: 'round' // strokeCap: 'round'
}; };
ImportSvg.importSvg(document.getElementById('svg')); SvgImporter.importSvg(document.getElementById('svg'));
</script> </script>
</head> </head>
<body> <body>

View file

@ -11,7 +11,7 @@
// strokeWidth: 2, // strokeWidth: 2,
// strokeCap: 'round' // strokeCap: 'round'
}; };
ImportSvg.importSvg(document.getElementById('svg')); SvgImporter.importSvg(document.getElementById('svg'));
</script> </script>
</head> </head>
<body> <body>

View file

@ -11,7 +11,7 @@
// strokeWidth: 2, // strokeWidth: 2,
// strokeCap: 'round' // strokeCap: 'round'
}; };
ImportSvg.importSvg(document.getElementById('svg')); SvgImporter.importSvg(document.getElementById('svg'));
</script> </script>
</head> </head>
<body> <body>

View file

@ -11,7 +11,7 @@
// strokeWidth: 2, // strokeWidth: 2,
// strokeCap: 'round' // strokeCap: 'round'
}; };
ImportSvg.importSvg(document.getElementById('svg')); SvgImporter.importSvg(document.getElementById('svg'));
</script> </script>
</head> </head>
<body> <body>

View file

@ -93,8 +93,8 @@ var paper = new function() {
/*#*/ include('text/TextItem.js'); /*#*/ include('text/TextItem.js');
/*#*/ include('text/PointText.js'); /*#*/ include('text/PointText.js');
/*#*/ include('svg/ExportSvg.js'); /*#*/ include('svg/SvgExporter.js');
/*#*/ include('svg/ImportSvg.js'); /*#*/ include('svg/SvgImporter.js');
/*#*/ include('style/Style.js'); /*#*/ include('style/Style.js');
/*#*/ include('style/PathStyle.js'); /*#*/ include('style/PathStyle.js');

View file

@ -127,6 +127,7 @@ Path.inject({ statics: new function() {
var _rect = Rectangle.read(arguments), var _rect = Rectangle.read(arguments),
_size = Size.read(arguments); _size = Size.read(arguments);
if (_size.isZero()) if (_size.isZero())
// No need for new, since constructors here do so themselves.
return Path.Rectangle(rect); return Path.Rectangle(rect);
_size = Size.min(_size, _rect.getSize(true).divide(2)); _size = Size.min(_size, _rect.getSize(true).divide(2));
var bl = _rect.getBottomLeft(true), var bl = _rect.getBottomLeft(true),

View file

@ -18,14 +18,14 @@
*/ */
/** /**
* @name ExportSvg * @name SvgExporter
* *
* @class The ExportSvg object holds all the functionality to convert a Paper.js * @class The SvgExporter object holds all the functionality to convert a Paper.js
* DOM to a SVG DOM. * DOM to a SVG DOM.
* *
*/ */
var ExportSvg = this.ExportSvg = /** @Lends ExportSvg */{ var SvgExporter = this.SvgExporter = /** @Lends SvgExporter */{
create: function(tag) { create: function(tag) {
return document.createElementNS('http://www.w3.org/2000/svg', tag); return document.createElementNS('http://www.w3.org/2000/svg', tag);
@ -55,7 +55,7 @@ var ExportSvg = this.ExportSvg = /** @Lends ExportSvg */{
* Takes the selected Paper.js layer and parses all groups * Takes the selected Paper.js layer and parses all groups
* and items on the layer into one SVG * and items on the layer into one SVG
* *
* @name ExportSvg#exportLayer * @name SvgExporter#exportLayer
* @function * @function
* @param {Layer} layer a Paper.js layer * @param {Layer} layer a Paper.js layer
* @return {SVGSVGElement} the layer converted into an SVG group * @return {SVGSVGElement} the layer converted into an SVG group
@ -68,7 +68,7 @@ var ExportSvg = this.ExportSvg = /** @Lends ExportSvg */{
* *
* Takes a Paper.js group and puts its items in a SVG file. * Takes a Paper.js group and puts its items in a SVG file.
* *
* @name ExportSvg#exportGroup * @name SvgExporter#exportGroup
* @function * @function
* @param {Group} group a Paper.js group * @param {Group} group a Paper.js group
* @return {SVGSVGElement} an SVG object * @return {SVGSVGElement} an SVG object
@ -92,7 +92,7 @@ var ExportSvg = this.ExportSvg = /** @Lends ExportSvg */{
* Takes the path and puts it in * Takes the path and puts it in
* a svg file. * a svg file.
* *
* @name ExportSvg#exportPath * @name SvgExporter#exportPath
* @function * @function
* @param {Path} path a Paper.js path object * @param {Path} path a Paper.js path object
* @return {SVGSVGElement} an SVG object of the imported path * @return {SVGSVGElement} an SVG object of the imported path
@ -390,7 +390,7 @@ var ExportSvg = this.ExportSvg = /** @Lends ExportSvg */{
/** /**
* Checks the type SVG object created by converting from Paper.js * Checks the type SVG object created by converting from Paper.js
* *
* @name ExportSvg#checkType * @name SvgExporter#checkType
* @function * @function
* @param {Array} segArray An array of objects for the newly * @param {Array} segArray An array of objects for the newly
* converted SVG object * converted SVG object

View file

@ -20,15 +20,15 @@
*/ */
/** /**
* @name ImportSvg * @name SvgImporter
* @class The ImportSvg object represents an object created using the SVG * @class The SvgImporter object represents an object created using the SVG
* Canvas that will be converted into a Paper.js object. * Canvas that will be converted into a Paper.js object.
* The SVG object is imported into Paper.js by converting it into items * The SVG object is imported into Paper.js by converting it into items
* within groups. * within groups.
* *
*/ */
var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{ var SvgImporter = this.SvgImporter = /** @Lends SvgImporter */{
/** /**
* Creates a Paper.js object using data parsed from the selected * Creates a Paper.js object using data parsed from the selected
* SVG Document Object Model (DOM). The SVG object is imported, * SVG Document Object Model (DOM). The SVG object is imported,
@ -72,16 +72,15 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
case 'symbol': case 'symbol':
item = this._importGroup(svg); item = this._importGroup(svg);
this._importAttributesAndStyles(svg, item); this._importAttributesAndStyles(svg, item);
// TODO: We're no returning symbol. How to handle this?
symbol = new Symbol(item); symbol = new Symbol(item);
item = null; item = null;
break; break;
default: default:
// Not supported yet. // Not supported yet.
} }
if (item) if (item)
this._importAttributesAndStyles(svg, item); this._importAttributesAndStyles(svg, item);
return item; return item;
}, },
@ -89,7 +88,7 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
* Creates a Paper.js group by parsing a specific GNode of the * Creates a Paper.js group by parsing a specific GNode of the
* imported SVG DOM * imported SVG DOM
* *
* @name ImportSvg#importGroup * @name SvgImporter#importGroup
* @function * @function
* @param {XML DOM} svg A node passed in by the imported SVG * @param {XML DOM} svg A node passed in by the imported SVG
* @return {Group} group A Paper.js group * @return {Group} group A Paper.js group
@ -115,7 +114,7 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
* Creates a Path.Circle item in Paper.js using an imported * Creates a Path.Circle item in Paper.js using an imported
* Circle from SVG * Circle from SVG
* *
* @name ImportSvg#importCircle * @name SvgImporter#importCircle
* @function * @function
* @param {XML DOM} svgCircle An SVG circle node * @param {XML DOM} svgCircle An SVG circle node
* @return {Path.Circle} circle A Path.Circle item for Paper.js * @return {Path.Circle} circle A Path.Circle item for Paper.js
@ -134,7 +133,7 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
/** /**
* Creates a Path.Oval item in Paper.js using an imported Oval from SVG * Creates a Path.Oval item in Paper.js using an imported Oval from SVG
* *
* @name ImportSvg#importOval * @name SvgImporter#importOval
* @function * @function
* @param {XML DOM} svgOval An SVG ellipse node * @param {XML DOM} svgOval An SVG ellipse node
* @return {Path.Oval} oval A Path.Oval item for Paper.js * @return {Path.Oval} oval A Path.Oval item for Paper.js
@ -159,7 +158,7 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
/** /**
* Creates a Path.Rectangle item from an imported SVG rectangle * Creates a Path.Rectangle item from an imported SVG rectangle
* *
* @name ImportSvg#importRectangle * @name SvgImporter#importRectangle
* @function * @function
* @param {XML DOM} svgRectangle An SVG rectangle node * @param {XML DOM} svgRectangle An SVG rectangle node
* @return {Path.Rectangle} rectangle A Path.Rectangle item for * @return {Path.Rectangle} rectangle A Path.Rectangle item for
@ -169,7 +168,7 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
* Creates a Path.RoundRectangle item from an imported SVG * Creates a Path.RoundRectangle item from an imported SVG
* rectangle with rounded corners * rectangle with rounded corners
* *
* @name ImportSvg#importRectangle * @name SvgImporter#importRectangle
* @function * @function
* @param {XML DOM} svgRectangle An SVG rectangle node with * @param {XML DOM} svgRectangle An SVG rectangle node with
* rounded corners * rounded corners
@ -201,7 +200,7 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
/** /**
* Creates a Path.Line item in Paper.js from an imported SVG line * Creates a Path.Line item in Paper.js from an imported SVG line
* *
* @name ImportSvg#importLine * @name SvgImporter#importLine
* @function * @function
* @param {XML DOM} svgLine An SVG line node * @param {XML DOM} svgLine An SVG line node
* @return {Path.Line} line A Path.Line item for Paper.js * @return {Path.Line} line A Path.Line item for Paper.js
@ -222,7 +221,7 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
/** /**
* Creates a PointText item in Paper.js from an imported SVG text node * Creates a PointText item in Paper.js from an imported SVG text node
* *
* @name ImportSvg#importText * @name SvgImporter#importText
* @function * @function
* @param {XML DOM} svgText An SVG text node * @param {XML DOM} svgText An SVG text node
* @return {Path.Text} text A PointText item for Paper.js * @return {Path.Text} text A PointText item for Paper.js
@ -266,7 +265,7 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
* a specific SVG node (rectangle, path, circle, polygon, etc.) * a specific SVG node (rectangle, path, circle, polygon, etc.)
* and creating the right Path object based on the SVG type. * and creating the right Path object based on the SVG type.
* *
* @name ImportSvg#importPath * @name SvgImporter#importPath
* @function * @function
* @param {XML DOM} svg An SVG object * @param {XML DOM} svg An SVG object
* @return {Item} item A Paper.js item * @return {Item} item A Paper.js item
@ -372,7 +371,7 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
* Creates a Path.Poly item in Paper.js using an imported Polygon or * Creates a Path.Poly item in Paper.js using an imported Polygon or
* Polyline SVG node * Polyline SVG node
* *
* @name ImportSvg#importPoly * @name SvgImporter#importPoly
* @function * @function
* @param {XML DOM} svgPoly An SVG polygon or polyline node * @param {XML DOM} svgPoly An SVG polygon or polyline node
* @return {Path.Poly} poly A Path.Poly item for Paper.js * @return {Path.Poly} poly A Path.Poly item for Paper.js
@ -403,7 +402,7 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
* attributes * attributes
* This method is destructive to item (changes happen to it) * This method is destructive to item (changes happen to it)
* *
* @name ImportSvg#importAttributesAndStyles * @name SvgImporter#importAttributesAndStyles
* @function * @function
* @param {XML DOM} svg An SVG node * @param {XML DOM} svg An SVG node
* @param {Item} item A Paper.js item * @param {Item} item A Paper.js item
@ -431,7 +430,7 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
* Parses an SVG style attibute and applies it to a Paper.js item * Parses an SVG style attibute and applies it to a Paper.js item
* This method is destructive to item (changes happen to it) * This method is destructive to item (changes happen to it)
* *
* @name ImportSvg#applyAttributeOrStyle * @name SvgImporter#applyAttributeOrStyle
* @function * @function
* @param {Style Name} name An SVG style name * @param {Style Name} name An SVG style name
* @param {Style Value} value The value of an SVG style * @param {Style Value} value The value of an SVG style
@ -526,7 +525,7 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
* made Paper.js item * made Paper.js item
* This method is destructive to item * This method is destructive to item
* *
* @name ImportSvg#applyTransform * @name SvgImporter#applyTransform
* @function * @function
* @param {XML DOM} An SVG node * @param {XML DOM} An SVG node
* @param {Item} A Paper.js item * @param {Item} A Paper.js item

View file

@ -16,7 +16,7 @@
* This test file created by Stetson-Team-Alpha * This test file created by Stetson-Team-Alpha
*/ */
module('ExportSvg'); module('SvgExporter');
test('compare line path functions', function() { test('compare line path functions', function() {
var svgns = 'http://www.w3.org/2000/svg'; var svgns = 'http://www.w3.org/2000/svg';
@ -32,7 +32,7 @@ test('compare line path functions', function() {
var line = new Path.Line([x1, y1], [x2, y2]); var line = new Path.Line([x1, y1], [x2, y2]);
var exportedLine = ExportSvg.exportPath(line); var exportedLine = SvgExporter.exportPath(line);
var shapex1 = shape.getAttribute('x1'); var shapex1 = shape.getAttribute('x1');
var shapey1 = shape.getAttribute('y1'); var shapey1 = shape.getAttribute('y1');
@ -65,7 +65,7 @@ test('compare negative line path functions', function() {
var line = new Path.Line([x1, y1], [x2, y2]); var line = new Path.Line([x1, y1], [x2, y2]);
var exportedLine = ExportSvg.exportPath(line); var exportedLine = SvgExporter.exportPath(line);
var shapex1 = shape.getAttribute('x1'); var shapex1 = shape.getAttribute('x1');
var shapey1 = shape.getAttribute('y1'); var shapey1 = shape.getAttribute('y1');
@ -98,7 +98,7 @@ test('compare invalid line path functions', function() {
var line = new Path.Line([x1, y1], [x2, y2]); var line = new Path.Line([x1, y1], [x2, y2]);
var exportedLine = ExportSvg.exportPath(line); var exportedLine = SvgExporter.exportPath(line);
var shapex1 = shape.getAttribute('x1'); var shapex1 = shape.getAttribute('x1');
var shapey1 = shape.getAttribute('y1'); var shapey1 = shape.getAttribute('y1');
@ -133,7 +133,7 @@ test('compare invalid line path functions', function() {
var size = new Size(100, 100); var size = new Size(100, 100);
var path = new Path.Rectangle(point, size); var path = new Path.Rectangle(point, size);
var exportedRectangle = ExportSvg.exportPath(path); var exportedRectangle = SvgExporter.exportPath(path);
var shapex1 = shape.getAttribute('x'); var shapex1 = shape.getAttribute('x');
var shapey1 = shape.getAttribute('y1'); var shapey1 = shape.getAttribute('y1');
@ -168,7 +168,7 @@ test('compare negative rectangle values', function() {
var size = new Size(width, height); var size = new Size(width, height);
var rect = new Rectangle(topLeft, size); var rect = new Rectangle(topLeft, size);
var exportedRectangle = ExportSvg.exportPath(rect); var exportedRectangle = SvgExporter.exportPath(rect);
var shapex = shape.getAttribute('x'); var shapex = shape.getAttribute('x');
var shapey = shape.getAttribute('y'); var shapey = shape.getAttribute('y');
@ -202,7 +202,7 @@ test('compare invalid rectangle values', function() {
var size = new Size(width, height); var size = new Size(width, height);
var rect = new Rectangle(topLeft, size); var rect = new Rectangle(topLeft, size);
var exportedRectangle = ExportSvg.exportPath(rect); var exportedRectangle = SvgExporter.exportPath(rect);
var shapex = shape.getAttribute('x'); var shapex = shape.getAttribute('x');
var shapey = shape.getAttribute('y'); var shapey = shape.getAttribute('y');
@ -242,7 +242,7 @@ test('compare rounded rectangle values', function() {
var rect = new Rectangle(topLeft, size); var rect = new Rectangle(topLeft, size);
var roundRect = new Path.RoundRectangle(rect, cornerSize); var roundRect = new Path.RoundRectangle(rect, cornerSize);
var exportedRectangle = ExportSvg.exportPath(rect); var exportedRectangle = SvgExporter.exportPath(rect);
var shapex = shape.getAttribute('x'); var shapex = shape.getAttribute('x');
var shapey = shape.getAttribute('y'); var shapey = shape.getAttribute('y');
@ -286,7 +286,7 @@ test('compare negative rounded rectangle values', function() {
var rect = new Rectangle(topLeft, size); var rect = new Rectangle(topLeft, size);
var roundRect = new Path.RoundRectangle(rect, cornerSize); var roundRect = new Path.RoundRectangle(rect, cornerSize);
var exportedRectangle = ExportSvg.exportPath(rect); var exportedRectangle = SvgExporter.exportPath(rect);
var shapex = shape.getAttribute('x'); var shapex = shape.getAttribute('x');
var shapey = shape.getAttribute('y'); var shapey = shape.getAttribute('y');
@ -330,7 +330,7 @@ test('compare invalid rounded rectangle values', function() {
var rect = new Rectangle(topLeft, size); var rect = new Rectangle(topLeft, size);
var roundRect = new Path.RoundRectangle(rect, cornerSize); var roundRect = new Path.RoundRectangle(rect, cornerSize);
var exportedRectangle = ExportSvg.exportPath(rect); var exportedRectangle = SvgExporter.exportPath(rect);
var shapex = shape.getAttribute('x'); var shapex = shape.getAttribute('x');
var shapey = shape.getAttribute('y'); var shapey = shape.getAttribute('y');
@ -372,7 +372,7 @@ test('compare oval values', function() {
var rect = new Rectangle(topLeft, bottomRight); var rect = new Rectangle(topLeft, bottomRight);
var oval = new Path.Oval(rect); var oval = new Path.Oval(rect);
var exportedOval = ExportSvg.exportPath(oval); var exportedOval = SvgExporter.exportPath(oval);
var shapecx = shape.getAttribute('cx'); var shapecx = shape.getAttribute('cx');
var shapecy = shape.getAttribute('cy'); var shapecy = shape.getAttribute('cy');
@ -404,7 +404,7 @@ test('compare circle values', function() {
var center = new Point(cx, cy); var center = new Point(cx, cy);
var circle = new Path.Circle(center, r); var circle = new Path.Circle(center, r);
var exportedCircle = ExportSvg.exportPath(circle); var exportedCircle = SvgExporter.exportPath(circle);
var shapecx = shape.getAttribute('cx'); var shapecx = shape.getAttribute('cx');
var shapecy = shape.getAttribute('cy'); var shapecy = shape.getAttribute('cy');
@ -440,7 +440,7 @@ test('compare polygon values', function() {
poly.closePath(); poly.closePath();
} }
var exportedPolygon = ExportSvg.exportPath(poly); var exportedPolygon = SvgExporter.exportPath(poly);
var svgPoints = shape.getAttribute('points'); var svgPoints = shape.getAttribute('points');
@ -470,7 +470,7 @@ test('compare negative polygon values', function() {
poly.closePath(); poly.closePath();
} }
var exportedPolygon = ExportSvg.exportPath(poly); var exportedPolygon = SvgExporter.exportPath(poly);
var svgPoints = shape.getAttribute('points'); var svgPoints = shape.getAttribute('points');
@ -500,7 +500,7 @@ test('compare polyline values', function() {
poly.closePath(); poly.closePath();
} }
var exportedPolygon = ExportSvg.exportPath(poly); var exportedPolygon = SvgExporter.exportPath(poly);
var svgPoints = shape.getAttribute('points'); var svgPoints = shape.getAttribute('points');
@ -530,7 +530,7 @@ test('compare negative polyline values', function() {
poly.closePath(); poly.closePath();
} }
var exportedPolygon = ExportSvg.exportPath(poly); var exportedPolygon = SvgExporter.exportPath(poly);
var svgPoints = shape.getAttribute('points'); var svgPoints = shape.getAttribute('points');

View file

@ -16,7 +16,7 @@
* This test file created by Stetson-Team-Alpha * This test file created by Stetson-Team-Alpha
*/ */
module('ImportSvg'); module('SvgImporter');
test('make an svg line', function() { test('make an svg line', function() {
var svgns = 'http://www.w3.org/2000/svg'; var svgns = 'http://www.w3.org/2000/svg';
@ -30,7 +30,7 @@ test('make an svg line', function() {
shape.setAttribute('x2', x2); shape.setAttribute('x2', x2);
shape.setAttribute('y2', y2); shape.setAttribute('y2', y2);
var importedLine = ImportSvg.importSvg(shape); var importedLine = SvgImporter.importSvg(shape);
var line = new Path.Line([x1, y1], [x2, y2]); var line = new Path.Line([x1, y1], [x2, y2]);
@ -45,7 +45,7 @@ test('make an svg line with invalid values', function() {
shape.setAttribute('x2', null); shape.setAttribute('x2', null);
shape.setAttribute('y2', null); shape.setAttribute('y2', null);
var importedLine = ImportSvg.importSvg(shape); var importedLine = SvgImporter.importSvg(shape);
var line = new Path.Line([0, 0], [0, 0]); var line = new Path.Line([0, 0], [0, 0]);
@ -64,7 +64,7 @@ test('compare rectangle values', function() {
shape.setAttribute('width', width); shape.setAttribute('width', width);
shape.setAttribute('height', height); shape.setAttribute('height', height);
var importedRectangle = ImportSvg.importSvg(shape); var importedRectangle = SvgImporter.importSvg(shape);
var topLeft = new Point(x, y); var topLeft = new Point(x, y);
var size = new Size(width, height); var size = new Size(width, height);
@ -87,7 +87,7 @@ test('compare negative rectangle values', function() {
shape.setAttribute('width', width); shape.setAttribute('width', width);
shape.setAttribute('height', height); shape.setAttribute('height', height);
var importedRectangle = ImportSvg.importSvg(shape); var importedRectangle = SvgImporter.importSvg(shape);
var topLeft = new Point(x, y); var topLeft = new Point(x, y);
var size = new Size(width, height); var size = new Size(width, height);
var rectangle = new Rectangle(topLeft, size); var rectangle = new Rectangle(topLeft, size);
@ -106,7 +106,7 @@ test('compare invalid rectangle values', function() {
shape.setAttribute('width', null); shape.setAttribute('width', null);
shape.setAttribute('height', null); shape.setAttribute('height', null);
var importedRectangle = ImportSvg.importSvg(shape); var importedRectangle = SvgImporter.importSvg(shape);
var topLeft = new Point(0, 0); var topLeft = new Point(0, 0);
var size = new Size(0, 0); var size = new Size(0, 0);
@ -132,7 +132,7 @@ test('compare round rectangle values', function() {
shape.setAttribute('width', width); shape.setAttribute('width', width);
shape.setAttribute('height', height); shape.setAttribute('height', height);
var importedRectangle = ImportSvg.importSvg(shape); var importedRectangle = SvgImporter.importSvg(shape);
var topLeft = new Point(x, y); var topLeft = new Point(x, y);
var size = new Size(width, height); var size = new Size(width, height);
@ -159,7 +159,7 @@ test('compare negative round rectangle values', function() {
shape.setAttribute('width', width); shape.setAttribute('width', width);
shape.setAttribute('height', height); shape.setAttribute('height', height);
var importedRectangle = ImportSvg.importSvg(shape); var importedRectangle = SvgImporter.importSvg(shape);
var topLeft = new Point(x, y); var topLeft = new Point(x, y);
var size = new Size(width, height); var size = new Size(width, height);
@ -186,7 +186,7 @@ test('compare invalid round rectangle values', function() {
shape.setAttribute('width', width); shape.setAttribute('width', width);
shape.setAttribute('height', height); shape.setAttribute('height', height);
var importedRectangle = ImportSvg.importSvg(shape); var importedRectangle = SvgImporter.importSvg(shape);
var topLeft = new Point(x, y); var topLeft = new Point(x, y);
var size = new Size(width, height); var size = new Size(width, height);
@ -209,7 +209,7 @@ test('compare oval values', function() {
shape.setAttribute('rx', rx); shape.setAttribute('rx', rx);
shape.setAttribute('ry', ry); shape.setAttribute('ry', ry);
var importedOval = ImportSvg.importSvg(shape); var importedOval = SvgImporter.importSvg(shape);
var center = new Point(cx, cy); var center = new Point(cx, cy);
var offset = new Point(rx, ry); var offset = new Point(rx, ry);
@ -234,7 +234,7 @@ test('compare negative oval values', function() {
shape.setAttribute('rx', rx); shape.setAttribute('rx', rx);
shape.setAttribute('ry', ry); shape.setAttribute('ry', ry);
var importedOval = ImportSvg.importSvg(shape); var importedOval = SvgImporter.importSvg(shape);
var center = new Point(cx, cy); var center = new Point(cx, cy);
var offset = new Point(rx, ry); var offset = new Point(rx, ry);
@ -255,7 +255,7 @@ test('compare invalid oval values', function() {
shape.setAttribute('rx', null); shape.setAttribute('rx', null);
shape.setAttribute('ry', null); shape.setAttribute('ry', null);
var importedOval = ImportSvg.importSvg(shape); var importedOval = SvgImporter.importSvg(shape);
var center = new Point(0, 0); var center = new Point(0, 0);
var offset = new Point(0, 0); var offset = new Point(0, 0);
@ -278,7 +278,7 @@ test('compare circle values', function() {
shape.setAttribute('cy', cy); shape.setAttribute('cy', cy);
shape.setAttribute('r', r); shape.setAttribute('r', r);
var importedCircle = ImportSvg.importSvg(shape); var importedCircle = SvgImporter.importSvg(shape);
var center = new Point(cx, cy); var center = new Point(cx, cy);
var circle = new Path.Circle(center, r); var circle = new Path.Circle(center, r);
@ -296,7 +296,7 @@ test('compare negative circle values', function() {
shape.setAttribute('cy', cy); shape.setAttribute('cy', cy);
shape.setAttribute('r', r); shape.setAttribute('r', r);
var importedCircle = ImportSvg.importSvg(shape); var importedCircle = SvgImporter.importSvg(shape);
var center = new Point(cx, cy); var center = new Point(cx, cy);
var circle = new Path.Circle(center, r); var circle = new Path.Circle(center, r);
@ -312,7 +312,7 @@ test('compare invalid circle values', function() {
shape.setAttribute('cy', null); shape.setAttribute('cy', null);
shape.setAttribute('r', null); shape.setAttribute('r', null);
var importedCircle = ImportSvg.importSvg(shape); var importedCircle = SvgImporter.importSvg(shape);
var center = new Point(0, 0); var center = new Point(0, 0);
var circle = new Path.Circle(center, 0); var circle = new Path.Circle(center, 0);
@ -327,7 +327,7 @@ test('compare polygon values', function() {
var svgpoints = "100,10 40,180 190,60 10,60 160,180"; var svgpoints = "100,10 40,180 190,60 10,60 160,180";
shape.setAttribute('points', svgpoints); shape.setAttribute('points', svgpoints);
var importedPolygon = ImportSvg.importSvg(shape); var importedPolygon = SvgImporter.importSvg(shape);
var poly = new Path(); var poly = new Path();
var points = shape.points; var points = shape.points;
@ -352,7 +352,7 @@ test('compare negative polygon values', function() {
var svgpoints = "-100,-10 -40,-180 -190,-60 -10,-60 -160,-180"; var svgpoints = "-100,-10 -40,-180 -190,-60 -10,-60 -160,-180";
shape.setAttribute('points', svgpoints); shape.setAttribute('points', svgpoints);
var importedPolygon = ImportSvg.importSvg(shape); var importedPolygon = SvgImporter.importSvg(shape);
var poly = new Path(); var poly = new Path();
var points = shape.points; var points = shape.points;
@ -377,7 +377,7 @@ test('compare polyline values', function() {
var svgpoints = "5,5 45,45 5,45 45,5"; var svgpoints = "5,5 45,45 5,45 45,5";
shape.setAttribute('points', svgpoints); shape.setAttribute('points', svgpoints);
var importedPolyline = ImportSvg.importSvg(shape); var importedPolyline = SvgImporter.importSvg(shape);
var poly = new Path(); var poly = new Path();
var points = shape.points; var points = shape.points;
@ -402,7 +402,7 @@ test('compare negative polyline values', function() {
var svgpoints = "-5,-5 -45,-45 -5,-45 -45,-5"; var svgpoints = "-5,-5 -45,-45 -5,-45 -45,-5";
shape.setAttribute('points', svgpoints); shape.setAttribute('points', svgpoints);
var importedPolyline = ImportSvg.importSvg(shape); var importedPolyline = SvgImporter.importSvg(shape);
var poly = new Path(); var poly = new Path();
var points = shape.points; var points = shape.points;

View file

@ -28,5 +28,5 @@
/*#*/ include('HitResult.js'); /*#*/ include('HitResult.js');
/*#*/ include('ImportSvg.js'); /*#*/ include('SvgImporter.js');
/*#*/ include('ExportSvg.js'); /*#*/ include('SvgExporter.js');