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

add two test cases and relavent pictures for solving issue #211 #219

Merged
merged 2 commits into from
Jun 17, 2024

Conversation

Cheese-Bar
Copy link
Contributor

@Cheese-Bar Cheese-Bar commented Apr 19, 2022

PR Details

Description

By setting the parameters PixelToleranceLevel in the test to achieve aim comparation.

Related Issue

#211

image
image

The bug is the following code can not distinguish difference in color and text between the two pictures.

BufferedImage expectedImage = ImageComparisonUtil.readImageFromResources("expected#211.png");
BufferedImage actualImage = ImageComparisonUtil.readImageFromResources("actual#211.png");
ImageComparison comparison = new ImageComparison(expectedImage, actualImage);
ImageComparisonResult result = comparison.compareImages();
assertTrue(ImageComparisonState.MATCH != result.getImageComparisonState());

Motivation and Context

This is because the distinction between the two graphs is too small. So we need to add setPixelToleranceLevel(0.0) when we use it. I also added a separate test to separate the two colors, it shows PixelToleranceLevel = 0.079 can distingrush #c20272 and #df0272. But only PixelToleranceLevel = 0.0 can recognize the difference in numbers.

How Has This Been Tested

Tested in UT level

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Mention here, shouldProperlyHandleBug180FromRoot() in ImageComparisonUtilUnitTest seems has a incorrect file location for historical reasons. Maybe need to change String imagePath = "build/resources/test/result.png"; to String imagePath = "build/test-images/result.png"; in line 163; But I'm not here to deal with it, just in case.

@romankh3 romankh3 merged commit d22bfe6 into romankh3:master Jun 17, 2024
@romankh3
Copy link
Owner

thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants