Search in sources :

Example 1 with ImageOverviewController

use of org.mycore.iview.tests.controller.ImageOverviewController in project mycore by MyCoRe-Org.

the class ImageOverviewIT method testImageOverview.

@Test
public /**
 * Checks if the image overview works
 * @throws IOException
 * @throws InterruptedException
 */
void testImageOverview() throws IOException, InterruptedException {
    this.setTestName(getClassname() + "-testImageOverview");
    this.getDriver();
    this.getAppController().openViewer(this.getDriver(), getTestDerivate());
    ImageViewerController controller = this.getViewerController();
    ToolBarController tbController = controller.getToolBarController();
    ImageOverviewController ioController = controller.getImageOverviewController();
    tbController.pressButton(ToolBarController.BUTTON_ID_ZOOM_IN);
    tbController.pressButton(ToolBarController.BUTTON_ID_SIDEBAR_CONTROLL);
    tbController.clickElementById(ImageOverviewController.IMAGE_OVERVIEW_SELECTOR);
    Thread.sleep(500);
    int greenPixelCount = clickImgAndCountColor(ioController, getGreenLabel(), Color.GREEN);
    int redPixelCount = clickImgAndCountColor(ioController, getRedLabel(), Color.RED);
    ioController.scrollSidbar(getDriver(), 250);
    int bluePixelCount = clickImgAndCountColor(ioController, getBlueLabel(), Color.BLUE);
    ioController.scrollSidbar(getDriver(), 250);
    int redPixelCountRGB = clickImgAndCountColor(ioController, getRgbLabel(), Color.RED);
    int greenPixelCountRGB = clickImgAndCountColor(ioController, getRgbLabel(), Color.GREEN);
    int bluePixelCountRGB = clickImgAndCountColor(ioController, getRgbLabel(), Color.BLUE);
    String messagePattern = "There should be less red pixels in the rgb screenshot than in the red ({0} > {1})";
    assertLess(redPixelCount, redPixelCountRGB, messagePattern);
    messagePattern = "There should be less green pixels in the rgb screenshot than in the green ({0} > {1})";
    assertLess(greenPixelCount, greenPixelCountRGB, messagePattern);
    messagePattern = "There should be less blue pixels in the rgb screenshot than in the blue ({0} > {1})";
    assertLess(bluePixelCount, bluePixelCountRGB, messagePattern);
}
Also used : ImageOverviewController(org.mycore.iview.tests.controller.ImageOverviewController) ImageViewerController(org.mycore.iview.tests.controller.ImageViewerController) ToolBarController(org.mycore.iview.tests.controller.ToolBarController) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 ImageOverviewController (org.mycore.iview.tests.controller.ImageOverviewController)1 ImageViewerController (org.mycore.iview.tests.controller.ImageViewerController)1 ToolBarController (org.mycore.iview.tests.controller.ToolBarController)1