New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Promote renderResult method to public #1801
Promote renderResult method to public #1801
Conversation
I think that's OK. My request would be to fill out javadoc for this method then, and if you have a sec, any basic unit test for the method too |
c4aa812
to
27e3059
Compare
@srowen , the javadoc was added to the target method and some junit tests were added too. By the way, I moved the "renderResult" method to the begin of the class, taking into consideration that it is now a |
core/src/test/java/com/google/zxing/qrcode/QRCodeWriterTestCase.java
Outdated
Show resolved
Hide resolved
@@ -37,6 +37,60 @@ public final class QRCodeWriter implements Writer { | |||
|
|||
private static final int QUIET_ZONE_SIZE = 4; | |||
|
|||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not against moving this, but it'd be slightly cleaner to not move the method
I will fix that ASAP ... thanks for the insights ...
…On Wed, May 1, 2024, 9:16 AM Sean Owen ***@***.***> wrote:
***@***.**** requested changes on this pull request.
------------------------------
In core/src/test/java/com/google/zxing/qrcode/QRCodeWriterTestCase.java
<#1801 (comment)>:
> @@ -133,4 +136,55 @@ public void testRegressionTest() throws Exception {
"renderer-test-01.png");
}
+ @test
+ public void renderResultScalesNothing() {
+ final int expected_size = 33; // Original Size (25) + quietZone
Oh, this fails style checks. Just expectedSize
------------------------------
In core/src/main/java/com/google/zxing/qrcode/QRCodeWriter.java
<#1801 (comment)>:
> @@ -37,6 +37,60 @@ public final class QRCodeWriter implements Writer {
private static final int QUIET_ZONE_SIZE = 4;
+ /**
I'm not against moving this, but it'd be slightly cleaner to not move the
method
—
Reply to this email directly, view it on GitHub
<#1801 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABPGBRUUV2PQGUUKVEFIT53ZAD2NBAVCNFSM6AAAAABG7SJOYOVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDAMZTG4YDOOJWGU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
This small commit makes public the "renderResult" method of the "QRCodeWriter" class. The reason to promote this method as public is that I'm facing Business Case where, besides of generating the QR code as a PNG image, I also need to print information about the QR code itself (specifically, the QR version). Navigating through the code of zxing library, I noticed that the com.google.zxing.qrcode.encoder.Encoder allows me to have that (the QR metadata); however, by invoking that class I only have part of the equation (the QRCode DTO) ... I'm still needing to generate the BitMatrix in order to produce the QR image. Here, I have two alternatives: either I invoke the Encoder.encode class by myself and repeat the same logic when invoking the QRCodeWriter.encode method; or I make the renderResult Public, call the Encoder.encode and then I proceed to call the QRCodeWriter.renderResult method with the previous result.
27e3059
to
8e20b8c
Compare
The style issues were fixed ... also, the |
This small commit makes public the "
renderResult
" method of the "QRCodeWriter
" class.The reason to promote this method as public is that I'm facing business case where, besides of generating the QR code as a PNG image, I also need to print information about the QR code itself (specifically, the QR version). Navigating through the code of zxing library, I noticed that the
com.google.zxing.qrcode.encoder.Encoder
allows me to have that (the QR metadata); however, by invoking that class I only have part of the equation (theQRCode
DTO) ... I'm still needing to generate theBitMatrix
in order to produce the QR image.Here, I have two alternatives: either I invoke the
Encoder.encode
class by myself and repeat the same logic when invoking theQRCodeWriter.encode
method; or I make therenderResult
Public, call theEncoder.encode
and then I proceed to call theQRCodeWriter.renderResult
method with the previous result.