@SuppressWarnings("UnusedDeclaration") /** * See {@link #checkWindowBase(RegionProvider, String, boolean, int)}. * {@code retryTimeout} defaults to {@code USE_DEFAULT_TIMEOUT}. * * @param regionProvider Returns the region to check or the empty * rectangle to check the entire window. * @param tag An optional tag to be associated with the snapshot. * @param ignoreMismatch Whether to ignore this check if a mismatch is * found. * @return The result of matching the output with the expected output. */ protected MatchResult checkWindowBase(RegionProvider regionProvider, String tag, boolean ignoreMismatch) { return checkWindowBase(regionProvider, tag, ignoreMismatch, USE_DEFAULT_TIMEOUT); }
@SuppressWarnings("UnusedDeclaration") /** * See {@link #checkWindowBase(RegionProvider, String, boolean, int)}. * {@code retryTimeout} defaults to {@code USE_DEFAULT_TIMEOUT}. * * @param regionProvider Returns the region to check or the empty * rectangle to check the entire window. * @param tag An optional tag to be associated with the snapshot. * @param ignoreMismatch Whether to ignore this check if a mismatch is * found. * @return The result of matching the output with the expected output. */ protected MatchResult checkWindowBase(RegionProvider regionProvider, String tag, boolean ignoreMismatch) { return checkWindowBase(regionProvider, tag, ignoreMismatch, USE_DEFAULT_TIMEOUT); }
@SuppressWarnings("UnusedDeclaration") /** * See {@link #checkWindowBase(RegionProvider, String, boolean, int)}. * {@code retryTimeout} defaults to {@code USE_DEFAULT_TIMEOUT}. * * @param regionProvider Returns the region to check or the empty * rectangle to check the entire window. * @param tag An optional tag to be associated with the snapshot. * @param ignoreMismatch Whether to ignore this check if a mismatch is * found. * @return The result of matching the output with the expected output. */ protected MatchResult checkWindowBase(RegionProvider regionProvider, String tag, boolean ignoreMismatch) { return checkWindowBase(regionProvider, tag, ignoreMismatch, USE_DEFAULT_TIMEOUT); }
/** * Takes a snapshot of the application under test and matches a specific region within it with the expected output. * @param region A non empty region representing the screen region to check. * @param matchTimeout The amount of time to retry matching. (Milliseconds) * @param tag An optional tag to be associated with the snapshot. * @throws TestFailedException Thrown if a mismatch is detected and immediate failure reports are enabled. */ public void checkRegion(final Region region, int matchTimeout, String tag) { if (getIsDisabled()) { logger.log(String.format("checkRegion([%s], %d, '%s'): Ignored", region, matchTimeout, tag)); return; } ArgumentGuard.notNull(region, "region"); logger.verbose(String.format("checkRegion([%s], %d, '%s')", region, matchTimeout, tag)); super.checkWindowBase( new RegionProvider() { public Region getRegion() { return region; } }, tag, false, matchTimeout ); }
/** * Verifies the current frame. * @param matchTimeout The amount of time to retry matching. (Milliseconds) * @param tag An optional tag to be associated with the snapshot. */ protected void checkCurrentFrame(int matchTimeout, String tag) { try { logger.verbose(String.format("CheckCurrentFrame(%d, '%s')", matchTimeout, tag)); checkFrameOrElement = true; logger.verbose("Getting screenshot as base64.."); String screenshot64 = driver.getScreenshotAs(OutputType.BASE64); logger.verbose("Done! Creating image object..."); BufferedImage screenshotImage = ImageUtils.imageFromBase64(screenshot64); // FIXME - Scaling should be handled in a single place instead ScaleProvider scaleProvider = updateScalingParams().getScaleProvider(screenshotImage.getWidth()); screenshotImage = ImageUtils.scaleImage(screenshotImage, scaleProvider); logger.verbose("Done! Building required object..."); final EyesWebDriverScreenshot screenshot = new EyesWebDriverScreenshot(logger, driver, screenshotImage); logger.verbose("Done!"); logger.verbose("replacing regionToCheck"); setRegionToCheck(screenshot.getFrameWindow()); super.checkWindowBase(NullRegionProvider.INSTANCE, tag, false, matchTimeout); } finally { checkFrameOrElement = false; regionToCheck = null; } }