Skip to content
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

Fix symbology identifier tests #1396

Merged
merged 4 commits into from Jun 7, 2021

Conversation

makiuchi-d
Copy link
Contributor

I found that some metadata tests did not work because the *.metadata.txt filename did not match to the png file.
First, in this PR, I renamed them to correct names.

And I also found that the symbology-identifier was not implemented in the ITFReader and there was no metadata test for the RSS14.
I implemented it, and added a metadata test file.

In addition, I removed unused code in the Code128Reader.
CODE_FNC_2 (value=97) is not available in the CODE_C (value=97 means "97"; see line 458-462 of Code128Reader.java).

@codecov
Copy link

codecov bot commented Jun 5, 2021

Codecov Report

Merging #1396 (5555569) into master (adbf17d) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1396      +/-   ##
============================================
+ Coverage     79.25%   79.26%   +0.01%     
  Complexity     4367     4367              
============================================
  Files           251      251              
  Lines         14641    14641              
  Branches       3017     3017              
============================================
+ Hits          11603    11605       +2     
+ Misses         2154     2152       -2     
  Partials        884      884              
Impacted Files Coverage Δ
...main/java/com/google/zxing/oned/Code128Reader.java 82.71% <ø> (+0.76%) ⬆️
...src/main/java/com/google/zxing/oned/ITFReader.java 95.65% <100.00%> (+0.07%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update adbf17d...5555569. Read the comment docs.

@@ -482,9 +482,6 @@ public Result decodeRow(int rowNumber, BitArray row, Map<DecodeHintType,?> hints
}
}
break;
case CODE_FNC_2:
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe you, but why is this definitely unused?

Copy link
Contributor Author

@makiuchi-d makiuchi-d Jun 6, 2021

Choose a reason for hiding this comment

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

This switch(code) is in the else block from line 463, and corresponding if is at line 458.

The line 458 is:

if (code < 100) {

Therefore, the code in this switch expression is greater than or equal to 100.
And CODE_FNC_2 is 97 (defined at line 160), so there is no chance to match to this case.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK you're right. The static analyzer agrees. @dehnhard you added this in #1372 - do you object?

Copy link
Contributor

@dehnhard dehnhard Jun 7, 2021

Choose a reason for hiding this comment

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

No objection from me. Looks like CODE_C is numeric only and can't contain FNC2 (but a leading FNC1). So, no harm done, it is removable dead code.
( and good to see improvements coming in on the symbology identifier code 👍 )

@srowen srowen merged commit ad061f0 into zxing:master Jun 7, 2021
@makiuchi-d makiuchi-d deleted the fix-symbology-identifier-tests branch June 7, 2021 16:17
@srowen srowen added this to the 3.4.2 milestone Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

3 participants