-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
66 additions
and
0 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
webcam-capture/src/test/java/com/github/sarxos/webcam/util/jh/JHBlurFilterTest.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,66 @@ | ||
package com.github.sarxos.webcam.util.jh; | ||
|
||
import java.awt.image.BufferedImage; | ||
|
||
import org.assertj.core.api.Assertions; | ||
import org.junit.Test; | ||
|
||
|
||
public class JHBlurFilterTest { | ||
|
||
@Test | ||
public void test_filterNonPremultiplied() { | ||
|
||
final JHBlurFilter filter = new JHBlurFilter(); | ||
filter.setPremultiplyAlpha(false); | ||
|
||
final BufferedImage bi1 = new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB); | ||
final BufferedImage bi2 = filter.filter(bi1, null); | ||
|
||
Assertions | ||
.assertThat(bi1.getWidth()) | ||
.isEqualTo(bi2.getWidth()); | ||
Assertions | ||
.assertThat(bi1.getHeight()) | ||
.isEqualTo(bi2.getHeight()); | ||
Assertions | ||
.assertThat(bi1.getType()) | ||
.isEqualTo(bi2.getType()); | ||
} | ||
|
||
@Test | ||
public void test_filterPremultiplied() { | ||
|
||
final JHBlurFilter filter = new JHBlurFilter(); | ||
filter.setPremultiplyAlpha(true); | ||
|
||
final BufferedImage bi1 = new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB); | ||
final BufferedImage bi2 = filter.filter(bi1, null); | ||
|
||
Assertions | ||
.assertThat(bi1.getWidth()) | ||
.isEqualTo(bi2.getWidth()); | ||
Assertions | ||
.assertThat(bi1.getHeight()) | ||
.isEqualTo(bi2.getHeight()); | ||
Assertions | ||
.assertThat(bi1.getType()) | ||
.isEqualTo(bi2.getType()); | ||
} | ||
|
||
@Test | ||
public void test_setGetPremultiplyAlpha() { | ||
|
||
final JHBlurFilter filter = new JHBlurFilter(); | ||
|
||
filter.setPremultiplyAlpha(true); | ||
Assertions | ||
.assertThat(filter.getPremultiplyAlpha()) | ||
.isTrue(); | ||
|
||
filter.setPremultiplyAlpha(false); | ||
Assertions | ||
.assertThat(filter.getPremultiplyAlpha()) | ||
.isFalse(); | ||
} | ||
} |