svgedit/archive/from-old-wiki/RoundtripTests.md

72 lines
3.9 KiB
Markdown
Raw Normal View History

- Security fix: 'extPath', 'imgPath', 'extIconsPath', 'canvgPath', 'langPath', 'jGraduatePath', and 'jspdfPath' were not being prevented - Breaking change: Rename "svgutils.js" to "utilities.js" (make in conformity with JSDoc module naming convention) - Breaking change: Rename "svgedit.js" to "namespaces.js" (to make clear purpose and avoid confusing with editor) - Breaking change: Rename "jquery-svg.js" to "jQuery.attr.js" - Breaking change: Rename "jquery.contextMenu.js" to "jQuery.contextMenu.js" - Breaking change: Rename "jquery.jpicker.js" to "jQuery.jPicker.js" - Breaking change: Rename "JQuerySpinBtn.css" to "jQuery.SpinButton.css" - Breaking change: Rename "JQuerySpinBtn.js" to "jQuery.SpinButton.js" (to have file name more closely reflect name) - Breaking change: Rename "jquery.svgicons.js" to "jQuery.svgIcons.js" - Breaking change: Rename "jquery.jgraduate.js" to "jQuery.jGraduate.js" - Breaking change: Rename "pathseg.js" to "svgpathseg.js" (as it is a poyfill of SVGPathSeg) - Breaking change: Rename `addSvgElementFromJson()` to `addSVGElementFromJson` for consistency - Breaking change: Rename `changeSvgContent()` to `changeSVGContent()` for consistency - Breaking change: Have `exportPDF` resolve with `output` and `outputType` rather than `dataurlstring` (as type may vary) - Breaking change: Rename `extensions/mathjax/MathJax.js` to `extensions/mathjax/MathJax.min.js` - Breaking change: Avoid recent change to have editor ready callbacks return Promises (we're not using and advantageous to keep sequential) - Breaking change: Avoid recent addition of locale-side function in ext-imagelib for l10n - Breaking change: Change name of ext-arrows.js from `Arrows` to `arrows` for sake of file path (not localized anyways). - Breaking change: Change `addlangData` extension event to `addLangData` for consistency with method name - Breaking change: Have `readLang` return lang and data but do not call `setLang` - Fix: Have general locales load first so extensions may use - Fix: Provide `importLocale` to extensions `init` so it may delay adding of the extension until locale data loaded - Fix: Ensure call to `rasterExport` without `imgType` properly sets MIME type to PNG - Fix: Wrong name for moinsave - Update: Update WebAppFind per new API changes - Enhancement: Make `setStrings` public on editor for late setting (used by `ext-shapes.js`) - Enhancement: Add `extensions_added` event - Enhancement: Add `message` event (Relay messages including those which have been been received prior to extension load) - Enhancement: Allow SVGEdit to work out of the box--avoid need for copying sample config file. Should also help with Github-based file servers - Enhancement: Allow avoiding "name" in extension export (just extract out of file name) - Enhancement: Add stack blur to canvg by default (and refactoring it) - Enhancement: Return `Promise` for `embedImage` (as with some other loading methods) - Enhancement: Supply `importLocale` to `langReady` to facilitate extension locale loading - Enhancement: Recover if an extension fails to load (just log and otherwise ignore) - Enhancement: More i18n of extensions (also fixed issue with some console warnings about missing locale strings); i18nize Hello World too - Enhancement: Allowing importing of locales within `addLangData` - npm: Update devDeps - Docs: Migrate copies of all old wiki pages to docs/from-old-wiki folder; intended for a possible move to Markdown, so raw HTML (with formatting) was not preserved, though named links had their absolute URL links preserved - Docs: Begin deleting `SvgCanvas.md` as ensuring jsdoc has replacements - Docs: Add Edtior doc file for help to general users - Docs: Clarify/simplify install instructions - npm/Docs (JSDoc): Add script to check for overly generic types - Docs (JSDoc): For config/prefs and extension creating, link to tutorials (moved tutorials to own directory to avoid recursion problems by jsdoc) - Docs (JSDoc): Add modules (upper case for usual main entrance files or regular names) - Docs (JSDoc): Fill out missing areas; indicate return of `undefined`; consistency with `@returns` - Docs (JSDoc): Add our own layout template to support overflow - Docs (JSDoc): Use cleverLinks and disallow unknown tags - Docs (JSDoc): Insist on "pedantic" flag; put output directory in config - Docs (JSDoc): Use more precise Integer/Float over number, the specific type of array/function/object - Docs (JSDoc): Use `@throws`, `@enum`, `@event`/`@fires`/`@listens` - Docs: Generally update/improve docs (fixes #92) - Docs: Update links to `latest` path (Avoid needing to update such references upon each release) - Docs: 80 chars max - Refactoring: Drop code for extension as function (already requiring export to be an object) - Refactoring: Object destructuring, `Object.entries`, Object shorthand, array extras, more camelCase variable names - Refactoring: Add a `Command` base class - Refactoring: Simplify svgicons `callback` ready detection - Refactoring: Put `let` or `const` closer to scope - Refactoring: Remove unneeded `delimiter` from regex escaping utility - Refactoring: Clearer variable names - Refactoring: Use (non-deprecated) Event constructors - Testing: Use new Sinon
2018-06-06 07:26:20 +00:00
Roundtrip Tests
Primarily in an effort to make SVG-edit suitable for Wikipedia, there are some tests that determine how accurately SVG-edit reproduces an original svg document when it is loaded into SVG-edit and immediately saved back out.
Hosted tests
The tests automate SVG-edit to perform a series of load-save operations on svg documents randomly selected from the Wikimedia Commons, but SVG-edit's output is sent back to a server for analysis and permanent storage. Currently, the main test server is https://www.mbaynton.com/svg-edit/2.6/test/roundtrip-test-src/launcher.php'>https://www.mbaynton.com/svg-edit/2.6/test/roundtrip-test-src/launcher.php'>https://www.mbaynton.com/svg-edit/2.6/test/roundtrip-test-src/launcher.php. Anyone who wants to help out can donate some cycles and bandwidth to the tests just by visiting this URL. We test hundreds of svg's on many browsers and many SVG-edit code revisions, so there's probably tests to be run.
The Error Score is based on how many pixels differ between the rasterized version of the original SVG document and the rasterized version of the SVG document that ran through SVG-edit. The closer to 0 the better. In the present interface you can also see a highlighted view of which pixels differ in each test, and compare the C14N-canonicalized input xml with the C14N-canonicalized SVG-edit output in a side-by-side diff.
In revisions of SVG-edit as of this writing, one of the first tests (352) will pause at "uploading saved source..." for a very long time due to the wildly inaccurate dimensions of the image that SVG-edit reports back to the server. Be patient.
Identified Issues
This section lists some issues that the roundtrip tests have revealed
Inline style attributes are not preserved
Wildly inaccurate dimensions of saved document, as exemplified by test 352
2013-10-03 Firefox on Windows eats up over 2 gigs of RAM and eventually crashes (reported by marclaporte)
Test code and dependencies
This section is only of interest if you wanted to set up a new roundtrip test environment on your own server.
I've checked in the code in a new branch at /svn/branches/roundtrip-diff-tests/2.6/test/roundtrip-test-src. Those with more ownership of the project can feel free to reorganize and/or merge it into trunk if you like.
To get this working on your server:
Create a MySQL database and apply the svg-edit-test.sql file to it to create two empty tables. Configure permissions to this database as you desire; you'll need to give php credentials to read and write.
Create a settings.php file in the same directory as test-runner.php, replacing the variable values for your environment:
<?php
$dbhost = "localhost";
$dbuser = "www";
$dbpass = "";
$dbschema = "svg-edit-test"; // name of database you created
$baseURL = "http://www.mbaynton.com/svg-edit-test/2.6/test/roundtrip-test-src";
?>
Load a set of svg files ("tests") into your database from Wikimedia Commons via the Tests-generator.php command-line script. Verify everything is working by loading a single document with
$ php Tests-generator.php
If this is successful, you can load some n SVG documents with
$ php Tests-generator.php n
Once you're satisfied with the set of tests you've loaded, you probably shouldn't change them again. It will be easier to compare test runs that way.
A (probably incomplete) list of dependencies on the server:
PHP cURL extension
SVN Functions for PHP
ImageMagick and its PHP extension
(Optionally) a W3C markup validator. The validator is web based and so doesn't need to be local; the one it uses should be in settings.php but is currently hardcoded in helper-functions.php (function testSvgStrictValidity).
# Future Enhancements #
Use http://www.mergely.com/ for textual diffs
Allow tests to run from svg-edit hosted on arbitrary servers, so developers can evaluate changes before checking them in.
Plenty more...
Related links