@@ -0,0 +1,128 @@
1+module Tests.Writers.Docx (tests) where
3+import Text.Pandoc.Options
4+import Text.Pandoc.Readers.Native
5+import Text.Pandoc.Definition
8+import Text.Pandoc.Readers.Docx
9+import Text.Pandoc.Writers.Docx
11+type Options = (WriterOptions, ReaderOptions)
13+compareOutput :: Options
15+ -> IO (Pandoc, Pandoc)
16+compareOutput opts nativeFile = do
17+ nf <- Prelude.readFile nativeFile
18+ df <- writeDocx (fst opts) (readNative nf)
19+ let (p, _) = readDocx (snd opts) df
20+ return (p, readNative nf)
22+testCompareWithOptsIO :: Options -> String -> FilePath -> IO Test
23+testCompareWithOptsIO opts name nativeFile = do
24+ (dp, np) <- compareOutput opts nativeFile
25+ return $ test id name (dp, np)
27+testCompareWithOpts :: Options -> String -> FilePath -> Test
28+testCompareWithOpts opts name nativeFile =
29+ buildTest $ testCompareWithOptsIO opts name nativeFile
31+testCompare :: String -> FilePath -> Test
32+testCompare = testCompareWithOpts def
35+tests = [ testGroup "inlines"
38+ "docx/inline_formatting_writer.native"
40+ "font formatting with character styles"
41+ "docx/char_styles.native"
44+ "docx/links_writer.native"
47+ "docx/image_no_embed_writer.native"
49+ "inline image in links"
50+ "docx/inline_images_writer.native"
52+ "handling unicode input"
53+ "docx/unicode.native"
58+ "normalizing inlines"
59+ "docx/normalize.native"
61+ "normalizing inlines deep inside blocks"
62+ "docx/deep_normalize.native"
64+ "move trailing spaces outside of formatting"
65+ "docx/trailing_spaces_in_formatting.native"
67+ "inline code (with VerbatimChar style)"
68+ "docx/inline_code.native"
70+ "inline code in subscript and superscript"
71+ "docx/verbatim_subsuper.native"
76+ "docx/headers.native"
78+ "headers already having auto identifiers"
79+ "docx/already_auto_ident.native"
81+ "numbered headers automatically made into list"
82+ "docx/numbered_header.native"
84+ "i18n blocks (headers and blockquotes)"
85+ "docx/i18n_blocks.native"
86+ -- some level problems, look into that
89+ -- "docx/lists.native"
92+ "docx/definition_list.native"
94+ "custom defined lists in styles"
95+ "docx/german_styled_lists.native"
97+ "footnotes and endnotes"
100+ "blockquotes (parsing indent as blockquote)"
101+ "docx/block_quotes_parse_indent.native"
104+ "docx/hanging_indent.native"
105+ -- tables headers do not survive round-trip, should look into that
108+ -- "docx/tables.native"
110+ -- "tables with lists in cells"
111+ -- "docx/table_with_list_cell.native"
114+ "docx/codeblock.native"
116+ "dropcap paragraphs"
117+ "docx/drop_cap.native"
119+ , testGroup "metadata"
120+ [ testCompareWithOpts (def,def{readerStandalone=True})
122+ "docx/metadata.native"
123+ , testCompareWithOpts (def,def{readerStandalone=True})
124+ "stop recording metadata with normal text"
125+ "docx/metadata_after_normal.native"