mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-09-20 20:07:57 +08:00
use invariant culture for parsing all numbers #37
This commit is contained in:
@@ -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
|
||||
};
|
||||
|
@@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user