diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-04-30 17:20:53 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-04-30 17:20:53 +0100 |
| commit | ec5037c01868fecaec2eba89b975f3e53aded89a (patch) | |
| tree | e0d5a092419bace577a90eb29699f5be57f36078 /Mammoth.Tests | |
| parent | 17d1a1f710edd8dfb92e75bcd273e04cee7c8146 (diff) | |
Export from java-mammoth 5f538798b147f0e76
Diffstat (limited to 'Mammoth.Tests')
23 files changed, 324 insertions, 115 deletions
diff --git a/Mammoth.Tests/DocumentConverterTests.cs b/Mammoth.Tests/DocumentConverterTests.cs index 37cec23..92a3adf 100644 --- a/Mammoth.Tests/DocumentConverterTests.cs +++ b/Mammoth.Tests/DocumentConverterTests.cs @@ -1,24 +1,214 @@ -using NUnit.Framework; - -namespace Mammoth.Tests -{ - public class DocumentConverterTests - { - [Test] - public void SingleWordParagraphIsConvertedToSingleHtmlParagraph() - { - var documentConverter = new DocumentConverter(); - var result = documentConverter.ConvertToHtml("TestDocuments/single-paragraph.docx"); - Assert.AreEqual("<p>Walking on imported air</p>", result.Value); - Assert.IsEmpty(result.Messages); - } - - [Test] - public void UnrecognisedStylesAreStatedInMessages() - { - var documentConverter = new DocumentConverter(); - var result = documentConverter.ConvertToHtml("TestDocuments/unrecognised-paragraph-styles.docx"); - Assert.AreEqual("Unrecognised paragraph style: 'Funky' (Style ID: style20)", result.Messages[0].Value); +using Xunit; +using System.IO; +using Xunit.Sdk; +using System; +using System.Linq; + +namespace Mammoth.Tests { + public class DocumentConverterTests { + [Fact] + public void DocxContainingOneParagraphIsConvertedToSingleParagraphElement() { + AssertSuccessfulConversion( + ConvertToHtml("single-paragraph.docx"), + "<p>Walking on imported air</p>"); + } + + [Fact] + public void CanReadFilesWithUtf8Bom() { + AssertSuccessfulConversion( + ConvertToHtml("utf8-bom.docx"), + "<p>This XML has a byte order mark.</p>"); + } + + [Fact] + public void EmptyParagraphsAreIgnoredByDefault() { + AssertSuccessfulConversion( + ConvertToHtml("empty.docx"), + ""); + } + + [Fact] + public void EmptyParagraphsArePreservedIfIgnoreEmptyParagraphsIsFalse() { + AssertSuccessfulConversion( + ConvertToHtml("empty.docx", converter => converter.PreserveEmptyParagraphs()), + "<p></p>"); + } + + [Fact] + public void SimpleListIsConvertedToListElements() { + AssertSuccessfulConversion( + ConvertToHtml("simple-list.docx"), + "<ul><li>Apple</li><li>Banana</li></ul>"); + } + + [Fact] + public void WordTablesAreConvertedToHtmlTables() { + AssertSuccessfulConversion( + ConvertToHtml("tables.docx"), + "<p>Above</p>" + + "<table>" + + "<tr><td><p>Top left</p></td><td><p>Top right</p></td></tr>" + + "<tr><td><p>Bottom left</p></td><td><p>Bottom right</p></td></tr>" + + "</table>" + + "<p>Below</p>"); + } + + [Fact] + public void InlineImagesAreIncludedInOutput() { + AssertSuccessfulConversion( + ConvertToHtml("tiny-picture.docx"), + "<p><img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAOvgAADr4B6kKxwAAAABNJREFUKFNj/M+ADzDhlWUYqdIAQSwBE8U+X40AAAAASUVORK5CYII=\" /></p>"); + } + + [Fact] + public void ImagesStoredOutsideOfDocumentAreIncludedInOutput() { + AssertSuccessfulConversion( + ConvertToHtml("external-picture.docx"), + "<p><img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAOvgAADr4B6kKxwAAAABNJREFUKFNj/M+ADzDhlWUYqdIAQSwBE8U+X40AAAAASUVORK5CYII=\" /></p>"); + } + + [Fact] + public void WarnIfDocumentHasImagesStoredOutsideOfDocumentWhenPathOfDocumentIsUnknown() { + using (var file = File.OpenRead(TestFilePath("external-picture.docx"))) { + var result = new DocumentConverter().ConvertToHtml(file); + Assert.Equal("", result.Value); + Assert.Equal(new[]{"could not open external image 'tiny-picture.png': path of document is unknown, but is required for relative URI"}, result.Warnings); + } + } + + [Fact] + public void WarnIfImagesStoredOutsideOfDocumentAreNotFound() { + var tempDirectory = Path.Combine(Path.GetTempPath(), "mammoth-" + Guid.NewGuid()); + Directory.CreateDirectory(tempDirectory); + try { + var documentPath = Path.Combine(tempDirectory, "external-picture.docx"); + File.Copy(TestFilePath("external-picture.docx"), documentPath); + var result = new DocumentConverter().ConvertToHtml(documentPath); + Assert.Equal("", result.Value); + Assert.StartsWith("could not open external image 'tiny-picture.png':", result.Warnings.Single()); + } finally { + Directory.Delete(tempDirectory, recursive: true); + } + } + + [Fact] + public void ContentTypesAreRead() { + AssertSuccessfulConversion( + ConvertToHtml("tiny-picture-custom-content-type.docx"), + "<p><img src=\"data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAOvgAADr4B6kKxwAAAABNJREFUKFNj/M+ADzDhlWUYqdIAQSwBE8U+X40AAAAASUVORK5CYII=\" /></p>"); + } + + [Fact] + public void FootnotesAreAppendedToText() { + AssertSuccessfulConversion( + ConvertToHtml("footnotes.docx", mammoth => mammoth.IdPrefix("doc-42-")), + "<p>Ouch" + + "<sup><a href=\"#doc-42-footnote-1\" id=\"doc-42-footnote-ref-1\">[1]</a></sup>." + + "<sup><a href=\"#doc-42-footnote-2\" id=\"doc-42-footnote-ref-2\">[2]</a></sup></p>" + + "<ol><li id=\"doc-42-footnote-1\"><p> A tachyon walks into a bar. <a href=\"#doc-42-footnote-ref-1\">↑</a></p></li>" + + "<li id=\"doc-42-footnote-2\"><p> Fin. <a href=\"#doc-42-footnote-ref-2\">↑</a></p></li></ol>"); + } + + [Fact] + public void EndNotesAreAppendedToText() { + AssertSuccessfulConversion( + ConvertToHtml("endnotes.docx", mammoth => mammoth.IdPrefix("doc-42-")), + "<p>Ouch" + + "<sup><a href=\"#doc-42-endnote-2\" id=\"doc-42-endnote-ref-2\">[1]</a></sup>." + + "<sup><a href=\"#doc-42-endnote-3\" id=\"doc-42-endnote-ref-3\">[2]</a></sup></p>" + + "<ol><li id=\"doc-42-endnote-2\"><p> A tachyon walks into a bar. <a href=\"#doc-42-endnote-ref-2\">↑</a></p></li>" + + "<li id=\"doc-42-endnote-3\"><p> Fin. <a href=\"#doc-42-endnote-ref-3\">↑</a></p></li></ol>"); + } + + [Fact] + public void RelationshipsAreReadForEachFileContainingBodyXml() { + AssertSuccessfulConversion( + ConvertToHtml("footnote-hyperlink.docx", mammoth => mammoth.IdPrefix("doc-42-")), + + "<p><sup><a href=\"#doc-42-footnote-1\" id=\"doc-42-footnote-ref-1\">[1]</a></sup></p>" + + "<ol><li id=\"doc-42-footnote-1\"><p> <a href=\"http://www.example.com\">Example</a> <a href=\"#doc-42-footnote-ref-1\">↑</a></p></li></ol>"); + } + + [Fact] + public void TextBoxesAreRead() { + AssertSuccessfulConversion( + ConvertToHtml("text-box.docx"), + "<p>Datum plane</p>"); + } + + [Fact] + public void CanUseCustomStyleMap() { + AssertSuccessfulConversion( + ConvertToHtml("underline.docx", mammoth => mammoth.AddStyleMap("u => em")), + "<p><strong>The <em>Sunset</em> Tree</strong></p>"); + } + + [Fact] + public void MostRecentlyAddedStyleMapTakesPrecedence() { + AssertSuccessfulConversion( + ConvertToHtml("underline.docx", mammoth => mammoth.AddStyleMap("u => em").AddStyleMap("u => strong")), + "<p><strong>The <strong>Sunset</strong> Tree</strong></p>"); + } + + [Fact] + public void RulesFromPreviouslyAddedStyleMapsStillTakeEffectIfNotOverridden() { + AssertSuccessfulConversion( + ConvertToHtml("underline.docx", mammoth => mammoth.AddStyleMap("u => em").AddStyleMap("strike => del")), + "<p><strong>The <em>Sunset</em> Tree</strong></p>"); + } + + [Fact] + public void ErrorIsRaisedIfStyleMapCannotBeParsed() { + var exception = Assert.ThrowsAny<Exception>(() => + new DocumentConverter().AddStyleMap("p =>\np[style-name=] =>")); + Assert.Equal( + "error reading style map at line 2, character 14: expected token of type _STRING but was of type _CLOSE_SQUARE_BRACKET\n\n" + + "p[style-name=] =>\n" + + " ^", + exception.Message); + } + + [Fact] + public void CanDisableDefaultStyleMap() { + var result = ConvertToHtml("simple-list.docx", mammoth => mammoth.DisableDefaultStyleMap()); + Assert.Equal(new[]{"Unrecognised paragraph style: List Paragraph (Style ID: ListParagraph)"}, result.Warnings); + Assert.Equal("<p>Apple</p><p>Banana</p>", result.Value); + } + + [Fact] + public void CanExtractRawTextFromFile() { + AssertSuccessfulConversion( + new DocumentConverter().ExtractRawText(TestFilePath("simple-list.docx")), + "Apple\n\nBanana\n\n"); + } + + [Fact] + public void CanExtractRawTextFromStream() { + using (var file = File.OpenRead(TestFilePath("simple-list.docx"))) { + AssertSuccessfulConversion( + new DocumentConverter().ExtractRawText(file), + "Apple\n\nBanana\n\n"); + } + } + + private void AssertSuccessfulConversion(IResult<string> result, string expectedValue) { + if (result.Warnings.Count > 0) { + throw new XunitException("Unexpected warnings: " + string.Join(", ", result.Warnings)); + } + Assert.Equal(expectedValue, result.Value); + } + + private IResult<string> ConvertToHtml(string name) { + return ConvertToHtml(name, converter => converter); + } + + private IResult<string> ConvertToHtml(string name, Func<DocumentConverter, DocumentConverter> configure) { + return configure(new DocumentConverter()).ConvertToHtml(TestFilePath(name)); + } + + private string TestFilePath(string name) { + return Path.Combine("../../TestData", name); } } } + diff --git a/Mammoth.Tests/Mammoth.Tests.csproj b/Mammoth.Tests/Mammoth.Tests.csproj index 212db46..d561dde 100644 --- a/Mammoth.Tests/Mammoth.Tests.csproj +++ b/Mammoth.Tests/Mammoth.Tests.csproj @@ -1,99 +1,77 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProjectGuid>{ED442448-256E-4574-BB1C-3303EF29B262}</ProjectGuid> + <ProjectGuid>{E9C3EA8B-FF3B-4E3E-8137-1510465200B5}</ProjectGuid> <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>Mammoth.Tests</RootNamespace> <AssemblyName>Mammoth.Tests</AssemblyName> - <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> - <FileAlignment>512</FileAlignment> - <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir> - <RestorePackages>true</RestorePackages> + <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> - <OutputPath>bin\Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> + <OutputPath>bin\Debug</OutputPath> + <DefineConstants>DEBUG;</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> + <ConsolePause>false</ConsolePause> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> + <DebugType>full</DebugType> <Optimize>true</Optimize> - <OutputPath>bin\Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> + <OutputPath>bin\Release</OutputPath> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> + <ConsolePause>false</ConsolePause> </PropertyGroup> <ItemGroup> - <Reference Include="nunit.core"> - <HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.dll</HintPath> - <Private>False</Private> - </Reference> - <Reference Include="nunit.core.interfaces"> - <HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.interfaces.dll</HintPath> - <Private>False</Private> + <Reference Include="System" /> + <Reference Include="xunit.abstractions"> + <HintPath>..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath> </Reference> - <Reference Include="nunit.framework"> - <HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath> + <Reference Include="xunit.core"> + <HintPath>..\packages\xunit.extensibility.core.2.1.0\lib\portable-net45+win8+wp8+wpa81\xunit.core.dll</HintPath> </Reference> - <Reference Include="nunit.util"> - <HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\nunit.util.dll</HintPath> - <Private>False</Private> + <Reference Include="xunit.execution.desktop"> + <HintPath>..\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll</HintPath> </Reference> - <Reference Include="NUnit.VisualStudio.TestAdapter"> - <HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\NUnit.VisualStudio.TestAdapter.dll</HintPath> - <Private>False</Private> + <Reference Include="xunit.assert"> + <HintPath>..\packages\xunit.assert.2.1.0\lib\portable-net45+win8+wp8+wpa81\xunit.assert.dll</HintPath> </Reference> - <Reference Include="System" /> - <Reference Include="System.Core" /> - <Reference Include="System.Xml.Linq" /> - <Reference Include="System.Data.DataSetExtensions" /> - <Reference Include="Microsoft.CSharp" /> - <Reference Include="System.Data" /> - <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> - <Compile Include="DocumentConverterTests.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="DocumentConverterTests.cs" /> </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <Import Project="..\packages\xunit.core.2.1.0\build\portable-net45+win8+wp8+wpa81\xunit.core.props" Condition="Exists('..\packages\xunit.core.2.1.0\build\portable-net45+win8+wp8+wpa81\xunit.core.props')" /> <ItemGroup> <None Include="packages.config" /> - <None Include="TestDocuments\single-paragraph.docx"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> - <None Include="TestDocuments\unrecognised-paragraph-styles.docx"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </None> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="TestData\empty.docx" /> + <EmbeddedResource Include="TestData\endnotes.docx" /> + <EmbeddedResource Include="TestData\external-picture.docx" /> + <EmbeddedResource Include="TestData\footnote-hyperlink.docx" /> + <EmbeddedResource Include="TestData\footnotes.docx" /> + <EmbeddedResource Include="TestData\simple-list.docx" /> + <EmbeddedResource Include="TestData\single-paragraph.docx" /> + <EmbeddedResource Include="TestData\strikethrough.docx" /> + <EmbeddedResource Include="TestData\tables.docx" /> + <EmbeddedResource Include="TestData\text-box.docx" /> + <EmbeddedResource Include="TestData\tiny-picture.docx" /> + <EmbeddedResource Include="TestData\tiny-picture.png" /> + <EmbeddedResource Include="TestData\tiny-picture-custom-content-type.docx" /> + <EmbeddedResource Include="TestData\underline.docx" /> + <EmbeddedResource Include="TestData\utf8-bom.docx" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\Mammoth\Mammoth.csproj"> - <Project>{7398c88c-cb94-41c3-bef9-755bcf81f373}</Project> + <Project>{51C5CBD6-8809-4D5E-BABE-1787A16F5ED8}</Project> <Name>Mammoth</Name> </ProjectReference> </ItemGroup> - <ItemGroup> - <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> - </ItemGroup> - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> - <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" /> - <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> - <PropertyGroup> - <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> - </PropertyGroup> - <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" /> - </Target> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> </Project>
\ No newline at end of file diff --git a/Mammoth.Tests/Properties/AssemblyInfo.cs b/Mammoth.Tests/Properties/AssemblyInfo.cs index c3c901e..79596a3 100644 --- a/Mammoth.Tests/Properties/AssemblyInfo.cs +++ b/Mammoth.Tests/Properties/AssemblyInfo.cs @@ -1,36 +1,27 @@ using System.Reflection; using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Mammoth.Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("Mammoth.Tests")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] +[assembly: AssemblyTitle ("Mammoth.Tests")] +[assembly: AssemblyDescription ("")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany ("")] +[assembly: AssemblyProduct ("")] +[assembly: AssemblyCopyright ("Michael Williamson")] +[assembly: AssemblyTrademark ("")] +[assembly: AssemblyCulture ("")] -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("ba4940f2-3760-4a66-b2a7-861164d661cc")] +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion ("1.0.*")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Mammoth.Tests/TestData/empty.docx b/Mammoth.Tests/TestData/empty.docx Binary files differnew file mode 100644 index 0000000..e10b869 --- /dev/null +++ b/Mammoth.Tests/TestData/empty.docx diff --git a/Mammoth.Tests/TestData/endnotes.docx b/Mammoth.Tests/TestData/endnotes.docx Binary files differnew file mode 100644 index 0000000..1ae4f93 --- /dev/null +++ b/Mammoth.Tests/TestData/endnotes.docx diff --git a/Mammoth.Tests/TestData/external-picture.docx b/Mammoth.Tests/TestData/external-picture.docx Binary files differnew file mode 100644 index 0000000..3475626 --- /dev/null +++ b/Mammoth.Tests/TestData/external-picture.docx diff --git a/Mammoth.Tests/TestData/footnote-hyperlink.docx b/Mammoth.Tests/TestData/footnote-hyperlink.docx Binary files differnew file mode 100755 index 0000000..208f3dc --- /dev/null +++ b/Mammoth.Tests/TestData/footnote-hyperlink.docx diff --git a/Mammoth.Tests/TestData/footnotes.docx b/Mammoth.Tests/TestData/footnotes.docx Binary files differnew file mode 100755 index 0000000..3228e74 --- /dev/null +++ b/Mammoth.Tests/TestData/footnotes.docx diff --git a/Mammoth.Tests/TestData/hyperlinks/word/_rels/document.xml.rels b/Mammoth.Tests/TestData/hyperlinks/word/_rels/document.xml.rels new file mode 100644 index 0000000..baa4102 --- /dev/null +++ b/Mammoth.Tests/TestData/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/Mammoth.Tests/TestData/hyperlinks/word/document.xml b/Mammoth.Tests/TestData/hyperlinks/word/document.xml new file mode 100644 index 0000000..f1ce575 --- /dev/null +++ b/Mammoth.Tests/TestData/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/Mammoth.Tests/TestData/simple-list.docx b/Mammoth.Tests/TestData/simple-list.docx Binary files differnew file mode 100755 index 0000000..c2cd5ae --- /dev/null +++ b/Mammoth.Tests/TestData/simple-list.docx diff --git a/Mammoth.Tests/TestData/simple/word/document.xml b/Mammoth.Tests/TestData/simple/word/document.xml new file mode 100644 index 0000000..1723398 --- /dev/null +++ b/Mammoth.Tests/TestData/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/Mammoth.Tests/TestDocuments/single-paragraph.docx b/Mammoth.Tests/TestData/single-paragraph.docx Binary files differindex 09caf9a..09caf9a 100644..100755 --- a/Mammoth.Tests/TestDocuments/single-paragraph.docx +++ b/Mammoth.Tests/TestData/single-paragraph.docx diff --git a/Mammoth.Tests/TestData/strikethrough.docx b/Mammoth.Tests/TestData/strikethrough.docx Binary files differnew file mode 100755 index 0000000..0d2b713 --- /dev/null +++ b/Mammoth.Tests/TestData/strikethrough.docx diff --git a/Mammoth.Tests/TestData/tables.docx b/Mammoth.Tests/TestData/tables.docx Binary files differnew file mode 100755 index 0000000..86009a7 --- /dev/null +++ b/Mammoth.Tests/TestData/tables.docx diff --git a/Mammoth.Tests/TestData/text-box.docx b/Mammoth.Tests/TestData/text-box.docx Binary files differnew file mode 100755 index 0000000..2d53703 --- /dev/null +++ b/Mammoth.Tests/TestData/text-box.docx diff --git a/Mammoth.Tests/TestData/tiny-picture-custom-content-type.docx b/Mammoth.Tests/TestData/tiny-picture-custom-content-type.docx Binary files differnew file mode 100644 index 0000000..3638f88 --- /dev/null +++ b/Mammoth.Tests/TestData/tiny-picture-custom-content-type.docx diff --git a/Mammoth.Tests/TestData/tiny-picture.docx b/Mammoth.Tests/TestData/tiny-picture.docx Binary files differnew file mode 100755 index 0000000..d45bb9e --- /dev/null +++ b/Mammoth.Tests/TestData/tiny-picture.docx diff --git a/Mammoth.Tests/TestData/tiny-picture.png b/Mammoth.Tests/TestData/tiny-picture.png Binary files differnew file mode 100644 index 0000000..74cb4ba --- /dev/null +++ b/Mammoth.Tests/TestData/tiny-picture.png diff --git a/Mammoth.Tests/TestData/underline.docx b/Mammoth.Tests/TestData/underline.docx Binary files differnew file mode 100755 index 0000000..36604fc --- /dev/null +++ b/Mammoth.Tests/TestData/underline.docx diff --git a/Mammoth.Tests/TestData/utf8-bom.docx b/Mammoth.Tests/TestData/utf8-bom.docx Binary files differnew file mode 100644 index 0000000..3881238 --- /dev/null +++ b/Mammoth.Tests/TestData/utf8-bom.docx diff --git a/Mammoth.Tests/TestDocuments/unrecognised-paragraph-styles.docx b/Mammoth.Tests/TestDocuments/unrecognised-paragraph-styles.docx Binary files differdeleted file mode 100644 index ad4064f..0000000 --- a/Mammoth.Tests/TestDocuments/unrecognised-paragraph-styles.docx +++ /dev/null diff --git a/Mammoth.Tests/packages.config b/Mammoth.Tests/packages.config index af221c7..69a4ec4 100644 --- a/Mammoth.Tests/packages.config +++ b/Mammoth.Tests/packages.config @@ -1,5 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> <packages> - <package id="NUnit" version="2.6.4" targetFramework="net40" /> - <package id="NUnitTestAdapter" version="2.0.0" targetFramework="net40" /> + <package id="xunit" version="2.1.0" targetFramework="net45" /> + <package id="xunit.abstractions" version="2.0.0" targetFramework="net45" /> + <package id="xunit.assert" version="2.1.0" targetFramework="net45" /> + <package id="xunit.core" version="2.1.0" targetFramework="net45" /> + <package id="xunit.extensibility.core" version="2.1.0" targetFramework="net45" /> + <package id="xunit.extensibility.execution" version="2.1.0" targetFramework="net45" /> </packages>
\ No newline at end of file |
