Skip to content
This repository has been archived by the owner on Jul 29, 2023. It is now read-only.

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
  • Loading branch information
miurahr committed Jul 30, 2020
1 parent b16ec49 commit dc23c67
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,12 @@ public boolean isMode(final String name) {
* @param tLang target language.
* @return this object.
*/
public TextraOptions setLang(final String sLang, final String tLang) {
this.sourceLang = formatLang(sLang, "");
this.targetLang = formatLang(tLang, "");
return this;
}

public TextraOptions setLang(final Language sLang, final Language tLang) {
this.sourceLang = formatLang(sLang.getLanguageCode(), sLang.getCountryCode());
this.targetLang = formatLang(tLang.getLanguageCode(), tLang.getCountryCode());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
package tokyo.northside.omegat.textra

import org.testng.annotations.Test;
import org.testng.annotations.Test

import org.omegat.util.Language

import static org.testng.Assert.*

import static org.testng.Assert.*;

class TextraOptionsTest {

@Test
void testIsCombinationValid() {
assertTrue(new TextraOptions().setMode("generalN").setLang("ja", "en").isCombinationValid())
assertFalse(new TextraOptions().setMode("generalN").setLang("fr", "es").isCombinationValid())
assertFalse(new TextraOptions().setMode("generalN").setLang("zh-CN", "zh-TW").isCombinationValid())
assertTrue(new TextraOptions().setMode("generalN").setLang("ja", "zh-CN").isCombinationValid())
assertTrue(new TextraOptions().setMode("generalN").setLang(new Language("ja-JP"), new Language("en-US")).isCombinationValid())
assertFalse(new TextraOptions().setMode("generalN").setLang(new Language("fr"), new Language("es")).isCombinationValid())
assertFalse(new TextraOptions().setMode("generalN").setLang(new Language("zh-CN"), new Language("zh-TW")).isCombinationValid())
assertTrue(new TextraOptions().setMode("generalN").setLang(new Language("ja"), new Language("zh-CN")).isCombinationValid())
assertTrue(new TextraOptions().setMode("generalN").setLang("JA", "EN").isCombinationValid())
assertTrue(new TextraOptions().setMode("patentN").setLang("en", "ja").isCombinationValid())
assertTrue(new TextraOptions().setMode("patent_claimN").setLang("ja", "en").isCombinationValid())
Expand Down

0 comments on commit dc23c67

Please sign in to comment.