50
|
1 |
// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
//
|
|
15 |
|
|
16 |
#undef G_DISABLE_ASSERT
|
|
17 |
#undef G_LOG_DOMAIN
|
|
18 |
|
72
|
19 |
#include <sys/stat.h>
|
50
|
20 |
#include <glib.h>
|
|
21 |
#include <errno.h>
|
72
|
22 |
#include <glib/gprintf.h>
|
|
23 |
#ifdef __SYMBIAN32__
|
|
24 |
#include "mrt2_glib2_test.h"
|
|
25 |
#endif /*__SYMBIAN32__*/
|
50
|
26 |
|
|
27 |
int main (int argc, char *argv[])
|
|
28 |
{
|
|
29 |
gunichar ret;
|
|
30 |
gunichar mark = 0x0BCA; //spacing mark. Tamil letter.
|
|
31 |
gunichar title = 0x01F2; //Latin letter.
|
|
32 |
gunichar square = 0x25A1; //white square
|
|
33 |
gunichar space = 0x200B; //zero width space
|
|
34 |
gunichar tel_symbol = 0x32C0; //telegraphic symbol for january
|
|
35 |
gunichar CR = 0x000D; //carriage return
|
|
36 |
GUnicodeBreakType type;
|
72
|
37 |
#ifdef __SYMBIAN32__
|
|
38 |
g_log_set_handler (NULL, G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, &mrtLogHandler, NULL);
|
|
39 |
g_set_print_handler(mrtPrintHandler);
|
|
40 |
#endif /*__SYMBIAN32__*/
|
50
|
41 |
|
72
|
42 |
g_print("Test unichar-test Start");
|
50
|
43 |
g_unichar_get_mirror_char('(', &ret);
|
|
44 |
|
|
45 |
if(!(')' == ret))
|
|
46 |
{
|
72
|
47 |
g_print("g_unichar_get_mirror_char didnt work as expected");
|
50
|
48 |
assert_failed = 1;
|
|
49 |
}
|
|
50 |
|
|
51 |
|
|
52 |
if(!g_unichar_ismark(mark))
|
|
53 |
{
|
72
|
54 |
g_print("g_unichar_ismark didnt work as expected");
|
50
|
55 |
assert_failed = 1;
|
|
56 |
}
|
|
57 |
|
|
58 |
if(!g_unichar_istitle(title))
|
|
59 |
{
|
72
|
60 |
g_print("g_unichar_istitle didnt work as expected");
|
50
|
61 |
assert_failed = 1;
|
|
62 |
}
|
|
63 |
|
|
64 |
if(!g_unichar_isdefined(square))
|
|
65 |
{
|
72
|
66 |
g_print("g_unichar_isdefined didnt work as expected");
|
50
|
67 |
assert_failed = 1;
|
|
68 |
}
|
|
69 |
|
|
70 |
if(!g_unichar_iszerowidth(space))
|
|
71 |
{
|
72
|
72 |
g_print("g_unichar_iszerowidth didnt work as expected");
|
50
|
73 |
assert_failed = 1;
|
|
74 |
}
|
|
75 |
|
|
76 |
if(!g_unichar_iswide(tel_symbol))
|
|
77 |
{
|
72
|
78 |
g_print("g_unichar_iswide didnt work as expected");
|
50
|
79 |
assert_failed = 1;
|
|
80 |
}
|
|
81 |
|
|
82 |
if(!g_unichar_iswide_cjk(tel_symbol))
|
|
83 |
{
|
72
|
84 |
g_print("g_unichar_iswide_cjk didnt work as expected");
|
50
|
85 |
assert_failed = 1;
|
|
86 |
}
|
|
87 |
|
|
88 |
ret = g_unichar_totitle('a');
|
|
89 |
if(!(ret == 'A'))
|
|
90 |
{
|
72
|
91 |
g_print("g_unichar_totitle didnt work as expected");
|
50
|
92 |
assert_failed = 1;
|
|
93 |
}
|
|
94 |
|
|
95 |
type = g_unichar_break_type(CR);
|
|
96 |
if(type != G_UNICODE_BREAK_CARRIAGE_RETURN)
|
|
97 |
{
|
72
|
98 |
g_print("g_unichar_break_type didnt work as expected");
|
50
|
99 |
assert_failed = 1;
|
|
100 |
}
|
|
101 |
|
|
102 |
if(assert_failed)
|
72
|
103 |
g_print("Test unichar-test Failed");
|
50
|
104 |
else
|
72
|
105 |
g_print("Test unichar-test Successful");
|
50
|
106 |
|
72
|
107 |
#if __SYMBIAN32__
|
|
108 |
testResultXml("unichar-test");
|
|
109 |
#endif /* EMULATOR */
|
50
|
110 |
return 0;
|
|
111 |
}
|