-
Notifications
You must be signed in to change notification settings - Fork 0
/
ImageComparatorTest.scala
41 lines (31 loc) · 1.35 KB
/
ImageComparatorTest.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package net.cyphoria.weddingapp.imagecompare
import org.specs2.mutable.Specification
import org.springframework.core.io.ClassPathResource
import net.cyphoria.weddingapp.imagecompare.specs2.ImageCompareMatchers
import java.awt.image.BufferedImage
/**
*
* @author Stefan Penndorf <stefan@cyphoria.net>
*/
class ImageComparatorTest extends Specification with ImageCompareMatchers {
val bild1: BufferedImage = new ClassPathResource("images/mara_und_lukas.jpg")
val bild1_mit_kleinem_Fehler: BufferedImage = new ClassPathResource("images/mara_und_lukas_mit_kleinem_Fehler.jpg")
val bild2: BufferedImage = new ClassPathResource("images/blumen.png")
"ImageComparator" should {
"das identische Bild als identisch erkennen" in {
bild1 must beSameImageAs (bild1)
}
"komplett unterschiedliche Bilder als unterschiedlich erkennen" in {
bild1 must not (beSameImageAs (bild2))
}
"komplett unterschiedliche Bilder als unterschiedlich erkennen (Symmetrie)" in {
bild2 must not (beSameImageAs (bild1))
}
"kaum unterschiedliche Bilder als unterschiedlich erkennen" in {
bild1 must not (beSameImageAs (bild1_mit_kleinem_Fehler))
}
"kaum unterschiedliche Bilder als unterschiedlich erkennen (Symmetrie)" in {
bild1_mit_kleinem_Fehler must not (beSameImageAs (bild1))
}
}
}