1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <config_locales.h>
24 #include <osl/thread.h>
25 #include <rtl/tencinfo.h>
27 #include <cppunit/TestFixture.h>
28 #include <cppunit/extensions/HelperMacros.h>
29 #include <cppunit/plugin/TestPlugIn.h>
33 class testBestMime
: public CppUnit::TestFixture
36 void setUp() SAL_OVERRIDE
40 void check(rtl_TextEncoding eIn
, rtl_TextEncoding eOut
)
42 const sal_Char
*pCharSet
= rtl_getBestMimeCharsetFromTextEncoding(eIn
);
43 rtl_TextEncoding eTextEnc
= rtl_getTextEncodingFromMimeCharset(pCharSet
);
44 CPPUNIT_ASSERT_MESSAGE("rtl_getBestMimeCharsetFromTextEncoding && rtl_getTextEncodingFromMimeCharset differdiffer", eTextEnc
== eOut
);
47 // the defines for the follows test could be found in file inc/rtl/textenc.h
49 void MimeCharsetFromTextEncoding_MS_1252()
51 check( RTL_TEXTENCODING_MS_1252
, RTL_TEXTENCODING_MS_1252
);
54 void MimeCharsetFromTextEncoding_APPLE_ROMAN()
56 check( RTL_TEXTENCODING_APPLE_ROMAN
, RTL_TEXTENCODING_APPLE_ROMAN
);
59 void MimeCharsetFromTextEncoding_IBM_437()
61 check( RTL_TEXTENCODING_IBM_437
, RTL_TEXTENCODING_IBM_437
);
64 void MimeCharsetFromTextEncoding_IBM_850()
66 check( RTL_TEXTENCODING_IBM_850
, RTL_TEXTENCODING_IBM_850
);
69 void MimeCharsetFromTextEncoding_IBM_860()
71 check( RTL_TEXTENCODING_IBM_860
, RTL_TEXTENCODING_IBM_860
);
74 void MimeCharsetFromTextEncoding_IBM_861()
76 check( RTL_TEXTENCODING_IBM_861
, RTL_TEXTENCODING_IBM_861
);
79 void MimeCharsetFromTextEncoding_IBM_863()
81 check( RTL_TEXTENCODING_IBM_863
, RTL_TEXTENCODING_IBM_863
);
84 void MimeCharsetFromTextEncoding_IBM_865()
86 check( RTL_TEXTENCODING_IBM_865
, RTL_TEXTENCODING_IBM_865
);
89 void MimeCharsetFromTextEncoding_SYMBOL()
91 check( RTL_TEXTENCODING_SYMBOL
, RTL_TEXTENCODING_DONTKNOW
);
94 void MimeCharsetFromTextEncoding_ASCII_US()
96 check( RTL_TEXTENCODING_ASCII_US
, RTL_TEXTENCODING_ASCII_US
);
99 void MimeCharsetFromTextEncoding_ISO_8859_1()
101 check( RTL_TEXTENCODING_ISO_8859_1
, RTL_TEXTENCODING_ISO_8859_1
);
103 void MimeCharsetFromTextEncoding_ISO_8859_2()
105 check( RTL_TEXTENCODING_ISO_8859_2
, RTL_TEXTENCODING_ISO_8859_2
);
107 void MimeCharsetFromTextEncoding_ISO_8859_3()
109 check( RTL_TEXTENCODING_ISO_8859_3
, RTL_TEXTENCODING_ISO_8859_3
);
111 void MimeCharsetFromTextEncoding_ISO_8859_4()
113 check( RTL_TEXTENCODING_ISO_8859_4
, RTL_TEXTENCODING_ISO_8859_4
);
115 void MimeCharsetFromTextEncoding_ISO_8859_5()
117 check( RTL_TEXTENCODING_ISO_8859_5
, RTL_TEXTENCODING_ISO_8859_5
);
119 void MimeCharsetFromTextEncoding_ISO_8859_6()
121 check( RTL_TEXTENCODING_ISO_8859_6
, RTL_TEXTENCODING_ISO_8859_6
);
123 void MimeCharsetFromTextEncoding_ISO_8859_7()
125 check( RTL_TEXTENCODING_ISO_8859_7
, RTL_TEXTENCODING_ISO_8859_7
);
127 void MimeCharsetFromTextEncoding_ISO_8859_8()
129 check( RTL_TEXTENCODING_ISO_8859_8
, RTL_TEXTENCODING_ISO_8859_8
);
131 void MimeCharsetFromTextEncoding_ISO_8859_9()
133 check( RTL_TEXTENCODING_ISO_8859_9
, RTL_TEXTENCODING_ISO_8859_9
);
135 void MimeCharsetFromTextEncoding_ISO_8859_14()
137 check( RTL_TEXTENCODING_ISO_8859_14
, RTL_TEXTENCODING_ISO_8859_14
);
139 void MimeCharsetFromTextEncoding_ISO_8859_15()
141 check( RTL_TEXTENCODING_ISO_8859_15
, RTL_TEXTENCODING_ISO_8859_15
);
143 void MimeCharsetFromTextEncoding_IBM_737()
145 check( RTL_TEXTENCODING_IBM_737
, RTL_TEXTENCODING_ISO_8859_7
);
147 void MimeCharsetFromTextEncoding_IBM_775()
149 check( RTL_TEXTENCODING_IBM_775
, RTL_TEXTENCODING_ISO_8859_4
);
151 void MimeCharsetFromTextEncoding_IBM_852()
153 check( RTL_TEXTENCODING_IBM_852
, RTL_TEXTENCODING_IBM_852
);
155 void MimeCharsetFromTextEncoding_IBM_855()
157 check( RTL_TEXTENCODING_IBM_855
, RTL_TEXTENCODING_ISO_8859_5
);
159 void MimeCharsetFromTextEncoding_IBM_857()
161 check( RTL_TEXTENCODING_IBM_857
, RTL_TEXTENCODING_ISO_8859_9
);
163 void MimeCharsetFromTextEncoding_IBM_862()
165 check( RTL_TEXTENCODING_IBM_862
, RTL_TEXTENCODING_IBM_862
);
167 void MimeCharsetFromTextEncoding_IBM_864()
169 check( RTL_TEXTENCODING_IBM_864
, RTL_TEXTENCODING_IBM_864
);
171 void MimeCharsetFromTextEncoding_IBM_866()
173 check( RTL_TEXTENCODING_IBM_866
, RTL_TEXTENCODING_IBM_866
);
175 void MimeCharsetFromTextEncoding_IBM_869()
177 check( RTL_TEXTENCODING_IBM_869
, RTL_TEXTENCODING_ISO_8859_7
);
179 void MimeCharsetFromTextEncoding_MS_874()
181 check( RTL_TEXTENCODING_MS_874
, RTL_TEXTENCODING_MS_874
);
183 void MimeCharsetFromTextEncoding_MS_1250()
185 check( RTL_TEXTENCODING_MS_1250
, RTL_TEXTENCODING_MS_1250
);
187 void MimeCharsetFromTextEncoding_MS_1251()
189 check( RTL_TEXTENCODING_MS_1251
, RTL_TEXTENCODING_MS_1251
);
191 void MimeCharsetFromTextEncoding_MS_1253()
193 check( RTL_TEXTENCODING_MS_1253
, RTL_TEXTENCODING_MS_1253
);
195 void MimeCharsetFromTextEncoding_MS_1254()
197 check( RTL_TEXTENCODING_MS_1254
, RTL_TEXTENCODING_MS_1254
);
199 void MimeCharsetFromTextEncoding_MS_1255()
201 check( RTL_TEXTENCODING_MS_1255
, RTL_TEXTENCODING_MS_1255
);
203 void MimeCharsetFromTextEncoding_MS_1256()
205 check( RTL_TEXTENCODING_MS_1256
, RTL_TEXTENCODING_MS_1256
);
207 void MimeCharsetFromTextEncoding_MS_1257()
209 check( RTL_TEXTENCODING_MS_1257
, RTL_TEXTENCODING_MS_1257
);
211 void MimeCharsetFromTextEncoding_MS_1258()
213 check( RTL_TEXTENCODING_MS_1258
, RTL_TEXTENCODING_MS_1258
);
215 void MimeCharsetFromTextEncoding_APPLE_CENTEURO()
217 check( RTL_TEXTENCODING_APPLE_CENTEURO
, RTL_TEXTENCODING_ISO_8859_2
);
219 void MimeCharsetFromTextEncoding_APPLE_CROATIAN()
221 check( RTL_TEXTENCODING_APPLE_CROATIAN
, RTL_TEXTENCODING_ISO_8859_2
);
223 void MimeCharsetFromTextEncoding_APPLE_CYRILLIC()
225 check( RTL_TEXTENCODING_APPLE_CYRILLIC
, RTL_TEXTENCODING_ISO_8859_5
);
227 void MimeCharsetFromTextEncoding_APPLE_GREEK()
229 check( RTL_TEXTENCODING_APPLE_GREEK
, RTL_TEXTENCODING_ISO_8859_7
);
231 void MimeCharsetFromTextEncoding_APPLE_ICELAND()
233 check( RTL_TEXTENCODING_APPLE_ICELAND
, RTL_TEXTENCODING_ISO_8859_1
);
235 void MimeCharsetFromTextEncoding_APPLE_ROMANIAN()
237 check( RTL_TEXTENCODING_APPLE_ROMANIAN
, RTL_TEXTENCODING_ISO_8859_2
);
239 void MimeCharsetFromTextEncoding_APPLE_TURKISH()
241 check( RTL_TEXTENCODING_APPLE_TURKISH
, RTL_TEXTENCODING_ISO_8859_9
);
243 void MimeCharsetFromTextEncoding_APPLE_UKRAINIAN()
245 check( RTL_TEXTENCODING_APPLE_UKRAINIAN
, RTL_TEXTENCODING_ISO_8859_5
);
247 void MimeCharsetFromTextEncoding_MS_932()
249 check( RTL_TEXTENCODING_MS_932
, RTL_TEXTENCODING_SHIFT_JIS
);
251 void MimeCharsetFromTextEncoding_MS_936()
253 check( RTL_TEXTENCODING_MS_936
, RTL_TEXTENCODING_GB_2312
);
255 void MimeCharsetFromTextEncoding_MS_949()
257 check( RTL_TEXTENCODING_MS_949
, RTL_TEXTENCODING_EUC_KR
);
259 void MimeCharsetFromTextEncoding_MS_950()
261 check( RTL_TEXTENCODING_MS_950
, RTL_TEXTENCODING_BIG5
);
263 void MimeCharsetFromTextEncoding_KOI8_R()
265 check( RTL_TEXTENCODING_KOI8_R
, RTL_TEXTENCODING_KOI8_R
);
267 void MimeCharsetFromTextEncoding_UTF7()
269 check( RTL_TEXTENCODING_UTF7
, RTL_TEXTENCODING_UTF7
);
271 void MimeCharsetFromTextEncoding_UTF8()
273 check( RTL_TEXTENCODING_UTF8
, RTL_TEXTENCODING_UTF8
);
275 void MimeCharsetFromTextEncoding_ISO_8859_10()
277 check( RTL_TEXTENCODING_ISO_8859_10
, RTL_TEXTENCODING_ISO_8859_10
);
279 void MimeCharsetFromTextEncoding_ISO_8859_13()
281 check( RTL_TEXTENCODING_ISO_8859_13
, RTL_TEXTENCODING_ISO_8859_13
);
283 void MimeCharsetFromTextEncoding_MS_1361()
285 check( RTL_TEXTENCODING_MS_1361
, RTL_TEXTENCODING_EUC_KR
);
287 void MimeCharsetFromTextEncoding_TIS_620()
289 check( RTL_TEXTENCODING_TIS_620
, RTL_TEXTENCODING_TIS_620
);
291 void MimeCharsetFromTextEncoding_KOI8_U()
293 check( RTL_TEXTENCODING_KOI8_U
, RTL_TEXTENCODING_KOI8_U
);
295 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
296 void MimeCharsetFromTextEncoding_APPLE_JAPANESE()
298 check( RTL_TEXTENCODING_APPLE_JAPANESE
, RTL_TEXTENCODING_SHIFT_JIS
);
300 void MimeCharsetFromTextEncoding_SHIFT_JIS()
302 check( RTL_TEXTENCODING_SHIFT_JIS
, RTL_TEXTENCODING_SHIFT_JIS
);
304 void MimeCharsetFromTextEncoding_EUC_JP()
306 check( RTL_TEXTENCODING_EUC_JP
, RTL_TEXTENCODING_EUC_JP
);
308 void MimeCharsetFromTextEncoding_ISO_2022_JP()
310 check( RTL_TEXTENCODING_ISO_2022_JP
, RTL_TEXTENCODING_ISO_2022_JP
);
312 void MimeCharsetFromTextEncoding_JIS_X_0201()
314 check( RTL_TEXTENCODING_JIS_X_0201
, RTL_TEXTENCODING_EUC_JP
);
316 void MimeCharsetFromTextEncoding_JIS_X_0208()
318 check( RTL_TEXTENCODING_JIS_X_0208
, RTL_TEXTENCODING_EUC_JP
);
320 void MimeCharsetFromTextEncoding_JIS_X_0212()
322 check( RTL_TEXTENCODING_JIS_X_0212
, RTL_TEXTENCODING_EUC_JP
);
325 #if WITH_LOCALE_ALL || WITH_LOCALE_ko
326 void MimeCharsetFromTextEncoding_APPLE_KOREAN()
328 check( RTL_TEXTENCODING_APPLE_KOREAN
, RTL_TEXTENCODING_EUC_KR
);
330 void MimeCharsetFromTextEncoding_EUC_KR()
332 check( RTL_TEXTENCODING_EUC_KR
, RTL_TEXTENCODING_EUC_KR
);
334 void MimeCharsetFromTextEncoding_ISO_2022_KR()
336 check( RTL_TEXTENCODING_ISO_2022_KR
, RTL_TEXTENCODING_ISO_2022_KR
);
339 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
340 void MimeCharsetFromTextEncoding_APPLE_CHINSIMP()
342 check( RTL_TEXTENCODING_APPLE_CHINSIMP
, RTL_TEXTENCODING_GB_2312
);
344 void MimeCharsetFromTextEncoding_APPLE_CHINTRAD()
346 check( RTL_TEXTENCODING_APPLE_CHINTRAD
, RTL_TEXTENCODING_BIG5
);
348 void MimeCharsetFromTextEncoding_GB_2312()
350 check( RTL_TEXTENCODING_GB_2312
, RTL_TEXTENCODING_GB_2312
);
352 void MimeCharsetFromTextEncoding_GBT_12345()
354 check( RTL_TEXTENCODING_GBT_12345
, RTL_TEXTENCODING_GBT_12345
);
356 void MimeCharsetFromTextEncoding_GBK()
358 check( RTL_TEXTENCODING_GBK
, RTL_TEXTENCODING_GBK
);
360 void MimeCharsetFromTextEncoding_BIG5()
362 check( RTL_TEXTENCODING_BIG5
, RTL_TEXTENCODING_BIG5
);
364 void MimeCharsetFromTextEncoding_EUC_CN()
366 check( RTL_TEXTENCODING_EUC_CN
, RTL_TEXTENCODING_GB_2312
);
368 void MimeCharsetFromTextEncoding_EUC_TW()
370 check( RTL_TEXTENCODING_EUC_TW
, RTL_TEXTENCODING_BIG5
);
372 void MimeCharsetFromTextEncoding_ISO_2022_CN()
374 check( RTL_TEXTENCODING_ISO_2022_CN
, RTL_TEXTENCODING_ISO_2022_CN
);
376 void MimeCharsetFromTextEncoding_GB_18030()
378 check( RTL_TEXTENCODING_GB_18030
, RTL_TEXTENCODING_GB_18030
);
380 void MimeCharsetFromTextEncoding_BIG5_HKSCS()
382 check( RTL_TEXTENCODING_BIG5_HKSCS
, RTL_TEXTENCODING_BIG5_HKSCS
);
385 #if WITH_LOCALE_ALL || WITH_LOCALE_FOR_SCRIPT_Deva
386 void MimeCharsetFromTextEncoding_ISCII_DEVANAGARI()
388 check( RTL_TEXTENCODING_ISCII_DEVANAGARI
, RTL_TEXTENCODING_ISCII_DEVANAGARI
);
391 CPPUNIT_TEST_SUITE( testBestMime
);
393 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1252
);
394 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_ROMAN
);
395 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_437
);
396 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_850
);
397 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_860
);
398 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_861
);
399 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_863
);
400 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_865
);
401 CPPUNIT_TEST( MimeCharsetFromTextEncoding_SYMBOL
);
402 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ASCII_US
);
403 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_1
);
404 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_2
);
405 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_3
);
406 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_4
);
407 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_5
);
408 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_6
);
409 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_7
);
410 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_8
);
411 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_9
);
412 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_14
);
413 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_15
);
414 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_737
);
415 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_775
);
416 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_852
);
417 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_855
);
418 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_857
);
419 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_862
);
420 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_864
);
421 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_866
);
422 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_869
);
423 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_874
);
424 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1250
);
425 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1251
);
426 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1253
);
427 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1254
);
428 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1255
);
429 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1256
);
430 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1257
);
431 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1258
);
432 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CENTEURO
);
433 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CROATIAN
);
434 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CYRILLIC
);
435 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_GREEK
);
436 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_ICELAND
);
437 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_ROMANIAN
);
438 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_TURKISH
);
439 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_UKRAINIAN
);
440 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_932
);
441 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_936
);
442 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_949
);
443 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_950
);
444 CPPUNIT_TEST( MimeCharsetFromTextEncoding_KOI8_R
);
445 CPPUNIT_TEST( MimeCharsetFromTextEncoding_UTF7
);
446 CPPUNIT_TEST( MimeCharsetFromTextEncoding_UTF8
);
447 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_10
);
448 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_13
);
449 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1361
);
450 CPPUNIT_TEST( MimeCharsetFromTextEncoding_TIS_620
);
451 CPPUNIT_TEST( MimeCharsetFromTextEncoding_KOI8_U
);
452 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
453 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_JAPANESE
);
454 CPPUNIT_TEST( MimeCharsetFromTextEncoding_SHIFT_JIS
);
455 CPPUNIT_TEST( MimeCharsetFromTextEncoding_EUC_JP
);
456 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_2022_JP
);
457 CPPUNIT_TEST( MimeCharsetFromTextEncoding_JIS_X_0201
);
458 CPPUNIT_TEST( MimeCharsetFromTextEncoding_JIS_X_0208
);
459 CPPUNIT_TEST( MimeCharsetFromTextEncoding_JIS_X_0212
);
461 #if WITH_LOCALE_ALL || WITH_LOCALE_ko
462 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_KOREAN
);
463 CPPUNIT_TEST( MimeCharsetFromTextEncoding_EUC_KR
);
464 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_2022_KR
);
466 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
467 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CHINSIMP
);
468 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CHINTRAD
);
469 CPPUNIT_TEST( MimeCharsetFromTextEncoding_GB_2312
);
470 CPPUNIT_TEST( MimeCharsetFromTextEncoding_GBT_12345
);
471 CPPUNIT_TEST( MimeCharsetFromTextEncoding_GBK
);
472 CPPUNIT_TEST( MimeCharsetFromTextEncoding_BIG5
);
473 CPPUNIT_TEST( MimeCharsetFromTextEncoding_EUC_CN
);
474 CPPUNIT_TEST( MimeCharsetFromTextEncoding_EUC_TW
);
475 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_2022_CN
);
476 CPPUNIT_TEST( MimeCharsetFromTextEncoding_GB_18030
);
477 CPPUNIT_TEST( MimeCharsetFromTextEncoding_BIG5_HKSCS
);
479 #if WITH_LOCALE_ALL || WITH_LOCALE_FOR_SCRIPT_Deva
480 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISCII_DEVANAGARI
);
482 CPPUNIT_TEST_SUITE_END( );
485 class testBestUnix
: public CppUnit::TestFixture
488 void setUp() SAL_OVERRIDE
492 void check(rtl_TextEncoding eIn
, rtl_TextEncoding eOut
)
494 const sal_Char
*pCharSet
= rtl_getBestUnixCharsetFromTextEncoding(eIn
);
495 rtl_TextEncoding eTextEnc
= rtl_getTextEncodingFromUnixCharset(pCharSet
);
496 CPPUNIT_ASSERT_MESSAGE("rtl_getBestUnixCharsetFromTextEncoding && rtl_getTextEncodingFromUnixCharset", eTextEnc
== eOut
);
499 void UnixCharsetFromTextEncoding_MS_1252()
501 check( RTL_TEXTENCODING_MS_1252
, RTL_TEXTENCODING_ISO_8859_1
);
504 void UnixCharsetFromTextEncoding_APPLE_ROMAN()
506 check( RTL_TEXTENCODING_APPLE_ROMAN
, RTL_TEXTENCODING_ISO_8859_1
);
509 void UnixCharsetFromTextEncoding_IBM_437()
511 check( RTL_TEXTENCODING_IBM_437
, RTL_TEXTENCODING_ISO_8859_1
);
514 void UnixCharsetFromTextEncoding_IBM_850()
516 check( RTL_TEXTENCODING_IBM_850
, RTL_TEXTENCODING_ISO_8859_1
);
519 void UnixCharsetFromTextEncoding_IBM_860()
521 check( RTL_TEXTENCODING_IBM_860
, RTL_TEXTENCODING_ISO_8859_1
);
524 void UnixCharsetFromTextEncoding_IBM_861()
526 check( RTL_TEXTENCODING_IBM_861
, RTL_TEXTENCODING_ISO_8859_1
);
529 void UnixCharsetFromTextEncoding_IBM_863()
531 check( RTL_TEXTENCODING_IBM_863
, RTL_TEXTENCODING_ISO_8859_1
);
534 void UnixCharsetFromTextEncoding_IBM_865()
536 check( RTL_TEXTENCODING_IBM_865
, RTL_TEXTENCODING_ISO_8859_1
);
539 void UnixCharsetFromTextEncoding_SYMBOL()
541 check( RTL_TEXTENCODING_SYMBOL
, RTL_TEXTENCODING_SYMBOL
);
544 void UnixCharsetFromTextEncoding_ASCII_US()
546 check( RTL_TEXTENCODING_ASCII_US
, RTL_TEXTENCODING_ISO_8859_1
);
549 void UnixCharsetFromTextEncoding_ISO_8859_1()
551 check( RTL_TEXTENCODING_ISO_8859_1
, RTL_TEXTENCODING_ISO_8859_1
);
554 void UnixCharsetFromTextEncoding_ISO_8859_2()
556 check( RTL_TEXTENCODING_ISO_8859_2
, RTL_TEXTENCODING_ISO_8859_2
);
559 void UnixCharsetFromTextEncoding_ISO_8859_3()
561 check( RTL_TEXTENCODING_ISO_8859_3
, RTL_TEXTENCODING_ISO_8859_3
);
564 void UnixCharsetFromTextEncoding_ISO_8859_4()
566 check( RTL_TEXTENCODING_ISO_8859_4
, RTL_TEXTENCODING_ISO_8859_4
);
569 void UnixCharsetFromTextEncoding_ISO_8859_5()
571 check( RTL_TEXTENCODING_ISO_8859_5
, RTL_TEXTENCODING_ISO_8859_5
);
574 void UnixCharsetFromTextEncoding_ISO_8859_6()
576 check( RTL_TEXTENCODING_ISO_8859_6
, RTL_TEXTENCODING_ISO_8859_6
);
579 void UnixCharsetFromTextEncoding_ISO_8859_7()
581 check( RTL_TEXTENCODING_ISO_8859_7
, RTL_TEXTENCODING_ISO_8859_7
);
584 void UnixCharsetFromTextEncoding_ISO_8859_8()
586 check( RTL_TEXTENCODING_ISO_8859_8
, RTL_TEXTENCODING_ISO_8859_8
);
589 void UnixCharsetFromTextEncoding_ISO_8859_9()
591 check( RTL_TEXTENCODING_ISO_8859_9
, RTL_TEXTENCODING_ISO_8859_9
);
594 void UnixCharsetFromTextEncoding_ISO_8859_14()
596 check( RTL_TEXTENCODING_ISO_8859_14
, RTL_TEXTENCODING_ISO_8859_14
);
599 void UnixCharsetFromTextEncoding_ISO_8859_15()
601 check( RTL_TEXTENCODING_ISO_8859_15
, RTL_TEXTENCODING_ISO_8859_15
);
604 void UnixCharsetFromTextEncoding_IBM_737()
606 check( RTL_TEXTENCODING_IBM_737
, RTL_TEXTENCODING_ISO_8859_7
);
609 void UnixCharsetFromTextEncoding_IBM_775()
611 check( RTL_TEXTENCODING_IBM_775
, RTL_TEXTENCODING_ISO_8859_4
);
614 void UnixCharsetFromTextEncoding_IBM_852()
616 check( RTL_TEXTENCODING_IBM_852
, RTL_TEXTENCODING_ISO_8859_2
);
619 void UnixCharsetFromTextEncoding_IBM_855()
621 check( RTL_TEXTENCODING_IBM_855
, RTL_TEXTENCODING_ISO_8859_5
);
624 void UnixCharsetFromTextEncoding_IBM_857()
626 check( RTL_TEXTENCODING_IBM_857
, RTL_TEXTENCODING_ISO_8859_9
);
629 void UnixCharsetFromTextEncoding_IBM_862()
631 check( RTL_TEXTENCODING_IBM_862
, RTL_TEXTENCODING_ISO_8859_8
);
634 void UnixCharsetFromTextEncoding_IBM_864()
636 check( RTL_TEXTENCODING_IBM_864
, RTL_TEXTENCODING_ISO_8859_6
);
639 void UnixCharsetFromTextEncoding_IBM_866()
641 check( RTL_TEXTENCODING_IBM_866
, RTL_TEXTENCODING_ISO_8859_5
);
644 void UnixCharsetFromTextEncoding_IBM_869()
646 check( RTL_TEXTENCODING_IBM_869
, RTL_TEXTENCODING_ISO_8859_7
);
649 void UnixCharsetFromTextEncoding_MS_874()
651 check( RTL_TEXTENCODING_MS_874
, RTL_TEXTENCODING_ISO_8859_1
);
654 void UnixCharsetFromTextEncoding_MS_1250()
656 check( RTL_TEXTENCODING_MS_1250
, RTL_TEXTENCODING_ISO_8859_2
);
659 void UnixCharsetFromTextEncoding_MS_1251()
661 check( RTL_TEXTENCODING_MS_1251
, RTL_TEXTENCODING_ISO_8859_5
);
664 void UnixCharsetFromTextEncoding_MS_1253()
666 check( RTL_TEXTENCODING_MS_1253
, RTL_TEXTENCODING_ISO_8859_7
);
669 void UnixCharsetFromTextEncoding_MS_1254()
671 check( RTL_TEXTENCODING_MS_1254
, RTL_TEXTENCODING_ISO_8859_9
);
674 void UnixCharsetFromTextEncoding_MS_1255()
676 check( RTL_TEXTENCODING_MS_1255
, RTL_TEXTENCODING_ISO_8859_8
);
679 void UnixCharsetFromTextEncoding_MS_1256()
681 check( RTL_TEXTENCODING_MS_1256
, RTL_TEXTENCODING_ISO_8859_6
);
684 void UnixCharsetFromTextEncoding_MS_1257()
686 check( RTL_TEXTENCODING_MS_1257
, RTL_TEXTENCODING_ISO_8859_4
);
689 void UnixCharsetFromTextEncoding_MS_1258()
691 check( RTL_TEXTENCODING_MS_1258
, RTL_TEXTENCODING_ISO_8859_1
);
694 void UnixCharsetFromTextEncoding_APPLE_CENTEURO()
696 check( RTL_TEXTENCODING_APPLE_CENTEURO
, RTL_TEXTENCODING_ISO_8859_2
);
699 void UnixCharsetFromTextEncoding_APPLE_CROATIAN()
701 check( RTL_TEXTENCODING_APPLE_CROATIAN
, RTL_TEXTENCODING_ISO_8859_2
);
704 void UnixCharsetFromTextEncoding_APPLE_CYRILLIC()
706 check( RTL_TEXTENCODING_APPLE_CYRILLIC
, RTL_TEXTENCODING_ISO_8859_5
);
709 void UnixCharsetFromTextEncoding_APPLE_GREEK()
711 check( RTL_TEXTENCODING_APPLE_GREEK
, RTL_TEXTENCODING_ISO_8859_7
);
714 void UnixCharsetFromTextEncoding_APPLE_ICELAND()
716 check( RTL_TEXTENCODING_APPLE_ICELAND
, RTL_TEXTENCODING_ISO_8859_1
);
719 void UnixCharsetFromTextEncoding_APPLE_ROMANIAN()
721 check( RTL_TEXTENCODING_APPLE_ROMANIAN
, RTL_TEXTENCODING_ISO_8859_2
);
724 void UnixCharsetFromTextEncoding_APPLE_TURKISH()
726 check( RTL_TEXTENCODING_APPLE_TURKISH
, RTL_TEXTENCODING_ISO_8859_9
);
729 void UnixCharsetFromTextEncoding_APPLE_UKRAINIAN()
731 check( RTL_TEXTENCODING_APPLE_UKRAINIAN
, RTL_TEXTENCODING_ISO_8859_5
);
733 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
734 void UnixCharsetFromTextEncoding_APPLE_CHINSIMP()
736 check( RTL_TEXTENCODING_APPLE_CHINSIMP
, RTL_TEXTENCODING_DONTKNOW
);
739 void UnixCharsetFromTextEncoding_APPLE_CHINTRAD()
741 check( RTL_TEXTENCODING_APPLE_CHINTRAD
, RTL_TEXTENCODING_DONTKNOW
);
744 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
745 void UnixCharsetFromTextEncoding_APPLE_JAPANESE()
747 check( RTL_TEXTENCODING_APPLE_JAPANESE
, RTL_TEXTENCODING_DONTKNOW
);
750 #if WITH_LOCALE_ALL || WITH_LOCALE_ko
751 void UnixCharsetFromTextEncoding_APPLE_KOREAN()
753 check( RTL_TEXTENCODING_APPLE_KOREAN
, RTL_TEXTENCODING_DONTKNOW
);
756 void UnixCharsetFromTextEncoding_MS_932()
758 check( RTL_TEXTENCODING_MS_932
, RTL_TEXTENCODING_DONTKNOW
);
761 void UnixCharsetFromTextEncoding_MS_936()
763 check( RTL_TEXTENCODING_MS_936
, RTL_TEXTENCODING_DONTKNOW
);
766 void UnixCharsetFromTextEncoding_MS_949()
768 check( RTL_TEXTENCODING_MS_949
, RTL_TEXTENCODING_DONTKNOW
);
771 void UnixCharsetFromTextEncoding_MS_950()
773 check( RTL_TEXTENCODING_MS_950
, RTL_TEXTENCODING_DONTKNOW
);
775 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
776 void UnixCharsetFromTextEncoding_SHIFT_JIS()
778 check( RTL_TEXTENCODING_SHIFT_JIS
, RTL_TEXTENCODING_DONTKNOW
);
781 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
782 void UnixCharsetFromTextEncoding_GB_2312()
784 check( RTL_TEXTENCODING_GB_2312
, RTL_TEXTENCODING_DONTKNOW
);
787 void UnixCharsetFromTextEncoding_GBT_12345()
789 check( RTL_TEXTENCODING_GBT_12345
, RTL_TEXTENCODING_DONTKNOW
);
792 void UnixCharsetFromTextEncoding_GBK()
794 check( RTL_TEXTENCODING_GBK
, RTL_TEXTENCODING_DONTKNOW
);
797 void UnixCharsetFromTextEncoding_BIG5()
799 check( RTL_TEXTENCODING_BIG5
, RTL_TEXTENCODING_DONTKNOW
);
802 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
803 void UnixCharsetFromTextEncoding_EUC_JP()
805 check( RTL_TEXTENCODING_EUC_JP
, RTL_TEXTENCODING_DONTKNOW
);
808 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
809 void UnixCharsetFromTextEncoding_EUC_CN()
811 check( RTL_TEXTENCODING_EUC_CN
, RTL_TEXTENCODING_DONTKNOW
);
814 void UnixCharsetFromTextEncoding_EUC_TW()
816 check( RTL_TEXTENCODING_EUC_TW
, RTL_TEXTENCODING_DONTKNOW
);
819 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
820 void UnixCharsetFromTextEncoding_ISO_2022_JP()
822 check( RTL_TEXTENCODING_ISO_2022_JP
, RTL_TEXTENCODING_DONTKNOW
);
825 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
826 void UnixCharsetFromTextEncoding_ISO_2022_CN()
828 check( RTL_TEXTENCODING_ISO_2022_CN
, RTL_TEXTENCODING_DONTKNOW
);
831 void UnixCharsetFromTextEncoding_KOI8_R()
833 check( RTL_TEXTENCODING_KOI8_R
, RTL_TEXTENCODING_KOI8_R
);
836 void UnixCharsetFromTextEncoding_UTF7()
838 check( RTL_TEXTENCODING_UTF7
, RTL_TEXTENCODING_ISO_8859_1
);
841 void UnixCharsetFromTextEncoding_UTF8()
843 check( RTL_TEXTENCODING_UTF8
, RTL_TEXTENCODING_ISO_8859_1
);
846 void UnixCharsetFromTextEncoding_ISO_8859_10()
848 check( RTL_TEXTENCODING_ISO_8859_10
, RTL_TEXTENCODING_ISO_8859_10
);
851 void UnixCharsetFromTextEncoding_ISO_8859_13()
853 check( RTL_TEXTENCODING_ISO_8859_13
, RTL_TEXTENCODING_ISO_8859_13
);
855 #if WITH_LOCALE_ALL || WITH_LOCALE_ko
856 void UnixCharsetFromTextEncoding_EUC_KR()
858 check( RTL_TEXTENCODING_EUC_KR
, RTL_TEXTENCODING_DONTKNOW
);
861 void UnixCharsetFromTextEncoding_ISO_2022_KR()
863 check( RTL_TEXTENCODING_ISO_2022_KR
, RTL_TEXTENCODING_DONTKNOW
);
866 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
867 void UnixCharsetFromTextEncoding_JIS_X_0201()
869 check( RTL_TEXTENCODING_JIS_X_0201
, RTL_TEXTENCODING_DONTKNOW
);
872 void UnixCharsetFromTextEncoding_JIS_X_0208()
874 check( RTL_TEXTENCODING_JIS_X_0208
, RTL_TEXTENCODING_DONTKNOW
);
877 void UnixCharsetFromTextEncoding_JIS_X_0212()
879 check( RTL_TEXTENCODING_JIS_X_0212
, RTL_TEXTENCODING_DONTKNOW
);
882 void UnixCharsetFromTextEncoding_MS_1361()
884 check( RTL_TEXTENCODING_MS_1361
, RTL_TEXTENCODING_DONTKNOW
);
886 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
887 void UnixCharsetFromTextEncoding_GB_18030()
889 check( RTL_TEXTENCODING_GB_18030
, RTL_TEXTENCODING_GBK
);
892 void UnixCharsetFromTextEncoding_BIG5_HKSCS()
894 check( RTL_TEXTENCODING_BIG5_HKSCS
, RTL_TEXTENCODING_DONTKNOW
);
897 void UnixCharsetFromTextEncoding_TIS_620()
899 check( RTL_TEXTENCODING_TIS_620
, RTL_TEXTENCODING_ISO_8859_1
);
902 void UnixCharsetFromTextEncoding_KOI8_U()
904 check( RTL_TEXTENCODING_KOI8_U
, RTL_TEXTENCODING_KOI8_U
);
907 CPPUNIT_TEST_SUITE( testBestUnix
);
908 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1252
);
909 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_ROMAN
);
910 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_437
);
911 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_850
);
912 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_860
);
913 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_861
);
914 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_863
);
915 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_865
);
917 CPPUNIT_TEST( UnixCharsetFromTextEncoding_SYMBOL
);
918 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ASCII_US
);
919 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_1
);
920 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_2
);
921 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_3
);
922 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_4
);
923 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_5
);
924 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_6
);
925 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_7
);
926 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_8
);
927 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_9
);
928 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_14
);
929 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_15
);
930 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_737
);
931 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_775
);
932 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_852
);
933 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_855
);
934 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_857
);
935 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_862
);
936 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_864
);
937 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_866
);
938 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_869
);
939 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_874
);
940 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1250
);
941 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1251
);
942 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1253
);
943 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1254
);
944 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1255
);
945 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1256
);
946 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1257
);
947 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1258
);
948 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CENTEURO
);
949 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CROATIAN
);
950 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CYRILLIC
);
951 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_GREEK
);
952 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_ICELAND
);
953 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_ROMANIAN
);
954 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_TURKISH
);
955 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_UKRAINIAN
);
956 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
957 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CHINSIMP
);
958 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CHINTRAD
);
960 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
961 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_JAPANESE
);
963 #if WITH_LOCALE_ALL || WITH_LOCALE_ko
964 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_KOREAN
);
966 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_932
);
967 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_936
);
968 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_949
);
969 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_950
);
970 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
971 CPPUNIT_TEST( UnixCharsetFromTextEncoding_SHIFT_JIS
);
973 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
974 CPPUNIT_TEST( UnixCharsetFromTextEncoding_GB_2312
);
975 CPPUNIT_TEST( UnixCharsetFromTextEncoding_GBT_12345
);
976 CPPUNIT_TEST( UnixCharsetFromTextEncoding_GBK
);
977 CPPUNIT_TEST( UnixCharsetFromTextEncoding_BIG5
);
979 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
980 CPPUNIT_TEST( UnixCharsetFromTextEncoding_EUC_JP
);
982 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
983 CPPUNIT_TEST( UnixCharsetFromTextEncoding_EUC_CN
);
984 CPPUNIT_TEST( UnixCharsetFromTextEncoding_EUC_TW
);
986 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
987 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_2022_JP
);
989 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
990 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_2022_CN
);
992 CPPUNIT_TEST( UnixCharsetFromTextEncoding_KOI8_R
);
993 CPPUNIT_TEST( UnixCharsetFromTextEncoding_UTF7
);
994 CPPUNIT_TEST( UnixCharsetFromTextEncoding_UTF8
);
995 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_10
);
996 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_13
);
997 #if WITH_LOCALE_ALL || WITH_LOCALE_ko
998 CPPUNIT_TEST( UnixCharsetFromTextEncoding_EUC_KR
);
999 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_2022_KR
);
1001 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
1002 CPPUNIT_TEST( UnixCharsetFromTextEncoding_JIS_X_0201
);
1003 CPPUNIT_TEST( UnixCharsetFromTextEncoding_JIS_X_0208
);
1004 CPPUNIT_TEST( UnixCharsetFromTextEncoding_JIS_X_0212
);
1006 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1361
);
1007 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
1008 CPPUNIT_TEST( UnixCharsetFromTextEncoding_GB_18030
);
1009 CPPUNIT_TEST( UnixCharsetFromTextEncoding_BIG5_HKSCS
);
1011 CPPUNIT_TEST( UnixCharsetFromTextEncoding_TIS_620
);
1012 CPPUNIT_TEST( UnixCharsetFromTextEncoding_KOI8_U
);
1014 CPPUNIT_TEST_SUITE_END( );
1017 class testBestWindows
: public CppUnit::TestFixture
1020 void setUp() SAL_OVERRIDE
1024 void check(rtl_TextEncoding nIn
, rtl_TextEncoding nOut
)
1026 const sal_uInt8 nCharSet
= rtl_getBestWindowsCharsetFromTextEncoding(nIn
);
1027 rtl_TextEncoding eTextEnc
= rtl_getTextEncodingFromWindowsCharset(nCharSet
);
1028 CPPUNIT_ASSERT_MESSAGE("rtl_getBestWindowsCharsetFromTextEncoding && rtl_getTextEncodingFromWindowsCharset differ", eTextEnc
== nOut
);
1031 void WindowsCharsetFromTextEncoding_MS_1252()
1033 check( RTL_TEXTENCODING_MS_1252
, RTL_TEXTENCODING_MS_1252
);
1036 void WindowsCharsetFromTextEncoding_APPLE_ROMAN()
1038 check( RTL_TEXTENCODING_APPLE_ROMAN
, RTL_TEXTENCODING_APPLE_ROMAN
);
1041 void WindowsCharsetFromTextEncoding_IBM_437()
1043 check( RTL_TEXTENCODING_IBM_437
, RTL_TEXTENCODING_MS_1252
);
1046 void WindowsCharsetFromTextEncoding_IBM_850()
1048 check( RTL_TEXTENCODING_IBM_850
, RTL_TEXTENCODING_MS_1252
);
1051 void WindowsCharsetFromTextEncoding_IBM_860()
1053 check( RTL_TEXTENCODING_IBM_860
, RTL_TEXTENCODING_MS_1252
);
1056 void WindowsCharsetFromTextEncoding_IBM_861()
1058 check( RTL_TEXTENCODING_IBM_861
, RTL_TEXTENCODING_MS_1252
);
1061 void WindowsCharsetFromTextEncoding_IBM_863()
1063 check( RTL_TEXTENCODING_IBM_863
, RTL_TEXTENCODING_MS_1252
);
1066 void WindowsCharsetFromTextEncoding_IBM_865()
1068 check( RTL_TEXTENCODING_IBM_865
, RTL_TEXTENCODING_MS_1252
);
1071 void WindowsCharsetFromTextEncoding_SYMBOL()
1073 check( RTL_TEXTENCODING_SYMBOL
, RTL_TEXTENCODING_SYMBOL
);
1076 void WindowsCharsetFromTextEncoding_ASCII_US()
1078 check( RTL_TEXTENCODING_ASCII_US
, RTL_TEXTENCODING_MS_1252
);
1081 void WindowsCharsetFromTextEncoding_ISO_8859_1()
1083 check( RTL_TEXTENCODING_ISO_8859_1
, RTL_TEXTENCODING_MS_1252
);
1086 void WindowsCharsetFromTextEncoding_ISO_8859_2()
1088 check( RTL_TEXTENCODING_ISO_8859_2
, RTL_TEXTENCODING_MS_1252
);
1091 void WindowsCharsetFromTextEncoding_ISO_8859_3()
1093 check( RTL_TEXTENCODING_ISO_8859_3
, RTL_TEXTENCODING_MS_1252
);
1096 void WindowsCharsetFromTextEncoding_ISO_8859_4()
1098 check( RTL_TEXTENCODING_ISO_8859_4
, RTL_TEXTENCODING_MS_1257
);
1101 void WindowsCharsetFromTextEncoding_ISO_8859_5()
1103 check( RTL_TEXTENCODING_ISO_8859_5
, RTL_TEXTENCODING_MS_1252
);
1106 void WindowsCharsetFromTextEncoding_ISO_8859_6()
1108 check( RTL_TEXTENCODING_ISO_8859_6
, RTL_TEXTENCODING_MS_1252
);
1111 void WindowsCharsetFromTextEncoding_ISO_8859_7()
1113 check( RTL_TEXTENCODING_ISO_8859_7
, RTL_TEXTENCODING_MS_1252
);
1116 void WindowsCharsetFromTextEncoding_ISO_8859_8()
1118 check( RTL_TEXTENCODING_ISO_8859_8
, RTL_TEXTENCODING_MS_1252
);
1121 void WindowsCharsetFromTextEncoding_ISO_8859_9()
1123 check( RTL_TEXTENCODING_ISO_8859_9
, RTL_TEXTENCODING_MS_1252
);
1126 void WindowsCharsetFromTextEncoding_ISO_8859_14()
1128 check( RTL_TEXTENCODING_ISO_8859_14
, RTL_TEXTENCODING_MS_1252
);
1131 void WindowsCharsetFromTextEncoding_ISO_8859_15()
1133 check( RTL_TEXTENCODING_ISO_8859_15
, RTL_TEXTENCODING_MS_1252
);
1136 void WindowsCharsetFromTextEncoding_IBM_737()
1138 check( RTL_TEXTENCODING_IBM_737
, RTL_TEXTENCODING_MS_1252
);
1141 void WindowsCharsetFromTextEncoding_IBM_775()
1143 check( RTL_TEXTENCODING_IBM_775
, RTL_TEXTENCODING_MS_1252
);
1146 void WindowsCharsetFromTextEncoding_IBM_852()
1148 check( RTL_TEXTENCODING_IBM_852
, RTL_TEXTENCODING_MS_1252
);
1151 void WindowsCharsetFromTextEncoding_IBM_855()
1153 check( RTL_TEXTENCODING_IBM_855
, RTL_TEXTENCODING_MS_1252
);
1156 void WindowsCharsetFromTextEncoding_IBM_857()
1158 check( RTL_TEXTENCODING_IBM_857
, RTL_TEXTENCODING_MS_1252
);
1161 void WindowsCharsetFromTextEncoding_IBM_862()
1163 check( RTL_TEXTENCODING_IBM_862
, RTL_TEXTENCODING_MS_1252
);
1166 void WindowsCharsetFromTextEncoding_IBM_864()
1168 check( RTL_TEXTENCODING_IBM_864
, RTL_TEXTENCODING_MS_1252
);
1171 void WindowsCharsetFromTextEncoding_IBM_866()
1173 check( RTL_TEXTENCODING_IBM_866
, RTL_TEXTENCODING_MS_1252
);
1176 void WindowsCharsetFromTextEncoding_IBM_869()
1178 check( RTL_TEXTENCODING_IBM_869
, RTL_TEXTENCODING_MS_1252
);
1181 void WindowsCharsetFromTextEncoding_MS_874()
1183 check( RTL_TEXTENCODING_MS_874
, RTL_TEXTENCODING_MS_1252
);
1186 void WindowsCharsetFromTextEncoding_MS_1250()
1188 check( RTL_TEXTENCODING_MS_1250
, RTL_TEXTENCODING_MS_1252
);
1191 void WindowsCharsetFromTextEncoding_MS_1251()
1193 check( RTL_TEXTENCODING_MS_1251
, RTL_TEXTENCODING_MS_1252
);
1196 void WindowsCharsetFromTextEncoding_MS_1253()
1198 check( RTL_TEXTENCODING_MS_1253
, RTL_TEXTENCODING_MS_1252
);
1201 void WindowsCharsetFromTextEncoding_MS_1254()
1203 check( RTL_TEXTENCODING_MS_1254
, RTL_TEXTENCODING_MS_1252
);
1206 void WindowsCharsetFromTextEncoding_MS_1255()
1208 check( RTL_TEXTENCODING_MS_1255
, RTL_TEXTENCODING_MS_1252
);
1211 void WindowsCharsetFromTextEncoding_MS_1256()
1213 check( RTL_TEXTENCODING_MS_1256
, RTL_TEXTENCODING_MS_1252
);
1216 void WindowsCharsetFromTextEncoding_MS_1257()
1218 check( RTL_TEXTENCODING_MS_1257
, RTL_TEXTENCODING_MS_1252
);
1221 void WindowsCharsetFromTextEncoding_MS_1258()
1223 check( RTL_TEXTENCODING_MS_1258
, RTL_TEXTENCODING_MS_1252
);
1226 void WindowsCharsetFromTextEncoding_APPLE_ARABIC()
1228 check( RTL_TEXTENCODING_APPLE_ARABIC
, RTL_TEXTENCODING_MS_1252
);
1231 void WindowsCharsetFromTextEncoding_APPLE_CENTEURO()
1233 check( RTL_TEXTENCODING_APPLE_CENTEURO
, RTL_TEXTENCODING_MS_1252
);
1236 void WindowsCharsetFromTextEncoding_APPLE_CROATIAN()
1238 check( RTL_TEXTENCODING_APPLE_CROATIAN
, RTL_TEXTENCODING_MS_1252
);
1241 void WindowsCharsetFromTextEncoding_APPLE_CYRILLIC()
1243 check( RTL_TEXTENCODING_APPLE_CYRILLIC
, RTL_TEXTENCODING_MS_1252
);
1246 void WindowsCharsetFromTextEncoding_APPLE_DEVANAGARI()
1248 check( RTL_TEXTENCODING_APPLE_DEVANAGARI
, RTL_TEXTENCODING_MS_1252
);
1251 void WindowsCharsetFromTextEncoding_APPLE_FARSI()
1253 check( RTL_TEXTENCODING_APPLE_FARSI
, RTL_TEXTENCODING_MS_1252
);
1256 void WindowsCharsetFromTextEncoding_APPLE_GREEK()
1258 check( RTL_TEXTENCODING_APPLE_GREEK
, RTL_TEXTENCODING_MS_1252
);
1261 void WindowsCharsetFromTextEncoding_APPLE_GUJARATI()
1263 check( RTL_TEXTENCODING_APPLE_GUJARATI
, RTL_TEXTENCODING_MS_1252
);
1266 void WindowsCharsetFromTextEncoding_APPLE_GURMUKHI()
1268 check( RTL_TEXTENCODING_APPLE_GURMUKHI
, RTL_TEXTENCODING_MS_1252
);
1271 void WindowsCharsetFromTextEncoding_APPLE_HEBREW()
1273 check( RTL_TEXTENCODING_APPLE_HEBREW
, RTL_TEXTENCODING_MS_1252
);
1276 void WindowsCharsetFromTextEncoding_APPLE_ICELAND()
1278 check( RTL_TEXTENCODING_APPLE_ICELAND
, RTL_TEXTENCODING_MS_1252
);
1281 void WindowsCharsetFromTextEncoding_APPLE_ROMANIAN()
1283 check( RTL_TEXTENCODING_APPLE_ROMANIAN
, RTL_TEXTENCODING_MS_1252
);
1286 void WindowsCharsetFromTextEncoding_APPLE_THAI()
1288 check( RTL_TEXTENCODING_APPLE_THAI
, RTL_TEXTENCODING_MS_1252
);
1291 void WindowsCharsetFromTextEncoding_APPLE_TURKISH()
1293 check( RTL_TEXTENCODING_APPLE_TURKISH
, RTL_TEXTENCODING_MS_1252
);
1296 void WindowsCharsetFromTextEncoding_APPLE_UKRAINIAN()
1298 check( RTL_TEXTENCODING_APPLE_UKRAINIAN
, RTL_TEXTENCODING_MS_1252
);
1301 void WindowsCharsetFromTextEncoding_APPLE_CHINSIMP()
1303 check( RTL_TEXTENCODING_APPLE_CHINSIMP
, RTL_TEXTENCODING_MS_1252
);
1306 void WindowsCharsetFromTextEncoding_APPLE_CHINTRAD()
1308 check( RTL_TEXTENCODING_APPLE_CHINTRAD
, RTL_TEXTENCODING_MS_1252
);
1311 void WindowsCharsetFromTextEncoding_APPLE_JAPANESE()
1313 check( RTL_TEXTENCODING_APPLE_JAPANESE
, RTL_TEXTENCODING_MS_1252
);
1316 void WindowsCharsetFromTextEncoding_APPLE_KOREAN()
1318 check( RTL_TEXTENCODING_APPLE_KOREAN
, RTL_TEXTENCODING_MS_1252
);
1321 void WindowsCharsetFromTextEncoding_MS_932()
1323 check( RTL_TEXTENCODING_MS_932
, RTL_TEXTENCODING_MS_1252
);
1326 void WindowsCharsetFromTextEncoding_MS_936()
1328 check( RTL_TEXTENCODING_MS_936
, RTL_TEXTENCODING_MS_1252
);
1331 void WindowsCharsetFromTextEncoding_MS_949()
1333 check( RTL_TEXTENCODING_MS_949
, RTL_TEXTENCODING_MS_1252
);
1336 void WindowsCharsetFromTextEncoding_MS_950()
1338 check( RTL_TEXTENCODING_MS_950
, RTL_TEXTENCODING_MS_1252
);
1341 void WindowsCharsetFromTextEncoding_SHIFT_JIS()
1343 check( RTL_TEXTENCODING_SHIFT_JIS
, RTL_TEXTENCODING_MS_1252
);
1346 void WindowsCharsetFromTextEncoding_GB_2312()
1348 check( RTL_TEXTENCODING_GB_2312
, RTL_TEXTENCODING_MS_1252
);
1351 void WindowsCharsetFromTextEncoding_GBT_12345()
1353 check( RTL_TEXTENCODING_GBT_12345
, RTL_TEXTENCODING_MS_1252
);
1356 void WindowsCharsetFromTextEncoding_GBK()
1358 check( RTL_TEXTENCODING_GBK
, RTL_TEXTENCODING_MS_1252
);
1361 void WindowsCharsetFromTextEncoding_BIG5()
1363 check( RTL_TEXTENCODING_BIG5
, RTL_TEXTENCODING_MS_1252
);
1366 void WindowsCharsetFromTextEncoding_EUC_JP()
1368 check( RTL_TEXTENCODING_EUC_JP
, RTL_TEXTENCODING_MS_1252
);
1371 void WindowsCharsetFromTextEncoding_EUC_CN()
1373 check( RTL_TEXTENCODING_EUC_CN
, RTL_TEXTENCODING_MS_1252
);
1376 void WindowsCharsetFromTextEncoding_EUC_TW()
1378 check( RTL_TEXTENCODING_EUC_TW
, RTL_TEXTENCODING_MS_1252
);
1381 void WindowsCharsetFromTextEncoding_ISO_2022_JP()
1383 check( RTL_TEXTENCODING_ISO_2022_JP
, RTL_TEXTENCODING_MS_1252
);
1386 void WindowsCharsetFromTextEncoding_ISO_2022_CN()
1388 check( RTL_TEXTENCODING_ISO_2022_CN
, RTL_TEXTENCODING_MS_1252
);
1391 void WindowsCharsetFromTextEncoding_KOI8_R()
1393 check( RTL_TEXTENCODING_KOI8_R
, RTL_TEXTENCODING_MS_1252
);
1396 void WindowsCharsetFromTextEncoding_UTF7()
1398 check( RTL_TEXTENCODING_UTF7
, RTL_TEXTENCODING_MS_1252
);
1401 void WindowsCharsetFromTextEncoding_UTF8()
1403 check( RTL_TEXTENCODING_UTF8
, RTL_TEXTENCODING_MS_1252
);
1406 void WindowsCharsetFromTextEncoding_ISO_8859_10()
1408 check( RTL_TEXTENCODING_ISO_8859_10
, RTL_TEXTENCODING_MS_1252
);
1411 void WindowsCharsetFromTextEncoding_ISO_8859_13()
1413 check( RTL_TEXTENCODING_ISO_8859_13
, RTL_TEXTENCODING_MS_1252
);
1416 void WindowsCharsetFromTextEncoding_EUC_KR()
1418 check( RTL_TEXTENCODING_EUC_KR
, RTL_TEXTENCODING_MS_1252
);
1421 void WindowsCharsetFromTextEncoding_ISO_2022_KR()
1423 check( RTL_TEXTENCODING_ISO_2022_KR
, RTL_TEXTENCODING_MS_1252
);
1426 void WindowsCharsetFromTextEncoding_JIS_X_0201()
1428 check( RTL_TEXTENCODING_JIS_X_0201
, RTL_TEXTENCODING_MS_1252
);
1431 void WindowsCharsetFromTextEncoding_JIS_X_0208()
1433 check( RTL_TEXTENCODING_JIS_X_0208
, RTL_TEXTENCODING_MS_1252
);
1436 void WindowsCharsetFromTextEncoding_JIS_X_0212()
1438 check( RTL_TEXTENCODING_JIS_X_0212
, RTL_TEXTENCODING_MS_1252
);
1441 void WindowsCharsetFromTextEncoding_MS_1361()
1443 check( RTL_TEXTENCODING_MS_1361
, RTL_TEXTENCODING_MS_1252
);
1446 void WindowsCharsetFromTextEncoding_GB_18030()
1448 check( RTL_TEXTENCODING_GB_18030
, RTL_TEXTENCODING_MS_1252
);
1451 void WindowsCharsetFromTextEncoding_BIG5_HKSCS()
1453 check( RTL_TEXTENCODING_BIG5_HKSCS
, RTL_TEXTENCODING_MS_1252
);
1456 void WindowsCharsetFromTextEncoding_TIS_620()
1458 check( RTL_TEXTENCODING_TIS_620
, RTL_TEXTENCODING_MS_1252
);
1461 void WindowsCharsetFromTextEncoding_KOI8_U()
1463 check( RTL_TEXTENCODING_KOI8_U
, RTL_TEXTENCODING_MS_1252
);
1466 void WindowsCharsetFromTextEncoding_ISCII_DEVANAGARI()
1468 check( RTL_TEXTENCODING_ISCII_DEVANAGARI
, RTL_TEXTENCODING_MS_1252
);
1471 void WindowsCharsetFromTextEncoding_JAVA_UTF8()
1473 check( RTL_TEXTENCODING_JAVA_UTF8
, RTL_TEXTENCODING_MS_1252
);
1476 CPPUNIT_TEST_SUITE( testBestWindows
);
1477 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1252
);
1478 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_ROMAN
);
1479 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_437
);
1480 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_850
);
1481 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_860
);
1482 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_861
);
1483 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_863
);
1484 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_865
);
1485 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_SYMBOL
);
1486 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ASCII_US
);
1487 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_1
);
1489 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_2
);
1491 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_3
);
1492 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_4
);
1494 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_5
);
1495 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_6
);
1496 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_7
);
1497 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_8
);
1498 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_9
);
1500 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_14
);
1501 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_15
);
1503 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_737
);
1504 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_775
);
1505 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_852
);
1506 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_855
);
1507 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_857
);
1508 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_862
);
1509 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_864
);
1510 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_866
);
1511 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_869
);
1512 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_874
);
1513 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1250
);
1514 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1251
);
1515 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1253
);
1516 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1254
);
1517 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1255
);
1518 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1256
);
1519 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1257
);
1520 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1258
);
1521 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_ARABIC
);
1522 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_CENTEURO
);
1523 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_CROATIAN
);
1524 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_CYRILLIC
);
1525 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_DEVANAGARI
);
1526 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_FARSI
);
1527 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_GREEK
);
1528 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_GUJARATI
);
1529 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_GURMUKHI
);
1530 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_HEBREW
);
1532 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_ICELAND
);
1534 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_ROMANIAN
);
1535 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_THAI
);
1536 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_TURKISH
);
1537 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_UKRAINIAN
);
1538 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_CHINSIMP
);
1539 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_CHINTRAD
);
1540 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_JAPANESE
);
1541 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_KOREAN
);
1542 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_932
);
1543 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_936
);
1544 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_949
);
1545 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_950
);
1546 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_SHIFT_JIS
);
1547 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_GB_2312
);
1548 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_GBT_12345
);
1549 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_GBK
);
1550 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_BIG5
);
1551 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_EUC_JP
);
1552 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_EUC_CN
);
1553 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_EUC_TW
);
1554 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_2022_JP
);
1555 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_2022_CN
);
1556 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_KOI8_R
);
1558 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_UTF7
);
1559 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_UTF8
);
1561 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_10
);
1562 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_13
);
1563 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_EUC_KR
);
1564 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_2022_KR
);
1565 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_JIS_X_0201
);
1566 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_JIS_X_0208
);
1567 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_JIS_X_0212
);
1568 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1361
);
1569 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_GB_18030
);
1570 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_BIG5_HKSCS
);
1571 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_TIS_620
);
1572 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_KOI8_U
);
1573 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISCII_DEVANAGARI
);
1575 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_JAVA_UTF8
);
1577 CPPUNIT_TEST_SUITE_END( );
1580 class testTextEncodingInfo
: public CppUnit::TestFixture
1583 // initialise your test code values here.
1584 void setUp() SAL_OVERRIDE
1588 void tearDown() SAL_OVERRIDE
1592 // not implemented encoding test
1593 void testTextEncodingInfo_001()
1595 rtl_TextEncodingInfo aInfo1
, aInfo2
, aInfo3
, aInfo4
, aInfo5
;
1596 aInfo1
.StructSize
= 4;
1598 bool bRes1
= rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC
, &aInfo1
);
1600 bool bRes11
= rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC
, &aInfo1
);
1601 CPPUNIT_ASSERT_MESSAGE("should return sal_False.", !bRes1
&& !bRes11
);
1603 aInfo2
.StructSize
= 5;
1604 bool bRes2
= rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC
, &aInfo2
);
1605 bool bRes21
= rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC
, &aInfo2
);
1606 CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes2
&& bRes21
&& aInfo2
.MinimumCharSize
>=1 );
1608 aInfo3
.StructSize
= 6;
1609 bool bRes3
= rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC
, &aInfo3
);
1610 bool bRes31
= rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC
, &aInfo3
);
1611 CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes3
&& bRes31
);
1612 //&& aInfo2.MinimumCharSize >=1 );
1614 aInfo4
.StructSize
= 8;
1615 bool bRes4
= rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC
, &aInfo4
);
1616 bool bRes41
= rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC
, &aInfo4
);
1617 CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes4
&& bRes41
);
1618 // && aInfo2.MinimumCharSize >=1 );
1620 aInfo5
.StructSize
= sizeof aInfo5
;
1621 bool bRes5
= rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC
, &aInfo5
);
1622 CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", !bRes5
&& aInfo5
.Flags
== 0);
1625 CPPUNIT_TEST_SUITE(testTextEncodingInfo
);
1626 CPPUNIT_TEST(testTextEncodingInfo_001
);
1627 CPPUNIT_TEST_SUITE_END();
1630 class testEncodingFromUnix
: public CppUnit::TestFixture
1633 void testIso8859() {
1634 check(RTL_TEXTENCODING_DONTKNOW
, "ISO8859");
1635 check(RTL_TEXTENCODING_DONTKNOW
, "ISO8859-0");
1636 check(RTL_TEXTENCODING_DONTKNOW
, "ISO8859-01");
1637 check(RTL_TEXTENCODING_DONTKNOW
, "ISO8859_1");
1638 check(RTL_TEXTENCODING_DONTKNOW
, "ISO88591");
1639 check(RTL_TEXTENCODING_ISO_8859_1
, "ISO8859-1");
1640 check(RTL_TEXTENCODING_ISO_8859_2
, "ISO8859-2");
1641 check(RTL_TEXTENCODING_ISO_8859_3
, "ISO8859-3");
1642 check(RTL_TEXTENCODING_ISO_8859_4
, "ISO8859-4");
1643 check(RTL_TEXTENCODING_ISO_8859_5
, "ISO8859-5");
1644 check(RTL_TEXTENCODING_ISO_8859_6
, "ISO8859-6");
1645 check(RTL_TEXTENCODING_ISO_8859_7
, "ISO8859-7");
1646 check(RTL_TEXTENCODING_ISO_8859_8
, "ISO8859-8");
1647 check(RTL_TEXTENCODING_ISO_8859_9
, "ISO8859-9");
1648 check(RTL_TEXTENCODING_ISO_8859_10
, "ISO8859-10");
1649 check(RTL_TEXTENCODING_TIS_620
, "ISO8859-11");
1650 check(RTL_TEXTENCODING_ISO_8859_13
, "ISO8859-13");
1651 check(RTL_TEXTENCODING_ISO_8859_14
, "ISO8859-14");
1652 check(RTL_TEXTENCODING_ISO_8859_15
, "ISO8859-15");
1656 check(RTL_TEXTENCODING_DONTKNOW
, "TIS620");
1657 check(RTL_TEXTENCODING_TIS_620
, "TIS620-0");
1658 check(RTL_TEXTENCODING_DONTKNOW
, "TIS620-1");
1659 check(RTL_TEXTENCODING_TIS_620
, "TIS620-2529");
1660 check(RTL_TEXTENCODING_TIS_620
, "TIS620-2533");
1661 check(RTL_TEXTENCODING_DONTKNOW
, "TIS620.2529-0");
1662 check(RTL_TEXTENCODING_TIS_620
, "TIS620.2529-1");
1663 check(RTL_TEXTENCODING_DONTKNOW
, "TIS620.2529-2");
1664 check(RTL_TEXTENCODING_TIS_620
, "TIS620.2533-0");
1665 check(RTL_TEXTENCODING_TIS_620
, "TIS620.2533-1");
1666 check(RTL_TEXTENCODING_DONTKNOW
, "TIS620.2533-2");
1669 CPPUNIT_TEST_SUITE(testEncodingFromUnix
);
1670 CPPUNIT_TEST(testIso8859
);
1671 CPPUNIT_TEST(testTis620
);
1672 CPPUNIT_TEST_SUITE_END();
1675 void check(rtl_TextEncoding expected
, char const * input
) {
1676 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1677 input
, expected
, rtl_getTextEncodingFromUnixCharset(input
));
1683 CPPUNIT_TEST_SUITE_REGISTRATION(testBestMime
);
1684 CPPUNIT_TEST_SUITE_REGISTRATION(testBestUnix
);
1685 CPPUNIT_TEST_SUITE_REGISTRATION(testBestWindows
);
1686 CPPUNIT_TEST_SUITE_REGISTRATION(testTextEncodingInfo
);
1687 CPPUNIT_TEST_SUITE_REGISTRATION(testEncodingFromUnix
);
1689 CPPUNIT_PLUGIN_IMPLEMENT();
1691 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */