utilitylibraries/libutils/tsrc/src/integration_test_scenario25.cpp
changeset 31 ce057bb09d0b
child 45 4b03adbd26ca
equal deleted inserted replaced
30:e20de85af2ee 31:ce057bb09d0b
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #include <stdio.h>
       
    19 #include<e32std.h>
       
    20 #include "libutils.h"
       
    21 #include"std_log_result.h"
       
    22 #define LOG_FILENAME_LINE __FILE__, __LINE__
       
    23 int main()
       
    24 {
       
    25     __UHEAP_MARK;
       
    26     {
       
    27     int retval[10];
       
    28     _LIT(KTxt, "HelloHello");
       
    29     HBufC* buffer = HBufC::NewL(10);
       
    30     *buffer = KTxt;
       
    31     wstring myWstring;
       
    32     retval[0] = Hbufc16ToWstring(buffer,myWstring);
       
    33 
       
    34     TPtrC myTptr16(KTxt);
       
    35     retval[2] = WstringToTptrc16(myWstring,myTptr16);
       
    36 
       
    37     char* myChar = new char[40];
       
    38     int size = 40;
       
    39     retval[3] = Tptrc16ToCharp(myTptr16,myChar,size);
       
    40 
       
    41     TBufC8<30> buf8;
       
    42     TPtr8 myTptr = buf8.Des();  
       
    43     retval[4] = CharpToTptr8(myChar,myTptr);
       
    44 
       
    45     wchar_t* Wstr_fin = new wchar_t[36];
       
    46     int size_char=36;
       
    47     retval[5] = Tptr8ToWcharp(myTptr,Wstr_fin,size_char);
       
    48 
       
    49     HBufC16* finBuffer = HBufC16::NewMaxL(20);
       
    50     retval[6] = WcharToHbufc16(Wstr_fin,finBuffer);
       
    51     
       
    52     for(int i=1; i<=6; i++)
       
    53         {
       
    54         if (retval[i]!= 0)
       
    55                 printf("Conversion failed for retval\n",retval[i]);
       
    56         }
       
    57 
       
    58     if(!buffer->Compare(finBuffer->Des()))
       
    59     {
       
    60     printf("\n\nintegration_test_scenario25 case passed");
       
    61     }
       
    62     else
       
    63     {
       
    64     printf("\n\nintegration_test_scenario25 case failed");
       
    65     assert_failed = true;
       
    66     }
       
    67     delete buffer;
       
    68     delete[] myChar;
       
    69     delete[] Wstr_fin;
       
    70     delete 	finBuffer;
       
    71     }
       
    72     __UHEAP_MARKEND;
       
    73     testResultXml("integration_test_scenario25");
       
    74     return 0;
       
    75 }