Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test to overload with filepaths #51

Merged
merged 1 commit into from
Jan 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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