mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-08-20 09:57:23 +08:00
Fix: Missing cultureinfo fails tests on non-US systems
This commit is contained in:
parent
08f4b4a372
commit
876808b1eb
@ -1,6 +1,7 @@
|
||||
namespace UglyToad.PdfPig.Tests.Functions.Type4
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using UglyToad.PdfPig.Functions.Type4;
|
||||
using Xunit;
|
||||
|
||||
@ -60,7 +61,7 @@
|
||||
/// <returns>this instance</returns>
|
||||
public Type4Tester PopReal(double expected, double delta)
|
||||
{
|
||||
double value = Convert.ToDouble(context.Stack.Pop());
|
||||
double value = Convert.ToDouble(context.Stack.Pop(), CultureInfo.InvariantCulture);
|
||||
DoubleComparer doubleComparer = new DoubleComparer(delta);
|
||||
Assert.True(doubleComparer.Equals(expected, value));//expected, value, delta);
|
||||
return this;
|
||||
@ -98,7 +99,7 @@
|
||||
{
|
||||
object value = context.PopNumber();
|
||||
DoubleComparer doubleComparer = new DoubleComparer(delta);
|
||||
Assert.True(doubleComparer.Equals(expected, Convert.ToDouble(value)));
|
||||
Assert.True(doubleComparer.Equals(expected, Convert.ToDouble(value, CultureInfo.InvariantCulture)));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
namespace UglyToad.PdfPig.Functions.Type4
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
||||
/// <summary>
|
||||
/// Basic parser for Type 4 functions which is used to build up instruction sequences.
|
||||
@ -62,13 +63,13 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
if (int.TryParse(token, out int tokenInt))
|
||||
if (int.TryParse(token, NumberStyles.Integer, CultureInfo.InvariantCulture, out int tokenInt))
|
||||
{
|
||||
GetCurrentSequence().AddInteger(tokenInt);
|
||||
return;
|
||||
}
|
||||
|
||||
if (double.TryParse(token, out double tokenFloat))
|
||||
if (double.TryParse(token, NumberStyles.Float, CultureInfo.InvariantCulture, out double tokenFloat))
|
||||
{
|
||||
GetCurrentSequence().AddReal(tokenFloat);
|
||||
return;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user