summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-01-28 12:02:36 +0100
committerSamy Pessé <samypesse@gmail.com>2015-01-28 12:02:36 +0100
commit924006d508f79e8d0f6db27f74bc1e59672b7be1 (patch)
tree6fc7221e57280f7f0610a8009e814df0a84b77fa
parent350f34561a07bf6291bd8770866685128a09bef5 (diff)
downloadgitbook-924006d508f79e8d0f6db27f74bc1e59672b7be1.zip
gitbook-924006d508f79e8d0f6db27f74bc1e59672b7be1.tar.gz
gitbook-924006d508f79e8d0f6db27f74bc1e59672b7be1.tar.bz2
Add test for svg conversion
-rw-r--r--test/ebook.js6
-rw-r--r--test/fixtures/test4/README.md2
-rw-r--r--test/fixtures/test4/test.svg11
3 files changed, 19 insertions, 0 deletions
diff --git a/test/ebook.js b/test/ebook.js
index e835a6e..b82bb19 100644
--- a/test/ebook.js
+++ b/test/ebook.js
@@ -12,4 +12,10 @@ describe('eBook Generator', function () {
assert(fs.existsSync(path.join(output, "SUMMARY.html")));
}, done);
});
+
+ it('should correctly convert svg images to png', function(done) {
+ testGeneration(books[4], "ebook", function(output) {
+ assert(fs.existsSync(path.join(output, "test.png")));
+ }, done);
+ });
});
diff --git a/test/fixtures/test4/README.md b/test/fixtures/test4/README.md
index d26ab9b..6d7efdc 100644
--- a/test/fixtures/test4/README.md
+++ b/test/fixtures/test4/README.md
@@ -1,3 +1,5 @@
# Other Title
A description
+
+![test image to be converted](./test.svg)
diff --git a/test/fixtures/test4/test.svg b/test/fixtures/test4/test.svg
new file mode 100644
index 0000000..417f2c1
--- /dev/null
+++ b/test/fixtures/test4/test.svg
@@ -0,0 +1,11 @@
+<?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">
+<svg version="1.1" baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg-root" width="100%" height="100%" viewBox="0 0 480 360">
+ <title id="test-title">basic SVG tiny doc</title>
+ <g id="test-body-content">
+ <text font-family="Arial" font-size="14" text-anchor="middle" x="225" y="25">hello world</text>
+ </g>
+ <text id="revision" x="10" y="340" font-size="40" stroke="none" fill="black">Revision: 1.1</text>
+ <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/>
+</svg>
+