abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r586146 - /incubator/abdera/java/trunk/extensions/main/src/test/java/org/apache/abdera/test/ext/bidi/BidiTest.java
Date Thu, 18 Oct 2007 21:29:58 GMT
Author: jmsnell
Date: Thu Oct 18 14:29:57 2007
New Revision: 586146

URL: http://svn.apache.org/viewvc?rev=586146&view=rev
Log:
Bidi detection algorithm improvements

Modified:
    incubator/abdera/java/trunk/extensions/main/src/test/java/org/apache/abdera/test/ext/bidi/BidiTest.java

Modified: incubator/abdera/java/trunk/extensions/main/src/test/java/org/apache/abdera/test/ext/bidi/BidiTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/main/src/test/java/org/apache/abdera/test/ext/bidi/BidiTest.java?rev=586146&r1=586145&r2=586146&view=diff
==============================================================================
--- incubator/abdera/java/trunk/extensions/main/src/test/java/org/apache/abdera/test/ext/bidi/BidiTest.java
(original)
+++ incubator/abdera/java/trunk/extensions/main/src/test/java/org/apache/abdera/test/ext/bidi/BidiTest.java
Thu Oct 18 14:29:57 2007
@@ -17,13 +17,14 @@
 */
 package org.apache.abdera.test.ext.bidi;
 
+import junit.framework.TestCase;
+
 import org.apache.abdera.Abdera;
 import org.apache.abdera.ext.bidi.BidiHelper;
 import org.apache.abdera.ext.bidi.BidiHelper.Direction;
+import org.apache.abdera.model.Entry;
 import org.apache.abdera.model.Feed;
 
-import junit.framework.TestCase;
-
 public class BidiTest extends TestCase {
 
   public static void testBidi() throws Exception {
@@ -42,6 +43,18 @@
     assertEquals(BidiHelper.getBidiElementText(feed.getTitleElement()), BidiHelper.getBidiText(Direction.RTL,
"Testing"));
     assertEquals(BidiHelper.getBidiElementText(feed.getSubtitleElement()), BidiHelper.getBidiText(Direction.LTR,
"Testing"));
     
+    Entry entry = abdera.newEntry();
+    entry.setLanguage("az-arab");
+    assertEquals(BidiHelper.guessDirectionFromLanguage(entry), Direction.RTL);
+    
+    entry.setLanguage("az-latn");
+    assertEquals(BidiHelper.guessDirectionFromLanguage(entry), Direction.UNSPECIFIED);
+    
+    
+    assertEquals(BidiHelper.guessDirectionFromEncoding(entry), Direction.UNSPECIFIED);
+    
+    entry.getDocument().setCharset("iso-8859-6");
+    assertEquals(BidiHelper.guessDirectionFromEncoding(entry), Direction.RTL);
   }
   
 }



Mime
View raw message