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.
This commit is contained in:
Jesse Rosenthal 2016-06-23 10:46:01 -04:00
parent 5d48a62b74
commit 7980631a0b
5 changed files with 32 additions and 0 deletions

View file

@ -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

BIN
tests/docx/comments.docx Normal file

Binary file not shown.

View file

@ -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 "."]]

View file

@ -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."]]

Binary file not shown.