use of net.heartsome.test.swtbot.widgets.SWTBotNatTable in project translationstudio8 by heartsome.
the class SplitSegment method splitAfter.
/**
* @param xe 要操作的 XlfEditor 对象
* @param segNum 要分割的文本段序号
* @param afterText 在此文本之后分割
*/
public static void splitAfter(XlfEditor xe, int segNum, String afterText) {
SWTBotNatTable nt = xe.getNatTable();
xe.selectSourceCell(segNum);
Position pos = nt.positionOfSelectedCell();
String expectedText = nt.getTextByPosition(pos.line, pos.column);
int splitIndex = StringUtil.indexAfterWithAssert(expectedText, afterText);
splitAt(xe, segNum, splitIndex);
}
use of net.heartsome.test.swtbot.widgets.SWTBotNatTable in project translationstudio8 by heartsome.
the class SplitSegment method splitWithoutCursor.
/**
* 尝试不将光标置于源文本中直接分割
* @param xe 要操作的 XlfEditor 对象
* @param segNum 尝试分割的文本段序号
*/
public static void splitWithoutCursor(XlfEditor xe, int segNum) {
// 判断该文本段是否可编辑
String rowID = xe.rowIdOfSegNum(segNum);
XliffUtil xu = new XliffUtil(rowID);
SegmentAsserts.segIsEditable(xu);
// 选中文本段的源文本单元格,而不进入编辑状态
xe.selectSourceCell(segNum);
// 在实际进行分割文本段之前,得到原文本段的 tuid,用以验证得到的文本段内容是否符合预期。
String tuid = xe.tuidOfSegNum(segNum);
// 判断给定的分割点是否可分割
SWTBotNatTable nt = xe.getNatTable();
Position pos = nt.positionOfSelectedCell();
String expectedText = nt.getTextByPosition(pos.line, pos.column);
// 点击相应的菜单项进行分割
ts.menuTranslationSplitSegment().click();
// 弹出提示信息
InformationDialog dialog = new InformationDialog(1, TsUIConstants.getString("msgPlaceCursorToSplit"));
dialog.lblMessage().isVisible();
dialog.btnOK().click();
xe.getNatTable();
// 确认文本段没有被分割
SegmentAsserts.segNotSplit(tuid, expectedText, xu);
}
use of net.heartsome.test.swtbot.widgets.SWTBotNatTable in project translationstudio8 by heartsome.
the class SplitSegment method splitAtEnd.
/**
* 尝试从段末分割文本段
* @param xe 要操作的 XlfEditor 对象
* @param segNum 尝试分割的文本段序号
*/
public static void splitAtEnd(XlfEditor xe, int segNum) {
SWTBotNatTable nt = xe.getNatTable();
xe.selectSourceCell(segNum);
Position pos = nt.positionOfSelectedCell();
String expectedText = nt.getTextByPosition(pos.line, pos.column);
int splitIndex = expectedText.length();
splitAt(xe, segNum, splitIndex);
}
use of net.heartsome.test.swtbot.widgets.SWTBotNatTable in project translationstudio8 by heartsome.
the class SplitSegment method splitBefore.
/**
* @param xe 要操作的 XlfEditor 对象
* @param segNum 要分割的文本段序号
* @param beforeText 在此文本之前分割
*/
public static void splitBefore(XlfEditor xe, int segNum, String beforeText) {
SWTBotNatTable nt = xe.getNatTable();
xe.selectSourceCell(segNum);
Position pos = nt.positionOfSelectedCell();
String expectedText = nt.getTextByPosition(pos.line, pos.column);
int splitIndex = StringUtil.indexBeforeWithAssert(expectedText, beforeText);
splitAt(xe, segNum, splitIndex);
}
use of net.heartsome.test.swtbot.widgets.SWTBotNatTable in project translationstudio8 by heartsome.
the class SplitSegment method splitBetween.
/**
* @param xe 要操作的 XlfEditor 对象
* @param segNum 要分割的文本段序号
* @param afterText 在此文本之后分割,此内容在文本段中必须与下一个参数相邻
* @param beforeText 在此文本之前分割,此内容在文本段中必须与上一个参数相邻
*/
public static void splitBetween(XlfEditor xe, int segNum, String afterText, String beforeText) {
SWTBotNatTable nt = xe.getNatTable();
xe.selectSourceCell(segNum);
Position pos = nt.positionOfSelectedCell();
String expectedText = nt.getTextByPosition(pos.line, pos.column);
int splitIndex = StringUtil.indexBetweenWithAssert(expectedText, afterText, beforeText);
splitAt(xe, segNum, splitIndex);
}
Aggregations