use of org.omegat.filters2.text.TextFilter in project omegat by omegat-org.
the class TextFilterTest method testLineLengthLimit.
@Test
public void testLineLengthLimit() throws Exception {
Map<String, String> options = new TreeMap<String, String>();
options.put(TextFilter.OPTION_SEGMENT_ON, TextFilter.SEGMENT_EMPTYLINES);
options.put(TextFilter.OPTION_LINE_LENGTH, "8");
options.put(TextFilter.OPTION_MAX_LINE_LENGTH, "10");
TextFilter filter = new TextFilter();
translate(filter, "test/data/filters/text/file-TextFilter-SMP.txt", options);
compareBinary(new File("test/data/filters/text/file-TextFilter-SMP-gold.txt"), outFile);
}
use of org.omegat.filters2.text.TextFilter in project omegat by omegat-org.
the class TextFilterTest method checkFile.
protected void checkFile(String segValue, int count1, int count2) throws Exception {
Map<String, String> options = new TreeMap<String, String>();
options.put(TextFilter.OPTION_SEGMENT_ON, segValue);
TextFilter filter = new TextFilter();
List<String> entries = parse(filter, "test/data/filters/text/file-TextFilter.txt", options);
assertEquals(count1, entries.size());
entries = parse(filter, "test/data/filters/text/file-TextFilter-noemptylines.txt", options);
assertEquals(count2, entries.size());
}
use of org.omegat.filters2.text.TextFilter in project omegat by omegat-org.
the class TextFilterTest method testTextFilterParsing.
@Test
public void testTextFilterParsing() throws Exception {
List<String> entries = parse(new TextFilter(), "test/data/filters/text/text1.txt");
assertEquals("First entry\r\n", entries.get(0));
}
use of org.omegat.filters2.text.TextFilter in project omegat by omegat-org.
the class TmxComplianceBase method translateAndCheckTextUsingTmx.
protected void translateAndCheckTextUsingTmx(String fileTextIn, String inCharset, String fileTMX, String fileTextOut, String outCharset, String sourceLang, String targetLang, Map<String, TMXEntry> tmxPatch) throws Exception {
TextFilter f = new TextFilter();
Map<String, String> c = new TreeMap<String, String>();
c.put(TextFilter.OPTION_SEGMENT_ON, TextFilter.SEGMENT_BREAKS);
ProjectProperties props = new TestProjectProperties(sourceLang, targetLang);
translateUsingTmx(f, c, fileTextIn, inCharset, fileTMX, outCharset, props, tmxPatch);
compareTexts(new File("test/data/tmx/TMXComplianceKit/" + fileTextOut), outCharset, outFile, outCharset);
}
use of org.omegat.filters2.text.TextFilter in project omegat by omegat-org.
the class TextFilterTest method testLoad.
@Test
public void testLoad() throws Exception {
String f = "test/data/filters/text/file-TextFilter-multiple.txt";
IProject.FileInfo fi = loadSourceFiles(new TextFilter(), f);
checkMultiStart(fi, f);
checkMulti("line1", null, null, "", "line2", null);
checkMulti("line2", null, null, "line1", "line3", null);
checkMulti("line3", null, null, "line2", "", null);
checkMultiEnd();
}
Aggregations