• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Region类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.sikuli.script.Region的典型用法代码示例。如果您正苦于以下问题:Java Region类的具体用法?Java Region怎么用?Java Region使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Region类属于org.sikuli.script包,在下文中一共展示了Region类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getMatchesList

import org.sikuli.script.Region; //导入依赖的package包/类
private List<Shape> getMatchesList() {
    List<Shape> rMatches = new ArrayList<>();
    try {
        Iterator<?> it = getMatches();
        if (it != null) {
            Region sRegion = Region.create(shapes.get(0).getBounds());
            while (it.hasNext()) {
                Object region = it.next();
                Shape rx = ((Region) region).getRect();
                if (sRegion != null && sRegion.getRect().contains(rx.getBounds())) {
                    rMatches.add(rx);
                }
            }
        }

    } catch (FindFailed | IOException | NullPointerException ex) {
        Logger.getLogger(PropertyEditor.class.getName()).log(Level.SEVERE, null, ex);
    }
    return rMatches;
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:21,代码来源:PropertyEditor.java


示例2: imgmouseUp

import org.sikuli.script.Region; //导入依赖的package包/类
/**
 * perform mouse up on the given image
 */
@Action(object = ObjectType.IMAGE, desc ="Perform  Mouse key Up  action on the image [<Object>]", input =InputType.YES)
public void imgmouseUp() {
    int button = parseToInt(Data, Button.LEFT);
    try {
        target = findTarget(imageObjectGroup, Flag.SET_OFFSET, Flag.MATCH_ONLY);
        if (target != null) {
            ((Region) target).mouseUp(button);
            Report.updateTestLog(Action, "Mouse Up action is done on " + ObjectName,
                    Status.DONE);
            return;

        }
        Report.updateTestLog(Action,
                ObjectName
                + (imageObjectGroup.isLeaf() ? ExceptionType.Empty_Group : ExceptionType.Not_Found_on_Screen),
                Status.FAIL);

    } catch (Exception ex) {
        Report.updateTestLog(Action,
                ex.getMessage(), Status.DEBUG);
        Logger.getLogger(Mouse.class.getName()).log(Level.SEVERE, null, ex);
    }

}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:28,代码来源:Mouse.java


示例3: getObjectAreas

import org.sikuli.script.Region; //导入依赖的package包/类
public List<String> getObjectAreas(Object target, String name) {
    List<Map<String, String>> objectList = new ArrayList<>();
    if (target instanceof Region) {
        Region region = (Region) target;
        Map<String, String> obMap = new HashMap<>();
        obMap.put("name", name);
        obMap.put("area", "[" + region.x + "," + region.y + "," + region.w + "," + region.h + "]");
        objectList.add(obMap);
    }
    try {
        if (!objectList.isEmpty()) {
            return Arrays.asList(new ObjectMapper().writeValueAsString(objectList));
        }
    } catch (JsonProcessingException ex) {
        Logger.getLogger(ImageCommand.class.getName()).log(Level.SEVERE, null, ex);
    }
    return null;
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:19,代码来源:ImageCommand.java


示例4: imgVerifyImage

import org.sikuli.script.Region; //导入依赖的package包/类
/**
 * verify the image present on SCREEN
 */
@Action(object = ObjectType.IMAGE, desc = "Verify if the image [<Data>] is present on the screen.")
public void imgVerifyImage() {

    try {
        target = findTarget(imageObjectGroup, Flag.REGION_ONLY, Flag.MATCH_ONLY);
        if (target != null) {
            ((Region) target).highlight(1);
            Report.updateTestLog(Action, "The Image " + ObjectName + " Exists on screen",
                    Status.PASS);
            return;
        }
        Report.updateTestLog(Action,
                ObjectName
                + (imageObjectGroup.isLeaf() ? ExceptionType.Empty_Group : ExceptionType.Not_Found_on_Screen),
                Status.FAIL);
    } catch (Exception ex) {
        Report.updateTestLog(Action, ex.getMessage(), Status.DEBUG);
        Logger.getLogger(CommonImageMethods.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:24,代码来源:CommonImageMethods.java


示例5: findMidiAutomatorInstallerRegion

import org.sikuli.script.Region; //导入依赖的package包/类
/**
 * Finds the region of the Midi Automator installer main Window
 * 
 * @return the found region
 * @throws FindFailed
 */
public static Region findMidiAutomatorInstallerRegion() throws FindFailed {

	try {
		setMinSimilarity(LOW_SIMILARITY);
		SikuliXAutomation.setSearchRegion(SCREEN);
		Region searchRegion = findMultipleStateRegion(MAX_TIMEOUT,
				"midi_automator_installer.png");
		setMinSimilarity(DEFAULT_SIMILARITY);
		searchRegion.y -= 41;
		searchRegion.h += 41;
		return searchRegion;
	} catch (FindFailed e) {
		System.err.println("findMidiAutomatorInstallerRegion() failed");
		throw e;
	}
}
 
开发者ID:aguelle,项目名称:MIDI-Automator,代码行数:23,代码来源:SikuliXGUIAutomations.java


示例6: findMidiAutomatorRegion

import org.sikuli.script.Region; //导入依赖的package包/类
/**
 * Finds the region of the Midi Automator main Window
 * 
 * @return the found region
 * @throws FindFailed
 */
public static Region findMidiAutomatorRegion() throws FindFailed {

	try {
		setMinSimilarity(LOW_SIMILARITY);
		SikuliXAutomation.setSearchRegion(SCREEN);
		Region searchRegion = findMultipleStateRegion(MAX_TIMEOUT,
				"midi_automator.png");
		setMinSimilarity(DEFAULT_SIMILARITY);
		searchRegion.y = searchRegion.y - 21;
		searchRegion.w = searchRegion.w + 500;
		searchRegion.h = searchRegion.h + 100;
		return searchRegion;
	} catch (FindFailed e) {
		System.err.println("findMidiAutomatorRegion() failed");
		throw e;
	}
}
 
开发者ID:aguelle,项目名称:MIDI-Automator,代码行数:24,代码来源:SikuliXGUIAutomations.java


示例7: checkIfFileOpened

import org.sikuli.script.Region; //导入依赖的package包/类
/**
 * Checks if the file opened correctly
 * 
 * @param states
 *            the different states of the region
 */
public void checkIfFileOpened(String... states) {

	Region match = null;

	try {

		// check if file opened
		SikuliXAutomation.setSearchRegion(SCREEN);
		match = findMultipleStateRegion(DEFAULT_TIMEOUT, states);

		// close editor
		match.click();
		closeFocusedProgram();

	} catch (FindFailed e) {
		Fail.fail("File did not open.", e);
	}

}
 
开发者ID:aguelle,项目名称:MIDI-Automator,代码行数:26,代码来源:SikuliXGUIAutomations.java


示例8: checkIfFileNotOpened

import org.sikuli.script.Region; //导入依赖的package包/类
/**
 * Checks if the file did not open.
 * 
 * @param states
 *            the different states of the region
 */
public void checkIfFileNotOpened(String... states) {

	Region match = null;

	try {

		// check if file opened
		SikuliXAutomation.setSearchRegion(SCREEN);
		match = findMultipleStateRegion(DEFAULT_TIMEOUT, states);

		// close editor
		match.click();
		closeFocusedProgram();
		Fail.fail("File did open.");

	} catch (FindFailed e) {

	}
}
 
开发者ID:aguelle,项目名称:MIDI-Automator,代码行数:26,代码来源:SikuliXGUIAutomations.java


示例9: findMultipleStateRegion

import org.sikuli.script.Region; //导入依赖的package包/类
/**
 * Finds a region that can have multiple states, i.e. active, inactive,
 * unfocused
 * 
 * @param timeout
 *            the timeout to search for every state
 * @param states
 *            the different states of the region
 * @return The found region
 * @throws FindFailed
 */
public static Region findMultipleStateRegion(double timeout,
		String... states) throws FindFailed {

	Region match;
	FindFailed findFailed = null;

	for (String state : states) {
		if (state != null) {
			try {
				match = searchRegion.wait(screenshotpath + state, timeout);
				return match;
			} catch (FindFailed e) {
				findFailed = e;
				System.out.println(state
						+ " not found. Trying next state...");
			}
		}
	}

	throw findFailed;
}
 
开发者ID:aguelle,项目名称:MIDI-Automator,代码行数:33,代码来源:SikuliXAutomation.java


示例10: display

import org.sikuli.script.Region; //导入依赖的package包/类
public void display(final float sec) {
    for (final Region box : boxes) {
        Thread th = new Thread("UI:CanvasHighlightBox") {
            @Override
            public void run() {
                box.highlight(sec);
            }
        };
        th.start();
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:12,代码来源:Canvas.java


示例11: imgmouseDown

import org.sikuli.script.Region; //导入依赖的package包/类
/**
 * perform mouse down on the given image
 */
@Action(object = ObjectType.IMAGE, 
		desc ="Perform  Mouse key Down action on the image [<Object>]", 
		input =InputType.YES)
public void imgmouseDown() {
    int button = parseToInt(Data, Button.LEFT);
    try {
        target = findTarget(imageObjectGroup, Flag.SET_OFFSET, Flag.MATCH_ONLY);
        if (target != null) {
            ((Region) target).mouseDown(button);
            Report.updateTestLog(Action, "Mouse Down action is done on " + ObjectName,
                    Status.DONE);
            return;

        }
        Report.updateTestLog(Action,
                ObjectName
                + (imageObjectGroup.isLeaf() ? ExceptionType.Empty_Group : ExceptionType.Not_Found_on_Screen),
                Status.FAIL);

    } catch (Exception ex) {
        Report.updateTestLog(Action,
                ex.getMessage(), Status.DEBUG);
        Logger.getLogger(Mouse.class.getName()).log(Level.SEVERE, null, ex);
    }

}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:30,代码来源:Mouse.java


示例12: getRegion

import org.sikuli.script.Region; //导入依赖的package包/类
Region getRegion(Region r, String where, Integer... size) {

        switch (where.toUpperCase()) {
            case "RIGHT":
                return r.right(size.length == 1 ? size[0] : r.w);
            case "LEFT":
                return r.left(size.length == 1 ? size[0] : r.w);
            case "ABOVE":
                return r.above(size.length == 1 ? size[0] : r.h);
            case "BELOW":
                return r.below(size.length == 1 ? size[0] : r.h);
            default:
                return r;
        }
    }
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:16,代码来源:ImageCommand.java


示例13: imgClearText

import org.sikuli.script.Region; //导入依赖的package包/类
/**
 * clear all text in the given image
 */
@Action(object = ObjectType.IMAGE,
        desc = "Clear the text present inside the [<Object>]"
)
public void imgClearText() {

    try {
        target = findTarget(imageObjectGroup, Flag.SET_OFFSET, Flag.MATCH_ONLY);
        if (target != null) {
            ((Region) target).click();

            robot.keyPress(getKeyEvent("Ctrl"));
            robot.keyPress(KeyEvent.VK_A);
            robot.keyRelease(KeyEvent.VK_A);
            robot.keyRelease(getKeyEvent("Ctrl"));
            robot.keyPress(getKeyEvent("BACKSPACE"));
            robot.keyRelease(getKeyEvent("BACKSPACE"));
            Report.updateTestLog(Action,
                    "Cleared Text  on " + ObjectName, Status.DONE);
            return;

        }
        Report.updateTestLog(Action,
                ObjectName
                + (imageObjectGroup.isLeaf() ? ExceptionType.Empty_Group : ExceptionType.Not_Found_on_Screen),
                Status.FAIL);
    } catch (Exception ex) {
        Report.updateTestLog(Action, ex.getMessage(), Status.DEBUG);
        Logger.getLogger(CommonImageMethods.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:34,代码来源:CommonImageMethods.java


示例14: imgClearAndSet

import org.sikuli.script.Region; //导入依赖的package包/类
/**
 * clear and set the value on a image
 */
@Action(object = ObjectType.IMAGE,
        desc = "clear text from image[<Object>] and enters the new text [<Data>]", input = InputType.YES)
public void imgClearAndSet() {
    try {
        target = findTarget(imageObjectGroup, Flag.SET_OFFSET, Flag.MATCH_ONLY);
        if (target != null) {
            ((Region) target).click();
            robot.keyPress(getKeyEvent("Ctrl"));
            robot.keyPress(KeyEvent.VK_A);
            robot.keyRelease(KeyEvent.VK_A);
            robot.keyRelease(getKeyEvent("Ctrl"));
            robot.keyPress(getKeyEvent("BACKSPACE"));
            robot.keyRelease(getKeyEvent("BACKSPACE"));
            Thread.sleep(99);
            SCREEN.paste(Data);
            Report.updateTestLog(Action,
                    "Clear and Set on " + ObjectName + " is done", Status.DONE);
            return;

        }
        Report.updateTestLog(Action,
                ObjectName
                + (imageObjectGroup.isLeaf() ? ExceptionType.Empty_Group : ExceptionType.Not_Found_on_Screen),
                Status.FAIL);
    } catch (Exception ex) {
        Report.updateTestLog(Action, ex.getMessage(), Status.DEBUG);
        Logger.getLogger(CommonImageMethods.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:33,代码来源:CommonImageMethods.java


示例15: imgDragandDropAt

import org.sikuli.script.Region; //导入依赖的package包/类
/**
 * Drag and drop to the given location
 */
@Action(object = ObjectType.IMAGE, 
		desc =" Drag an image [<Object>] and drop it in a user-defined region [<Data>]", 
		input =InputType.YES)
public void imgDragandDropAt() {

    try {
        int x = Integer.valueOf(Data.split(",", -1)[0]), y = Integer
                .valueOf(Data.split(",", -1)[1]), width = Integer
                .valueOf(Data.split(",", -1)[2]), height = Integer
                .valueOf(Data.split(",", -1)[3]);
        target = findTarget(imageObjectGroup, Flag.SET_OFFSET, Flag.MATCH_ONLY);
        droptarget = Region.create(x, y, width, height);

        if (target != null) {
            if (SCREEN.dragDrop(target, droptarget) == 1) {
                Report.updateTestLog(Action,
                        "Draged image " + ObjectName + " and Dropped at given location", Status.DONE);
                return;
            }
        }
        Report.updateTestLog(Action,
                ObjectName
                + (imageObjectGroup.isLeaf() ? ExceptionType.Empty_Group : ExceptionType.Not_Found_on_Screen),
                Status.FAIL);
    } catch (Exception ex) {
        Report.updateTestLog(Action,
                ex.getMessage(), Status.DEBUG);
        Logger.getLogger(DragAndDrop.class.getName()).log(Level.SEVERE, null, ex);
    }

}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:35,代码来源:DragAndDrop.java


示例16: storeText

import org.sikuli.script.Region; //导入依赖的package包/类
private void storeText(String where) {
    try {
        String varName = Data.contains(",") ? Data.split(",", -1)[0] : Data;
        if (varName.startsWith("%") && varName.endsWith("%")) {
            target = findTarget(imageObjectGroup, Flag.REGION_ONLY,
                    Flag.SET_COORDINATES, Flag.IMAGE_ONLY);
            if (target != null) {
                Region rx = getRegion((Region) target, where);
                rx.highlight(1);
                String text = rx.text();
                if (text != null) {
                    addVar(varName, text);
                    Report.updateTestLog(Action, "Text '"
                            + text + "' is stored in '" + varName + "'",
                            Status.DONE);
                    return;
                }
            }
            Report.updateTestLog(Action,
                    ObjectName
                    + (imageObjectGroup.isLeaf() ? ExceptionType.Empty_Group :ExceptionType.Not_Found_on_Screen),
                    Status.FAIL);
        } else {
            Report.updateTestLog(Action,
                    "Variable format is not correct", Status.FAIL);
        }
    } catch (Exception ex) {
        Report.updateTestLog(Action,
                ex.getMessage(), Status.DEBUG);
        Logger.getLogger(Text.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:33,代码来源:Text.java


示例17: searchForScreenshot

import org.sikuli.script.Region; //导入依赖的package包/类
/**
 * Search for the given screenshot
 *
 * @return <TRUE> if it was found, <FALSE> if it was not found within the
 *         time period.
 */
private boolean searchForScreenshot() {

	Region lastFound = guiAutomation.getLastFoundRegion();

	// reduce search region
	if (lastFound != null && !guiAutomation.isMovable()
			&& !fixedSearchRegion) {

		searchRegion.x = lastFound.x;
		searchRegion.y = lastFound.y;
		searchRegion.w = lastFound.w;
		searchRegion.h = lastFound.h;

		fixedSearchRegion = true;
	}

	log.debug("("
			+ getName()
			+ "): Search for match of \""
			+ SystemUtils.replaceSystemVariables(guiAutomation
					.getImagePath()) + "\" " + ", minimum smimilarity: "
			+ String.format("%.2g%n", Settings.MinSimilarity)
			+ ", scan rate: " + searchRegion.getObserveScanRate());

	return searchRegion.observe(SIKULIX_TIMEOUT);
}
 
开发者ID:aguelle,项目名称:MIDI-Automator,代码行数:33,代码来源:GUIAutomator.java


示例18: setSearchRegion

import org.sikuli.script.Region; //导入依赖的package包/类
/**
 * Sets the search region for the screen
 * 
 * @param searchRegion
 *            The search region
 */
public void setSearchRegion(Region searchRegion) {
	this.searchRegion = searchRegion;
	setH(searchRegion.h);
	setW(searchRegion.w);
	this.setLocation(new Location(searchRegion.x, searchRegion.y));
}
 
开发者ID:aguelle,项目名称:MIDI-Automator,代码行数:13,代码来源:MinSimColoredScreen.java


示例19: focusMidiAutomatorInstaller

import org.sikuli.script.Region; //导入依赖的package包/类
/**
 * Sets the focus on the Midi Automator installer window
 * 
 * @throws FindFailed
 */
public static void focusMidiAutomatorInstaller() throws FindFailed {
	try {
		SikuliXAutomation
				.setSearchRegion(findMidiAutomatorInstallerRegion());
		Region match = findMultipleStateRegion(DEFAULT_TIMEOUT,
				"Midi_Automator_installer_title.png",
				"Midi_Automator_installer_title_inactive.png");
		match.click(match.offset(50, 20));
	} catch (FindFailed e) {
		System.err.println("focusMidiAutomatorInstaller() failed");
		throw e;
	}
}
 
开发者ID:aguelle,项目名称:MIDI-Automator,代码行数:19,代码来源:SikuliXGUIAutomations.java


示例20: focusMidiAutomator

import org.sikuli.script.Region; //导入依赖的package包/类
/**
 * Sets the focus on the Midi Automator window
 * 
 * @throws FindFailed
 */
public static void focusMidiAutomator() throws FindFailed {
	try {
		SikuliXAutomation.setSearchRegion(findMidiAutomatorRegion());
		Region match = findMultipleStateRegion(DEFAULT_TIMEOUT,
				"Midi_Automator_title.png",
				"Midi_Automator_title_inactive.png");
		match.click(match.offset(50, 20));
	} catch (FindFailed e) {
		System.err.println("focusMidiAutomator() failed");
		throw e;
	}
}
 
开发者ID:aguelle,项目名称:MIDI-Automator,代码行数:18,代码来源:SikuliXGUIAutomations.java



注:本文中的org.sikuli.script.Region类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GetDelegationTokenOp类代码示例发布时间:2022-05-22
下一篇:
Java Query类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap