use invariant culture for parsing all numbers #37

This commit is contained in:
Eliot Jones
2019-06-18 19:12:51 +01:00
parent 2c9a3d6e96
commit caf1a0c233
16 changed files with 60 additions and 53 deletions

View File

@@ -1,6 +1,7 @@
namespace UglyToad.PdfPig.Tests.Integration
{
using System;
using System.Globalization;
using Content;
using Xunit;
@@ -29,15 +30,15 @@
throw new ArgumentException($"Expected 6 parts to the line, instead got {parts.Length}");
}
var height = parts.Length < 7 ? 0 : decimal.Parse(parts[6]);
var height = parts.Length < 7 ? 0 : decimal.Parse(parts[6], CultureInfo.InvariantCulture);
return new AssertablePositionData
{
X = decimal.Parse(parts[0]),
Y = decimal.Parse(parts[1]),
Width = decimal.Parse(parts[2]),
X = decimal.Parse(parts[0], CultureInfo.InvariantCulture),
Y = decimal.Parse(parts[1], CultureInfo.InvariantCulture),
Width = decimal.Parse(parts[2], CultureInfo.InvariantCulture),
Text = parts[3],
FontSize = decimal.Parse(parts[4]),
FontSize = decimal.Parse(parts[4], CultureInfo.InvariantCulture),
FontName = parts[5],
Height = height
};

View File

@@ -3,8 +3,10 @@ namespace UglyToad.PdfPig.Tests.Integration
{
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading;
using Content;
using Xunit;
@@ -189,7 +191,7 @@ namespace UglyToad.PdfPig.Tests.Integration
}
}
}
private static IReadOnlyList<AssertablePositionData> GetPdfBoxPositionData()
{
// X Y Width Letter FontSize Font
@@ -418,7 +420,7 @@ namespace UglyToad.PdfPig.Tests.Integration
209.499 173.25 3.045609 . 0 ArialMT
212.543 173.25 3.045609 0 ArialMT";
return fromOther.Split(new[]{"\r\n", "\r", "\n"}, StringSplitOptions.RemoveEmptyEntries)
return fromOther.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries)
.Select(AssertablePositionData.Parse)
.ToList();
}