Two more tests, +7 picture
MODIFY
WalletWasabi.Tests/UnitTests/QrCode/QrCodeDecodingTests.cs
WalletWasabi.Tests/UnitTests/QrCode/QrCodeDecodingTests.cs
@@ -92,5 +92,32 @@ namespace WalletWasabi.Tests.UnitTests.QrCode
Assert.Single(dataCollection);
Assert.Equal(expectedOutput, dataCollection.First());
}
+
+ [Fact]
+ public void DecodePictureWithMouseOverTheQRCodeReturnsNull()
+ {
+ QRDecoder decoder = new();
+
+ string path = Path.Combine(_commonPartialPath, "Mouse_over_the_QR-code.jpg");
+ using Bitmap inputImage = new(path);
+
+ //Returns null because of the mouse over the QR image
+ var dataCollection = decoder.SearchQrCodes(inputImage);
+
+ Assert.Empty(dataCollection);
+ }
+
+ [Fact]
+ public void DecodePictureWithImageInsideTheQR()
+ {
+ QRDecoder decoder = new();
+ string expectedOutput = "bitcoin:bc1q3r0ayktdsh8yd3krk5zkvpc5weeqnmw8ztzsgx?amount=1000&label=GIMME%201000BTC";
+
+ string path = Path.Combine(_commonPartialPath, "Payment_details_included.jpg");
+ using Bitmap inputImage = new(path);
+ var dataCollection = decoder.SearchQrCodes(inputImage);
+
+ Assert.Equal(expectedOutput, dataCollection.First());
+ }
}
}

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

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

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

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

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

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

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

MODIFY
WalletWasabi.Tests/WalletWasabi.Tests.csproj
WalletWasabi.Tests/WalletWasabi.Tests.csproj
<None Update="UnitTests\QrCode\QrTestResources\AddressTest2.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
+ <None Update="UnitTests\QrCode\QrTestResources\Mouse_over_the_QR-code.jpg">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
<None Update="UnitTests\QrCode\QrTestResources\NotBitcoinAddress.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
+ <None Update="UnitTests\QrCode\QrTestResources\Payment_details_included.jpg">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
<None Update="UnitTests\QrCode\QrTestResources\QRBrick.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="UnitTests\QrCode\QrTestResources\QRwithZebraBackground.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
+ <None Update="UnitTests\QrCode\QrTestResources\Random_address_ starting_with_1.png">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
+ <None Update="UnitTests\QrCode\QrTestResources\Random_Bech32.jpg">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
+ <None Update="UnitTests\QrCode\QrTestResources\Special_signs.jpg">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
+ <None Update="UnitTests\QrCode\QrTestResources\Text_QR-code.png">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
+ <None Update="UnitTests\QrCode\QrTestResources\URL_QR-code.jpg">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
<None Update="xunit.runner.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>

Two more tests, +7 picture