-
Notifications
You must be signed in to change notification settings - Fork 49
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
Newfeature/layout comparator with treshold #293
Merged
Merged
Changes from 12 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
2be75f9
created threshold, moved logic from image comparision result to layou…
plutasnyy 0843464
created tests for threshold
plutasnyy 6c78eb6
created status conditionally passed in frontend
plutasnyy 6831e14
created documentation for threshold parameters
plutasnyy b5129aa
updated changelog
plutasnyy 87a4f61
Merge branch 'master' into newfeature/layout_comparator_with_treshold
plutasnyy 4124737
updated documentation
plutasnyy 115cac8
Update SuiteReportLayoutCase.md
plutasnyy cd2da98
added sum of passed and conditionally passed in side panel
plutasnyy 5679cd5
Merge branch 'newfeature/layout_comparator_with_treshold' of https://…
plutasnyy 47acb27
updated photo
plutasnyy 8bd8915
removed unused incrementation
plutasnyy 0294312
updated tests
plutasnyy e211d4b
merge
plutasnyy f2dbc05
resolved conflicts
plutasnyy 7c8977d
merge
plutasnyy b89582b
updated gulp
plutasnyy 0a52b2a
updated gulp and bobcat
plutasnyy 11fbb76
updated doc
plutasnyy 9d88d41
removed wrong margin
plutasnyy e2b6148
add information about pixel difference in raport
plutasnyy e8666d4
Merge branch 'master' into newfeature/layout_comparator_with_treshold
tkaik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,7 @@ public enum Status { | |
FAILED, | ||
WARNING, | ||
REBASED, | ||
PROCESSING_ERROR | ||
PROCESSING_ERROR, | ||
CONDITIONALLY_PASSED, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
143 changes: 143 additions & 0 deletions
143
...s/src/test/java/com/cognifide/aet/job/common/comparators/layout/LayoutComparatorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
/** | ||
* AET | ||
* | ||
* Copyright (C) 2013 Cognifide Limited | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
package com.cognifide.aet.job.common.comparators.layout; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.is; | ||
import static org.mockito.Mockito.when; | ||
|
||
import com.cognifide.aet.job.api.comparator.ComparatorProperties; | ||
import com.cognifide.aet.job.common.comparators.layout.utils.ImageComparisonResult; | ||
import com.cognifide.aet.vs.ArtifactsDAO; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.mockito.Mock; | ||
import org.mockito.runners.MockitoJUnitRunner; | ||
|
||
@RunWith(MockitoJUnitRunner.class) | ||
public class LayoutComparatorTest { | ||
|
||
@Mock | ||
private ComparatorProperties comparatorProperties; | ||
|
||
@Mock | ||
private ArtifactsDAO artifactsDAO; | ||
|
||
@Mock | ||
private ImageComparisonResult imageComparisonResult; | ||
|
||
private LayoutComparator layoutComparator; | ||
|
||
@Before | ||
public void setUp() { | ||
//given | ||
this.layoutComparator = new LayoutComparator(this.comparatorProperties, this.artifactsDAO); | ||
} | ||
|
||
@Test | ||
public void hasMaskThresholdWithAcceptableDifference_withoutThreshold_expectFalse() { | ||
//when | ||
when(imageComparisonResult.getPercentagePixelDifference()).thenReturn(12.567); | ||
when(imageComparisonResult.getPixelDifferenceCount()).thenReturn(300); | ||
|
||
//then | ||
assertThat( | ||
this.layoutComparator.hasMaskThresholdWithAcceptableDifference(imageComparisonResult), | ||
is(false)); | ||
} | ||
|
||
@Test | ||
public void hasMaskThresholdWithAcceptableDifference_withThreshold_expectFalse() { | ||
//when | ||
when(imageComparisonResult.getPercentagePixelDifference()).thenReturn(12.567); | ||
when(imageComparisonResult.getPixelDifferenceCount()).thenReturn(300); | ||
|
||
this.layoutComparator.setPixelThreshold(299); | ||
this.layoutComparator.setPercentageThreshold(null); | ||
|
||
//then | ||
assertThat(this.layoutComparator.hasMaskThresholdWithAcceptableDifference(imageComparisonResult), | ||
is(false)); | ||
|
||
//when | ||
this.layoutComparator.setPixelThreshold(null); | ||
this.layoutComparator.setPercentageThreshold(12.566); | ||
|
||
//then | ||
assertThat(this.layoutComparator.hasMaskThresholdWithAcceptableDifference(imageComparisonResult), | ||
is(false)); | ||
} | ||
|
||
@Test | ||
public void hasMaskThresholdWithAcceptableDifference_withThreshold_expectTrue() { | ||
//when | ||
when(imageComparisonResult.getPercentagePixelDifference()).thenReturn(12.567); | ||
when(imageComparisonResult.getPixelDifferenceCount()).thenReturn(300); | ||
|
||
this.layoutComparator.setPixelThreshold(300); | ||
this.layoutComparator.setPercentageThreshold(null); | ||
|
||
//then | ||
assertThat(this.layoutComparator.hasMaskThresholdWithAcceptableDifference(imageComparisonResult), | ||
is(true)); | ||
|
||
//when | ||
this.layoutComparator.setPixelThreshold(null); | ||
this.layoutComparator.setPercentageThreshold(12.567); | ||
|
||
//then | ||
assertThat(this.layoutComparator.hasMaskThresholdWithAcceptableDifference(imageComparisonResult), | ||
is(true)); | ||
} | ||
|
||
@Test | ||
public void hasMaskThresholdWithAcceptableDifference_withBothThreshold_expectFalse() { | ||
//when | ||
when(imageComparisonResult.getPercentagePixelDifference()).thenReturn(12.567); | ||
when(imageComparisonResult.getPixelDifferenceCount()).thenReturn(300); | ||
|
||
this.layoutComparator.setPixelThreshold(299); | ||
this.layoutComparator.setPercentageThreshold(30.0); | ||
|
||
//then | ||
assertThat(this.layoutComparator.hasMaskThresholdWithAcceptableDifference(imageComparisonResult), | ||
is(false)); | ||
|
||
//when | ||
this.layoutComparator.setPixelThreshold(301); | ||
this.layoutComparator.setPercentageThreshold(12.566); | ||
|
||
//then | ||
assertThat(this.layoutComparator.hasMaskThresholdWithAcceptableDifference(imageComparisonResult), | ||
is(false)); | ||
} | ||
|
||
@Test | ||
public void hasMaskThresholdWithAcceptableDifference_withBothThreshold_expectTrue() { | ||
//when | ||
when(imageComparisonResult.getPercentagePixelDifference()).thenReturn(12.567); | ||
when(imageComparisonResult.getPixelDifferenceCount()).thenReturn(300); | ||
|
||
this.layoutComparator.setPixelThreshold(300); | ||
this.layoutComparator.setPercentageThreshold(12.567); | ||
|
||
//then | ||
assertThat(this.layoutComparator.hasMaskThresholdWithAcceptableDifference(imageComparisonResult), | ||
is(true)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is something wrong with the formatting, maybe put extra blank line between the table and sentence in line
17
.