Search in sources :

Example 6 with HsSWTBotStyledText

use of net.heartsome.test.swtbot.widgets.HsSWTBotStyledText in project translationstudio8 by heartsome.

the class XlfEditor method typeTextAfter.

/**
	 * 在指定字符串之后输入内容
	 * @param afterText
	 *            指定的字符串,输入的内容将在其最后一个字符之后
	 * @param text
	 *            要输入的内容
	 */
public void typeTextAfter(String afterText, String text) {
    HsSWTBotStyledText styledText = getStyledText();
    Position targetPos = styledText.positionOfFollowing(afterText);
    Assert.isTrue(!targetPos.equals(new Position(-1, -1)), "Text \"" + afterText + "\" not found.");
    styledText.typeText(targetPos.line, targetPos.column, text);
}
Also used : Position(org.eclipse.swtbot.swt.finder.utils.Position) HsSWTBotStyledText(net.heartsome.test.swtbot.widgets.HsSWTBotStyledText)

Example 7 with HsSWTBotStyledText

use of net.heartsome.test.swtbot.widgets.HsSWTBotStyledText in project translationstudio8 by heartsome.

the class XlfEditor method navigateToIndex.

/**
	 * 将光标定位到指定索引位置
	 * @param index
	 *            目标位置的索引
	 */
public void navigateToIndex(int index) {
    HsSWTBotStyledText styledText = getStyledText();
    styledText.navigateTo(styledText.getPositionByIndex(index));
}
Also used : HsSWTBotStyledText(net.heartsome.test.swtbot.widgets.HsSWTBotStyledText)

Example 8 with HsSWTBotStyledText

use of net.heartsome.test.swtbot.widgets.HsSWTBotStyledText in project translationstudio8 by heartsome.

the class XlfEditor method navigateBetween.

/**
	 * 将光标定位到指定的两个字符串之间 指定的两个字符串必须相邻
	 * @param afterText
	 *            指定的字符串,光标将置于其最后一个字符之后
	 * @param beforeText
	 *            指定的字符串,光标将置于其第一个字符之前
	 */
public void navigateBetween(String afterText, String beforeText) {
    HsSWTBotStyledText styledText = getStyledText();
    Position targetPosA = styledText.positionOfFollowing(afterText);
    Assert.isTrue(!targetPosA.equals(new Position(-1, -1)), "Text \"" + afterText + "\" not found.");
    Position targetPosB = styledText.positionOf(beforeText);
    Assert.isTrue(!targetPosB.equals(new Position(-1, -1)), "Text \"" + beforeText + "\" not found.");
    Assert.isTrue(targetPosB.equals(targetPosA), "Text \"" + afterText + beforeText + "\" not found.");
    styledText.navigateTo(targetPosA);
}
Also used : Position(org.eclipse.swtbot.swt.finder.utils.Position) HsSWTBotStyledText(net.heartsome.test.swtbot.widgets.HsSWTBotStyledText)

Example 9 with HsSWTBotStyledText

use of net.heartsome.test.swtbot.widgets.HsSWTBotStyledText in project translationstudio8 by heartsome.

the class XlfEditor method typeTextBetween.

/**
	 * 在指定的两个字符串之间输入内容
	 * @param afterText
	 *            指定的字符串,输入的内容将在其最后一个字符之后
	 * @param beforeText
	 *            指定的字符串,输入的内容将在其第一个字符之前
	 * @param text
	 *            要输入的内容
	 */
public void typeTextBetween(String afterText, String beforeText, String text) {
    HsSWTBotStyledText styledText = getStyledText();
    Position targetPosA = styledText.positionOfFollowing(afterText);
    Assert.isTrue(!targetPosA.equals(new Position(-1, -1)), "Text \"" + afterText + "\" not found.");
    Position targetPosB = styledText.positionOf(beforeText);
    Assert.isTrue(!targetPosB.equals(new Position(-1, -1)), "Text \"" + beforeText + "\" not found.");
    Assert.isTrue(targetPosB.equals(targetPosA), "Text \"" + afterText + beforeText + "\" not found.");
    styledText.typeText(targetPosA.line, targetPosA.column, text);
}
Also used : Position(org.eclipse.swtbot.swt.finder.utils.Position) HsSWTBotStyledText(net.heartsome.test.swtbot.widgets.HsSWTBotStyledText)

Example 10 with HsSWTBotStyledText

use of net.heartsome.test.swtbot.widgets.HsSWTBotStyledText in project translationstudio8 by heartsome.

the class XlfEditor method typeTextBegining.

/**
	 * 在文本框开始位置输入内容
	 * @param text
	 *            要输入的内容
	 */
public void typeTextBegining(String text) {
    navigateToBegining();
    HsSWTBotStyledText styledText = getStyledText();
    styledText.typeText(text);
}
Also used : HsSWTBotStyledText(net.heartsome.test.swtbot.widgets.HsSWTBotStyledText)

Aggregations

HsSWTBotStyledText (net.heartsome.test.swtbot.widgets.HsSWTBotStyledText)15 Position (org.eclipse.swtbot.swt.finder.utils.Position)6 InformationDialog (net.heartsome.cat.ts.test.ui.msgdialogs.InformationDialog)2 XliffUtil (net.heartsome.cat.ts.test.ui.utils.XliffUtil)2