Update contrib.
2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
28 TBool __bb = (cond); \
32 ERR_PRINTF1(_L("ERROR: Test Failed")); \
38 ///////////////////////////////////////////////////////////////////////////////////////
39 ///////////////////////////////////////////////////////////////////////////////////////
41 @SYMTestCaseID SYSLIB-CHARCONV-CT-0574
42 @SYMTestCaseDesc Tests for converting to Unicode from UTF- 7, from UTF-7 to Unicode
43 @SYMTestPriority Medium
44 @SYMTestActions Tests for CCnvCharacterSetConverter::ConvertToUnicode(),
45 CCnvCharacterSetConverter::ConvertFromUnicode() function
46 @SYMTestExpectedResults Test must not fail
49 void CT_IMAP::TestIMAP()
51 RFs fileServerSession;
52 CleanupClosePushL(fileServerSession);
53 User::LeaveIfError(fileServerSession.Connect());
54 CCnvCharacterSetConverter* characterSetConverter=CCnvCharacterSetConverter::NewLC();
55 TInt state=CCnvCharacterSetConverter::KStateDefault;
56 INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0574 Testing IMAP UTF-7 "));
57 test(characterSetConverter->PrepareToConvertToOrFromL(KCharacterSetIdentifierImapUtf7, fileServerSession)==CCnvCharacterSetConverter::EAvailable);
58 TBuf16<256> originalUnicode;
59 TBuf8<256> generatedUtf7;
60 TBuf16<256> generatedUnicode;
62 INFO_PRINTF1(_L("Empty descriptor"));
63 originalUnicode=_L16("");
64 test(characterSetConverter->ConvertFromUnicode(generatedUtf7, originalUnicode)==0);
65 test(generatedUtf7==_L8(""));
66 test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf7, state)==0);
67 test(state==CCnvCharacterSetConverter::KStateDefault);
68 test(generatedUnicode==originalUnicode);
69 INFO_PRINTF1(_L("Characters \" +&-~\\\""));
70 originalUnicode=_L16(" +&-~\\");
71 test(characterSetConverter->ConvertFromUnicode(generatedUtf7, originalUnicode)==0);
72 test(generatedUtf7==_L8(" +&--~\\"));
73 test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf7, state)==0);
74 test(state==CCnvCharacterSetConverter::KStateDefault);
75 test(generatedUnicode==originalUnicode);
76 INFO_PRINTF1(_L("Example quoted in RFC 2060 (Section 5.1.3)"));
77 originalUnicode.Format(_L16("~peter/mail/%c%c%c/%c%c"), 0x65e5, 0x672c, 0x8a9e, 0x53f0, 0x5317);
78 test(characterSetConverter->ConvertFromUnicode(generatedUtf7, originalUnicode)==0);
79 test(generatedUtf7==_L8("~peter/mail/&ZeVnLIqe-/&U,BTFw-"));
80 test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf7, state)==0);
81 test(state==CCnvCharacterSetConverter::KStateDefault);
82 test(generatedUnicode==originalUnicode);
83 INFO_PRINTF1(_L("Testing fix for defect EDNDSEF-4KMEUH in \"Symbian Defect Tracking v3.0\""));
84 originalUnicode.Format(_L16("%c%c%c%c%c%c%c%c%c"), 0x30ad, 0x30e3, 0x30d3, 0x30cd, 0x30c3, 0x30c8, 0x3068, 0x306f, 0xff1f);
85 test(characterSetConverter->ConvertFromUnicode(generatedUtf7, originalUnicode)==0);
86 test(generatedUtf7==_L8("&MK0w4zDTMM0wwzDIMGgwb,8f-"));
87 test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf7, state)==0);
88 test(state==CCnvCharacterSetConverter::KStateDefault);
89 test(generatedUnicode==originalUnicode);
90 TBuf8<0x14> generatedUtf7_0x14;
91 test(characterSetConverter->ConvertFromUnicode(generatedUtf7_0x14, originalUnicode)==3);
92 test(generatedUtf7_0x14==_L8("&MK0w4zDTMM0wwzDI-"));
93 test(characterSetConverter->ConvertToUnicode(generatedUnicode, generatedUtf7_0x14, state)==0);
94 test(state==CCnvCharacterSetConverter::KStateDefault);
95 test(generatedUnicode==originalUnicode.Left(6));
96 CleanupStack::PopAndDestroy(2); // characterSetConverter and fileServerSession
101 SetTestStepName(KTestStep_T_IMAP);
104 TVerdict CT_IMAP::doTestStepL()
106 SetTestStepResult(EFail);
110 TRAPD(error1, TestIMAP());
114 if(error1 == KErrNone )
116 SetTestStepResult(EPass);
119 return TestStepResult();