summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJesse Rosenthal <jrosenthal@jhu.edu>2016-08-15 15:33:06 -0400
committerJesse Rosenthal <jrosenthal@jhu.edu>2016-08-15 15:33:06 -0400
commitd416f6241079a8d596fd071ed3dc20c4a60a6069 (patch)
tree3dfa4ffecc3c163db6882bd2a16a0777bada6e96 /tests
parent663f689fa40458d680d44624c108c3009b8329ca (diff)
Docx writer: test for custom styles.
This just tests whether a custom style with a recognizable style (italic etc, defined in a reference.docx) will roundtrip back to that format (i.e., whether `<span custom-style="Emphasized">` will roundtrip to `Emph`). The custom styles are defined in the `custom-style-reference.docx` included in the docx dir.
Diffstat (limited to 'tests')
-rw-r--r--tests/Tests/Writers/Docx.hs8
-rw-r--r--tests/docx/custom-style-reference.docxbin0 -> 14846 bytes
-rw-r--r--tests/docx/custom-style-roundtrip-end.native5
-rw-r--r--tests/docx/custom-style-roundtrip-start.native5
4 files changed, 18 insertions, 0 deletions
diff --git a/tests/Tests/Writers/Docx.hs b/tests/Tests/Writers/Docx.hs
index d662697a1..8e0f37818 100644
--- a/tests/Tests/Writers/Docx.hs
+++ b/tests/Tests/Writers/Docx.hs
@@ -137,5 +137,13 @@ tests = [ testGroup "inlines"
"stop recording metadata with normal text"
"docx/metadata_after_normal.native"
]
+ , testGroup "customized styles"
+ [ testCompareWithOpts
+ ( def{writerReferenceDocx=Just "docx/custom-style-reference.docx"}
+ , def)
+ "simple customized blocks and inlines"
+ "docx/custom-style-roundtrip-start.native"
+ "docx/custom-style-roundtrip-end.native"
+ ]
]
diff --git a/tests/docx/custom-style-reference.docx b/tests/docx/custom-style-reference.docx
new file mode 100644
index 000000000..0f53c6c88
--- /dev/null
+++ b/tests/docx/custom-style-reference.docx
Binary files differ
diff --git a/tests/docx/custom-style-roundtrip-end.native b/tests/docx/custom-style-roundtrip-end.native
new file mode 100644
index 000000000..4313c3595
--- /dev/null
+++ b/tests/docx/custom-style-roundtrip-end.native
@@ -0,0 +1,5 @@
+[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "test",Space,Str "of",Space,Str "custom-styles."]
+,Para [Str "Here",Space,Str "is",Space,Str "something",Space,Emph [Str "emphasized"],Str ".",Space,Str "And",Space,Str "here",Space,Str "is",Space,Str "something",Space,Strong [Str "strong"],Str "."]
+,BlockQuote
+ [Para [Str "One",Space,Str "paragraph",Space,Str "of",Space,Str "text."]
+ ,Para [Str "And",Space,Str "another",Space,Str "paragraph",Space,Str "of",Space,Emph [Str "really",Space,Str "cool"],Space,Str "text."]]]
diff --git a/tests/docx/custom-style-roundtrip-start.native b/tests/docx/custom-style-roundtrip-start.native
new file mode 100644
index 000000000..c4566ed85
--- /dev/null
+++ b/tests/docx/custom-style-roundtrip-start.native
@@ -0,0 +1,5 @@
+[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "test",Space,Str "of",Space,Str "custom-styles."]
+,Para [Str "Here",Space,Str "is",Space,Str "something",Space,Span ("",[],[("custom-style","Emphatic")]) [Str "emphasized"],Str ".",Space,Str "And",SoftBreak,Str "here",Space,Str "is",Space,Str "something",Space,Span ("",[],[("custom-style","Strengthened")]) [Str "strong"],Str "."]
+,Div ("",[],[("custom-style","My Block Style")])
+ [Para [Str "One",Space,Str "paragraph",Space,Str "of",Space,Str "text."]
+ ,Para [Str "And",Space,Str "another",Space,Str "paragraph",Space,Str "of",Space,Span ("",[],[("custom-style","Emphatic")]) [Str "really",SoftBreak,Str "cool"],Space,Str "text."]]]