From 1ce332756e3d46fd04b1df208935f1ef8a31e8d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Fri, 2 Nov 2012 17:40:07 -0700 Subject: [PATCH] Rename ImportSvg to SvgImporter, and ExportSvg to SvgExporter. --- examples/SVG Export/Circle Testing.html | 2 +- examples/SVG Export/Empty Path Testing.html | 2 +- examples/SVG Export/Line Testing.html | 2 +- examples/SVG Export/Random Path Testing.html | 2 +- .../Rect and Attribute Testing.html | 2 +- examples/SVG Export/Text Testing.html | 2 +- examples/SVG Export/Transform Test 1.html | 2 +- examples/SVG Export/Transform Test 2.html | 2 +- .../SVG Import/Circle and Oval Testing.html | 2 +- examples/SVG Import/Line Testing.html | 2 +- .../SVG Import/Multiple Paths Test 1.html | 2 +- .../SVG Import/Multiple Paths Test 2.html | 2 +- examples/SVG Import/Nested Groups Test.html | 2 +- examples/SVG Import/Rect Testing.html | 2 +- examples/SVG Import/Testing.html | 2 +- examples/SVG Import/Text Testing.html | 2 +- examples/SVG Import/Transform Testing.html | 2 +- src/paper.js | 4 +- src/path/Path.Constructors.js | 1 + src/svg/{ExportSvg.js => SvgExporter.js} | 14 +++---- src/svg/{ImportSvg.js => SvgImporter.js} | 33 ++++++++-------- test/tests/{ExportSvg.js => SvgExporter.js} | 32 ++++++++-------- test/tests/{ImportSvg.js => SvgImporter.js} | 38 +++++++++---------- test/tests/load.js | 4 +- 24 files changed, 80 insertions(+), 80 deletions(-) rename src/svg/{ExportSvg.js => SvgExporter.js} (98%) rename src/svg/{ImportSvg.js => SvgImporter.js} (95%) rename test/tests/{ExportSvg.js => SvgExporter.js} (94%) rename test/tests/{ImportSvg.js => SvgImporter.js} (91%) diff --git a/examples/SVG Export/Circle Testing.html b/examples/SVG Export/Circle Testing.html index 522c5b3a..31c420e7 100644 --- a/examples/SVG Export/Circle Testing.html +++ b/examples/SVG Export/Circle Testing.html @@ -28,7 +28,7 @@ var path = new Path.Circle(new Point(50, 50), 25); path.fillColor = 'red'; - var output = ExportSvg.exportProject(paper.project); + var output = SvgExporter.exportProject(paper.project); console.log(output); var test = document.getElementById('svg') test.innerHTML = ""; diff --git a/examples/SVG Export/Empty Path Testing.html b/examples/SVG Export/Empty Path Testing.html index 2f522afa..4ea7314e 100644 --- a/examples/SVG Export/Empty Path Testing.html +++ b/examples/SVG Export/Empty Path Testing.html @@ -22,7 +22,7 @@ var path2 = new Path(segments); path2.strokeColor = 'yellow'; - var output = ExportSvg.exportProject(paper.project); + var output = SvgExporter.exportProject(paper.project); console.log(output); var test = document.getElementById('svg') test.innerHTML = ""; diff --git a/examples/SVG Export/Line Testing.html b/examples/SVG Export/Line Testing.html index e19b4de9..e1b262d5 100644 --- a/examples/SVG Export/Line Testing.html +++ b/examples/SVG Export/Line Testing.html @@ -37,7 +37,7 @@ line3.strokeColor = "yellow"; line3.strokeWidth = "5"; - var output = ExportSvg.exportProject(paper.project); + var output = SvgExporter.exportProject(paper.project); console.log(output); var test = document.getElementById('svg') test.innerHTML = ""; diff --git a/examples/SVG Export/Random Path Testing.html b/examples/SVG Export/Random Path Testing.html index cdc94b5a..bc583943 100644 --- a/examples/SVG Export/Random Path Testing.html +++ b/examples/SVG Export/Random Path Testing.html @@ -35,7 +35,7 @@ var path = new Path.Star(center, points, radius1, radius2); path.fillColor = 'black'; - var output = ExportSvg.exportProject(paper.project); + var output = SvgExporter.exportProject(paper.project); console.log(output); var test = document.getElementById('svg') test.innerHTML = ""; diff --git a/examples/SVG Export/Rect and Attribute Testing.html b/examples/SVG Export/Rect and Attribute Testing.html index 84d88bb4..679c61e8 100644 --- a/examples/SVG Export/Rect and Attribute Testing.html +++ b/examples/SVG Export/Rect and Attribute Testing.html @@ -49,7 +49,7 @@ path4.strokeColor= 'yellow'; path4.fillColor='purple'; - var output = ExportSvg.exportProject(paper.project); + var output = SvgExporter.exportProject(paper.project); console.log(output); var test = document.getElementById('svg') test.innerHTML = ""; diff --git a/examples/SVG Export/Text Testing.html b/examples/SVG Export/Text Testing.html index 6f004259..4c18d1ab 100644 --- a/examples/SVG Export/Text Testing.html +++ b/examples/SVG Export/Text Testing.html @@ -35,7 +35,7 @@ c.fillColor = colors[i]; } - var output = ExportSvg.exportProject(paper.project); + var output = SvgExporter.exportProject(paper.project); var test = document.getElementById('svg') test.innerHTML = ""; test.appendChild (output); diff --git a/examples/SVG Export/Transform Test 1.html b/examples/SVG Export/Transform Test 1.html index ded618fe..bcc64418 100644 --- a/examples/SVG Export/Transform Test 1.html +++ b/examples/SVG Export/Transform Test 1.html @@ -25,7 +25,7 @@ clonedPath.rotate(angle * i, circlePath.bounds.topLeft); }; - var output = ExportSvg.exportProject(paper.project); + var output = SvgExporter.exportProject(paper.project); console.log(output); var test = document.getElementById('svg') test.innerHTML = ""; diff --git a/examples/SVG Export/Transform Test 2.html b/examples/SVG Export/Transform Test 2.html index be6f0bc1..62eb6b31 100644 --- a/examples/SVG Export/Transform Test 2.html +++ b/examples/SVG Export/Transform Test 2.html @@ -21,7 +21,7 @@ copy.strokeColor = 'red'; copy.rotate(-45); copy.scale(0.5); - var output = ExportSvg.exportProject(paper.project); + var output = SvgExporter.exportProject(paper.project); var test = document.getElementById('svg') test.innerHTML = ""; test.appendChild (output); diff --git a/examples/SVG Import/Circle and Oval Testing.html b/examples/SVG Import/Circle and Oval Testing.html index 257f95e5..5f8b1e79 100644 --- a/examples/SVG Import/Circle and Oval Testing.html +++ b/examples/SVG Import/Circle and Oval Testing.html @@ -11,7 +11,7 @@ // strokeWidth: 2, // strokeCap: 'round' }; - ImportSvg.importSvg(document.getElementById('svg')); + SvgImporter.importSvg(document.getElementById('svg')); diff --git a/examples/SVG Import/Line Testing.html b/examples/SVG Import/Line Testing.html index 42e8fcb1..c25dcc8d 100644 --- a/examples/SVG Import/Line Testing.html +++ b/examples/SVG Import/Line Testing.html @@ -11,7 +11,7 @@ // strokeWidth: 2, // strokeCap: 'round' }; - ImportSvg.importSvg(document.getElementById('svg')); + SvgImporter.importSvg(document.getElementById('svg')); diff --git a/examples/SVG Import/Multiple Paths Test 1.html b/examples/SVG Import/Multiple Paths Test 1.html index 805ef9a8..7d5b1b29 100644 --- a/examples/SVG Import/Multiple Paths Test 1.html +++ b/examples/SVG Import/Multiple Paths Test 1.html @@ -11,7 +11,7 @@ // strokeWidth: 2, // strokeCap: 'round' }; - ImportSvg.importSvg(document.getElementById('svg')); + SvgImporter.importSvg(document.getElementById('svg')); diff --git a/examples/SVG Import/Multiple Paths Test 2.html b/examples/SVG Import/Multiple Paths Test 2.html index b63c8aff..8a3369d6 100644 --- a/examples/SVG Import/Multiple Paths Test 2.html +++ b/examples/SVG Import/Multiple Paths Test 2.html @@ -11,7 +11,7 @@ // strokeWidth: 2, // strokeCap: 'round' }; - ImportSvg.importSvg(document.getElementById('svg')); + SvgImporter.importSvg(document.getElementById('svg')); diff --git a/examples/SVG Import/Nested Groups Test.html b/examples/SVG Import/Nested Groups Test.html index b781ee9b..a54092c5 100644 --- a/examples/SVG Import/Nested Groups Test.html +++ b/examples/SVG Import/Nested Groups Test.html @@ -12,7 +12,7 @@ // strokeWidth: 2, // strokeCap: 'round' }; - ImportSvg.importSvg(document.getElementById('svg')); + SvgImporter.importSvg(document.getElementById('svg')); diff --git a/examples/SVG Import/Rect Testing.html b/examples/SVG Import/Rect Testing.html index 3a91b736..85eb5057 100644 --- a/examples/SVG Import/Rect Testing.html +++ b/examples/SVG Import/Rect Testing.html @@ -11,7 +11,7 @@ // strokeWidth: 2, // strokeCap: 'round' }; - ImportSvg.importSvg(document.getElementById('svg')); + SvgImporter.importSvg(document.getElementById('svg')); diff --git a/examples/SVG Import/Testing.html b/examples/SVG Import/Testing.html index e0a78f77..22beee03 100644 --- a/examples/SVG Import/Testing.html +++ b/examples/SVG Import/Testing.html @@ -11,7 +11,7 @@ // strokeWidth: 2, // strokeCap: 'round' }; - ImportSvg.importSvg(document.getElementById('svg')); + SvgImporter.importSvg(document.getElementById('svg')); diff --git a/examples/SVG Import/Text Testing.html b/examples/SVG Import/Text Testing.html index cc8a1f33..597129a4 100644 --- a/examples/SVG Import/Text Testing.html +++ b/examples/SVG Import/Text Testing.html @@ -11,7 +11,7 @@ // strokeWidth: 2, // strokeCap: 'round' }; - ImportSvg.importSvg(document.getElementById('svg')); + SvgImporter.importSvg(document.getElementById('svg')); diff --git a/examples/SVG Import/Transform Testing.html b/examples/SVG Import/Transform Testing.html index 97fea716..276cf4fd 100644 --- a/examples/SVG Import/Transform Testing.html +++ b/examples/SVG Import/Transform Testing.html @@ -11,7 +11,7 @@ // strokeWidth: 2, // strokeCap: 'round' }; - ImportSvg.importSvg(document.getElementById('svg')); + SvgImporter.importSvg(document.getElementById('svg')); diff --git a/src/paper.js b/src/paper.js index 0dbda8ac..f4f06ba1 100644 --- a/src/paper.js +++ b/src/paper.js @@ -93,8 +93,8 @@ var paper = new function() { /*#*/ include('text/TextItem.js'); /*#*/ include('text/PointText.js'); -/*#*/ include('svg/ExportSvg.js'); -/*#*/ include('svg/ImportSvg.js'); +/*#*/ include('svg/SvgExporter.js'); +/*#*/ include('svg/SvgImporter.js'); /*#*/ include('style/Style.js'); /*#*/ include('style/PathStyle.js'); diff --git a/src/path/Path.Constructors.js b/src/path/Path.Constructors.js index ed59dce7..507c626a 100644 --- a/src/path/Path.Constructors.js +++ b/src/path/Path.Constructors.js @@ -127,6 +127,7 @@ Path.inject({ statics: new function() { var _rect = Rectangle.read(arguments), _size = Size.read(arguments); if (_size.isZero()) + // No need for new, since constructors here do so themselves. return Path.Rectangle(rect); _size = Size.min(_size, _rect.getSize(true).divide(2)); var bl = _rect.getBottomLeft(true), diff --git a/src/svg/ExportSvg.js b/src/svg/SvgExporter.js similarity index 98% rename from src/svg/ExportSvg.js rename to src/svg/SvgExporter.js index fdd284d9..750e27a8 100644 --- a/src/svg/ExportSvg.js +++ b/src/svg/SvgExporter.js @@ -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. * */ -var ExportSvg = this.ExportSvg = /** @Lends ExportSvg */{ +var SvgExporter = this.SvgExporter = /** @Lends SvgExporter */{ create: function(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 * and items on the layer into one SVG * - * @name ExportSvg#exportLayer + * @name SvgExporter#exportLayer * @function * @param {Layer} layer a Paper.js layer * @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. * - * @name ExportSvg#exportGroup + * @name SvgExporter#exportGroup * @function * @param {Group} group a Paper.js group * @return {SVGSVGElement} an SVG object @@ -92,7 +92,7 @@ var ExportSvg = this.ExportSvg = /** @Lends ExportSvg */{ * Takes the path and puts it in * a svg file. * - * @name ExportSvg#exportPath + * @name SvgExporter#exportPath * @function * @param {Path} path a Paper.js path object * @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 * - * @name ExportSvg#checkType + * @name SvgExporter#checkType * @function * @param {Array} segArray An array of objects for the newly * converted SVG object diff --git a/src/svg/ImportSvg.js b/src/svg/SvgImporter.js similarity index 95% rename from src/svg/ImportSvg.js rename to src/svg/SvgImporter.js index 2df83a87..fa53fdb5 100644 --- a/src/svg/ImportSvg.js +++ b/src/svg/SvgImporter.js @@ -20,15 +20,15 @@ */ /** -* @name ImportSvg -* @class The ImportSvg object represents an object created using the SVG +* @name SvgImporter +* @class The SvgImporter object represents an object created using the SVG * Canvas that will be converted into a Paper.js object. * The SVG object is imported into Paper.js by converting it into items * 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 * SVG Document Object Model (DOM). The SVG object is imported, @@ -72,16 +72,15 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{ case 'symbol': item = this._importGroup(svg); this._importAttributesAndStyles(svg, item); + // TODO: We're no returning symbol. How to handle this? symbol = new Symbol(item); item = null; break; default: // Not supported yet. } - if (item) this._importAttributesAndStyles(svg, 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 * imported SVG DOM * - * @name ImportSvg#importGroup + * @name SvgImporter#importGroup * @function * @param {XML DOM} svg A node passed in by the imported SVG * @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 * Circle from SVG * - * @name ImportSvg#importCircle + * @name SvgImporter#importCircle * @function * @param {XML DOM} svgCircle An SVG circle node * @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 * - * @name ImportSvg#importOval + * @name SvgImporter#importOval * @function * @param {XML DOM} svgOval An SVG ellipse node * @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 * - * @name ImportSvg#importRectangle + * @name SvgImporter#importRectangle * @function * @param {XML DOM} svgRectangle An SVG rectangle node * @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 * rectangle with rounded corners * - * @name ImportSvg#importRectangle + * @name SvgImporter#importRectangle * @function * @param {XML DOM} svgRectangle An SVG rectangle node with * 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 * - * @name ImportSvg#importLine + * @name SvgImporter#importLine * @function * @param {XML DOM} svgLine An SVG line node * @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 * - * @name ImportSvg#importText + * @name SvgImporter#importText * @function * @param {XML DOM} svgText An SVG text node * @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.) * and creating the right Path object based on the SVG type. * - * @name ImportSvg#importPath + * @name SvgImporter#importPath * @function * @param {XML DOM} svg An SVG object * @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 * Polyline SVG node * - * @name ImportSvg#importPoly + * @name SvgImporter#importPoly * @function * @param {XML DOM} svgPoly An SVG polygon or polyline node * @return {Path.Poly} poly A Path.Poly item for Paper.js @@ -403,7 +402,7 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{ * attributes * This method is destructive to item (changes happen to it) * - * @name ImportSvg#importAttributesAndStyles + * @name SvgImporter#importAttributesAndStyles * @function * @param {XML DOM} svg An SVG node * @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 * This method is destructive to item (changes happen to it) * - * @name ImportSvg#applyAttributeOrStyle + * @name SvgImporter#applyAttributeOrStyle * @function * @param {Style Name} name An SVG style name * @param {Style Value} value The value of an SVG style @@ -526,7 +525,7 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{ * made Paper.js item * This method is destructive to item * - * @name ImportSvg#applyTransform + * @name SvgImporter#applyTransform * @function * @param {XML DOM} An SVG node * @param {Item} A Paper.js item diff --git a/test/tests/ExportSvg.js b/test/tests/SvgExporter.js similarity index 94% rename from test/tests/ExportSvg.js rename to test/tests/SvgExporter.js index 0908edac..16201009 100644 --- a/test/tests/ExportSvg.js +++ b/test/tests/SvgExporter.js @@ -16,7 +16,7 @@ * This test file created by Stetson-Team-Alpha */ -module('ExportSvg'); +module('SvgExporter'); test('compare line path functions', function() { 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 exportedLine = ExportSvg.exportPath(line); + var exportedLine = SvgExporter.exportPath(line); var shapex1 = shape.getAttribute('x1'); 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 exportedLine = ExportSvg.exportPath(line); + var exportedLine = SvgExporter.exportPath(line); var shapex1 = shape.getAttribute('x1'); 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 exportedLine = ExportSvg.exportPath(line); + var exportedLine = SvgExporter.exportPath(line); var shapex1 = shape.getAttribute('x1'); var shapey1 = shape.getAttribute('y1'); @@ -133,7 +133,7 @@ test('compare invalid line path functions', function() { var size = new Size(100, 100); var path = new Path.Rectangle(point, size); - var exportedRectangle = ExportSvg.exportPath(path); + var exportedRectangle = SvgExporter.exportPath(path); var shapex1 = shape.getAttribute('x'); var shapey1 = shape.getAttribute('y1'); @@ -168,7 +168,7 @@ test('compare negative rectangle values', function() { var size = new Size(width, height); var rect = new Rectangle(topLeft, size); - var exportedRectangle = ExportSvg.exportPath(rect); + var exportedRectangle = SvgExporter.exportPath(rect); var shapex = shape.getAttribute('x'); var shapey = shape.getAttribute('y'); @@ -202,7 +202,7 @@ test('compare invalid rectangle values', function() { var size = new Size(width, height); var rect = new Rectangle(topLeft, size); - var exportedRectangle = ExportSvg.exportPath(rect); + var exportedRectangle = SvgExporter.exportPath(rect); var shapex = shape.getAttribute('x'); var shapey = shape.getAttribute('y'); @@ -242,7 +242,7 @@ test('compare rounded rectangle values', function() { var rect = new Rectangle(topLeft, size); var roundRect = new Path.RoundRectangle(rect, cornerSize); - var exportedRectangle = ExportSvg.exportPath(rect); + var exportedRectangle = SvgExporter.exportPath(rect); var shapex = shape.getAttribute('x'); var shapey = shape.getAttribute('y'); @@ -286,7 +286,7 @@ test('compare negative rounded rectangle values', function() { var rect = new Rectangle(topLeft, size); var roundRect = new Path.RoundRectangle(rect, cornerSize); - var exportedRectangle = ExportSvg.exportPath(rect); + var exportedRectangle = SvgExporter.exportPath(rect); var shapex = shape.getAttribute('x'); var shapey = shape.getAttribute('y'); @@ -330,7 +330,7 @@ test('compare invalid rounded rectangle values', function() { var rect = new Rectangle(topLeft, size); var roundRect = new Path.RoundRectangle(rect, cornerSize); - var exportedRectangle = ExportSvg.exportPath(rect); + var exportedRectangle = SvgExporter.exportPath(rect); var shapex = shape.getAttribute('x'); var shapey = shape.getAttribute('y'); @@ -372,7 +372,7 @@ test('compare oval values', function() { var rect = new Rectangle(topLeft, bottomRight); var oval = new Path.Oval(rect); - var exportedOval = ExportSvg.exportPath(oval); + var exportedOval = SvgExporter.exportPath(oval); var shapecx = shape.getAttribute('cx'); var shapecy = shape.getAttribute('cy'); @@ -404,7 +404,7 @@ test('compare circle values', function() { var center = new Point(cx, cy); var circle = new Path.Circle(center, r); - var exportedCircle = ExportSvg.exportPath(circle); + var exportedCircle = SvgExporter.exportPath(circle); var shapecx = shape.getAttribute('cx'); var shapecy = shape.getAttribute('cy'); @@ -440,7 +440,7 @@ test('compare polygon values', function() { poly.closePath(); } - var exportedPolygon = ExportSvg.exportPath(poly); + var exportedPolygon = SvgExporter.exportPath(poly); var svgPoints = shape.getAttribute('points'); @@ -470,7 +470,7 @@ test('compare negative polygon values', function() { poly.closePath(); } - var exportedPolygon = ExportSvg.exportPath(poly); + var exportedPolygon = SvgExporter.exportPath(poly); var svgPoints = shape.getAttribute('points'); @@ -500,7 +500,7 @@ test('compare polyline values', function() { poly.closePath(); } - var exportedPolygon = ExportSvg.exportPath(poly); + var exportedPolygon = SvgExporter.exportPath(poly); var svgPoints = shape.getAttribute('points'); @@ -530,7 +530,7 @@ test('compare negative polyline values', function() { poly.closePath(); } - var exportedPolygon = ExportSvg.exportPath(poly); + var exportedPolygon = SvgExporter.exportPath(poly); var svgPoints = shape.getAttribute('points'); diff --git a/test/tests/ImportSvg.js b/test/tests/SvgImporter.js similarity index 91% rename from test/tests/ImportSvg.js rename to test/tests/SvgImporter.js index af862a0e..d4a5adae 100644 --- a/test/tests/ImportSvg.js +++ b/test/tests/SvgImporter.js @@ -16,7 +16,7 @@ * This test file created by Stetson-Team-Alpha */ -module('ImportSvg'); +module('SvgImporter'); test('make an svg line', function() { var svgns = 'http://www.w3.org/2000/svg'; @@ -30,7 +30,7 @@ test('make an svg line', function() { shape.setAttribute('x2', x2); shape.setAttribute('y2', y2); - var importedLine = ImportSvg.importSvg(shape); + var importedLine = SvgImporter.importSvg(shape); 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('y2', null); - var importedLine = ImportSvg.importSvg(shape); + var importedLine = SvgImporter.importSvg(shape); var line = new Path.Line([0, 0], [0, 0]); @@ -64,7 +64,7 @@ test('compare rectangle values', function() { shape.setAttribute('width', width); shape.setAttribute('height', height); - var importedRectangle = ImportSvg.importSvg(shape); + var importedRectangle = SvgImporter.importSvg(shape); var topLeft = new Point(x, y); var size = new Size(width, height); @@ -87,7 +87,7 @@ test('compare negative rectangle values', function() { shape.setAttribute('width', width); shape.setAttribute('height', height); - var importedRectangle = ImportSvg.importSvg(shape); + var importedRectangle = SvgImporter.importSvg(shape); var topLeft = new Point(x, y); var size = new Size(width, height); var rectangle = new Rectangle(topLeft, size); @@ -106,7 +106,7 @@ test('compare invalid rectangle values', function() { shape.setAttribute('width', null); shape.setAttribute('height', null); - var importedRectangle = ImportSvg.importSvg(shape); + var importedRectangle = SvgImporter.importSvg(shape); var topLeft = new Point(0, 0); var size = new Size(0, 0); @@ -132,7 +132,7 @@ test('compare round rectangle values', function() { shape.setAttribute('width', width); shape.setAttribute('height', height); - var importedRectangle = ImportSvg.importSvg(shape); + var importedRectangle = SvgImporter.importSvg(shape); var topLeft = new Point(x, y); var size = new Size(width, height); @@ -159,7 +159,7 @@ test('compare negative round rectangle values', function() { shape.setAttribute('width', width); shape.setAttribute('height', height); - var importedRectangle = ImportSvg.importSvg(shape); + var importedRectangle = SvgImporter.importSvg(shape); var topLeft = new Point(x, y); var size = new Size(width, height); @@ -186,7 +186,7 @@ test('compare invalid round rectangle values', function() { shape.setAttribute('width', width); shape.setAttribute('height', height); - var importedRectangle = ImportSvg.importSvg(shape); + var importedRectangle = SvgImporter.importSvg(shape); var topLeft = new Point(x, y); var size = new Size(width, height); @@ -209,7 +209,7 @@ test('compare oval values', function() { shape.setAttribute('rx', rx); shape.setAttribute('ry', ry); - var importedOval = ImportSvg.importSvg(shape); + var importedOval = SvgImporter.importSvg(shape); var center = new Point(cx, cy); var offset = new Point(rx, ry); @@ -234,7 +234,7 @@ test('compare negative oval values', function() { shape.setAttribute('rx', rx); shape.setAttribute('ry', ry); - var importedOval = ImportSvg.importSvg(shape); + var importedOval = SvgImporter.importSvg(shape); var center = new Point(cx, cy); var offset = new Point(rx, ry); @@ -255,7 +255,7 @@ test('compare invalid oval values', function() { shape.setAttribute('rx', null); shape.setAttribute('ry', null); - var importedOval = ImportSvg.importSvg(shape); + var importedOval = SvgImporter.importSvg(shape); var center = 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('r', r); - var importedCircle = ImportSvg.importSvg(shape); + var importedCircle = SvgImporter.importSvg(shape); var center = new Point(cx, cy); var circle = new Path.Circle(center, r); @@ -296,7 +296,7 @@ test('compare negative circle values', function() { shape.setAttribute('cy', cy); shape.setAttribute('r', r); - var importedCircle = ImportSvg.importSvg(shape); + var importedCircle = SvgImporter.importSvg(shape); var center = new Point(cx, cy); var circle = new Path.Circle(center, r); @@ -312,7 +312,7 @@ test('compare invalid circle values', function() { shape.setAttribute('cy', null); shape.setAttribute('r', null); - var importedCircle = ImportSvg.importSvg(shape); + var importedCircle = SvgImporter.importSvg(shape); var center = new Point(0, 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"; shape.setAttribute('points', svgpoints); - var importedPolygon = ImportSvg.importSvg(shape); + var importedPolygon = SvgImporter.importSvg(shape); var poly = new Path(); 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"; shape.setAttribute('points', svgpoints); - var importedPolygon = ImportSvg.importSvg(shape); + var importedPolygon = SvgImporter.importSvg(shape); var poly = new Path(); var points = shape.points; @@ -377,7 +377,7 @@ test('compare polyline values', function() { var svgpoints = "5,5 45,45 5,45 45,5"; shape.setAttribute('points', svgpoints); - var importedPolyline = ImportSvg.importSvg(shape); + var importedPolyline = SvgImporter.importSvg(shape); var poly = new Path(); var points = shape.points; @@ -402,7 +402,7 @@ test('compare negative polyline values', function() { var svgpoints = "-5,-5 -45,-45 -5,-45 -45,-5"; shape.setAttribute('points', svgpoints); - var importedPolyline = ImportSvg.importSvg(shape); + var importedPolyline = SvgImporter.importSvg(shape); var poly = new Path(); var points = shape.points; diff --git a/test/tests/load.js b/test/tests/load.js index a8eb194d..87feea22 100644 --- a/test/tests/load.js +++ b/test/tests/load.js @@ -28,5 +28,5 @@ /*#*/ include('HitResult.js'); -/*#*/ include('ImportSvg.js'); -/*#*/ include('ExportSvg.js'); +/*#*/ include('SvgImporter.js'); +/*#*/ include('SvgExporter.js');