Browse Source

Merge pull request #74 from lucwuyts/master

Unit test for script parsing (super- sub- script)
master
PrzemyslawKlys 9 years ago
parent
commit
6296917633

BIN
DocX/bin/Debug/DocX.dll View File


+ 15
- 0
UnitTests/DocXUnitTests.cs View File

Assert.AreEqual("dxa", left.Attribute(XName.Get("type", DocX.w.NamespaceName)).Value); Assert.AreEqual("dxa", left.Attribute(XName.Get("type", DocX.w.NamespaceName)).Value);
} }
} }
[Test]
public void WhileReadingWhenTextIsSuperAndSubscript()
{
using (DocX document = DocX.Load(Path.Combine(_directoryWithFiles, "Super_Subscript.docx")))
{
var normalText = document.Paragraphs[0].MagicText[0].formatting;
var superscriptText = document.Paragraphs[0].MagicText[3].formatting;
var subscriptText = document.Paragraphs[0].MagicText[5].formatting;
Assert.IsTrue(normalText.Script.HasValue && normalText.Script == Script.none);
Assert.IsTrue(superscriptText.Script.HasValue && superscriptText.Script == Script.superscript);
Assert.IsTrue(subscriptText.Script.HasValue && subscriptText.Script == Script.subscript);
}
}
} }
} }

+ 3
- 0
UnitTests/UnitTests.csproj View File

<None Include="documents\ReplaceTests.docx"> <None Include="documents\ReplaceTests.docx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="documents\Super_Subscript.docx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="documents\Tables.docx"> <None Include="documents\Tables.docx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>

BIN
UnitTests/documents/Super_Subscript.docx View File


Loading…
Cancel
Save