-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
85 additions
and
2 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 |
---|---|---|
|
@@ -68,6 +68,5 @@ public void PngSaveAs() | |
QRBill.Draw(bill, canvas); | ||
canvas.SaveAs("qrbill.png"); | ||
} | ||
|
||
} | ||
} |
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,56 @@ | ||
// | ||
// Swiss QR Bill Generator for .NET | ||
// Copyright (c) 2018 Manuel Bleichenbacher | ||
// Licensed under MIT License | ||
// https://opensource.org/licenses/MIT | ||
// | ||
|
||
using Codecrete.SwissQRBill.PixelCanvas; | ||
using System; | ||
using Xunit; | ||
|
||
namespace Codecrete.SwissQRBill.PixelCanvasTest | ||
{ | ||
public class PngProcessorTest | ||
{ | ||
[Fact] | ||
public void HeaderIncomplete_Fails() | ||
{ | ||
var data = new byte[] { 0, 0, 0, 0, 0 }; | ||
Assert.Throws<ArgumentException>(() => | ||
{ | ||
PngProcessor.InsertDpi(new System.IO.MemoryStream(data), new System.IO.MemoryStream(), 96); | ||
}); | ||
} | ||
|
||
[Fact] | ||
public void NoPhysChunk_Fails() | ||
{ | ||
var data = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 }; | ||
Assert.Throws<ArgumentException>(() => | ||
{ | ||
PngProcessor.InsertDpi(new System.IO.MemoryStream(data), new System.IO.MemoryStream(), 96); | ||
}); | ||
} | ||
|
||
[Fact] | ||
public void FirstChunkIncomplete_Fails() | ||
{ | ||
var data = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; | ||
Assert.Throws<ArgumentException>(() => | ||
{ | ||
PngProcessor.InsertDpi(new System.IO.MemoryStream(data), new System.IO.MemoryStream(), 96); | ||
}); | ||
} | ||
|
||
[Fact] | ||
public void Incomplete_Fails() | ||
{ | ||
var data = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; | ||
Assert.Throws<ArgumentException>(() => | ||
{ | ||
PngProcessor.InsertDpi(new System.IO.MemoryStream(data), new System.IO.MemoryStream(), 96); | ||
}); | ||
} | ||
} | ||
} |