You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kw...@apache.org on 2023/02/09 15:46:20 UTC

[maven-doxia] 01/01: Add test for parsing font styles including escape characters

This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch feature/add-test-for-parsing-fontstyles-with-escape-characters
in repository https://gitbox.apache.org/repos/asf/maven-doxia.git

commit 3f55ae3d7acd4e5dddcd2a5001428dcdef1846a6
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Thu Feb 9 16:46:13 2023 +0100

    Add test for parsing font styles including escape characters
---
 .../apache/maven/doxia/module/apt/AptParserTest.java    | 17 +++++++++++++++++
 .../doxia-module-apt/src/test/resources/test/font.apt   |  1 +
 2 files changed, 18 insertions(+)

diff --git a/doxia-modules/doxia-module-apt/src/test/java/org/apache/maven/doxia/module/apt/AptParserTest.java b/doxia-modules/doxia-module-apt/src/test/java/org/apache/maven/doxia/module/apt/AptParserTest.java
index 9420f044..afd833ae 100644
--- a/doxia-modules/doxia-module-apt/src/test/java/org/apache/maven/doxia/module/apt/AptParserTest.java
+++ b/doxia-modules/doxia-module-apt/src/test/java/org/apache/maven/doxia/module/apt/AptParserTest.java
@@ -124,6 +124,23 @@ public class AptParserTest extends AbstractParserTest {
                 "body_");
     }
 
+    @Test
+    public void testFontStyles() throws Exception {
+        SinkEventTestingSink sink = new SinkEventTestingSink();
+        try (Reader reader = getTestReader("test/font")) {
+            createParser().parse(reader, sink);
+        }
+
+        Iterator<SinkEventElement> it = sink.getEventList().iterator();
+
+        assertSinkStartsWith(it, "head", "head_", "body", "paragraph", "text", "italic");
+        assertSinkEquals(it.next(), "text", "<Italic>");
+        assertSinkStartsWith(it, "italic_", "text", "bold");
+        assertSinkEquals(it.next(), "text", "<Bold>");
+        assertSinkStartsWith(it, "bold_", "text", "monospaced");
+        assertSinkEquals(it.next(), "text", "<Monospaced>");
+    }
+
     @Test
     public void testSnippetTrailingSpace() throws Exception {
         // DOXIA-425
diff --git a/doxia-modules/doxia-module-apt/src/test/resources/test/font.apt b/doxia-modules/doxia-module-apt/src/test/resources/test/font.apt
new file mode 100644
index 00000000..c1b89631
--- /dev/null
+++ b/doxia-modules/doxia-module-apt/src/test/resources/test/font.apt
@@ -0,0 +1 @@
+  Paragraph with <\<Italic\>>, <<\<Bold\>>>, <<<\<Monospaced\>>>> font