Enable mixed case getNamefromChar().

X-SVN-Rev: 6655
This commit is contained in:
Syn Wee Quek 2001-11-07 00:30:02 +00:00
parent 40ec8bebf0
commit 2cc65b1603
4 changed files with 32 additions and 14 deletions

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/dev/test/lang/UCharacterTest.java,v $
* $Date: 2001/11/06 00:02:13 $
* $Revision: 1.17 $
* $Date: 2001/11/07 00:30:02 $
* $Revision: 1.18 $
*
*******************************************************************************
*/
@ -551,7 +551,6 @@ public final class UCharacterTest extends TestFmwk
/**
* Test for the character names
*/
/*
public void TestNames()
{
int c[] = {0x0061, 0x0284, 0x3401, 0x7fed, 0xac00, 0xd7a3, 0xff08, 0xffe5,
@ -606,6 +605,13 @@ public final class UCharacterTest extends TestFmwk
}
}
// test getName works with mixed-case names (new in 2.0)
if (0x61 != UCharacter.getCharFromName("LATin smALl letTER A")) {
errln(
"FAIL: 'LATin smALl letTER A' should result in character U+0061");
}
// extra testing different from icu
for (int i = UCharacter.MIN_VALUE; i < UCharacter.MAX_VALUE; i ++)
{

View file

@ -6,13 +6,15 @@
*
* $Source:
* /usr/cvs/icu4j/icu4j/src/com/ibm/icu/text/UCharacterName.java $
* $Date: 2001/10/23 17:08:13 $
* $Revision: 1.4 $
* $Date: 2001/11/07 00:30:02 $
* $Revision: 1.5 $
*
*******************************************************************************
*/
package com.ibm.text;
import java.util.Locale;
/**
* Internal class to manage character names.
* <a href=UCharacterNameDB.html>UCharacterNameDB</a> provides the data
@ -113,12 +115,13 @@ final class UCharacterName
return -1;
}
String uppercasename = UCharacter.toUpperCase(Locale.ENGLISH, name);
// try algorithmic names first, if fails then try group names
int result = getAlgorithmChar(choice, name);
int result = getAlgorithmChar(choice, uppercasename);
if (result >= 0) {
return result;
}
return getGroupChar(name, choice);
return getGroupChar(uppercasename, choice);
}
// private method =============================================

View file

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/test/text/Attic/UCharacterTest.java,v $
* $Date: 2001/11/06 00:02:13 $
* $Revision: 1.17 $
* $Date: 2001/11/07 00:30:02 $
* $Revision: 1.18 $
*
*******************************************************************************
*/
@ -551,7 +551,6 @@ public final class UCharacterTest extends TestFmwk
/**
* Test for the character names
*/
/*
public void TestNames()
{
int c[] = {0x0061, 0x0284, 0x3401, 0x7fed, 0xac00, 0xd7a3, 0xff08, 0xffe5,
@ -606,6 +605,13 @@ public final class UCharacterTest extends TestFmwk
}
}
// test getName works with mixed-case names (new in 2.0)
if (0x61 != UCharacter.getCharFromName("LATin smALl letTER A")) {
errln(
"FAIL: 'LATin smALl letTER A' should result in character U+0061");
}
// extra testing different from icu
for (int i = UCharacter.MIN_VALUE; i < UCharacter.MAX_VALUE; i ++)
{

View file

@ -6,13 +6,15 @@
*
* $Source:
* /usr/cvs/icu4j/icu4j/src/com/ibm/icu/text/UCharacterName.java $
* $Date: 2001/10/23 17:08:13 $
* $Revision: 1.4 $
* $Date: 2001/11/07 00:30:02 $
* $Revision: 1.5 $
*
*******************************************************************************
*/
package com.ibm.text;
import java.util.Locale;
/**
* Internal class to manage character names.
* <a href=UCharacterNameDB.html>UCharacterNameDB</a> provides the data
@ -113,12 +115,13 @@ final class UCharacterName
return -1;
}
String uppercasename = UCharacter.toUpperCase(Locale.ENGLISH, name);
// try algorithmic names first, if fails then try group names
int result = getAlgorithmChar(choice, name);
int result = getAlgorithmChar(choice, uppercasename);
if (result >= 0) {
return result;
}
return getGroupChar(name, choice);
return getGroupChar(uppercasename, choice);
}
// private method =============================================