/* ******************************************************************************* * Copyright (C) 1996-2010, International Business Machines Corporation and * * others. All Rights Reserved. * ******************************************************************************* */ package com.ibm.icu.dev.test.normalizer; import com.ibm.icu.dev.test.TestFmwk; import com.ibm.icu.impl.Utility; import com.ibm.icu.lang.UCharacter; import com.ibm.icu.lang.UProperty; import com.ibm.icu.text.ComposedCharIter; import com.ibm.icu.text.Normalizer; import com.ibm.icu.text.StringCharacterIterator; public class TestDeprecatedNormalizerAPI extends TestFmwk { public static void main(String[] args) throws Exception { String[] tempArgs = new String[args.length]; int count = 0; // Allow the test to be pointed at a specific version of the Unicode database //for (int i = 0; i < args.length; i++) //{ // if (args[i].equals("-data")) { // tempInfo = new UInfo(args[++i], args[++i]); // } else { // tempArgs[count++] = args[i]; // } //} args = new String[count]; System.arraycopy(tempArgs, 0, args, 0, count); new TestDeprecatedNormalizerAPI().run(args); } public TestDeprecatedNormalizerAPI() { } public void TestNormalizerAPI(){ // instantiate a Normalizer from a CharacterIterator String s=Utility.unescape("a\u0308\uac00\\U0002f800"); // make s a bit longer and more interesting java.text.CharacterIterator iter = new StringCharacterIterator(s+s); //test deprecated constructors Normalizer norm = new Normalizer(iter, Normalizer.NFC,0); if(norm.next()!=0xe4) { errln("error in Normalizer(CharacterIterator).next()"); } Normalizer norm2 = new Normalizer(s,Normalizer.NFC,0); if(norm2.next()!=0xe4) { errln("error in Normalizer(CharacterIterator).next()"); } // test clone(), ==, and hashCode() Normalizer clone=(Normalizer)norm.clone(); if(clone.getBeginIndex()!= norm.getBeginIndex()){ errln("error in Normalizer.getBeginIndex()"); } if(clone.getEndIndex()!= norm.getEndIndex()){ errln("error in Normalizer.getEndIndex()"); } // test setOption() and getOption() clone.setOption(0xaa0000, true); clone.setOption(0x20000, false); if(clone.getOption(0x880000) ==0|| clone.getOption(0x20000)==1) { errln("error in Normalizer::setOption() or Normalizer::getOption()"); } //test deprecated normalize method Normalizer.normalize(s,Normalizer.NFC,0); //test deprecated compose method Normalizer.compose(s,false,0); //test deprecated decompose method Normalizer.decompose(s,false,0); } /** * Run through all of the characters returned by a composed-char iterator * and make sure that: *