mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-10-15 19:54:52 +08:00
add flate filter to compress truetype font in output and fix some structure issues for pdf verification
This commit is contained in:
28
src/UglyToad.PdfPig.Tests/Filters/FlateFilterTests.cs
Normal file
28
src/UglyToad.PdfPig.Tests/Filters/FlateFilterTests.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
namespace UglyToad.PdfPig.Tests.Filters
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using PdfPig.Filters;
|
||||
using PdfPig.Tokens;
|
||||
using Xunit;
|
||||
|
||||
public class FlateFilterTests
|
||||
{
|
||||
private readonly FlateFilter filter = new FlateFilter(new DecodeParameterResolver(new TestingLog()), new PngPredictor(), new TestingLog());
|
||||
|
||||
[Fact]
|
||||
public void EncodeAndDecodePreservesInput()
|
||||
{
|
||||
var parameters = new DictionaryToken(new Dictionary<NameToken, IToken>());
|
||||
var input = new byte[] {67, 69, 69, 10, 4, 20, 6, 19, 120, 64, 64, 64, 32};
|
||||
|
||||
using (var inputStream = new MemoryStream(input))
|
||||
{
|
||||
inputStream.Seek(0, SeekOrigin.Begin);
|
||||
var result = filter.Encode(inputStream, parameters, 0);
|
||||
var decoded = filter.Decode(result, parameters, 0);
|
||||
Assert.Equal(input, decoded);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user