Skip to content

Commit

Permalink
#212: updated metrics in GitHub
Browse files Browse the repository at this point in the history
#212: updated Javadocs
  • Loading branch information
romankh3 committed Feb 10, 2022
1 parent 9936515 commit 1569643
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 31 deletions.
46 changes: 46 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Java Gradle CircleCI 2.0 configuration file
# See: https://circleci.com/docs/2.0/language-java/
version: 2

# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
jobs:
build:
# Specify the execution environment. You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub.
# See: https://circleci.com/docs/2.0/configuration-reference/#docker-machine-macos-windows-executor
docker:
# specify the version you desire here
- image: circleci/openjdk:8-jdk

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4

working_directory: ~/repo

environment:
# Customize the JVM maximum heap limit
JVM_OPTS: -Xmx3200m
TERM: dumb
# Add steps to the job
# See: https://circleci.com/docs/2.0/configuration-reference/#steps
steps:
- checkout

# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "build.gradle" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run: gradle dependencies

- save_cache:
paths:
- ~/.gradle
key: v1-dependencies-{{ checksum "build.gradle" }}

# run tests!
- run: gradle test jacocoTestReport coveralls
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
[![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/)
[![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/)
[![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 +119,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

0 comments on commit 1569643

Please sign in to comment.