Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(446)

Unified Diff: javatests/org/chromium/distiller/DocumentTitleGetterTest.java

Issue 1131853006: Fix word count issue for Chinese and Japanese (Closed) Base URL: git@github.com:chromium/dom-distiller.git@master
Patch Set: rewrite tests Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « java/org/chromium/distiller/StringUtil.java ('k') | javatests/org/chromium/distiller/StringUtilTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: javatests/org/chromium/distiller/DocumentTitleGetterTest.java
diff --git a/javatests/org/chromium/distiller/DocumentTitleGetterTest.java b/javatests/org/chromium/distiller/DocumentTitleGetterTest.java
index e24b5d9f77328db33586e2468f574f550d6eebdd..41ce1a987e5645e8477b741296c2b8fff88edbbb 100644
--- a/javatests/org/chromium/distiller/DocumentTitleGetterTest.java
+++ b/javatests/org/chromium/distiller/DocumentTitleGetterTest.java
@@ -59,6 +59,12 @@ public class DocumentTitleGetterTest extends DomDistillerJsTestCase {
assertEquals("part with 6 words before dash", title);
}
+ public void test1Dash2LongPartsChinese() {
+ String title = DocumentTitleGetter.getDocumentTitle(
+ "比較長一點的句子 - 這是不要的部分", null);
+ assertEquals("比較長一點的句子", title);
+ }
+
public void test1DashLongAndShortParts() {
String title = DocumentTitleGetter.getDocumentTitle(
"part with 6 words before dash - after dash", null);
@@ -66,12 +72,17 @@ public class DocumentTitleGetterTest extends DomDistillerJsTestCase {
}
public void test1DashShortAndLongParts() {
- // TODO(kuan): if using RegExp.split, this fails with "ant test.prod".
String title = DocumentTitleGetter.getDocumentTitle(
"before dash - part with 6 words after dash", null);
assertEquals("part with 6 words after dash", title);
}
+ public void test1DashShortAndLongPartsChinese() {
+ String title = DocumentTitleGetter.getDocumentTitle(
+ "短語 - 比較長一點的句子", null);
+ assertEquals("比較長一點的句子", title);
+ }
+
public void test2DashesShortParts() {
String title = DocumentTitleGetter.getDocumentTitle(
"before dash - between dash0 and dash1 - after dash1", null);
@@ -97,18 +108,36 @@ public class DocumentTitleGetterTest extends DomDistillerJsTestCase {
assertEquals("start : midway : end", title);
}
+ public void test2ColonsShortPartsChinese() {
+ String title = DocumentTitleGetter.getDocumentTitle(
+ "開始 : 中間 : 最後", null);
+ assertEquals("開始 : 中間 : 最後", title);
+ }
+
public void test2ColonsShortAndLongParts() {
String title = DocumentTitleGetter.getDocumentTitle(
"start : midway : part with 6 words at end", null);
assertEquals("part with 6 words at end", title);
}
+ public void test2ColonsShortAndLongPartsChinese() {
+ String title = DocumentTitleGetter.getDocumentTitle(
+ "開始 : 中間 : 最後比較長的部分", null);
+ assertEquals("最後比較長的部分", title);
+ }
+
public void test2ColonsShortAndLongAndShortParts() {
String title = DocumentTitleGetter.getDocumentTitle(
"start : part with 6 words at midway : end", null);
assertEquals("part with 6 words at midway : end", title);
}
+ public void test2ColonsShortAndLongAndShortPartsChinese() {
+ String title = DocumentTitleGetter.getDocumentTitle(
+ "開始 : 中間要的部分 : 最後", null);
+ assertEquals("中間要的部分 : 最後", title);
+ }
+
public void testH1WithShortText() {
Element root = TestUtil.createDiv(0);
Element h1 = TestUtil.createHeading(1, "short heading");
« no previous file with comments | « java/org/chromium/distiller/StringUtil.java ('k') | javatests/org/chromium/distiller/StringUtilTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698