Add test for issue #25 about parseSVGDocument and rect element.

This commit is contained in:
kangax 2011-04-28 16:37:21 -04:00
parent 74dcd851dd
commit 7a28d275a3
2 changed files with 33 additions and 0 deletions

7
test/fixtures/svg_with_rect.svg vendored Normal file
View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd" [
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
]>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg">
<rect x="8.5" y="208" width="8.76" height="17.28" />
</svg>

After

Width:  |  Height:  |  Size: 322 B

View file

@ -259,4 +259,30 @@
}, 1500);
});
// https://github.com/kangax/fabric.js/issues/25
asyncTest('parseSVGDocument w. rect', function() {
var data;
fabric.util.request('../fixtures/svg_with_rect.svg', {
method: 'get',
onComplete: function(resp) {
var doc = resp.responseXML;
fabric.parseSVGDocument(doc.documentElement, function() {
data = arguments[0];
});
}
});
setTimeout(function() {
equals(typeof data, 'object');
equals(data.length, 1);
if (data) {
var rect = data[0];
ok(rect instanceof fabric.Rect);
}
start();
}, 1500);
});
})();