Search in sources :

Example 16 with ImageDetector

use of com.seleniumtests.util.imaging.ImageDetector in project seleniumRobot by bhecquet.

the class TestImageDetector method searchPicturesByTemplateNoMatching.

@Test(groups = { "ut" }, expectedExceptions = ImageSearchException.class)
public void searchPicturesByTemplateNoMatching() throws IOException {
    ImageDetector detector = new ImageDetector(createFileFromResource("tu/images/p9.png"), createFileFromResource("tu/images/creditMutuelLogo.png"), 0.06);
    detector.detectExactZoneWithScale();
    Assert.assertEquals(detector.getSizeRatio(), 1.0, 0.05);
}
Also used : ImageDetector(com.seleniumtests.util.imaging.ImageDetector) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 17 with ImageDetector

use of com.seleniumtests.util.imaging.ImageDetector in project seleniumRobot by bhecquet.

the class TestImageDetector method searchPictureWithoutRotation.

/**
 * Search an image inside an other one, no rotation, no resizing
 * @throws IOException
 */
@Test(groups = { "ut" }, enabled = false)
public void searchPictureWithoutRotation() throws IOException {
    ImageDetector detector = new ImageDetector(createFileFromResource("tu/images/RIB.png"), createFileFromResource("tu/images/creditMutuelLogo.png"));
    detector.detectCorrespondingZone();
    Assert.assertEquals(detector.getRotationAngle(), 0);
    Assert.assertEquals(detector.getDetectedRectangle(), new Rectangle(604, 147, 76, 492));
}
Also used : ImageDetector(com.seleniumtests.util.imaging.ImageDetector) Rectangle(org.openqa.selenium.Rectangle) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 18 with ImageDetector

use of com.seleniumtests.util.imaging.ImageDetector in project seleniumRobot by bhecquet.

the class TestImageDetector method searchExactPictureNoDetection.

/**
 * Search an image with template matching. Here, image should not be found
 * @throws IOException
 */
@Test(groups = { "ut" }, expectedExceptions = ImageSearchException.class)
public void searchExactPictureNoDetection() throws IOException {
    ImageDetector detector = new ImageDetector(createFileFromResource("tu/images/RIB.png"), createFileFromResource("tu/images/vosAlertes.png"));
    detector.detectExactZoneWithScale();
}
Also used : ImageDetector(com.seleniumtests.util.imaging.ImageDetector) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 19 with ImageDetector

use of com.seleniumtests.util.imaging.ImageDetector in project seleniumRobot by bhecquet.

the class TestImageDetector method searchPicturesByTemplate4.

// highly detailed
@Test(groups = { "ut" })
public void searchPicturesByTemplate4() throws IOException {
    ImageDetector detector = new ImageDetector(createFileFromResource("tu/images/RIB.png"), createFileFromResource("tu/images/creditMutuelLogo.png"), 0.06);
    detector.detectExactZoneWithScale();
    Assert.assertEquals(detector.getDetectedRectangle(), new Rectangle(604, 147, 77, 493));
    Assert.assertEquals(detector.getSizeRatio(), 1.0, 0.05);
}
Also used : ImageDetector(com.seleniumtests.util.imaging.ImageDetector) Rectangle(org.openqa.selenium.Rectangle) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 20 with ImageDetector

use of com.seleniumtests.util.imaging.ImageDetector in project seleniumRobot by bhecquet.

the class TestImageDetector method searchPicturesByTemplate3.

// small object
@Test(groups = { "ut" })
public void searchPicturesByTemplate3() throws IOException {
    ImageDetector detector = new ImageDetector(createFileFromResource("tu/images/infolidays.png"), createFileFromResource("tu/images/bouton_enregistrer3.png"), 0.06);
    detector.detectExactZoneWithScale();
    Assert.assertEquals(detector.getDetectedRectangle(), new Rectangle(677, 1595, 220, 155));
    Assert.assertEquals(detector.getSizeRatio(), 1.2, 0.05);
}
Also used : ImageDetector(com.seleniumtests.util.imaging.ImageDetector) Rectangle(org.openqa.selenium.Rectangle) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Aggregations

ImageDetector (com.seleniumtests.util.imaging.ImageDetector)20 Test (org.testng.annotations.Test)18 GenericTest (com.seleniumtests.GenericTest)17 Rectangle (org.openqa.selenium.Rectangle)13 File (java.io.File)3 BufferedImage (java.awt.image.BufferedImage)2 IOException (java.io.IOException)2 ScreenshotException (org.openqa.selenium.remote.ScreenshotException)2 ScreenshotUtil (com.seleniumtests.driver.screenshots.ScreenshotUtil)1 GenericMultiBrowserTest (com.seleniumtests.it.driver.support.GenericMultiBrowserTest)1 Rectangle (java.awt.Rectangle)1 Dimension (org.openqa.selenium.Dimension)1