Double QR Code test added
MODIFY
WalletWasabi.Tests/UnitTests/QrCode/QrCodeDecodingTests.cs
WalletWasabi.Tests/UnitTests/QrCode/QrCodeDecodingTests.cs
@@ -133,5 +133,24 @@ namespace WalletWasabi.Tests.UnitTests.QrCode
Assert.Equal(expectedOutput, dataCollection.First());
}
+
+ [Fact]
+ public void DecodeQrCodeInsideQrCode()
+ {
+ QRDecoder decoder = new();
+
+ // If there are two QR Codes on the picture, it will find both, even if they are
+ // stacked on eachother, until the QR Code's quality is okay and is still readable
+ string path = Path.Combine(_commonPartialPath, "DoubleQRCode.png");
+ string firstExpectedOutput = "Big QR Code";
+ string secondExpectedOutput = "Small QR Code";
+ using Bitmap inputImage = new(path);
+ int expectedLength = 2;
+ var dataCollection = decoder.SearchQrCodes(inputImage).ToArray();
+
+ Assert.Equal(expectedLength, dataCollection.Length);
+ Assert.Equal(firstExpectedOutput, dataCollection[0]);
+ Assert.Equal(secondExpectedOutput, dataCollection[1]);
+ }
}
}

ADD
WalletWasabi.Tests/UnitTests/QrCode/QrTestResources/DoubleQRCode.png
WalletWasabi.Tests/UnitTests/QrCode/QrTestResources/DoubleQRCode.png
Binary files /dev/null and b/WalletWasabi.Tests/UnitTests/QrCode/QrTestResources/DoubleQRCode.png 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\DoubleQRCode.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
<None Update="UnitTests\QrCode\QrTestResources\Mouse_over_the_QR-code.jpg">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="UnitTests\QrCode\QrTestResources\NotBitcoinAddress.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

Double QR Code test added