Skip to content

Commit

Permalink
Tests: add more Mermaid tests
Browse files Browse the repository at this point in the history
Samples taken from the website https://mermaid.js.org/
  • Loading branch information
carlosame committed Jul 28, 2024
1 parent 7c05705 commit de3f128
Show file tree
Hide file tree
Showing 58 changed files with 745 additions and 485 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
/*
See the NOTICE file distributed with this work for additional
information regarding copyright ownership.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package io.sf.carte.echosvg.test.svg;

import java.io.IOException;

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import io.sf.carte.echosvg.test.TestFonts;
import io.sf.carte.echosvg.transcoder.TranscoderException;

/**
* This test renders a number of Mermaid-generated SVG files under the {@code samples}
* directory, and compares the result with a reference image.
* <p>
* It bypasses EchoSVG's style computations and uses CSS4J instead.
* </p>
*/
public class MermaidRenderingTest extends AbstractBypassRenderingCheck {

@BeforeAll
public static void setUpBeforeClass() throws Exception {
TestFonts.loadTestFonts();
}

@Test
public void testMermaid() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid.svg");
}

@Test
public void testWebsiteDiagram93() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-93.svg");
}

@Disabled
@Test
public void testBlock() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-block.svg");
}

@Test
public void testC4Context() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-c4-context.svg");
}

@Test
public void testC4Component() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-c4-component.svg");
}

@Test
public void testC4Container() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-c4-container.svg");
}

@Test
public void testC4Deployment() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-c4-deployment.svg");
}

@Test
public void testC4Dynamic() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-c4-dynamic.svg");
}

@Test
public void testClass() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-class.svg", 1);
}

@Test
public void testEntityRelationship() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-erd.svg");
}

@Test
public void testEntityRelationship2() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-erd2.svg");
}

@Test
public void testFlowChart() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-flowchart.svg");
}

@Test
public void testFlowChartCyrillic() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-flowchart-cyrillic.svg");
}

@Test
public void testGantt() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-gantt.svg", 6);
}

@Test
public void testGitGraph() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-git-graph.svg", 1);
}

@Test
public void testJourney() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-journey.svg", 9);
}

@Test
public void testMindmap() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-mindmap.svg", 1);
}

@Test
public void testPie() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-pie.svg");
}

@Test
public void testQuadrant() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-quadrant.svg", 6);
}

@Test
public void testRequirement() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-requirement.svg", 1);
}

@Test
public void testSankey() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-sankey.svg");
}

@Test
public void testSequence() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-sequence.svg", 9);
}

@Test
public void testSequenceBackground() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-sequence-background.svg", 5);
}

@Test
public void testSequenceCritical() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-sequence-critical.svg", 5);
}

@Test
public void testSequenceGrouping() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-sequence-grouping.svg", 11);
}

@Test
public void testSequenceParallel() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-sequence-parallel.svg", 7);
}

@Test
public void testState() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-state.svg");
}

@Test
public void testTimeline() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-timeline.svg", 2);
}

@Test
public void testXY() throws TranscoderException, IOException {
testNV("samples/tests/spec2/foreign/mermaid-xy.svg");
}

}
Loading

0 comments on commit de3f128

Please sign in to comment.