Skip to content

Commit bea7e29

Browse files
committed
Examples CI: add a Mermaid test
1 parent 0975f12 commit bea7e29

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ sourceSets {
1515
}
1616
resources {
1717
srcDirs = ['src/examples/resources', 'imag']
18-
includes = ['hdrbg.svg', '**/profiles/*']
18+
includes = ['hdrbg.svg', 'io/sf/**']
1919
}
2020
}
2121
}

src/examples/java/io/sf/carte/example/EchoSVGTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import io.sf.carte.echosvg.transcoder.TranscoderInput;
4343
import io.sf.carte.echosvg.transcoder.TranscoderOutput;
4444
import io.sf.carte.echosvg.transcoder.image.PNGTranscoder;
45+
import io.sf.carte.echosvg.transcoder.util.CSSTranscodingHelper;
4546

4647
/**
4748
* The purpose of this test is to verify that EchoSVG can be run with the given
@@ -120,6 +121,21 @@ static SVGGraphics2D createSVGGraphics2D() {
120121
return new SVGGraphics2D(ctx, false);
121122
}
122123

124+
@Test
125+
public void testTranscodingHelper() throws Exception {
126+
PNGTranscoder transcoder = new PNGTranscoder();
127+
CSSTranscodingHelper helper = new CSSTranscodingHelper(transcoder);
128+
ByteArrayOutputStream ostream = new ByteArrayOutputStream(700);
129+
TranscoderOutput output = new TranscoderOutput(ostream);
130+
ErrorHandler handler = new ExceptionErrorHandler();
131+
transcoder.setErrorHandler(handler);
132+
try (Reader re = loadDocumentFromClasspath("/io/sf/carte/example/mermaid/block.svg")) {
133+
TranscoderInput input = new TranscoderInput(re);
134+
helper.transcode(input, output);
135+
}
136+
assertTrue(ostream.size() > 8000, "Mermaid image had size of only " + ostream.size() + ".");
137+
}
138+
123139
@Test
124140
public void testTranscoding() throws Exception {
125141
org.w3c.dom.DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
Lines changed: 2 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)