Skip to content

Commit

Permalink
Merge pull request #51 from berthertogen/feature/49/add-test
Browse files Browse the repository at this point in the history
Add test to overload with filepaths
  • Loading branch information
berthertogen authored Jan 1, 2024
2 parents 163d7f4 + 05f58bf commit 25fefa0
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
8 changes: 8 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ dotnet pack -p:PackageVersion=0.0.25 --output nupkgs

Update the example project package version (Weasyprint.Wrapped.Example.csproj) and run the example to test it

## Error in tests

The following error might be thrown when running the tests on windows:
``` shell
(process:13448): GLib-GIO-WARNING **: 17:21:45.816: Unexpectedly, UWP app `Microsoft.OutlookForWindows_1.2023.1114.100_x64__8wekyb3d8bbwe' (AUMId `Microsoft.OutlookForWindows_8wekyb3d8bbwe!Microsoft.OutlookforWindows') supports 1 extensions but has no verbs
```
Check here for the answer: <https://stackoverflow.com/questions/67607643/what-does-this-warning-mean-it-happens-every-time-i-restart-the-node-process#answer-67715630>

## Building assets

### Windows (build-on-windows.ps1 does approximately this)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<html>
<meta charset="UTF-8">

<body>
<h1>TEST</h1>
</body>

</html>
Binary file not shown.
20 changes: 20 additions & 0 deletions src/Weasyprint.Wrapped.Tests/Tests/PrinterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.IO.Compression;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using Xunit;

Expand Down Expand Up @@ -94,6 +95,25 @@ public async Task Print_RunsCommand_Simple()
Assert.True(result.Bytes.Length > 0);
}

[Fact]
public async Task Print_RunsCommand_WithFilePaths_Simple()
{
var printer = GetPrinter();
await printer.Initialize();

var testingProjectRoot = new DirectoryInfo(AppContext.BaseDirectory).Parent.Parent.Parent.FullName;
var inputFile = Path.Combine(testingProjectRoot,"Expected/Print_RunsCommand_Simple_Input.html");
var outputFile = Path.Combine(testingProjectRoot, "Expected/Print_RunsCommand_WithFilePaths_Result_Actual.pdf");
var result = await printer.Print(inputFile, outputFile, CancellationToken.None);

Assert.True(string.IsNullOrWhiteSpace(result.Error), $"Should have no error but found {result.Error}");
Assert.Equal(0, result.ExitCode);
Assert.False(result.HasError);

var outputFileBytes = File.ReadAllBytes(outputFile);
Assert.True(outputFileBytes.Length > 0);
}

[Fact]
public async Task Print_RunsCommand_WithParameters()
{
Expand Down

0 comments on commit 25fefa0

Please sign in to comment.