utilitylibraries/libutils/tsrc/src/integration_test_scenario24.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     RBuf8 rbuf;
       
    29     int size=10;
       
    30     _LIT8(Ktext_rbuf,"hello hi");
       
    31     rbuf.CreateL(Ktext_rbuf,size);
       
    32     wchar_t* myWchar = new wchar_t[10];
       
    33     retval[0] = Rbuf8ToWchar(rbuf,myWchar,size);
       
    34 
       
    35     TBufC8<30> buf;
       
    36     TPtrC8 myTptr8 = buf.Des();
       
    37     char* temp = new char[15];
       
    38     retval[0] = WcharpToTptrc8(myWchar,temp,myTptr8);
       
    39 
       
    40     wstring myWstring(L"gdfgdsgghdfssfsafdsf");
       
    41     retval[1] = Tptrc8ToWstring(myTptr8,myWstring);
       
    42 
       
    43     TBufC<30> tbuf;
       
    44     TPtrC16 myTptr16 = tbuf.Des();
       
    45     retval[2] = WstringToTptrc16(myWstring,myTptr16);
       
    46 
       
    47     char* myChar = new char[40];     
       
    48     int size_new = 40;
       
    49     retval[3] = Tptrc16ToCharp(myTptr16,myChar,size_new);
       
    50 
       
    51     TBufC8<30> buf8;
       
    52     TPtr8 myTptr = buf8.Des();  
       
    53     retval[4] = CharpToTptr8(myChar,myTptr);
       
    54 
       
    55     wchar_t* Wstr_fin = new wchar_t[36];
       
    56     int size_char=36;
       
    57     retval[5] = Tptr8ToWcharp(myTptr,Wstr_fin,size_char);
       
    58     
       
    59     for(int i=1; i<=5; i++)
       
    60         {
       
    61         if (retval[i]!= 0)
       
    62                 printf("Conversion failed for retval\n",retval[i]);
       
    63         }
       
    64 
       
    65     if(!wcscmp(myWchar,Wstr_fin))
       
    66     {
       
    67     printf("\n\nintegration_test_scenario24 case passed");
       
    68     }
       
    69     else
       
    70     {
       
    71     printf("\n\nintegration_test_scenario24 case failed");
       
    72     assert_failed = true;
       
    73     }
       
    74     rbuf.Close();
       
    75     delete[] myWchar;
       
    76     delete[] temp;
       
    77     delete[] myChar;
       
    78     delete[] Wstr_fin;	
       
    79     }
       
    80     __UHEAP_MARKEND;
       
    81     testResultXml("integration_test_scenario24");
       
    82     return 0;
       
    83 }