Search in sources :

Example 1 with XlfEditor

use of net.heartsome.cat.ts.test.ui.editors.XlfEditor in project translationstudio8 by heartsome.

the class MergeSegmentsTest method setUp.

/**
	 * 每个测试开始之前执行
	 */
@Before
public void setUp() {
    if (SLOW_PLAYBACK) {
        SWTBotPreferences.PLAYBACK_DELAY = 500;
    }
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    INVISIBLE_CHAR = XlfEditor.INVISIBLE_CHAR;
    reTag = "(" + INVISIBLE_CHAR + "\\d+)?" + INVISIBLE_CHAR + "(x|bx|ex|g|bpt|ept|mrk|sub|ph|it)" + INVISIBLE_CHAR + "(\\d+" + INVISIBLE_CHAR + ")?";
    bot = HSBot.bot();
    bot.closeAllEditors();
    ts = TS.getInstance();
    prjName = "swtBot-Project-001";
    fileName = "HSCAT8-3.xlf";
    ProjectTreeView.doubleClickXlfFile(prjName, fileName);
    xe = new XlfEditor(bot.editorByTitle(fileName));
}
Also used : XlfEditor(net.heartsome.cat.ts.test.ui.editors.XlfEditor) Before(org.junit.Before)

Example 2 with XlfEditor

use of net.heartsome.cat.ts.test.ui.editors.XlfEditor in project translationstudio8 by heartsome.

the class SplitSegmentTest method setUp.

/**
	 * 每个测试开始之前执行
	 */
@Before
public void setUp() {
    //		SWTBotPreferences.PLAYBACK_DELAY = 500;
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    INVISIBLE_CHAR = XlfEditor.INVISIBLE_CHAR;
    reTag = "(" + INVISIBLE_CHAR + "\\d+)?" + INVISIBLE_CHAR + "(x|bx|ex|g|bpt|ept|mrk|sub|ph|it)" + INVISIBLE_CHAR + "(\\d+" + INVISIBLE_CHAR + ")?";
    bot = HSBot.bot();
    bot.closeAllEditors();
    ts = TS.getInstance();
    prjName = "prjBot-001";
    fileName = "HSCAT8-2T.xlf";
    ProjectTreeView.doubleClickXlfFile(prjName, fileName);
    xe = new XlfEditor(bot.editorByTitle(fileName));
}
Also used : XlfEditor(net.heartsome.cat.ts.test.ui.editors.XlfEditor) Before(org.junit.Before)

Example 3 with XlfEditor

use of net.heartsome.cat.ts.test.ui.editors.XlfEditor in project translationstudio8 by heartsome.

the class TestDemos method TestFile.

@Ignore
@Test
public void TestFile() {
    String fileName = "HSCAT8-83.xlf";
    ProjectTreeItem pTN = ProjectTreeItem.getInstance(prjName);
    pTN.ctxMenuOpenFile(fileName);
    TS ts = TS.getInstance();
    XlfEditor xe = ts.getXlfEditor(fileName);
    int segNum = 2;
    xe.gotoSeg(segNum);
    String rowID = xe.rowIdOfSegNum(segNum);
    XliffUtil xu = new XliffUtil(rowID);
    assertTrue(!xu.tuIsApproved());
    xe.clickContextMenu(xe.ctxMenuApproveStatus(), xe.ctxMenuapproveStatusApproveCurrentSeg());
    xu = new XliffUtil(rowID);
    assertTrue(xu.tuIsApproved());
}
Also used : XliffUtil(net.heartsome.cat.ts.test.ui.utils.XliffUtil) ProjectTreeItem(net.heartsome.cat.ts.test.ui.views.ProjectTreeItem) XlfEditor(net.heartsome.cat.ts.test.ui.editors.XlfEditor) TS(net.heartsome.cat.ts.test.ui.dialogs.TS) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 4 with XlfEditor

use of net.heartsome.cat.ts.test.ui.editors.XlfEditor in project translationstudio8 by heartsome.

the class TestDemos method TestProject.

@Ignore
@Test
public void TestProject() {
    //		String fileName = "temp.xlf";
    String srcLang = "en-US";
    String tgtLang = "zh-CN";
    //		String icon = "E:\\temp\\imgs\\LineNumber.png";
    //		String menuText = "设置文本段批准状态";
    ProjectTreeItem pTN = ProjectTreeItem.getInstance(prjName);
    pTN.ctxMenuOpenProjectFiles();
    //		String filePath = "D:\\Temp\\ts.win32.win32.x86\\workspace\\prjBot-001\\XLIFF\\temp.xlf";
    //		String fileName = new Path(filePath).lastSegment();
    TS ts = TS.getInstance();
    //		ts.menuFileOpenFile().click();
    //		OpenFileDialog.openFile(filePath);
    XlfEditor xe = ts.getXlfEditor(prjName);
    xe.selectLangPair(srcLang, tgtLang);
    xe.changeEditorLayout();
    xe.selectSourceCell(4);
    System.out.println(xe.rowIdOfSelectedSeg());
//		String filePath = "D:\\Temp\\TestExcel.xls";
//		String column = "password";
//		ExcelUtil exl = new ExcelUtil(filePath);
//		System.err.println(exl.getNextText(column));
//		XLIFFUtil xu = new XLIFFUtil(filePath);
//		System.err.println(xu.getSouceLang());
//		System.err.println(xu.getTargetLang());
}
Also used : ProjectTreeItem(net.heartsome.cat.ts.test.ui.views.ProjectTreeItem) XlfEditor(net.heartsome.cat.ts.test.ui.editors.XlfEditor) TS(net.heartsome.cat.ts.test.ui.dialogs.TS) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 5 with XlfEditor

use of net.heartsome.cat.ts.test.ui.editors.XlfEditor in project translationstudio8 by heartsome.

the class TS method getXlfEditor.

/**
	 * 得到指定文件名所在的编辑器
	 * 
	 * @param fileName
	 *            指定的文件名
	 * @return XlfEditor 得到的编辑器
	 */
public XlfEditor getXlfEditor(String fileName) {
    SWTBotEditor editor = bot.editorByTitle(fileName);
    editor.show();
    return new XlfEditor(editor);
}
Also used : SWTBotEditor(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor) XlfEditor(net.heartsome.cat.ts.test.ui.editors.XlfEditor)

Aggregations

XlfEditor (net.heartsome.cat.ts.test.ui.editors.XlfEditor)5 TS (net.heartsome.cat.ts.test.ui.dialogs.TS)2 ProjectTreeItem (net.heartsome.cat.ts.test.ui.views.ProjectTreeItem)2 Before (org.junit.Before)2 Ignore (org.junit.Ignore)2 Test (org.junit.Test)2 XliffUtil (net.heartsome.cat.ts.test.ui.utils.XliffUtil)1 SWTBotEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor)1