forked from chenkan/Dagger
-
Notifications
You must be signed in to change notification settings - Fork 1
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.
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();
}
}- Set the api in where we want to check, and give the parameters.
- 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/".
- After setting the sample, we could run to contrast.Make sure ScreenShotType = 2 in type.properties for contrast
- 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".
- Make sure the screen resolution is constant when setting sample and make contrast.