Skip to content

Demo for Image Contrast

leonar edited this page Apr 18, 2013 · 5 revisions

This demo is to intriduce how to use image contrast for checking ui style.

Steps

Create demo such as:

package com.netease.demo;

import com.netease.checkuistyle.ImageProcessing;
import com.netease.dagger.BrowserEmulator;

public class CheckPageStyle {
    public static void main(String[] args) throws Exception {
        String githubUrl = "https://github.com/";
        String checkPoint = "topbar";
        String folderName = "github";	
        BrowserEmulator be = new BrowserEmulator();
        be.open(githubUrl);//change url to https://github.com/login for contrast, remember change ScreenShotType to 2 in type.properties
        ImageProcessing.process(be.getBrowserCore(), folderName, checkPoint, "//div[@class='container clearfix']");
        be.quit();
    }
}
  1. Set the api in where we want to check, and give the parameters.
  2. If this is the first time to run, we should set sample.Make sure ScreenShotType = 1 in type.properties for set sample. And we could find the sample image called "topbar_sample" in the path "res/samples/".
  3. After setting the sample, we could run to contrast.Make sure ScreenShotType = 2 in type.properties for contrast
  4. We could find the contrast image called "topbar" in the path "images/github".If we want to see some difference between this two images, we could change the url(for different topbar).Then the different image would be shown in the path "images/github".
  5. Make sure the screen resolution is constant when setting sample and make contrast.

Clone this wiki locally