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

#212: updated metrics in GitHub #214

Merged
merged 14 commits into from
Sep 23, 2022
Merged
46 changes: 0 additions & 46 deletions .circleci/config.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/gradle.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Java CI with Maven

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
![logo-trans](https://user-images.githubusercontent.com/16310793/42029324-df117c42-7ad7-11e8-8d3e-9c6cd8822d6c.png)
![Maven_Workflow](https://github.com/romankh3/image-comparison/actions/workflows/maven.yml/badge.svg)
[![Maven Central](https://img.shields.io/maven-central/v/com.github.romankh3/image-comparison.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.github.romankh3%22%20AND%20a:%22image-comparison%22)
[![Gitter](https://badges.gitter.im/image-comparison/community.svg)](https://gitter.im/image-comparison/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![Javadocs](http://www.javadoc.io/badge/com.github.romankh3/image-comparison.svg?color=green)](http://www.javadoc.io/doc/com.github.romankh3/image-comparison)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/e4fd1c61d0f147358f8c5df212256491)](https://app.codacy.com/app/romankh3/image-comparison?utm_source=github.com&utm_medium=referral&utm_content=romankh3/image-comparison&utm_campaign=Badge_Grade_Dashboard)
[![Build Status](https://travis-ci.org/romankh3/image-comparison.svg?branch=master)](https://travis-ci.org/romankh3/image-comparison) [![Coverage Status](https://coveralls.io/repos/github/romankh3/image-comparison/badge.svg?branch=master)](https://coveralls.io/github/romankh3/image-comparison?branch=master) [![BCH compliance](https://bettercodehub.com/edge/badge/romankh3/image-comparison?branch=master)](https://bettercodehub.com/)
[![BCH compliance](https://bettercodehub.com/edge/badge/romankh3/image-comparison?branch=master)](https://bettercodehub.com/)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/romankh3/image-comparison/pulls)

* [About](#about)
Expand Down Expand Up @@ -119,19 +118,15 @@ To save result image, can be used two ways:
```

## Demo

Demo shows how `image-comparison` works.

### Expected Image

![expected](https://user-images.githubusercontent.com/16310793/28955567-52edeabe-78f0-11e7-8bb2-d435c8df23ff.png)

### Actual Image

![actual](https://user-images.githubusercontent.com/16310793/28955566-52ead892-78f0-11e7-993c-847350da0bf8.png)

### Result

![result](https://user-images.githubusercontent.com/16310793/28955568-52f23e02-78f0-11e7-92c5-07602b6a0887.png)

## Contributing
Expand Down
12 changes: 8 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,23 @@
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<mockito.version>2.26.0</mockito.version>
<junit.jupiter.api.version>5.5.2</junit.jupiter.api.version>
<maven.source.plugin.version>3.2.0</maven.source.plugin.version>
<maven.javadoc.plugin.version>3.1.1</maven.javadoc.plugin.version>
</properties>

<dependencies>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.26.0</version>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.5.2</version>
<version>${junit.jupiter.api.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -39,7 +43,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.0</version>
<version>${maven.source.plugin.version}</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -52,7 +56,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.1.1</version>
<version>${maven.javadoc.plugin.version}</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ private List<Rectangle> populateRectangles() {
* false - otherwise.
*/
private boolean isAllowedPercentOfDifferentPixels(long countOfDifferentPixels) {
long totalPixelCount = matrix.length * matrix[0].length;
long totalPixelCount = ((long) matrix.length) * ((long) matrix[0].length);
double actualPercentOfDifferentPixels = ((double) countOfDifferentPixels / (double) totalPixelCount) * 100;
return actualPercentOfDifferentPixels <= allowingPercentOfDifferentPixels;
}
Expand Down Expand Up @@ -681,10 +681,7 @@ public double getAllowingPercentOfDifferentPixels() {
public ImageComparison setAllowingPercentOfDifferentPixels(double allowingPercentOfDifferentPixels) {
if (0.0 <= allowingPercentOfDifferentPixels && allowingPercentOfDifferentPixels <= 100) {
this.allowingPercentOfDifferentPixels = allowingPercentOfDifferentPixels;
} else {
//todo add warning here
}

return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public final class ImageComparisonUtil {
* @param image the provided image.
* @return copy of the provided image.
*/
static BufferedImage deepCopy(BufferedImage image) {
public static BufferedImage deepCopy(BufferedImage image) {
ColorModel cm = image.getColorModel();
boolean isAlphaPremultiplied = cm.isAlphaPremultiplied();
WritableRaster raster = image.copyData(image.getRaster().createCompatibleWritableRaster());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ public boolean contains(Point point) {
return excluded.stream().anyMatch(rectangle -> rectangle.containsPoint(point));
}

/**
* Getter for excluded rectangles.
*
* @return the collection of the {@link Rectangle} objects.
*/
public List<Rectangle> getExcluded() {
return excluded;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public Rectangle merge(Rectangle that) {
}

/**
* Check is that rectangle overlapp this.
* Check is that rectangle overlap this.
*
* @param that {@link Rectangle} which checks with this.
* @return true if this over lapp that, false otherwise.
Expand All @@ -113,7 +113,7 @@ public void setDefaultValues() {
}

/**
* Make zero rectagle.
* Make zero rectangle.
*/
public void makeZeroRectangle() {
this.minPoint = new Point();
Expand Down Expand Up @@ -150,7 +150,7 @@ public int getHeight() {
}

/**
* Check in the provided {@link Point} contains in the {@link Rectangle}.
* Check if the provided {@link Point} contains in the {@link Rectangle}.
*
* @param point provided {@link Point}.
* @return {@code true} if provided {@link Point} contains, {@code false} - otherwise.
Expand Down