aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJesse Rosenthal <jrosenthal@jhu.edu>2016-06-23 10:46:01 -0400
committerJesse Rosenthal <jrosenthal@jhu.edu>2016-06-23 10:50:46 -0400
commit7980631a0b0f8508a8f8d74419d9f740a40e524c (patch)
tree4ca1e63ae03fefbbaac486607871a72a2ec22c08 /tests
parent5d48a62b74989cd14eb66856c8c340b8c262a473 (diff)
downloadpandoc-7980631a0b0f8508a8f8d74419d9f740a40e524c.tar.gz
Docx reader: add tests for comments
We test for comments, using all track-changes options. Note that we should only output comments if `--track-changes=all`. We also test for emitting warnings if there is complicated formatting.
Diffstat (limited to 'tests')
-rw-r--r--tests/Tests/Readers/Docx.hs24
-rw-r--r--tests/docx/comments.docxbin0 -> 17109 bytes
-rw-r--r--tests/docx/comments.native4
-rw-r--r--tests/docx/comments_no_comments.native4
-rw-r--r--tests/docx/comments_warning.docxbin0 -> 17078 bytes
5 files changed, 32 insertions, 0 deletions
diff --git a/tests/Tests/Readers/Docx.hs b/tests/Tests/Readers/Docx.hs
index a1315446a..a9a9094f1 100644
--- a/tests/Tests/Readers/Docx.hs
+++ b/tests/Tests/Readers/Docx.hs
@@ -291,6 +291,30 @@ tests = [ testGroup "inlines"
"move text (all)"
"docx/track_changes_move.docx"
"docx/track_changes_move_all.native"
+ , 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"
+ , 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"]
]
, testGroup "media"
[ testMediaBag
diff --git a/tests/docx/comments.docx b/tests/docx/comments.docx
new file mode 100644
index 000000000..9df74cf0a
--- /dev/null
+++ b/tests/docx/comments.docx
Binary files differ
diff --git a/tests/docx/comments.native b/tests/docx/comments.native
new file mode 100644
index 000000000..3357bc257
--- /dev/null
+++ b/tests/docx/comments.native
@@ -0,0 +1,4 @@
+[Para [Str "I",Space,Str "want",Space,Span ("",["comment-start"],[("id","0"),("author","Jesse Rosenthal"),("date","2016-05-09T16:13:00Z")]) [Str "I",Space,Str "left",Space,Str "a",Space,Str "comment."],Str "some",Space,Str "text",Space,Str "to",Space,Str "have",Space,Str "a",Space,Str "comment",Space,Span ("",["comment-end"],[("id","0")]) [],Str "on",Space,Str "it."]
+,Para [Str "This",Space,Str "is",Space,Span ("",["comment-start"],[("id","1"),("author","Jesse Rosenthal"),("date","2016-05-09T16:13:00Z")]) [Str "A",Space,Str "comment",Space,Str "across",Space,Str "paragraphs."],Str "a",Space,Str "new",Space,Str "paragraph."]
+,Para [Str "And",Space,Str "so",Span ("",["comment-end"],[("id","1")]) [],Space,Str "is",Space,Str "this."]
+,Para [Str "One",Space,Span ("",["comment-start"],[("id","2"),("author","Jesse Rosenthal"),("date","2016-05-09T16:14:00Z")]) [Str "This",Space,Str "one",Space,Str "has",Space,Str "multiple",Space,Str "paragraphs.",Space,Str "\182",Space,Str "See?"],Str "more",Span ("",["comment-end"],[("id","2")]) [],Str ".",Space,Str "And",Space,Str "this",Space,Str "is",Space,Str "one",Space,Str "with",Space,Str "a",Space,Span ("",["comment-start"],[("id","3"),("author","Jesse Rosenthal"),("date","2016-06-22T14:35:00Z")]) [Str "Do",Space,Str "something."],Span ("",["comment-start"],[("id","4"),("author","Jesse Rosenthal"),("date","2016-06-22T14:36:00Z")]) [Str "Do",Space,Str "something",Space,Str "else."],Str "comment",Space,Str "in",Space,Str "a",Space,Str "comment",Span ("",["comment-end"],[("id","3")]) [Span ("",["comment-end"],[("id","4")]) []],Str "."]]
diff --git a/tests/docx/comments_no_comments.native b/tests/docx/comments_no_comments.native
new file mode 100644
index 000000000..805e9b562
--- /dev/null
+++ b/tests/docx/comments_no_comments.native
@@ -0,0 +1,4 @@
+[Para [Str "I",Space,Str "want",Space,Str "some",Space,Str "text",Space,Str "to",Space,Str "have",Space,Str "a",Space,Str "comment",Space,Str "on",Space,Str "it."]
+,Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "new",Space,Str "paragraph."]
+,Para [Str "And",Space,Str "so",Space,Str "is",Space,Str "this."]
+,Para [Str "One",Space,Str "more.",Space,Str "And",Space,Str "this",Space,Str "is",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "comment",Space,Str "in",Space,Str "a",Space,Str "comment."]]
diff --git a/tests/docx/comments_warning.docx b/tests/docx/comments_warning.docx
new file mode 100644
index 000000000..e49642b22
--- /dev/null
+++ b/tests/docx/comments_warning.docx
Binary files differ