diff options
Diffstat (limited to 'src/test')
20 files changed, 73 insertions, 5 deletions
diff --git a/src/test/java/org/zwobble/mammoth/MammothTests.java b/src/test/java/org/zwobble/mammoth/MammothTests.java deleted file mode 100644 index 3e7e855..0000000 --- a/src/test/java/org/zwobble/mammoth/MammothTests.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.zwobble.mammoth; - -public class MammothTests { - -} diff --git a/src/test/java/org/zwobble/mammoth/tests/MammothTests.java b/src/test/java/org/zwobble/mammoth/tests/MammothTests.java new file mode 100644 index 0000000..acb8d0a --- /dev/null +++ b/src/test/java/org/zwobble/mammoth/tests/MammothTests.java @@ -0,0 +1,13 @@ +package org.zwobble.mammoth.tests; + +import org.junit.Test; + +import static org.hamcrest.core.IsNull.notNullValue; +import static org.junit.Assert.assertThat; + +public class MammothTests { + @Test + public void canReadTestData() { + assertThat(TestData.stream("/test-data/empty.docx"), notNullValue()); + } +} diff --git a/src/test/java/org/zwobble/mammoth/tests/TestData.java b/src/test/java/org/zwobble/mammoth/tests/TestData.java new file mode 100644 index 0000000..e2e94eb --- /dev/null +++ b/src/test/java/org/zwobble/mammoth/tests/TestData.java @@ -0,0 +1,14 @@ +package org.zwobble.mammoth.tests; + +import java.io.IOException; +import java.io.InputStream; + +public class TestData { + public static InputStream stream(String name) { + try { + return TestData.class.getResource(name).openStream(); + } catch (IOException exception) { + throw new RuntimeException(exception); + } + } +} diff --git a/src/test/resources/test-data/empty.docx b/src/test/resources/test-data/empty.docx Binary files differnew file mode 100644 index 0000000..e10b869 --- /dev/null +++ b/src/test/resources/test-data/empty.docx diff --git a/src/test/resources/test-data/endnotes.docx b/src/test/resources/test-data/endnotes.docx Binary files differnew file mode 100644 index 0000000..1ae4f93 --- /dev/null +++ b/src/test/resources/test-data/endnotes.docx diff --git a/src/test/resources/test-data/external-picture.docx b/src/test/resources/test-data/external-picture.docx Binary files differnew file mode 100644 index 0000000..3475626 --- /dev/null +++ b/src/test/resources/test-data/external-picture.docx diff --git a/src/test/resources/test-data/footnote-hyperlink.docx b/src/test/resources/test-data/footnote-hyperlink.docx Binary files differnew file mode 100755 index 0000000..208f3dc --- /dev/null +++ b/src/test/resources/test-data/footnote-hyperlink.docx diff --git a/src/test/resources/test-data/footnotes.docx b/src/test/resources/test-data/footnotes.docx Binary files differnew file mode 100755 index 0000000..3228e74 --- /dev/null +++ b/src/test/resources/test-data/footnotes.docx diff --git a/src/test/resources/test-data/hyperlinks/word/_rels/document.xml.rels b/src/test/resources/test-data/hyperlinks/word/_rels/document.xml.rels new file mode 100644 index 0000000..baa4102 --- /dev/null +++ b/src/test/resources/test-data/hyperlinks/word/_rels/document.xml.rels @@ -0,0 +1,10 @@ +<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"> + <Relationship Id="rId8" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="theme/theme1.xml" /> + <Relationship Id="rId3" Type="http://schemas.microsoft.com/office/2007/relationships/stylesWithEffects" Target="stylesWithEffects.xml" /> + <Relationship Id="rId7" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" Target="fontTable.xml" /> + <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml" /> + <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering" Target="numbering.xml" /> + <Relationship Id="rId6" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink" Target="http://www.example.com" TargetMode="External" /> + <Relationship Id="rId5" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings" Target="webSettings.xml" /> + <Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Target="settings.xml" /> +</Relationships>
\ No newline at end of file diff --git a/src/test/resources/test-data/hyperlinks/word/document.xml b/src/test/resources/test-data/hyperlinks/word/document.xml new file mode 100644 index 0000000..f1ce575 --- /dev/null +++ b/src/test/resources/test-data/hyperlinks/word/document.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" ?> +<w:document mc:Ignorable="w14 wp14" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape"> + <w:body> + <w:p w:rsidR="00E01ECE" w:rsidRDefault="000636A7"> + <w:hyperlink r:id="rId6" w:history="1"> + <w:r> + <w:t>coconuts</w:t> + </w:r> + </w:hyperlink> + </w:p> + <w:sectPr w:rsidR="00E01ECE"> + <w:pgSz w:h="16838" w:w="11906"/> + <w:pgMar w:bottom="1440" w:footer="708" w:gutter="0" w:header="708" w:left="1440" w:right="1440" w:top="1440"/> + <w:cols w:space="708"/> + <w:docGrid w:linePitch="360"/> + </w:sectPr> + </w:body> +</w:document> diff --git a/src/test/resources/test-data/simple-list.docx b/src/test/resources/test-data/simple-list.docx Binary files differnew file mode 100755 index 0000000..c2cd5ae --- /dev/null +++ b/src/test/resources/test-data/simple-list.docx diff --git a/src/test/resources/test-data/simple/word/document.xml b/src/test/resources/test-data/simple/word/document.xml new file mode 100644 index 0000000..1723398 --- /dev/null +++ b/src/test/resources/test-data/simple/word/document.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" ?> +<w:document mc:Ignorable="w14 wp14" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape"> + <w:body> + <w:p w:rsidR="00E01ECE" w:rsidRDefault="000636A7"> + <w:r> + <w:t>Hello.</w:t> + </w:r> + <w:bookmarkStart w:id="0" w:name="_GoBack"/> + <w:bookmarkEnd w:id="0"/> + </w:p> + <w:sectPr w:rsidR="00E01ECE"> + <w:pgSz w:h="16838" w:w="11906"/> + <w:pgMar w:bottom="1440" w:footer="708" w:gutter="0" w:header="708" w:left="1440" w:right="1440" w:top="1440"/> + <w:cols w:space="708"/> + <w:docGrid w:linePitch="360"/> + </w:sectPr> + </w:body> +</w:document> diff --git a/src/test/resources/test-data/single-paragraph.docx b/src/test/resources/test-data/single-paragraph.docx Binary files differnew file mode 100755 index 0000000..09caf9a --- /dev/null +++ b/src/test/resources/test-data/single-paragraph.docx diff --git a/src/test/resources/test-data/strikethrough.docx b/src/test/resources/test-data/strikethrough.docx Binary files differnew file mode 100755 index 0000000..0d2b713 --- /dev/null +++ b/src/test/resources/test-data/strikethrough.docx diff --git a/src/test/resources/test-data/tables.docx b/src/test/resources/test-data/tables.docx Binary files differnew file mode 100755 index 0000000..86009a7 --- /dev/null +++ b/src/test/resources/test-data/tables.docx diff --git a/src/test/resources/test-data/text-box.docx b/src/test/resources/test-data/text-box.docx Binary files differnew file mode 100755 index 0000000..2d53703 --- /dev/null +++ b/src/test/resources/test-data/text-box.docx diff --git a/src/test/resources/test-data/tiny-picture.docx b/src/test/resources/test-data/tiny-picture.docx Binary files differnew file mode 100755 index 0000000..d45bb9e --- /dev/null +++ b/src/test/resources/test-data/tiny-picture.docx diff --git a/src/test/resources/test-data/tiny-picture.png b/src/test/resources/test-data/tiny-picture.png Binary files differnew file mode 100644 index 0000000..74cb4ba --- /dev/null +++ b/src/test/resources/test-data/tiny-picture.png diff --git a/src/test/resources/test-data/underline.docx b/src/test/resources/test-data/underline.docx Binary files differnew file mode 100755 index 0000000..36604fc --- /dev/null +++ b/src/test/resources/test-data/underline.docx diff --git a/src/test/resources/test-data/utf8-bom.docx b/src/test/resources/test-data/utf8-bom.docx Binary files differnew file mode 100644 index 0000000..3881238 --- /dev/null +++ b/src/test/resources/test-data/utf8-bom.docx |
