Two more tests
MODIFY
WalletWasabi.Tests/UnitTests/QrCode/QrCodeDecodingTests.cs
WalletWasabi.Tests/UnitTests/QrCode/QrCodeDecodingTests.cs
@@ -57,7 +57,7 @@ namespace WalletWasabi.Tests.UnitTests.QrCode
}
[Fact]
- public void GetAddressFromPictureTakenByPhone()
+ public void DecodePictureTakenByPhone()
{
QRDecoder decoder = new();
string expectedOutput = "tb1qutgpgraaze3hqnvt2xyw5acsmd3urprk3ff27d";
@@ -69,5 +69,33 @@ namespace WalletWasabi.Tests.UnitTests.QrCode
Assert.Single(dataCollection);
Assert.Equal(expectedOutput, dataCollection.First());
}
+
+ [Fact]
+ public void DecodeDifficultPictureTakenByPhone()
+ {
+ QRDecoder decoder = new();
+ string expectedOutput = "Top right corner";
+
+ string path = Path.Combine(_commonPartialPath, "QrBrick.jpg");
+ using Bitmap inputImage = new(path);
+ var dataCollection = decoder.SearchQrCodes(inputImage);
+
+ Assert.Single(dataCollection);
+ Assert.Equal(expectedOutput, dataCollection.First());
+ }
+
+ [Fact]
+ public void DecodePictureWithZebraBackground()
+ {
+ QRDecoder decoder = new();
+ string expectedOutput = "Let's see a Zebra.";
+
+ string path = Path.Combine(_commonPartialPath, "QRwithZebraBackground.png");
+ using Bitmap inputImage = new(path);
+ var dataCollection = decoder.SearchQrCodes(inputImage);
+
+ Assert.Single(dataCollection);
+ Assert.Equal(expectedOutput, dataCollection.First());
+ }
}
}

ADD
WalletWasabi.Tests/UnitTests/QrCode/QrTestResources/QRBrick.jpg
WalletWasabi.Tests/UnitTests/QrCode/QrTestResources/QRBrick.jpg
Binary files /dev/null and b/WalletWasabi.Tests/UnitTests/QrCode/QrTestResources/QRBrick.jpg differ

ADD
WalletWasabi.Tests/UnitTests/QrCode/QrTestResources/QRwithZebraBackground.png
WalletWasabi.Tests/UnitTests/QrCode/QrTestResources/QRwithZebraBackground.png
Binary files /dev/null and b/WalletWasabi.Tests/UnitTests/QrCode/QrTestResources/QRwithZebraBackground.png differ

MODIFY
WalletWasabi.Tests/WalletWasabi.Tests.csproj
WalletWasabi.Tests/WalletWasabi.Tests.csproj
<None Update="UnitTests\QrCode\QrTestResources\NotBitcoinAddress.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
+ <None Update="UnitTests\QrCode\QrTestResources\QRBrick.jpg">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
<None Update="UnitTests\QrCode\QrTestResources\QrByPhone.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
+ <None Update="UnitTests\QrCode\QrTestResources\QRwithZebraBackground.png">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
<None Update="xunit.runner.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>

Two more tests