/** * * @return The (top,left) position of the current region. */ public RectangleSize getSize() { return new RectangleSize(width, height); }
public RenderBrowserInfo(int width, int height, RenderingConfiguration.BrowserType browserType, EmulationInfo emulationInfo, String baselineEnvName) { this.baselineEnvName = baselineEnvName; this.viewportSize = new RectangleSize(width, height); this.browserType = browserType; this.emulationInfo = emulationInfo; }
/** * @return The size of the region. */ public RectangleSize getSize() { return new RectangleSize(width, height); }
public RenderBrowserInfo(int width, int height, RenderingConfiguration.BrowserType browserType, String baselineEnvName) { this.baselineEnvName = baselineEnvName; this.viewportSize = new RectangleSize(width, height); this.browserType = browserType; }
/** * @return The size of the region. */ public RectangleSize getSize() { return new RectangleSize(width, height); }
/** * Get a scaled version of the current size. * * @param scaleRatio The ratio by which to scale. * @return A scaled version of the current size. */ public RectangleSize scale(double scaleRatio) { return new RectangleSize((int) Math.ceil(width * scaleRatio), (int) Math.ceil(height * scaleRatio)); }
/** * Get a scaled version of the current size. * * @param scaleRatio The ratio by which to scale. * @return A scaled version of the current size. */ public RectangleSize scale(double scaleRatio) { return new RectangleSize((int) Math.ceil(width * scaleRatio), (int) Math.ceil(height * scaleRatio)); }
/** * @param image The screenshot image. * @param location The top/left coordinates of the screenshot in context * relative coordinates type. */ public EyesImagesScreenshot(BufferedImage image, Location location) { super(image); ArgumentGuard.notNull(location, "location"); this.bounds = new Region(location, new RectangleSize(image.getWidth(), image.getHeight())); }
public RectangleSize getClientSize() { Object retVal = eyesDriver.executeScript(JS_GET_CLIENT_SIZE, this); @SuppressWarnings("unchecked") List<Float> esAsList = (List<Float>) retVal; return new RectangleSize( (int) Math.round(esAsList.get(0).doubleValue()), (int) Math.round(esAsList.get(1).doubleValue())); }
/** * @param executor The executor to use. * @return The viewport size. */ public static RectangleSize getViewportSize( JavascriptExecutor executor) { //noinspection unchecked List<Long> vsAsList = (List<Long>) executor.executeScript(JS_GET_VIEWPORT_SIZE); return new RectangleSize(vsAsList.get(0).intValue(), vsAsList.get(1).intValue()); }
/** * Ctor. * * @param image The screenshot image. * @param location The top/left coordinates of the screenshot in context * relative coordinates type. */ public EyesImagesScreenshot(Logger logger, BufferedImage image, Location location) { super(logger, image); ArgumentGuard.notNull(location, "location"); this.bounds = new Region(location, new RectangleSize(image.getWidth(), image.getHeight())); }
public SizeAndBorders(int width, int height, int left, int top, int right, int bottom) { size = new RectangleSize(width, height); borders = new Borders(left, top, right, bottom); }
/** * Parses a string into a {link RectangleSize} instance. * @param size A string representing width and height separated by "x". * @return An instance representing the input size. */ public static RectangleSize parse(String size) { ArgumentGuard.notNull(size, "size"); String[] parts = size.split("x"); if (parts.length != 2) { throw new IllegalArgumentException( "Not a valid size string: " + size); } return new RectangleSize( Integer.parseInt(parts[0]), Integer.parseInt(parts[1])); }
/** * Parses a string into a {link RectangleSize} instance. * @param size A string representing width and height separated by "x". * @return An instance representing the input size. */ public static RectangleSize parse(String size) { ArgumentGuard.notNull(size, "size"); String[] parts = size.split("x"); if (parts.length != 2) { throw new IllegalArgumentException( "Not a valid size string: " + size); } return new RectangleSize( Integer.parseInt(parts[0]), Integer.parseInt(parts[1])); }
@SuppressWarnings("unchecked") public static RectangleSize getEntireElementSize(Logger logger, IEyesJsExecutor executor, WebElement element) { RectangleSize result; try { //noinspection unchecked Object retVal = executor.executeScript(JS_GET_ENTIRE_PAGE_SIZE, element); List<Long> esAsList = (List<Long>) retVal; result = new RectangleSize(esAsList.get(0).intValue(), esAsList.get(1).intValue()); } catch (WebDriverException e) { GeneralUtils.logExceptionStackTrace(logger, e); throw new EyesDriverOperationException( "Failed to extract entire size!"); } return result; }
public boolean check(String name, ICheckSettings checkSettings) { IImagesCheckTarget imagesCheckTarget = (checkSettings instanceof IImagesCheckTarget) ? (IImagesCheckTarget) checkSettings : null; BufferedImage image = imagesCheckTarget.getImage(); if (viewportSizeHandler.get() == null) { setViewportSize(new RectangleSize(image.getWidth(), image.getHeight())); } return checkImage_(NullRegionProvider.INSTANCE, image, name, false, checkSettings); }
@Override public void setViewportSize(RectangleSize size) { ArgumentGuard.notNull(size, "size"); this.viewportSize = new RectangleSize(size.getWidth(), size.getHeight()); }
/** * @return The entire size of the container which the position is relative * to. */ public RectangleSize getEntireSize() { logger.verbose("enter"); RectangleSize result = new RectangleSize(element.getScrollWidth(), element.getScrollHeight()); logger.verbose("Entire size: " + result); return result; }
/** * Set the viewport size. * @param size The required viewport size. */ @Override public void setViewportSize(RectangleSize size) { ArgumentGuard.notNull(size, "size"); viewportSizeHandler.set(new RectangleSize(size.getWidth(), size.getHeight())); }
@SuppressWarnings("UnusedReturnValue") public static boolean setBrowserSizeByViewportSize(Logger logger, WebDriver driver, RectangleSize actualViewportSize, RectangleSize requiredViewportSize) { Dimension browserSize = driver.manage().window().getSize(); logger.verbose("Current browser size: " + browserSize); RectangleSize requiredBrowserSize = new RectangleSize( browserSize.width + (requiredViewportSize.getWidth() - actualViewportSize.getWidth()), browserSize.height + (requiredViewportSize.getHeight() - actualViewportSize.getHeight())); return setBrowserSize(logger, driver, requiredBrowserSize); }