Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions QRCoder/ASCIIQRCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ public string GetGraphicSmall(bool drawQuietZones = true, bool invert = false, s

var palette = new
{
WHITE_ALL = "\u2588",
WHITE_BLACK = "\u2580",
BLACK_WHITE = "\u2584",
BLACK_ALL = " ",
WHITE_ALL = " ",
WHITE_BLACK = "\u2584",
BLACK_WHITE = "\u2580",
BLACK_ALL = "\u2588",
Comment on lines +112 to +115
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Update the small-renderer fixtures in AsciiQRCodeRendererTests.

QRCoderTests/AsciiQRCodeRendererTests.cs:38-75 still hardcodes the pre-fix output: the default case expects the filled quiet zone, and the invert: true case expects the non-inverted one. After this palette swap, those expectations need to be swapped/rewritten as well, otherwise the corrected behavior is either untested or the existing tests will fail.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@QRCoder/ASCIIQRCode.cs` around lines 112 - 115, Tests still expect the old
palette ordering so update the small-renderer fixtures in
AsciiQRCodeRendererTests to match the new constants (WHITE_ALL, WHITE_BLACK,
BLACK_WHITE, BLACK_ALL) by swapping/rewriting the expected outputs: swap the
default-case expected output with the invert: true case (or otherwise invert the
fixtures) so the filled quiet zone and inverted-render expectations align with
the new palette mapping; modify the assertions in
QRCoderTests/AsciiQRCodeRendererTests.cs (the test method(s) around
AsciiQRCodeRendererTests) to use the corrected expected strings for the default
and invert:true cases and keep the test names/structure unchanged.

⚠️ Potential issue | 🟠 Major

Flip the helper overload default to false too.

This palette swap corrects GetGraphicSmall(invert: false), but Line 197 still declares AsciiQRCodeHelper.GetQRCode(..., bool invert = true). Calls through that public helper will therefore keep returning the inverted output by default, so the bug remains on one entry point.

Suggested follow-up
-    public static string GetQRCode(string plainText, ECCLevel eccLevel, bool forceUtf8 = false, bool utf8BOM = false, EciMode eciMode = EciMode.Default, int requestedVersion = -1, string endOfLine = "\n", bool drawQuietZones = true, bool invert = true)
+    public static string GetQRCode(string plainText, ECCLevel eccLevel, bool forceUtf8 = false, bool utf8BOM = false, EciMode eciMode = EciMode.Default, int requestedVersion = -1, string endOfLine = "\n", bool drawQuietZones = true, bool invert = false)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@QRCoder/ASCIIQRCode.cs` around lines 112 - 115, Default inversion for the
public helper AsciiQRCodeHelper.GetQRCode(..., bool invert = true) must be
flipped to false to match the palette change; locate the GetQRCode method
declaration and change its default parameter to invert = false (and update any
other overloads or callers that rely on the old default), ensuring the new
default aligns with the ASCII palette constants (WHITE_ALL, WHITE_BLACK,
BLACK_WHITE, BLACK_ALL) so GetGraphicSmall(invert: false) and the helper's
default behavior produce the same non-inverted output.

};

var moduleData = QrCodeData.ModuleMatrix;
Expand Down
Binary file modified QRCoderDemoUWP/Assets/LockScreenLogo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified QRCoderDemoUWP/Assets/SplashScreen.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified QRCoderDemoUWP/Assets/Square150x150Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified QRCoderDemoUWP/Assets/Square44x44Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified QRCoderDemoUWP/Assets/StoreLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified QRCoderDemoUWP/Assets/Wide310x150Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified QRCoderTests/TransposeVerificationTests.pdf_renderer.approved.pdf
Binary file not shown.
Binary file modified QRCoderTests/assets/noun_software engineer_2909346.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified nuget-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading