Package net.thucydides.core.images

Examples of net.thucydides.core.images.SimpleImageInfo


    public void should_resize_image_to_a_specified_height() throws IOException {

        Screenshot screenshot = new Screenshot("google_page_1.png", "Google", 1200);
        Screenshot expandedScreenshot = ScreenshotFormatter.forScreenshot(screenshot).inDirectory(screenshotDirectory).expandToHeight(1500);

        int resultingHeight = new SimpleImageInfo(new File(screenshotDirectory, expandedScreenshot.getFilename())).getHeight();
        assertThat(resultingHeight, is(1500));
        assertThat(expandedScreenshot.getWidth(), is(1200));
    }
View Full Code Here


    public void should_limit_image_resize_to_the_maximum_supported_height() throws IOException {

        Screenshot screenshot = new Screenshot("google_page_1.png", "Google", 1200);
        Screenshot expandedScreenshot = ScreenshotFormatter.forScreenshot(screenshot).inDirectory(screenshotDirectory).expandToHeight(30000);

        int resultingHeight = new SimpleImageInfo(new File(screenshotDirectory, expandedScreenshot.getFilename())).getHeight();
        assertThat(resultingHeight, is(4000));
        assertThat(expandedScreenshot.getWidth(), is(1200));
    }
View Full Code Here

    public void should_not_resize_image_that_is_larger_than_the_specified_height() throws IOException {

        Screenshot screenshot = new Screenshot("amazon.png", "Amazon", 1495);
        Screenshot expandedScreenshot = ScreenshotFormatter.forScreenshot(screenshot).inDirectory(screenshotDirectory).expandToHeight(2000);

        int resultingHeight = new SimpleImageInfo(new File(screenshotDirectory, expandedScreenshot.getFilename())).getHeight();
        assertThat(resultingHeight, is(2236));
        assertThat(expandedScreenshot.getWidth(), is(1495));
    }
View Full Code Here

    public void should_not_resize_image_if_target_height_is_larger_than_the_maximum_height() throws IOException {

        Screenshot screenshot = new Screenshot("wikipedia.png", "Wikipedia", 805);
        Screenshot expandedScreenshot = ScreenshotFormatter.forScreenshot(screenshot).inDirectory(screenshotDirectory).expandToHeight(4000);

        int resultingHeight = new SimpleImageInfo(new File(screenshotDirectory, expandedScreenshot.getFilename())).getHeight();
        assertThat(resultingHeight, is(29107));
        assertThat(expandedScreenshot.getWidth(), is(805));
    }
View Full Code Here

        };
    }

    private int widthOf(final File screenshot) {
        try {
            return new SimpleImageInfo(screenshot).getWidth();
        } catch (IOException e) {
            return ThucydidesSystemProperty.DEFAULT_WIDTH;
        }
    }
View Full Code Here

TOP

Related Classes of net.thucydides.core.images.SimpleImageInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.