add test for unusual latin characters and different document producer.

This commit is contained in:
Eliot Jones
2018-01-06 21:06:26 +00:00
parent d1aa390f01
commit c75b9d10bd
3 changed files with 71 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
namespace UglyToad.Pdf.Tests.Integration
{
using System;
using System.IO;
using Content;
using Xunit;
public class SwedishTouringCarChampionshipTests
{
private static string GetFilename()
{
var documentFolder = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..", "..", "..", "Integration", "Documents"));
return Path.Combine(documentFolder, "2006_Swedish_Touring_Car_Championship.pdf");
}
[Fact]
public void HasCorrectNumberOfPages()
{
var file = GetFilename();
using (var document = PdfDocument.Open(File.ReadAllBytes(file)))
{
Assert.Equal(4, document.NumberOfPages);
}
}
[Fact]
public void HasCorrectVersion()
{
using (var document = PdfDocument.Open(GetFilename()))
{
Assert.Equal(1.4m, document.Version);
}
}
[Fact]
public void GetsFirstPageContent()
{
using (var document = PdfDocument.Open(GetFilename()))
{
var page = document.GetPage(1);
Assert.Contains("A privateers championship named Caran Cup was created for drivers using cars constructed in 2003 or earlier", page.Text);
Assert.Equal(PageSize.A4, page.Size);
}
}
[Fact]
public void GetsSwedishCharacters()
{
using (var document = PdfDocument.Open(GetFilename()))
{
var page = document.GetPage(2);
Assert.Contains("Vålerbanen", page.Text);
page = document.GetPage(3);
Assert.Contains("Söderberg", page.Text);
}
}
}
}

View File

@@ -72,4 +72,10 @@
<ProjectReference Include="..\UglyToad.Pdf\UglyToad.Pdf.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="Integration\Documents\2006_Swedish_Touring_Car_Championship.pdf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>