sl@0: /*
sl@0: * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: * All rights reserved.
sl@0: * This component and the accompanying materials are made available
sl@0: * under the terms of "Eclipse Public License v1.0"
sl@0: * which accompanies this distribution, and is available
sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: *
sl@0: * Initial Contributors:
sl@0: * Nokia Corporation - initial contribution.
sl@0: *
sl@0: * Contributors:
sl@0: *
sl@0: * Description: 
sl@0: *
sl@0: */
sl@0: 
sl@0: 
sl@0: #include <e32std.h>
sl@0: #include <utf.h>
sl@0: #include "t_newlin7.h"
sl@0: 
sl@0: ///////////////////////////////////////////////////////////////////////////////////////
sl@0: 
sl@0: #define test(cond)                                          \
sl@0:     {                                                       \
sl@0:     TBool __bb = (cond);                                    \
sl@0:     TEST(__bb);                                             \
sl@0:     if (!__bb)                                              \
sl@0:         {                                                   \
sl@0:         ERR_PRINTF1(_L("ERROR: Test Failed"));              \
sl@0:         User::Leave(1);                                     \
sl@0:         }                                                   \
sl@0:     }
sl@0: ///////////////////////////////////////////////////////////////////////////////////////
sl@0: ///////////////////////////////////////////////////////////////////////////////////////
sl@0: /**
sl@0: @SYMTestCaseID          SYSLIB-CHARCONV-CT-0570
sl@0: @SYMTestCaseDesc        Testing base64 sequences combined with line-breaks
sl@0: @SYMTestPriority        Medium
sl@0: @SYMTestActions        	Tests for conversion from UTF-7 to Unicode with line-breaks
sl@0: @SYMTestExpectedResults Test must not fail
sl@0: @SYMREQ                 REQ0000
sl@0: */
sl@0: void CT_NEWLIN7::TestNEWLIN7()
sl@0: 	{
sl@0:     INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0570 Testing base64 sequences combined with line-breaks "));
sl@0: 	TBuf16<256> unicode;
sl@0: 	TBuf8<256> utf7;
sl@0: 	TInt state=CnvUtfConverter::KStateDefault;
sl@0: 	utf7=_L8("+U0E\nU0E");
sl@0: 	test(CnvUtfConverter::ConvertToUnicodeFromUtf7(unicode, utf7, state)==0);
sl@0: 	test(state==CnvUtfConverter::KStateDefault);
sl@0: 	test(unicode.Length()==5);
sl@0: 	test(unicode[0]==0x5341);
sl@0: 	test(unicode[1]==0x000a);
sl@0: 	test(unicode[2]==0x0055);
sl@0: 	test(unicode[3]==0x0030);
sl@0: 	test(unicode[4]==0x0045);
sl@0: 	unicode=_L16(")\n)\n*\n*\n+\n+\n)\n)\n*\n*\n+\n+");
sl@0: 	test(CnvUtfConverter::ConvertFromUnicodeToUtf7(utf7, unicode, ETrue)==0);
sl@0: 	test(utf7==_L8(")\n)\n+ACo-\n+ACo-\n+-\n+-\n)\n)\n+ACo-\n+ACo-\n+-\n+-"));
sl@0: 	test(CnvUtfConverter::ConvertFromUnicodeToUtf7(utf7, unicode, EFalse)==0);
sl@0: 	test(utf7==_L8(")\n)\n*\n*\n+-\n+-\n)\n)\n*\n*\n+-\n+-"));
sl@0: 	}
sl@0: 
sl@0: CT_NEWLIN7::CT_NEWLIN7()
sl@0:     {
sl@0:     SetTestStepName(KTestStep_T_NEWLIN7);
sl@0:     }
sl@0: 
sl@0: TVerdict CT_NEWLIN7::doTestStepL()
sl@0:     {
sl@0:     SetTestStepResult(EFail);
sl@0: 
sl@0:     __UHEAP_MARK;
sl@0: 
sl@0:     TRAPD(error1, TestNEWLIN7());
sl@0: 
sl@0:     __UHEAP_MARKEND;
sl@0: 
sl@0:     if(error1 == KErrNone )
sl@0:         {
sl@0:         SetTestStepResult(EPass);
sl@0:         }
sl@0: 
sl@0:     return TestStepResult();
sl@0:     }