/[schmitzm]/branches/2.3.x/src_junit/skrueger/i8n/I8NUtilTest.java
ViewVC logotype

Contents of /branches/2.3.x/src_junit/skrueger/i8n/I8NUtilTest.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1097 - (show annotations)
Sun Oct 10 21:14:05 2010 UTC (14 years, 4 months ago) by alfonx
Original Path: trunk/src_junit/skrueger/i8n/I8NUtilTest.java
File MIME type: text/plain
File size: 1297 byte(s)
Added a bunch of test cases for Translation, as i want to seperate Locale.default (the GP GUI) and the atlas content langauge (Translation.activeLang).
1 package skrueger.i8n;
2
3 import static org.junit.Assert.assertEquals;
4 import static org.junit.Assert.assertFalse;
5 import static org.junit.Assert.assertTrue;
6
7 import java.util.ArrayList;
8 import java.util.List;
9
10 import org.junit.BeforeClass;
11 import org.junit.Test;
12
13 public class I8NUtilTest {
14
15 final static String oneLineCoded = "de{Baum}en{tree}";
16 final static List<String> langs4 = new ArrayList<String>();
17
18 @BeforeClass
19 public static void setup() {
20 langs4.add("de");
21 langs4.add("en");
22 langs4.add("xx");
23 langs4.add("yy");
24 }
25
26 @Test
27 public void testCreateFromOneLine() {
28 Translation t = I8NUtil.createFromOneLine(oneLineCoded);
29 assertEquals("Baum", t.toString("de"));
30 assertEquals("tree", t.toString("en"));
31 assertEquals(oneLineCoded, t.toOneLine());
32 }
33
34 @Test
35 public void testIsValidISOLangCode() {
36 assertTrue(I8NUtil.isValidISOLangCode("de"));
37 assertTrue(I8NUtil.isValidISOLangCode("ar"));
38 assertFalse(I8NUtil.isValidISOLangCode("äü"));
39 assertFalse(I8NUtil.isValidISOLangCode("ara"));
40 }
41
42 @Test
43 public void testMitUmlaute() {
44 assertEquals("öäü", I8NUtil.mitUmlaute("oeaeue"));
45 }
46
47 @Test
48 public void testQmTranslation() {
49 Translation t = I8NUtil.createFromOneLine(oneLineCoded);
50 assertEquals(0.5, I8NUtil.qmTranslation(langs4, t), .00000000001);
51 }
52
53 }

Properties

Name Value
svn:eol-style native
svn:keywords Id URL
svn:mime-type text/plain

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26