author | William Roberts <williamr@symbian.org> |
Thu, 22 Jul 2010 16:48:56 +0100 | |
branch | GCC_SURGE |
changeset 45 | 4b03adbd26ca |
parent 22 | ddc455616bd6 |
parent 34 | 5fae379060a7 |
permissions | -rw-r--r-- |
31 | 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 |
wchar_t* mycharstring = L"hello"; |
|
29 |
RBuf16 buf; |
|
34
5fae379060a7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
30 |
buf.CreateL(30); |
31 | 31 |
retval[0]= WcharToRbuf16(mycharstring,buf); |
32 |
||
33 |
wstring str; |
|
34 |
retval[1]= Rbuf16ToWstring(buf,str); |
|
35 |
||
36 |
TPtr8 tptr8((unsigned char*)"",10,20); |
|
37 |
char* temp_c = new char[20]; |
|
38 |
retval[2]= WstringToTptr8(str,temp_c,tptr8); |
|
39 |
||
40 |
char* mychar = new char[30]; |
|
41 |
int size=30; |
|
42 |
retval[3]= Tptr8ToChar(tptr8,mychar,size); |
|
43 |
||
44 |
HBufC16 *hbufc = HBufC16::NewMaxL(20); |
|
45 |
retval[4]= CharToHbufc16(mychar,hbufc); |
|
46 |
||
47 |
string mystring; |
|
48 |
int size_hbufc=55; |
|
49 |
retval[5]= Hbufc16ToString(hbufc,mystring,size_hbufc); |
|
50 |
||
51 |
wchar_t* temp = new wchar_t[50]; |
|
52 |
TPtrC16 tptrc; |
|
53 |
retval[6]= StringToTptrc16(mystring,temp,tptrc); |
|
54 |
||
55 |
for(int i=1; i<=6; i++) |
|
56 |
{ |
|
57 |
if (retval[i]!= 0) |
|
58 |
printf("Conversion failed for retval\n",retval[i]); |
|
59 |
} |
|
60 |
||
61 |
wchar_t* myfinalstring = new wchar_t[50]; |
|
62 |
int size_fin=55; |
|
63 |
retval[7]= Tptrc16ToWcharp(tptrc,myfinalstring,size_fin); |
|
64 |
||
65 |
if(!wcsncmp(mycharstring,myfinalstring,5)) |
|
66 |
{ |
|
67 |
printf("\nintegration_test_scenario20 case passed"); |
|
68 |
} |
|
69 |
else |
|
70 |
{ |
|
71 |
printf("\nintegration_test_scenario20 case failed"); |
|
72 |
assert_failed = true; |
|
73 |
} |
|
74 |
buf.Close(); |
|
75 |
delete[] temp_c; |
|
76 |
delete[] mychar; |
|
77 |
delete hbufc; |
|
78 |
delete[] temp; |
|
79 |
delete[] myfinalstring; |
|
80 |
} |
|
81 |
__UHEAP_MARKEND; |
|
82 |
testResultXml("integration_test_scenario20"); |
|
83 |
return 0; |
|
84 |
} |