git.iko.soy/typeable/pandoc
on master help sign in
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.

commit7980631a0b0f8508a8f8d74419d9f740a40e524c authorJesse Rosenthal <jrosenthal@jhu.edu> dateThu 23 Jun 2016, 10:46 (10 years ago) parent5d48a62
5 files changed+32
tests/Tests/Readers/Docx.hs+24 tests/docx/comments.docx tests/docx/comments.native+4 tests/docx/comments_no_comments.native+4 tests/docx/comments_warning.docx
tests/Tests/Readers/Docx.hs+24
@@ -291,6 +291,30 @@ tests = [ testGroup "inlines"
291291 "move text (all)"
292292 "docx/track_changes_move.docx"
293293 "docx/track_changes_move_all.native"
294+ , testCompareWithOpts def{readerTrackChanges=AcceptChanges}
295+ "comments (accept -- no comments)"
296+ "docx/comments.docx"
297+ "docx/comments_no_comments.native"
298+ , testCompareWithOpts def{readerTrackChanges=RejectChanges}
299+ "comments (reject -- comments)"
300+ "docx/comments.docx"
301+ "docx/comments_no_comments.native"
302+ , testCompareWithOpts def{readerTrackChanges=AllChanges}
303+ "comments (all comments)"
304+ "docx/comments.docx"
305+ "docx/comments.native"
306+ , testForWarningsWithOpts def{readerTrackChanges=AcceptChanges}
307+ "comment warnings (accept -- no warnings)"
308+ "docx/comments_warning.docx"
309+ []
310+ , testForWarningsWithOpts def{readerTrackChanges=RejectChanges}
311+ "comment warnings (reject -- no warnings)"
312+ "docx/comments_warning.docx"
313+ []
314+ , testForWarningsWithOpts def{readerTrackChanges=AllChanges}
315+ "comment warnings (all)"
316+ "docx/comments_warning.docx"
317+ ["Docx comment 1 will not retain formatting"]
294318 ]
295319 , testGroup "media"
296320 [ testMediaBag
tests/docx/comments.docxnew file

Binary file not shown.

tests/docx/comments.nativenew file+4
@@ -0,0 +1,4 @@
1+[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."]
2+,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."]
3+,Para [Str "And",Space,Str "so",Span ("",["comment-end"],[("id","1")]) [],Space,Str "is",Space,Str "this."]
4+,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 "."]]
tests/docx/comments_no_comments.nativenew file+4
@@ -0,0 +1,4 @@
1+[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."]
2+,Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "new",Space,Str "paragraph."]
3+,Para [Str "And",Space,Str "so",Space,Str "is",Space,Str "this."]
4+,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."]]
tests/docx/comments_warning.docxnew file

Binary file not shown.