diff -r 2d65c2f76d7b -r 947f0dc9f7a8 kerneltest/e32test/buffer/t_des.cpp --- a/kerneltest/e32test/buffer/t_des.cpp Tue Feb 02 01:24:03 2010 +0200 +++ b/kerneltest/e32test/buffer/t_des.cpp Fri Apr 16 16:24:37 2010 +0300 @@ -1353,6 +1353,52 @@ LOCAL_C void testSurrogateAwareInterfaces() { test.Next(_L("new TDesC interfaces")); + TInt count; + + // string 1: all BMP characters + _LIT(KBmpString1, "abcdcf"); + TBuf16<128> s01(KBmpString1); + test(s01.FindCorruptSurrogate() == KErrNotFound); + test(s01.Locate2('f') == 5); + test(s01.LocateReverse2('c') == 4); + test(s01.Match(_L("*cdc*")) == 2); + test(s01.Match2(_L("*bcdc*")) == 1); + test(s01.Match2(_L("*c?c*")) == 2); + + // string 2: all non-BMP characters + _LIT(KSurrogateString1, "\xD840\xDDAA\xD840\xDDAB\xD840\xDDAC\xD840\xDDAD\xD840\xDDAE\xD840\xDDAF"); + TBuf16<128> s02(KSurrogateString1); + for (count=0; count<=11; count++) + test(s02.FindCorruptSurrogate() == KErrNotFound); + test(s02.Locate2(0x201AE) == 8); + test(s02.LocateReverse2(0x201AC) == 4); + test(s02.Match2(_L("*\xD840\xDDAB\xD840\xDDAC*")) == 2); + test(s02.Match2(_L("*\xD840\xDDBB*")) == KErrNotFound); + test(s02.Match2(_L("*\xD840\xDDAD*")) == 6); + + // string 3: mixed + _LIT(KMixedString1, "ab\xD840\xDDAD e\xD801\xDC27"); + TBuf16<128> s03(KMixedString1); + test(s03.FindCorruptSurrogate() == KErrNotFound); + test(s03.Locate2(0x10427) == 6); + test(s03.Locate2('e') == 5); + test(s03.LocateF2(0x1044F) == 6); // lower case=U+1044F(D801, DC4F), upper case=U+10427(D801, DC27), title case=U+10427 + TBuf16<128> s03a; + s03a.CopyLC2(s03); + s03a.Append2(0x21000); + TBuf16<128> s03b; + s03b.Copy(s03); + + s03b.AppendFill2(0x21000, 2); + test(s03a != s03b); + test(s03.Match2(_L("*b\xD840\xDDAD*")) == 1); + test(s03.Match2(_L("* e*")) == 4); + test(s03.Match2(_L("*\xD840\xDDAD?*")) == 2); + + // string 4: mixed, with corrupt surrogate + _LIT(KCorruptString1, "ab\xD840\xDDAD e\xDDAD\xD840"); + TBuf16<128> s04(KCorruptString1); + test(s04.FindCorruptSurrogate() == 6); }