2018-03-18 10:46:28 -07:00
|
|
|
{-# LANGUAGE NoImplicitPrelude #-}
|
2019-02-04 22:52:31 +01:00
|
|
|
{- |
|
|
|
|
Module : Tests.Readers.Docx
|
|
|
|
Copyright : © 2017-2019 Jesse Rosenthal, John MacFarlane
|
|
|
|
License : GNU GPL, version 2 or above
|
|
|
|
|
|
|
|
Maintainer : Jesse Rosenthal <jrosenthal@jhu.edu>
|
|
|
|
Stability : alpha
|
|
|
|
Portability : portable
|
|
|
|
|
|
|
|
Tests for the word docx reader.
|
|
|
|
-}
|
2014-06-16 22:44:40 -07:00
|
|
|
module Tests.Readers.Docx (tests) where
|
2014-06-15 14:55:17 -04:00
|
|
|
|
2018-03-18 10:46:28 -07:00
|
|
|
import Prelude
|
2017-03-04 13:03:41 +01:00
|
|
|
import Codec.Archive.Zip
|
2017-06-10 18:26:44 +02:00
|
|
|
import qualified Data.ByteString as BS
|
2017-10-27 20:28:29 -07:00
|
|
|
import qualified Data.ByteString.Lazy as B
|
2014-06-20 18:26:15 -04:00
|
|
|
import qualified Data.Map as M
|
2017-10-27 20:28:29 -07:00
|
|
|
import qualified Data.Text as T
|
2018-01-19 21:25:24 -08:00
|
|
|
import Data.Maybe
|
2017-10-27 20:28:29 -07:00
|
|
|
import System.IO.Unsafe
|
2017-03-14 17:05:36 +01:00
|
|
|
import Test.Tasty
|
|
|
|
import Test.Tasty.HUnit
|
2017-03-04 13:03:41 +01:00
|
|
|
import Tests.Helpers
|
|
|
|
import Text.Pandoc
|
2016-12-01 12:47:05 -05:00
|
|
|
import qualified Text.Pandoc.Class as P
|
2017-03-04 13:03:41 +01:00
|
|
|
import Text.Pandoc.MediaBag (MediaBag, lookupMedia, mediaDirectory)
|
2017-10-27 20:28:29 -07:00
|
|
|
import Text.Pandoc.UTF8 as UTF8
|
2014-06-15 14:55:17 -04:00
|
|
|
|
2014-06-20 18:26:15 -04:00
|
|
|
-- We define a wrapper around pandoc that doesn't normalize in the
|
|
|
|
-- tests. Since we do our own normalization, we want to make sure
|
|
|
|
-- we're doing it right.
|
|
|
|
|
|
|
|
data NoNormPandoc = NoNormPandoc {unNoNorm :: Pandoc}
|
|
|
|
deriving Show
|
|
|
|
|
|
|
|
noNorm :: Pandoc -> NoNormPandoc
|
|
|
|
noNorm = NoNormPandoc
|
|
|
|
|
2017-01-15 20:42:00 +01:00
|
|
|
defopts :: ReaderOptions
|
|
|
|
defopts = def{ readerExtensions = getDefaultExtensions "docx" }
|
|
|
|
|
2014-06-20 18:26:15 -04:00
|
|
|
instance ToString NoNormPandoc where
|
2017-06-10 23:39:49 +02:00
|
|
|
toString d = T.unpack $ purely (writeNative def{ writerTemplate = s }) $ toPandoc d
|
2014-06-20 18:26:15 -04:00
|
|
|
where s = case d of
|
|
|
|
NoNormPandoc (Pandoc (Meta m) _)
|
2016-11-30 15:34:58 +01:00
|
|
|
| M.null m -> Nothing
|
|
|
|
| otherwise -> Just "" -- need this to get meta output
|
2014-06-20 18:26:15 -04:00
|
|
|
|
|
|
|
instance ToPandoc NoNormPandoc where
|
|
|
|
toPandoc = unNoNorm
|
|
|
|
|
2017-12-04 10:31:06 -08:00
|
|
|
compareOutput :: ReaderOptions
|
|
|
|
-> FilePath
|
|
|
|
-> FilePath
|
|
|
|
-> IO (NoNormPandoc, NoNormPandoc)
|
|
|
|
compareOutput opts docxFile nativeFile = do
|
2014-06-15 14:55:17 -04:00
|
|
|
df <- B.readFile docxFile
|
2017-06-10 18:26:44 +02:00
|
|
|
nf <- UTF8.toText <$> BS.readFile nativeFile
|
2016-12-01 12:47:05 -05:00
|
|
|
p <- runIOorExplode $ readDocx opts df
|
2016-12-10 16:52:35 +01:00
|
|
|
df' <- runIOorExplode $ readNative def nf
|
2018-01-19 21:25:24 -08:00
|
|
|
return (noNorm p, noNorm df')
|
2014-06-15 14:55:17 -04:00
|
|
|
|
2017-03-14 17:05:36 +01:00
|
|
|
testCompareWithOptsIO :: ReaderOptions -> String -> FilePath -> FilePath -> IO TestTree
|
2014-06-19 12:05:16 -04:00
|
|
|
testCompareWithOptsIO opts name docxFile nativeFile = do
|
2017-12-04 10:31:06 -08:00
|
|
|
(dp, np) <- compareOutput opts docxFile nativeFile
|
2014-06-15 14:55:17 -04:00
|
|
|
return $ test id name (dp, np)
|
|
|
|
|
2017-03-14 17:05:36 +01:00
|
|
|
testCompareWithOpts :: ReaderOptions -> String -> FilePath -> FilePath -> TestTree
|
2014-06-19 12:05:16 -04:00
|
|
|
testCompareWithOpts opts name docxFile nativeFile =
|
2017-03-14 17:05:36 +01:00
|
|
|
unsafePerformIO $ testCompareWithOptsIO opts name docxFile nativeFile
|
2014-06-19 12:05:16 -04:00
|
|
|
|
2017-03-14 17:05:36 +01:00
|
|
|
testCompare :: String -> FilePath -> FilePath -> TestTree
|
2017-01-15 20:42:00 +01:00
|
|
|
testCompare = testCompareWithOpts defopts
|
2014-06-15 14:55:17 -04:00
|
|
|
|
2017-03-14 17:05:36 +01:00
|
|
|
testForWarningsWithOptsIO :: ReaderOptions -> String -> FilePath -> [String] -> IO TestTree
|
2016-06-23 10:45:14 -04:00
|
|
|
testForWarningsWithOptsIO opts name docxFile expected = do
|
|
|
|
df <- B.readFile docxFile
|
2017-03-14 21:06:14 +01:00
|
|
|
logs <- runIOorExplode $ setVerbosity ERROR >> readDocx opts df >> P.getLog
|
2017-02-10 23:59:47 +01:00
|
|
|
let warns = [m | DocxParserWarning m <- logs]
|
2016-06-23 10:45:14 -04:00
|
|
|
return $ test id name (unlines warns, unlines expected)
|
|
|
|
|
2017-03-14 17:05:36 +01:00
|
|
|
testForWarningsWithOpts :: ReaderOptions -> String -> FilePath -> [String] -> TestTree
|
2016-06-23 10:45:14 -04:00
|
|
|
testForWarningsWithOpts opts name docxFile expected =
|
2017-03-14 17:05:36 +01:00
|
|
|
unsafePerformIO $ testForWarningsWithOptsIO opts name docxFile expected
|
2016-06-23 10:45:14 -04:00
|
|
|
|
2017-03-14 17:05:36 +01:00
|
|
|
-- testForWarnings :: String -> FilePath -> [String] -> TestTree
|
2017-01-15 20:42:00 +01:00
|
|
|
-- testForWarnings = testForWarningsWithOpts defopts
|
2016-06-23 10:45:14 -04:00
|
|
|
|
2014-07-31 12:10:33 -04:00
|
|
|
getMedia :: FilePath -> FilePath -> IO (Maybe B.ByteString)
|
|
|
|
getMedia archivePath mediaPath = do
|
|
|
|
zf <- B.readFile archivePath >>= return . toArchive
|
2014-09-02 14:05:54 -04:00
|
|
|
return $ findEntryByPath ("word/" ++ mediaPath) zf >>= (Just . fromEntry)
|
2014-07-31 12:10:33 -04:00
|
|
|
|
|
|
|
compareMediaPathIO :: FilePath -> MediaBag -> FilePath -> IO Bool
|
|
|
|
compareMediaPathIO mediaPath mediaBag docxPath = do
|
|
|
|
docxMedia <- getMedia docxPath mediaPath
|
|
|
|
let mbBS = case lookupMedia mediaPath mediaBag of
|
|
|
|
Just (_, bs) -> bs
|
|
|
|
Nothing -> error ("couldn't find " ++
|
|
|
|
mediaPath ++
|
|
|
|
" in media bag")
|
2018-01-19 21:25:24 -08:00
|
|
|
docxBS = fromMaybe (error ("couldn't find " ++
|
|
|
|
mediaPath ++
|
|
|
|
" in media bag")) docxMedia
|
2014-07-31 12:10:33 -04:00
|
|
|
return $ mbBS == docxBS
|
|
|
|
|
|
|
|
compareMediaBagIO :: FilePath -> IO Bool
|
|
|
|
compareMediaBagIO docxFile = do
|
2014-07-30 22:31:38 -04:00
|
|
|
df <- B.readFile docxFile
|
2017-03-14 21:06:14 +01:00
|
|
|
mb <- runIOorExplode $ readDocx defopts df >> P.getMediaBag
|
2014-07-31 12:10:33 -04:00
|
|
|
bools <- mapM
|
2014-08-11 23:10:50 -04:00
|
|
|
(\(fp, _, _) -> compareMediaPathIO fp mb docxFile)
|
2014-07-31 12:10:33 -04:00
|
|
|
(mediaDirectory mb)
|
|
|
|
return $ and bools
|
2014-07-30 22:31:38 -04:00
|
|
|
|
2017-03-14 17:05:36 +01:00
|
|
|
testMediaBagIO :: String -> FilePath -> IO TestTree
|
2014-07-31 12:10:33 -04:00
|
|
|
testMediaBagIO name docxFile = do
|
|
|
|
outcome <- compareMediaBagIO docxFile
|
2014-08-11 23:10:50 -04:00
|
|
|
return $ testCase name (assertBool
|
2014-07-31 12:10:33 -04:00
|
|
|
("Media didn't match media bag in file " ++ docxFile)
|
|
|
|
outcome)
|
2014-07-30 22:31:38 -04:00
|
|
|
|
2017-03-14 17:05:36 +01:00
|
|
|
testMediaBag :: String -> FilePath -> TestTree
|
|
|
|
testMediaBag name docxFile = unsafePerformIO $ testMediaBagIO name docxFile
|
2014-06-15 14:55:17 -04:00
|
|
|
|
2017-03-14 17:05:36 +01:00
|
|
|
tests :: [TestTree]
|
2019-02-06 21:11:51 -05:00
|
|
|
tests = [ testGroup "document"
|
|
|
|
[ testCompare
|
|
|
|
"allow different document.xml file as defined in _rels/.rels"
|
|
|
|
"docx/alternate_document_path.docx"
|
|
|
|
"docx/alternate_document_path.native"
|
|
|
|
]
|
|
|
|
, testGroup "inlines"
|
2014-06-15 14:55:17 -04:00
|
|
|
[ testCompare
|
|
|
|
"font formatting"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/inline_formatting.docx"
|
|
|
|
"docx/inline_formatting.native"
|
2014-08-16 14:05:56 -04:00
|
|
|
, testCompare
|
|
|
|
"font formatting with character styles"
|
|
|
|
"docx/char_styles.docx"
|
|
|
|
"docx/char_styles.native"
|
2014-06-15 14:55:17 -04:00
|
|
|
, testCompare
|
|
|
|
"hyperlinks"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/links.docx"
|
|
|
|
"docx/links.native"
|
2018-01-16 13:20:01 -05:00
|
|
|
, testCompare
|
|
|
|
"hyperlinks in <w:instrText> tag"
|
|
|
|
"docx/instrText_hyperlink.docx"
|
|
|
|
"docx/instrText_hyperlink.native"
|
2014-06-15 14:55:17 -04:00
|
|
|
, testCompare
|
2014-08-07 15:34:49 -04:00
|
|
|
"inline image"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/image.docx"
|
|
|
|
"docx/image_no_embed.native"
|
2015-01-21 13:38:04 -05:00
|
|
|
, testCompare
|
|
|
|
"VML image"
|
|
|
|
"docx/image_vml.docx"
|
|
|
|
"docx/image_vml.native"
|
2014-08-07 15:34:49 -04:00
|
|
|
, testCompare
|
|
|
|
"inline image in links"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/inline_images.docx"
|
|
|
|
"docx/inline_images.native"
|
2014-06-15 14:55:17 -04:00
|
|
|
, testCompare
|
|
|
|
"handling unicode input"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/unicode.docx"
|
|
|
|
"docx/unicode.native"
|
2014-06-19 19:33:22 -04:00
|
|
|
, testCompare
|
|
|
|
"literal tabs"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/tabs.docx"
|
|
|
|
"docx/tabs.native"
|
2015-10-04 06:08:17 -04:00
|
|
|
, testCompare
|
|
|
|
"special punctuation"
|
|
|
|
"docx/special_punctuation.docx"
|
|
|
|
"docx/special_punctuation.native"
|
2014-06-21 17:58:32 -04:00
|
|
|
, testCompare
|
|
|
|
"normalizing inlines"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/normalize.docx"
|
|
|
|
"docx/normalize.native"
|
2014-06-22 01:58:41 -04:00
|
|
|
, testCompare
|
|
|
|
"normalizing inlines deep inside blocks"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/deep_normalize.docx"
|
|
|
|
"docx/deep_normalize.native"
|
2014-06-23 15:40:34 -04:00
|
|
|
, testCompare
|
|
|
|
"move trailing spaces outside of formatting"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/trailing_spaces_in_formatting.docx"
|
|
|
|
"docx/trailing_spaces_in_formatting.native"
|
2014-06-24 10:33:49 -04:00
|
|
|
, testCompare
|
2019-02-18 15:49:00 -05:00
|
|
|
"remove trailing spaces from last inline"
|
|
|
|
"docx/trim_last_inline.docx"
|
|
|
|
"docx/trim_last_inline.native"
|
|
|
|
, testCompare
|
2014-06-24 10:33:49 -04:00
|
|
|
"inline code (with VerbatimChar style)"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/inline_code.docx"
|
|
|
|
"docx/inline_code.native"
|
2015-02-21 08:44:13 -05:00
|
|
|
, testCompare
|
|
|
|
"inline code in subscript and superscript"
|
|
|
|
"docx/verbatim_subsuper.docx"
|
|
|
|
"docx/verbatim_subsuper.native"
|
2017-12-27 10:01:45 -05:00
|
|
|
, testCompare
|
|
|
|
"inlines inside of Structured Document Tags"
|
|
|
|
"docx/sdt_elements.docx"
|
|
|
|
"docx/sdt_elements.native"
|
2019-02-12 17:26:37 -05:00
|
|
|
, testCompare
|
|
|
|
"Structured Document Tags in footnotes"
|
|
|
|
"docx/sdt_in_footnote.docx"
|
|
|
|
"docx/sdt_in_footnote.native"
|
2018-02-28 16:27:18 -05:00
|
|
|
, testCompare
|
|
|
|
"nested Structured Document Tags"
|
|
|
|
"docx/nested_sdt.docx"
|
|
|
|
"docx/nested_sdt.native"
|
2018-03-13 22:12:55 -04:00
|
|
|
, testCompare
|
|
|
|
"nested Smart Tags"
|
|
|
|
"docx/nested_smart_tags.docx"
|
|
|
|
"docx/nested_smart_tags.native"
|
2017-12-30 22:43:33 -05:00
|
|
|
, testCompare
|
|
|
|
"remove anchor spans with nothing pointing to them"
|
|
|
|
"docx/unused_anchors.docx"
|
|
|
|
"docx/unused_anchors.native"
|
2017-12-31 09:36:42 -05:00
|
|
|
, testCompare
|
|
|
|
"collapse overlapping targets (anchor spans)"
|
|
|
|
"docx/overlapping_targets.docx"
|
|
|
|
"docx/overlapping_targets.native"
|
2014-06-19 19:33:22 -04:00
|
|
|
]
|
2014-06-15 14:55:17 -04:00
|
|
|
, testGroup "blocks"
|
|
|
|
[ testCompare
|
|
|
|
"headers"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/headers.docx"
|
|
|
|
"docx/headers.native"
|
2014-07-15 10:25:32 +01:00
|
|
|
, testCompare
|
|
|
|
"headers already having auto identifiers"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/already_auto_ident.docx"
|
|
|
|
"docx/already_auto_ident.native"
|
2017-08-06 19:36:25 -07:00
|
|
|
, testCompare
|
|
|
|
"avoid zero-level headers"
|
|
|
|
"docx/0_level_headers.docx"
|
|
|
|
"docx/0_level_headers.native"
|
2016-08-29 08:35:59 -04:00
|
|
|
, testCompare
|
|
|
|
"nested anchor spans in header"
|
|
|
|
"docx/nested_anchors_in_header.docx"
|
|
|
|
"docx/nested_anchors_in_header.native"
|
2014-09-04 19:39:49 -04:00
|
|
|
, testCompare
|
2016-03-16 12:56:17 -04:00
|
|
|
"single numbered item not made into list"
|
2014-09-04 19:39:49 -04:00
|
|
|
"docx/numbered_header.docx"
|
|
|
|
"docx/numbered_header.native"
|
2016-03-16 12:56:17 -04:00
|
|
|
, testCompare
|
|
|
|
"enumerated headers not made into numbered list"
|
|
|
|
"docx/enumerated_headings.docx"
|
|
|
|
"docx/enumerated_headings.native"
|
2014-10-25 16:00:27 -04:00
|
|
|
, testCompare
|
|
|
|
"i18n blocks (headers and blockquotes)"
|
|
|
|
"docx/i18n_blocks.docx"
|
|
|
|
"docx/i18n_blocks.native"
|
2014-06-15 14:55:17 -04:00
|
|
|
, testCompare
|
|
|
|
"lists"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/lists.docx"
|
|
|
|
"docx/lists.native"
|
2018-12-10 19:23:03 -05:00
|
|
|
, testCompare
|
|
|
|
"lists with level overrides"
|
|
|
|
"docx/lists_level_override.docx"
|
|
|
|
"docx/lists_level_override.native"
|
2017-12-13 15:14:23 -05:00
|
|
|
, testCompare
|
|
|
|
"lists continuing after interruption"
|
|
|
|
"docx/lists_continuing.docx"
|
|
|
|
"docx/lists_continuing.native"
|
|
|
|
, testCompare
|
|
|
|
"lists restarting after interruption"
|
|
|
|
"docx/lists_restarting.docx"
|
|
|
|
"docx/lists_restarting.native"
|
2014-06-24 11:48:23 -04:00
|
|
|
, testCompare
|
|
|
|
"definition lists"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/definition_list.docx"
|
|
|
|
"docx/definition_list.native"
|
2015-02-19 00:24:04 -05:00
|
|
|
, testCompare
|
|
|
|
"custom defined lists in styles"
|
|
|
|
"docx/german_styled_lists.docx"
|
|
|
|
"docx/german_styled_lists.native"
|
2015-11-18 13:15:23 -05:00
|
|
|
, testCompare
|
|
|
|
"user deletes bullet after list item (=> part of item par)"
|
|
|
|
"docx/dummy_item_after_list_item.docx"
|
|
|
|
"docx/dummy_item_after_list_item.native"
|
|
|
|
, testCompare
|
|
|
|
"user deletes bullet after par (=> new par)"
|
|
|
|
"docx/dummy_item_after_paragraph.docx"
|
|
|
|
"docx/dummy_item_after_paragraph.native"
|
2014-06-15 14:55:17 -04:00
|
|
|
, testCompare
|
|
|
|
"footnotes and endnotes"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/notes.docx"
|
|
|
|
"docx/notes.native"
|
2015-11-14 13:45:29 -05:00
|
|
|
, testCompare
|
|
|
|
"links in footnotes and endnotes"
|
|
|
|
"docx/link_in_notes.docx"
|
|
|
|
"docx/link_in_notes.native"
|
2014-06-15 14:55:17 -04:00
|
|
|
, testCompare
|
|
|
|
"blockquotes (parsing indent as blockquote)"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/block_quotes.docx"
|
|
|
|
"docx/block_quotes_parse_indent.native"
|
2014-06-29 23:37:00 -04:00
|
|
|
, testCompare
|
|
|
|
"hanging indents"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/hanging_indent.docx"
|
|
|
|
"docx/hanging_indent.native"
|
2014-06-15 14:55:17 -04:00
|
|
|
, testCompare
|
|
|
|
"tables"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/tables.docx"
|
|
|
|
"docx/tables.native"
|
2015-02-13 09:08:07 -05:00
|
|
|
, testCompare
|
|
|
|
"tables with lists in cells"
|
|
|
|
"docx/table_with_list_cell.docx"
|
|
|
|
"docx/table_with_list_cell.native"
|
2016-12-08 06:57:38 -05:00
|
|
|
, testCompare
|
|
|
|
"tables with one row"
|
|
|
|
"docx/table_one_row.docx"
|
|
|
|
"docx/table_one_row.native"
|
2018-02-12 17:10:29 +01:00
|
|
|
, testCompare
|
|
|
|
"tables with variable width"
|
|
|
|
"docx/table_variable_width.docx"
|
|
|
|
"docx/table_variable_width.native"
|
2014-06-24 10:33:49 -04:00
|
|
|
, testCompare
|
|
|
|
"code block"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/codeblock.docx"
|
|
|
|
"docx/codeblock.native"
|
2018-04-17 09:29:54 -04:00
|
|
|
, testCompare
|
|
|
|
"combine adjacent code blocks"
|
|
|
|
"docx/adjacent_codeblocks.docx"
|
|
|
|
"docx/adjacent_codeblocks.native"
|
2014-08-11 23:10:50 -04:00
|
|
|
, testCompare
|
|
|
|
"dropcap paragraphs"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/drop_cap.docx"
|
|
|
|
"docx/drop_cap.native"
|
2014-06-15 14:55:17 -04:00
|
|
|
]
|
2014-06-25 11:09:28 -04:00
|
|
|
, testGroup "track changes"
|
|
|
|
[ testCompare
|
2014-06-25 16:13:59 -04:00
|
|
|
"insertion (default)"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/track_changes_insertion.docx"
|
|
|
|
"docx/track_changes_insertion_accept.native"
|
2014-06-25 16:13:59 -04:00
|
|
|
, testCompareWithOpts def{readerTrackChanges=AcceptChanges}
|
|
|
|
"insert insertion (accept)"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/track_changes_insertion.docx"
|
|
|
|
"docx/track_changes_insertion_accept.native"
|
2014-06-25 16:13:59 -04:00
|
|
|
, testCompareWithOpts def{readerTrackChanges=RejectChanges}
|
|
|
|
"remove insertion (reject)"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/track_changes_insertion.docx"
|
|
|
|
"docx/track_changes_insertion_reject.native"
|
2014-06-25 11:09:28 -04:00
|
|
|
, testCompare
|
2014-06-25 16:13:59 -04:00
|
|
|
"deletion (default)"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/track_changes_deletion.docx"
|
|
|
|
"docx/track_changes_deletion_accept.native"
|
2014-06-25 16:13:59 -04:00
|
|
|
, testCompareWithOpts def{readerTrackChanges=AcceptChanges}
|
|
|
|
"remove deletion (accept)"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/track_changes_deletion.docx"
|
|
|
|
"docx/track_changes_deletion_accept.native"
|
2014-06-25 16:13:59 -04:00
|
|
|
, testCompareWithOpts def{readerTrackChanges=RejectChanges}
|
|
|
|
"insert deletion (reject)"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/track_changes_deletion.docx"
|
|
|
|
"docx/track_changes_deletion_reject.native"
|
2014-06-25 16:13:59 -04:00
|
|
|
, testCompareWithOpts def{readerTrackChanges=AllChanges}
|
|
|
|
"keep insertion (all)"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/track_changes_deletion.docx"
|
|
|
|
"docx/track_changes_deletion_all.native"
|
2014-06-25 16:13:59 -04:00
|
|
|
, testCompareWithOpts def{readerTrackChanges=AllChanges}
|
|
|
|
"keep deletion (all)"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/track_changes_deletion.docx"
|
|
|
|
"docx/track_changes_deletion_all.native"
|
2016-04-16 08:39:25 -04:00
|
|
|
, testCompareWithOpts def{readerTrackChanges=AcceptChanges}
|
|
|
|
"move text (accept)"
|
|
|
|
"docx/track_changes_move.docx"
|
|
|
|
"docx/track_changes_move_accept.native"
|
|
|
|
, testCompareWithOpts def{readerTrackChanges=RejectChanges}
|
|
|
|
"move text (reject)"
|
|
|
|
"docx/track_changes_move.docx"
|
|
|
|
"docx/track_changes_move_reject.native"
|
|
|
|
, testCompareWithOpts def{readerTrackChanges=AllChanges}
|
|
|
|
"move text (all)"
|
|
|
|
"docx/track_changes_move.docx"
|
|
|
|
"docx/track_changes_move_all.native"
|
2016-06-23 10:46:01 -04:00
|
|
|
, testCompareWithOpts def{readerTrackChanges=AcceptChanges}
|
|
|
|
"comments (accept -- no comments)"
|
|
|
|
"docx/comments.docx"
|
|
|
|
"docx/comments_no_comments.native"
|
|
|
|
, testCompareWithOpts def{readerTrackChanges=RejectChanges}
|
|
|
|
"comments (reject -- comments)"
|
|
|
|
"docx/comments.docx"
|
|
|
|
"docx/comments_no_comments.native"
|
|
|
|
, testCompareWithOpts def{readerTrackChanges=AllChanges}
|
|
|
|
"comments (all comments)"
|
|
|
|
"docx/comments.docx"
|
|
|
|
"docx/comments.native"
|
2018-01-02 11:24:26 -05:00
|
|
|
, testCompareWithOpts def{readerTrackChanges=AcceptChanges}
|
|
|
|
"paragraph insertion/deletion (accept)"
|
|
|
|
"docx/paragraph_insertion_deletion.docx"
|
|
|
|
"docx/paragraph_insertion_deletion_accept.native"
|
|
|
|
, testCompareWithOpts def{readerTrackChanges=RejectChanges}
|
|
|
|
"paragraph insertion/deletion (reject)"
|
|
|
|
"docx/paragraph_insertion_deletion.docx"
|
|
|
|
"docx/paragraph_insertion_deletion_reject.native"
|
|
|
|
, testCompareWithOpts def{readerTrackChanges=AllChanges}
|
|
|
|
"paragraph insertion/deletion (all)"
|
|
|
|
"docx/paragraph_insertion_deletion.docx"
|
|
|
|
"docx/paragraph_insertion_deletion_all.native"
|
2016-06-23 10:46:01 -04:00
|
|
|
, testForWarningsWithOpts def{readerTrackChanges=AcceptChanges}
|
|
|
|
"comment warnings (accept -- no warnings)"
|
|
|
|
"docx/comments_warning.docx"
|
|
|
|
[]
|
|
|
|
, testForWarningsWithOpts def{readerTrackChanges=RejectChanges}
|
|
|
|
"comment warnings (reject -- no warnings)"
|
|
|
|
"docx/comments_warning.docx"
|
|
|
|
[]
|
|
|
|
, testForWarningsWithOpts def{readerTrackChanges=AllChanges}
|
|
|
|
"comment warnings (all)"
|
|
|
|
"docx/comments_warning.docx"
|
|
|
|
["Docx comment 1 will not retain formatting"]
|
2014-06-25 11:09:28 -04:00
|
|
|
]
|
2014-07-30 22:32:55 -04:00
|
|
|
, testGroup "media"
|
2014-07-31 12:10:33 -04:00
|
|
|
[ testMediaBag
|
2014-07-30 22:32:55 -04:00
|
|
|
"image extraction"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/image.docx"
|
2014-07-30 22:32:55 -04:00
|
|
|
]
|
2018-02-22 12:06:25 -05:00
|
|
|
, testGroup "custom styles"
|
|
|
|
[ testCompare
|
|
|
|
"custom styles (`+styles`) not enabled (default)"
|
|
|
|
"docx/custom-style-reference.docx"
|
|
|
|
"docx/custom-style-no-styles.native"
|
|
|
|
, testCompareWithOpts
|
|
|
|
def{readerExtensions=extensionsFromList [Ext_styles]}
|
|
|
|
"custom styles (`+styles`) enabled"
|
|
|
|
"docx/custom-style-reference.docx"
|
|
|
|
"docx/custom-style-with-styles.native"
|
|
|
|
]
|
2014-07-27 15:11:18 -04:00
|
|
|
, testGroup "metadata"
|
|
|
|
[ testCompareWithOpts def{readerStandalone=True}
|
|
|
|
"metadata fields"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/metadata.docx"
|
|
|
|
"docx/metadata.native"
|
2014-07-27 15:11:18 -04:00
|
|
|
, testCompareWithOpts def{readerStandalone=True}
|
|
|
|
"stop recording metadata with normal text"
|
2014-08-13 11:16:50 -07:00
|
|
|
"docx/metadata_after_normal.docx"
|
|
|
|
"docx/metadata_after_normal.native"
|
2014-07-27 15:11:18 -04:00
|
|
|
]
|
2014-06-15 14:55:17 -04:00
|
|
|
]
|