Skip to content

Commit

Permalink
Add dist test
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Aug 3, 2023
1 parent f146588 commit 278f9ea
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ private File getRelatedFile(final String name) {
*
* @return a number between 0 and 10000 or Double.MAX_VALUE on images format error.
*/
private double calcDistance(final BufferedImage actual) {
protected double calcDistance(final BufferedImage actual) {
// There are several ways to calculate distances between two vectors,
// we will calculate the sum of the distances between the RGB values of
// pixels in the same positions.
Expand Down
15 changes: 0 additions & 15 deletions core/src/test/java/org/mapfish/print/CheckTest.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package org.mapfish.print;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import javax.imageio.ImageIO;
import org.junit.Test;
import org.mapfish.print.test.util.ImageSimilarity;

public class ImageSimilarityTest extends AbstractMapfishSpringTest {

@Test
public void testRegenerateFalse() throws Exception {
assertFalse(
"This flag should not be committed as true", ImageSimilarity.REGENERATE_EXPECTED_IMAGES);
}

@Test
public void testDist() throws Exception {
assertTrue(
new ImageSimilarity(getFile("imageSimilarity/with.png"))
.calcDistance(ImageIO.read(getFile("imageSimilarity/without.png")))
> 0);
}
}
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.

0 comments on commit 278f9ea

Please sign in to comment.