-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from ArjanKw/feature/add-image-support
Support images, .NET 8.0 and added options
- Loading branch information
Showing
21 changed files
with
856 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,5 @@ | |
<address> | ||
<strong>Support:</strong> <a href="mailto:[email protected]">Support@example.com</a><br /> | ||
<strong>Marketing:</strong> <a href="mailto:[email protected]">Marketing@example.com</a> | ||
<strong>Special character test:</strong> àéù | ||
</address> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@{ | ||
ViewData["Title"] = "Contact"; | ||
} | ||
<h2>@ViewData["Title"]</h2> | ||
<h3>@ViewData["Message"] </h3> | ||
|
||
<address> | ||
One Microsoft Way<br /> | ||
Redmond, WA 98052-6399<br /> | ||
<abbr title="Phone">P:</abbr> | ||
425.555.0100 | ||
</address> | ||
|
||
<address> | ||
<strong>Support:</strong> <a href="mailto:[email protected]">Support@example.com</a><br /> | ||
<strong>Marketing:</strong> <a href="mailto:[email protected]">Marketing@example.com</a> | ||
</address> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@{ | ||
ViewData["Title"] = "Privacy Policy"; | ||
} | ||
<h1>@ViewData["Title"]</h1> | ||
|
||
<p>Use this page to detail your site's privacy policy.</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Configuration; | ||
using System.Drawing; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Net; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
|
||
namespace Rotativa.AspNetCore.Tests | ||
{ | ||
|
||
[Trait("Rotativa.AspNetCore", "testing if the option flags are passed to wkhtmltopdf/wkhtmltoimage in the right way.")] | ||
public class OptionFlagTest | ||
{ | ||
StringBuilder verificationErrors; | ||
|
||
public OptionFlagTest() | ||
{ | ||
verificationErrors = new StringBuilder(); | ||
} | ||
|
||
[Fact(DisplayName = "should not pass options by default.")] | ||
public void NoOptions_ShouldNotPassOptions() | ||
{ | ||
var test = new ViewAsPdf(); | ||
|
||
Assert.Empty(test.GetConvertOptions()); | ||
} | ||
|
||
[Fact(DisplayName = "zoom option flag is outputted in wkhtml format.")] | ||
public void SingleOption_Zoom_ShouldBeFormatted() | ||
{ | ||
var test = new ViewAsPdf() | ||
{ | ||
Zoom = 1.5 | ||
}; | ||
|
||
Assert.Equal("--zoom 1.5", test.GetConvertOptions()); | ||
} | ||
|
||
[Fact(DisplayName = "boolean option flag are outputted in wkhtml format.")] | ||
public void SingleOption_Boolean_ShouldBeFormatted() | ||
{ | ||
var test = new ViewAsPdf() | ||
{ | ||
NoImages = true | ||
}; | ||
|
||
Assert.Equal("--no-images", test.GetConvertOptions()); | ||
} | ||
|
||
[Fact(DisplayName = "multiple option flags should be combined to one option string.")] | ||
public void MultipleOption_Boolean_ShouldBeCombined() | ||
{ | ||
var test = new ViewAsPdf() | ||
{ | ||
IsLowQuality = true, | ||
NoImages = true | ||
}; | ||
|
||
Assert.Equal("-l --no-images", test.GetConvertOptions()); | ||
} | ||
|
||
[Fact(DisplayName = "dictionary options should be repeated for each key")] | ||
public void DictionaryOption_ShouldBeFormatted() | ||
{ | ||
var test = new ViewAsPdf() | ||
{ | ||
CustomHeaders = new Dictionary<string, string> | ||
{ | ||
{ "Header1", "value" }, | ||
{ "Header2", "value" }, | ||
} | ||
}; | ||
|
||
Assert.Equal("--custom-header Header1 value --custom-header Header2 value", test.GetConvertOptions()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.