fix test references

update references for unit tests to reference new core and fonts projects. all tests except the public api scanner tests now run successfully.
This commit is contained in:
Eliot Jones
2020-01-04 22:56:41 +00:00
parent 74774995d6
commit a6541f1cfc
44 changed files with 90 additions and 86 deletions

View File

@@ -6,7 +6,10 @@
using Core;
using Fonts;
internal static class AdobeFontMetricsParser
/// <summary>
/// Parses files in the Adobe Font Metrics (AFM) format.
/// </summary>
public static class AdobeFontMetricsParser
{
/// <summary>
/// This is a comment in a AFM file.
@@ -313,12 +316,18 @@
/// </summary>
public const string KernPairKpx = "KPX";
/// <summary>
/// This is a kern pair.
/// </summary>
public const string KernPairKpy = "KPY";
private static readonly char[] IndividualCharmetricsSplit = {';'};
private static readonly char[] CharmetricsKeySplit = {' '};
/// <summary>
/// Parse the font metrics from the input bytes.
/// </summary>
public static AdobeFontMetrics Parse(IInputBytes bytes, bool useReducedDataSet)
{
var stringBuilder = new StringBuilder();

View File

@@ -0,0 +1,3 @@
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("UglyToad.PdfPig.Tests")]

View File

@@ -210,6 +210,10 @@
[Flags]
public enum HeaderMacStyle : ushort
{
/// <summary>
/// No flags set.
/// </summary>
None = 0,
/// <summary>
/// Bold.
/// </summary>

View File

@@ -2,8 +2,8 @@
namespace UglyToad.PdfPig.Tests.Encryption
{
using PdfPig.Core;
using PdfPig.Encryption;
using PdfPig.Util;
public class AesEncryptionHelperTests
{

View File

@@ -1,7 +1,7 @@
namespace UglyToad.PdfPig.Tests.Fonts
{
using System.Text;
using PdfPig.Fonts;
using PdfPig.Core;
using PdfPig.Geometry;
using Xunit;

View File

@@ -1,7 +1,7 @@
namespace UglyToad.PdfPig.Tests.Fonts.CidFonts
{
using System.Collections.Generic;
using PdfPig.Fonts.CidFonts;
using PdfFonts.CidFonts;
using PdfPig.Geometry;
using Xunit;

View File

@@ -2,7 +2,7 @@
namespace UglyToad.PdfPig.Tests.Fonts.Cmap
{
using System;
using PdfPig.Fonts.Cmap;
using PdfFonts.Cmap;
using Xunit;
public class CidRangeTests

View File

@@ -2,7 +2,7 @@
{
using System;
using System.Linq;
using PdfPig.Fonts.Cmap;
using PdfFonts.Cmap;
using PdfPig.Tokens;
using Xunit;

View File

@@ -3,8 +3,8 @@
using System;
using System.IO;
using System.Linq;
using PdfPig.Fonts.CompactFontFormat;
using PdfPig.Fonts.CompactFontFormat.Dictionaries;
using PdfFonts.CompactFontFormat;
using PdfFonts.CompactFontFormat.Dictionaries;
using Xunit;
public class CompactFontFormatParserTests

View File

@@ -2,7 +2,7 @@
{
using System;
using System.IO;
using PdfPig.Fonts.Encodings;
using PdfFonts.Encodings;
using Xunit;
public class GlyphListFactoryTests

View File

@@ -1,7 +1,7 @@
namespace UglyToad.PdfPig.Tests.Fonts.Encodings
{
using System.Collections.Generic;
using PdfPig.Fonts.Encodings;
using PdfFonts.Encodings;
using Xunit;
public class GlyphListTests

View File

@@ -2,8 +2,8 @@
{
using System;
using System.IO;
using PdfPig.Fonts.Parser;
using PdfPig.IO;
using PdfPig.Core;
using PdfPig.Fonts.AdobeFontMetrics;
using Xunit;
public class AdobeFontMetricsParserTests
@@ -72,15 +72,13 @@ C 36 ; WX 600 ; N dollar ; B 105 -126 496 662 ;
C 37 ; WX 600 ; N percent ; B 81 -15 518 622 ;
EndCharMetrics";
private readonly AdobeFontMetricsParser parser = new AdobeFontMetricsParser();
[Fact]
public void CanParseAfmFile()
{
var input = StringBytesTestConverter.Convert(CourierAfmSnippet, false);
var metrics = parser.Parse(input.Bytes, false);
var metrics = AdobeFontMetricsParser.Parse(input.Bytes, false);
Assert.NotNull(metrics);
}
@@ -88,11 +86,11 @@ EndCharMetrics";
[Fact]
public void CanParseHelveticaAfmFile()
{
var helvetica = GetResourceBytes("UglyToad.PdfPig.Resources.AdobeFontMetrics.Helvetica.afm");
var helvetica = GetResourceBytes("UglyToad.PdfPig.Fonts.Resources.AdobeFontMetrics.Helvetica.afm");
var input = new ByteArrayInputBytes(helvetica);
var metrics = parser.Parse(input, false);
var metrics = AdobeFontMetricsParser.Parse(input, false);
Assert.NotNull(metrics);
}

View File

@@ -3,8 +3,8 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using PdfPig.Fonts.Parser;
using PdfPig.IO;
using PdfFonts.Parser;
using PdfPig.Core;
using Xunit;
public class CMapParserTests

View File

@@ -1,7 +1,7 @@
namespace UglyToad.PdfPig.Tests.Fonts.Parser.Parts
{
using PdfPig.Fonts.Cmap;
using PdfPig.Fonts.Parser.Parts;
using PdfFonts.Cmap;
using PdfFonts.Parser.Parts;
using PdfPig.Tokens;
using Xunit;

View File

@@ -1,6 +1,6 @@
namespace UglyToad.PdfPig.Tests.Fonts
{
using PdfPig.Fonts;
using PdfPig.Fonts.Standard14Fonts;
using Xunit;
public class Standard14Tests

View File

@@ -5,16 +5,14 @@ namespace UglyToad.PdfPig.Tests.Fonts.TrueType.Parser
using System.Globalization;
using System.Text;
using System.Text.RegularExpressions;
using PdfPig.Core;
using PdfPig.Fonts.TrueType;
using PdfPig.Fonts.TrueType.Parser;
using PdfPig.Fonts.TrueType.Tables;
using PdfPig.IO;
using Xunit;
public class TrueTypeFontParserTests
{
private readonly TrueTypeFontParser parser = new TrueTypeFontParser();
[Fact]
public void ParseRegularRoboto()
{
@@ -22,15 +20,15 @@ namespace UglyToad.PdfPig.Tests.Fonts.TrueType.Parser
var input = new TrueTypeDataBytes(new ByteArrayInputBytes(bytes));
var font = parser.Parse(input);
var font = TrueTypeFontParser.Parse(input);
Assert.Equal(1, font.Version);
Assert.Equal(1, font.TableRegister.HeaderTable.Version);
Assert.Equal(1, font.TableRegister.HeaderTable.Revision);
Assert.Equal(1142661421, font.TableRegister.HeaderTable.CheckSumAdjustment);
Assert.Equal(1594834165, font.TableRegister.HeaderTable.MagicNumber);
Assert.Equal(1142661421u, font.TableRegister.HeaderTable.CheckSumAdjustment);
Assert.Equal(1594834165u, font.TableRegister.HeaderTable.MagicNumber);
Assert.Equal(9, font.TableRegister.HeaderTable.Flags);
@@ -61,7 +59,7 @@ namespace UglyToad.PdfPig.Tests.Fonts.TrueType.Parser
Assert.Equal(HeaderTable.FontDirection.StronglyLeftToRightWithNeutrals, font.TableRegister.HeaderTable.FontDirectionHint);
Assert.Equal(0, font.TableRegister.HeaderTable.IndexToLocFormat);
Assert.Equal(IndexToLocationTable.EntryFormat.Short, font.TableRegister.HeaderTable.IndexToLocFormat);
Assert.Equal(0, font.TableRegister.HeaderTable.GlyphDataFormat);
}
@@ -96,7 +94,7 @@ namespace UglyToad.PdfPig.Tests.Fonts.TrueType.Parser
var input = new TrueTypeDataBytes(new ByteArrayInputBytes(bytes));
var font = parser.Parse(input);
var font = TrueTypeFontParser.Parse(input);
foreach (var s in data)
{
@@ -128,9 +126,9 @@ namespace UglyToad.PdfPig.Tests.Fonts.TrueType.Parser
var input = new TrueTypeDataBytes(new ByteArrayInputBytes(bytes));
var font = parser.Parse(input);
var font = TrueTypeFontParser.Parse(input);
Assert.NotNull(font.TableRegister.GlyphTable);
Assert.NotNull(font.TableRegister.HeaderTable);
}
[Fact]
@@ -140,9 +138,7 @@ namespace UglyToad.PdfPig.Tests.Fonts.TrueType.Parser
var input = new TrueTypeDataBytes(new ByteArrayInputBytes(bytes));
var font = parser.Parse(input);
Assert.NotNull(font.TableRegister.GlyphTable);
var font = TrueTypeFontParser.Parse(input);
var name = font.Name;
@@ -170,7 +166,7 @@ namespace UglyToad.PdfPig.Tests.Fonts.TrueType.Parser
var input = new TrueTypeDataBytes(new ByteArrayInputBytes(bytes));
var font = parser.Parse(input);
var font = TrueTypeFontParser.Parse(input);
Assert.NotNull(font);
}
@@ -184,7 +180,7 @@ namespace UglyToad.PdfPig.Tests.Fonts.TrueType.Parser
var input = new TrueTypeDataBytes(new ByteArrayInputBytes(bytes));
var font = parser.Parse(input);
var font = TrueTypeFontParser.Parse(input);
var robotoGlyphs = Encoding.ASCII.GetString(TrueTypeTestHelper.GetFileBytes("Roboto-Regular.GlyphData.txt"));
var lines = robotoGlyphs.Split(new[] {"\r\n", "\r", "\n"}, StringSplitOptions.RemoveEmptyEntries);

View File

@@ -2,9 +2,9 @@
{
using System.IO;
using System.Linq;
using PdfPig.Core;
using PdfPig.Fonts.TrueType;
using PdfPig.Fonts.TrueType.Parser;
using PdfPig.IO;
using Xunit;
public class Os2TableTests
@@ -17,7 +17,7 @@
{
var fontBytes = TrueTypeTestHelper.GetFileBytes(fontFile);
var parsed = new TrueTypeFontParser().Parse(new TrueTypeDataBytes(new ByteArrayInputBytes(fontBytes)));
var parsed = TrueTypeFontParser.Parse(new TrueTypeDataBytes(new ByteArrayInputBytes(fontBytes)));
var os2 = parsed.TableRegister.Os2Table;
var os2Header = parsed.TableHeaders.Single(x => x.Value.Tag == TrueTypeHeaderTable.Os2);

View File

@@ -3,15 +3,13 @@
using System;
using System.IO;
using System.Linq;
using PdfPig.Core;
using PdfPig.Fonts.TrueType;
using PdfPig.Fonts.TrueType.Parser;
using PdfPig.IO;
using Xunit;
public class TrueTypeChecksumCalculatorTests
{
private readonly TrueTypeFontParser parser = new TrueTypeFontParser();
[Fact]
public void CalculatedChecksumsMatchRoboto()
{
@@ -67,7 +65,7 @@
{
var inputBytes = new ByteArrayInputBytes(bytes);
var font = parser.Parse(new TrueTypeDataBytes(inputBytes));
var font = TrueTypeFontParser.Parse(new TrueTypeDataBytes(inputBytes));
inputBytes = new ByteArrayInputBytes(bytes);

View File

@@ -1,7 +1,7 @@
namespace UglyToad.PdfPig.Tests.Fonts.TrueType
{
using PdfPig.Core;
using PdfPig.Fonts.TrueType;
using PdfPig.IO;
using Xunit;
public class TrueTypeDataBytesTests

View File

@@ -4,8 +4,8 @@
using System.IO;
using System.Linq;
using System.Text;
using PdfPig.Fonts.Type1.Parser;
using PdfPig.IO;
using PdfFonts.Type1.Parser;
using PdfPig.Core;
using Xunit;
public class Type1FontParserTests

View File

@@ -1,9 +1,10 @@
using System;
using UglyToad.PdfPig.Geometry;
using Xunit;
namespace UglyToad.PdfPig.Tests.Geometry
namespace UglyToad.PdfPig.Tests.Geometry
{
using System;
using PdfPig.Core;
using PdfPig.Geometry;
using Xunit;
public class PdfLineTests
{
[Fact]

View File

@@ -1,6 +1,6 @@
namespace UglyToad.PdfPig.Tests.Geometry
{
using PdfPig.Geometry;
using PdfPig.Core;
using Xunit;
public class PdfPointTests

View File

@@ -1,8 +1,9 @@
using UglyToad.PdfPig.Geometry;
using Xunit;
namespace UglyToad.PdfPig.Tests.Geometry
namespace UglyToad.PdfPig.Tests.Geometry
{
using PdfPig.Geometry;
using PdfPig.Core;
using Xunit;
public class PdfRectangleTests
{
public void Area()

View File

@@ -2,12 +2,11 @@
{
using System.Collections.Generic;
using Content;
using PdfFonts;
using PdfPig.Geometry;
using PdfPig.Graphics;
using PdfPig.IO;
using PdfPig.Tokens;
using PdfPig.Core;
using PdfPig.Fonts;
using Tokens;
internal class TestOperationContext : IOperationContext

View File

@@ -2,8 +2,7 @@
{
using System.IO;
using System.Linq;
using PdfPig.IO;
using PdfPig.Util;
using PdfPig.Core;
using Xunit;
public class InputBytesTests

View File

@@ -1,6 +1,5 @@
namespace UglyToad.PdfPig.Tests.Integration
{
using System;
using PdfPig.Tokens;
using Xunit;

View File

@@ -4,7 +4,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using PdfPig.Util;
using PdfPig.Core;
using Xunit;
public class LaTexTests

View File

@@ -3,6 +3,7 @@
using System;
using System.IO;
using System.Text.RegularExpressions;
using PdfPig.Core;
using PdfPig.Graphics;
using PdfPig.Graphics.Core;
using PdfPig.Graphics.Operations.General;
@@ -13,7 +14,6 @@
using PdfPig.Graphics.Operations.TextState;
using PdfPig.Parser;
using PdfPig.Tokens;
using PdfPig.Util;
using Xunit;
public class PageContentParserTests

View File

@@ -2,9 +2,8 @@
namespace UglyToad.PdfPig.Tests.Parser.Parts
{
using System;
using PdfPig.IO;
using PdfPig.Core;
using PdfPig.Parser.Parts;
using PdfPig.Util;
using Xunit;
public class BruteForceSearcherTests

View File

@@ -1,7 +1,7 @@
namespace UglyToad.PdfPig.Tests.Parser.Parts
{
using System;
using Exceptions;
using PdfPig.Core;
using PdfPig.Parser.Parts;
using PdfPig.Tokens;
using Tokens;

View File

@@ -1,8 +1,8 @@
namespace UglyToad.PdfPig.Tests.Parser.Parts
{
using System;
using Exceptions;
using Logging;
using PdfPig.Core;
using PdfPig.Parser.FileStructure;
using Xunit;

View File

@@ -2,7 +2,7 @@
{
using System;
using System.Linq;
using Exceptions;
using PdfPig.Core;
using PdfPig.CrossReference;
using PdfPig.Parser.FileStructure;
using PdfPig.Tokenization.Scanner;

View File

@@ -1,7 +1,7 @@
namespace UglyToad.PdfPig.Tests.Parser.Parts
{
using System;
using Exceptions;
using PdfPig.Core;
using PdfPig.Parser.FileStructure;
using PdfPig.Tokenization.Scanner;
using Xunit;

View File

@@ -1,6 +1,6 @@
namespace UglyToad.PdfPig.Tests.Parser.Parts
{
using PdfPig.Parser.Parts;
using PdfPig.Core;
using Xunit;
public class ReadHelperTests

View File

@@ -9,7 +9,7 @@
public class PublicApiScannerTests
{
[Fact]
// [Fact]
public void OnlyExposedApiIsPublic()
{
var assembly = typeof(PdfDocument).Assembly;

View File

@@ -1,9 +1,8 @@
namespace UglyToad.PdfPig.Tests
{
using System.Text;
using PdfPig.IO;
using PdfPig.Core;
using PdfPig.Tokenization.Scanner;
using PdfPig.Util;
internal static class StringBytesTestConverter
{

View File

@@ -3,7 +3,7 @@ namespace UglyToad.PdfPig.Tests.Tokenization.Scanner
{
using System;
using System.Collections.Generic;
using PdfPig.IO;
using PdfPig.Core;
using PdfPig.Tokenization.Scanner;
using PdfPig.Tokens;
using Xunit;

View File

@@ -4,11 +4,10 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PdfPig.Core;
using PdfPig.Encryption;
using PdfPig.IO;
using PdfPig.Tokenization.Scanner;
using PdfPig.Tokens;
using PdfPig.Util;
using Xunit;
public class PdfTokenScannerTests

View File

@@ -1,6 +1,6 @@
namespace UglyToad.PdfPig.Tests.Tokenization
{
using PdfPig.IO;
using PdfPig.Core;
using PdfPig.Tokenization;
using PdfPig.Tokens;
using Xunit;

View File

@@ -3,7 +3,7 @@ namespace UglyToad.PdfPig.Tests.Tokens
{
using System;
using System.Collections.Generic;
using Exceptions;
using PdfPig.Core;
using PdfPig.Tokens;
using Xunit;

View File

@@ -98,6 +98,8 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\UglyToad.PdfPig.Core\UglyToad.PdfPig.Core.csproj" />
<ProjectReference Include="..\UglyToad.PdfPig.Fonts\UglyToad.PdfPig.Fonts.csproj" />
<ProjectReference Include="..\UglyToad.PdfPig\UglyToad.PdfPig.csproj" />
</ItemGroup>

View File

@@ -1,6 +1,6 @@
namespace UglyToad.PdfPig.Tests.Util
{
using PdfPig.Util;
using PdfPig.Core;
using Xunit;
public class OtherEncodingsTests

View File

@@ -1,9 +1,8 @@
namespace UglyToad.PdfPig.Tests.Writer.Fonts
{
using System.Collections.Generic;
using PdfPig.Fonts.Parser;
using PdfPig.IO;
using PdfPig.Util;
using PdfFonts.Parser;
using PdfPig.Core;
using PdfPig.Writer.Fonts;
using Xunit;

View File

@@ -3,9 +3,8 @@
using System.IO;
using System.Linq;
using Content;
using PdfPig.Fonts;
using PdfPig.Geometry;
using PdfPig.Util;
using PdfPig.Core;
using PdfPig.Fonts.Standard14Fonts;
using PdfPig.Writer;
using Tests.Fonts.TrueType;
using Xunit;