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 <rtl/tencinfo.h>
26 #include <cppunit/TestFixture.h>
27 #include <cppunit/extensions/HelperMacros.h>
28 #include <cppunit/plugin/TestPlugIn.h>
32 class testBestMime
: public CppUnit::TestFixture
35 void check(rtl_TextEncoding eIn
, rtl_TextEncoding eOut
)
37 const char *pCharSet
= rtl_getBestMimeCharsetFromTextEncoding(eIn
);
38 rtl_TextEncoding eTextEnc
= rtl_getTextEncodingFromMimeCharset(pCharSet
);
39 CPPUNIT_ASSERT_EQUAL_MESSAGE("rtl_getBestMimeCharsetFromTextEncoding && rtl_getTextEncodingFromMimeCharset differdiffer", eOut
, eTextEnc
);
42 // the defines for the follows test could be found in file inc/rtl/textenc.h
44 void MimeCharsetFromTextEncoding_MS_1252()
46 check( RTL_TEXTENCODING_MS_1252
, RTL_TEXTENCODING_MS_1252
);
49 void MimeCharsetFromTextEncoding_APPLE_ROMAN()
51 check( RTL_TEXTENCODING_APPLE_ROMAN
, RTL_TEXTENCODING_APPLE_ROMAN
);
54 void MimeCharsetFromTextEncoding_IBM_437()
56 check( RTL_TEXTENCODING_IBM_437
, RTL_TEXTENCODING_IBM_437
);
59 void MimeCharsetFromTextEncoding_IBM_850()
61 check( RTL_TEXTENCODING_IBM_850
, RTL_TEXTENCODING_IBM_850
);
64 void MimeCharsetFromTextEncoding_IBM_860()
66 check( RTL_TEXTENCODING_IBM_860
, RTL_TEXTENCODING_IBM_860
);
69 void MimeCharsetFromTextEncoding_IBM_861()
71 check( RTL_TEXTENCODING_IBM_861
, RTL_TEXTENCODING_IBM_861
);
74 void MimeCharsetFromTextEncoding_IBM_863()
76 check( RTL_TEXTENCODING_IBM_863
, RTL_TEXTENCODING_IBM_863
);
79 void MimeCharsetFromTextEncoding_IBM_865()
81 check( RTL_TEXTENCODING_IBM_865
, RTL_TEXTENCODING_IBM_865
);
84 void MimeCharsetFromTextEncoding_SYMBOL()
86 check( RTL_TEXTENCODING_SYMBOL
, RTL_TEXTENCODING_DONTKNOW
);
89 void MimeCharsetFromTextEncoding_ASCII_US()
91 check( RTL_TEXTENCODING_ASCII_US
, RTL_TEXTENCODING_ASCII_US
);
94 void MimeCharsetFromTextEncoding_ISO_8859_1()
96 check( RTL_TEXTENCODING_ISO_8859_1
, RTL_TEXTENCODING_ISO_8859_1
);
98 void MimeCharsetFromTextEncoding_ISO_8859_2()
100 check( RTL_TEXTENCODING_ISO_8859_2
, RTL_TEXTENCODING_ISO_8859_2
);
102 void MimeCharsetFromTextEncoding_ISO_8859_3()
104 check( RTL_TEXTENCODING_ISO_8859_3
, RTL_TEXTENCODING_ISO_8859_3
);
106 void MimeCharsetFromTextEncoding_ISO_8859_4()
108 check( RTL_TEXTENCODING_ISO_8859_4
, RTL_TEXTENCODING_ISO_8859_4
);
110 void MimeCharsetFromTextEncoding_ISO_8859_5()
112 check( RTL_TEXTENCODING_ISO_8859_5
, RTL_TEXTENCODING_ISO_8859_5
);
114 void MimeCharsetFromTextEncoding_ISO_8859_6()
116 check( RTL_TEXTENCODING_ISO_8859_6
, RTL_TEXTENCODING_ISO_8859_6
);
118 void MimeCharsetFromTextEncoding_ISO_8859_7()
120 check( RTL_TEXTENCODING_ISO_8859_7
, RTL_TEXTENCODING_ISO_8859_7
);
122 void MimeCharsetFromTextEncoding_ISO_8859_8()
124 check( RTL_TEXTENCODING_ISO_8859_8
, RTL_TEXTENCODING_ISO_8859_8
);
126 void MimeCharsetFromTextEncoding_ISO_8859_9()
128 check( RTL_TEXTENCODING_ISO_8859_9
, RTL_TEXTENCODING_ISO_8859_9
);
130 void MimeCharsetFromTextEncoding_ISO_8859_14()
132 check( RTL_TEXTENCODING_ISO_8859_14
, RTL_TEXTENCODING_ISO_8859_14
);
134 void MimeCharsetFromTextEncoding_ISO_8859_15()
136 check( RTL_TEXTENCODING_ISO_8859_15
, RTL_TEXTENCODING_ISO_8859_15
);
138 void MimeCharsetFromTextEncoding_IBM_737()
140 check( RTL_TEXTENCODING_IBM_737
, RTL_TEXTENCODING_ISO_8859_7
);
142 void MimeCharsetFromTextEncoding_IBM_775()
144 check( RTL_TEXTENCODING_IBM_775
, RTL_TEXTENCODING_ISO_8859_4
);
146 void MimeCharsetFromTextEncoding_IBM_852()
148 check( RTL_TEXTENCODING_IBM_852
, RTL_TEXTENCODING_IBM_852
);
150 void MimeCharsetFromTextEncoding_IBM_855()
152 check( RTL_TEXTENCODING_IBM_855
, RTL_TEXTENCODING_ISO_8859_5
);
154 void MimeCharsetFromTextEncoding_IBM_857()
156 check( RTL_TEXTENCODING_IBM_857
, RTL_TEXTENCODING_ISO_8859_9
);
158 void MimeCharsetFromTextEncoding_IBM_862()
160 check( RTL_TEXTENCODING_IBM_862
, RTL_TEXTENCODING_IBM_862
);
162 void MimeCharsetFromTextEncoding_IBM_864()
164 check( RTL_TEXTENCODING_IBM_864
, RTL_TEXTENCODING_IBM_864
);
166 void MimeCharsetFromTextEncoding_IBM_866()
168 check( RTL_TEXTENCODING_IBM_866
, RTL_TEXTENCODING_IBM_866
);
170 void MimeCharsetFromTextEncoding_IBM_869()
172 check( RTL_TEXTENCODING_IBM_869
, RTL_TEXTENCODING_ISO_8859_7
);
174 void MimeCharsetFromTextEncoding_MS_874()
176 check( RTL_TEXTENCODING_MS_874
, RTL_TEXTENCODING_MS_874
);
178 void MimeCharsetFromTextEncoding_MS_1250()
180 check( RTL_TEXTENCODING_MS_1250
, RTL_TEXTENCODING_MS_1250
);
182 void MimeCharsetFromTextEncoding_MS_1251()
184 check( RTL_TEXTENCODING_MS_1251
, RTL_TEXTENCODING_MS_1251
);
186 void MimeCharsetFromTextEncoding_MS_1253()
188 check( RTL_TEXTENCODING_MS_1253
, RTL_TEXTENCODING_MS_1253
);
190 void MimeCharsetFromTextEncoding_MS_1254()
192 check( RTL_TEXTENCODING_MS_1254
, RTL_TEXTENCODING_MS_1254
);
194 void MimeCharsetFromTextEncoding_MS_1255()
196 check( RTL_TEXTENCODING_MS_1255
, RTL_TEXTENCODING_MS_1255
);
198 void MimeCharsetFromTextEncoding_MS_1256()
200 check( RTL_TEXTENCODING_MS_1256
, RTL_TEXTENCODING_MS_1256
);
202 void MimeCharsetFromTextEncoding_MS_1257()
204 check( RTL_TEXTENCODING_MS_1257
, RTL_TEXTENCODING_MS_1257
);
206 void MimeCharsetFromTextEncoding_MS_1258()
208 check( RTL_TEXTENCODING_MS_1258
, RTL_TEXTENCODING_MS_1258
);
210 void MimeCharsetFromTextEncoding_APPLE_CENTEURO()
212 check( RTL_TEXTENCODING_APPLE_CENTEURO
, RTL_TEXTENCODING_ISO_8859_2
);
214 void MimeCharsetFromTextEncoding_APPLE_CROATIAN()
216 check( RTL_TEXTENCODING_APPLE_CROATIAN
, RTL_TEXTENCODING_ISO_8859_2
);
218 void MimeCharsetFromTextEncoding_APPLE_CYRILLIC()
220 check( RTL_TEXTENCODING_APPLE_CYRILLIC
, RTL_TEXTENCODING_ISO_8859_5
);
222 void MimeCharsetFromTextEncoding_APPLE_GREEK()
224 check( RTL_TEXTENCODING_APPLE_GREEK
, RTL_TEXTENCODING_ISO_8859_7
);
226 void MimeCharsetFromTextEncoding_APPLE_ICELAND()
228 check( RTL_TEXTENCODING_APPLE_ICELAND
, RTL_TEXTENCODING_ISO_8859_1
);
230 void MimeCharsetFromTextEncoding_APPLE_ROMANIAN()
232 check( RTL_TEXTENCODING_APPLE_ROMANIAN
, RTL_TEXTENCODING_ISO_8859_2
);
234 void MimeCharsetFromTextEncoding_APPLE_TURKISH()
236 check( RTL_TEXTENCODING_APPLE_TURKISH
, RTL_TEXTENCODING_ISO_8859_9
);
238 void MimeCharsetFromTextEncoding_APPLE_UKRAINIAN()
240 check( RTL_TEXTENCODING_APPLE_UKRAINIAN
, RTL_TEXTENCODING_ISO_8859_5
);
242 void MimeCharsetFromTextEncoding_MS_932()
244 check( RTL_TEXTENCODING_MS_932
, RTL_TEXTENCODING_SHIFT_JIS
);
246 void MimeCharsetFromTextEncoding_MS_936()
248 check( RTL_TEXTENCODING_MS_936
, RTL_TEXTENCODING_GB_2312
);
250 void MimeCharsetFromTextEncoding_MS_949()
252 check( RTL_TEXTENCODING_MS_949
, RTL_TEXTENCODING_EUC_KR
);
254 void MimeCharsetFromTextEncoding_MS_950()
256 check( RTL_TEXTENCODING_MS_950
, RTL_TEXTENCODING_BIG5
);
258 void MimeCharsetFromTextEncoding_KOI8_R()
260 check( RTL_TEXTENCODING_KOI8_R
, RTL_TEXTENCODING_KOI8_R
);
262 void MimeCharsetFromTextEncoding_UTF7()
264 check( RTL_TEXTENCODING_UTF7
, RTL_TEXTENCODING_UTF7
);
266 void MimeCharsetFromTextEncoding_UTF8()
268 check( RTL_TEXTENCODING_UTF8
, RTL_TEXTENCODING_UTF8
);
270 void MimeCharsetFromTextEncoding_ISO_8859_10()
272 check( RTL_TEXTENCODING_ISO_8859_10
, RTL_TEXTENCODING_ISO_8859_10
);
274 void MimeCharsetFromTextEncoding_ISO_8859_13()
276 check( RTL_TEXTENCODING_ISO_8859_13
, RTL_TEXTENCODING_ISO_8859_13
);
278 void MimeCharsetFromTextEncoding_MS_1361()
280 check( RTL_TEXTENCODING_MS_1361
, RTL_TEXTENCODING_EUC_KR
);
282 void MimeCharsetFromTextEncoding_TIS_620()
284 check( RTL_TEXTENCODING_TIS_620
, RTL_TEXTENCODING_TIS_620
);
286 void MimeCharsetFromTextEncoding_KOI8_U()
288 check( RTL_TEXTENCODING_KOI8_U
, RTL_TEXTENCODING_KOI8_U
);
290 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
291 void MimeCharsetFromTextEncoding_APPLE_JAPANESE()
293 check( RTL_TEXTENCODING_APPLE_JAPANESE
, RTL_TEXTENCODING_SHIFT_JIS
);
295 void MimeCharsetFromTextEncoding_SHIFT_JIS()
297 check( RTL_TEXTENCODING_SHIFT_JIS
, RTL_TEXTENCODING_SHIFT_JIS
);
299 void MimeCharsetFromTextEncoding_EUC_JP()
301 check( RTL_TEXTENCODING_EUC_JP
, RTL_TEXTENCODING_EUC_JP
);
303 void MimeCharsetFromTextEncoding_ISO_2022_JP()
305 check( RTL_TEXTENCODING_ISO_2022_JP
, RTL_TEXTENCODING_ISO_2022_JP
);
307 void MimeCharsetFromTextEncoding_JIS_X_0201()
309 check( RTL_TEXTENCODING_JIS_X_0201
, RTL_TEXTENCODING_EUC_JP
);
311 void MimeCharsetFromTextEncoding_JIS_X_0208()
313 check( RTL_TEXTENCODING_JIS_X_0208
, RTL_TEXTENCODING_EUC_JP
);
315 void MimeCharsetFromTextEncoding_JIS_X_0212()
317 check( RTL_TEXTENCODING_JIS_X_0212
, RTL_TEXTENCODING_EUC_JP
);
320 #if WITH_LOCALE_ALL || WITH_LOCALE_ko
321 void MimeCharsetFromTextEncoding_APPLE_KOREAN()
323 check( RTL_TEXTENCODING_APPLE_KOREAN
, RTL_TEXTENCODING_EUC_KR
);
325 void MimeCharsetFromTextEncoding_EUC_KR()
327 check( RTL_TEXTENCODING_EUC_KR
, RTL_TEXTENCODING_EUC_KR
);
329 void MimeCharsetFromTextEncoding_ISO_2022_KR()
331 check( RTL_TEXTENCODING_ISO_2022_KR
, RTL_TEXTENCODING_ISO_2022_KR
);
334 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
335 void MimeCharsetFromTextEncoding_APPLE_CHINSIMP()
337 check( RTL_TEXTENCODING_APPLE_CHINSIMP
, RTL_TEXTENCODING_GB_2312
);
339 void MimeCharsetFromTextEncoding_APPLE_CHINTRAD()
341 check( RTL_TEXTENCODING_APPLE_CHINTRAD
, RTL_TEXTENCODING_BIG5
);
343 void MimeCharsetFromTextEncoding_GB_2312()
345 check( RTL_TEXTENCODING_GB_2312
, RTL_TEXTENCODING_GB_2312
);
347 void MimeCharsetFromTextEncoding_GBT_12345()
349 check( RTL_TEXTENCODING_GBT_12345
, RTL_TEXTENCODING_GBT_12345
);
351 void MimeCharsetFromTextEncoding_GBK()
353 check( RTL_TEXTENCODING_GBK
, RTL_TEXTENCODING_GBK
);
355 void MimeCharsetFromTextEncoding_BIG5()
357 check( RTL_TEXTENCODING_BIG5
, RTL_TEXTENCODING_BIG5
);
359 void MimeCharsetFromTextEncoding_EUC_CN()
361 check( RTL_TEXTENCODING_EUC_CN
, RTL_TEXTENCODING_GB_2312
);
363 void MimeCharsetFromTextEncoding_EUC_TW()
365 check( RTL_TEXTENCODING_EUC_TW
, RTL_TEXTENCODING_BIG5
);
367 void MimeCharsetFromTextEncoding_ISO_2022_CN()
369 check( RTL_TEXTENCODING_ISO_2022_CN
, RTL_TEXTENCODING_ISO_2022_CN
);
371 void MimeCharsetFromTextEncoding_GB_18030()
373 check( RTL_TEXTENCODING_GB_18030
, RTL_TEXTENCODING_GB_18030
);
375 void MimeCharsetFromTextEncoding_BIG5_HKSCS()
377 check( RTL_TEXTENCODING_BIG5_HKSCS
, RTL_TEXTENCODING_BIG5_HKSCS
);
380 #if WITH_LOCALE_ALL || WITH_LOCALE_FOR_SCRIPT_Deva
381 void MimeCharsetFromTextEncoding_ISCII_DEVANAGARI()
383 check( RTL_TEXTENCODING_ISCII_DEVANAGARI
, RTL_TEXTENCODING_ISCII_DEVANAGARI
);
386 CPPUNIT_TEST_SUITE( testBestMime
);
388 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1252
);
389 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_ROMAN
);
390 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_437
);
391 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_850
);
392 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_860
);
393 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_861
);
394 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_863
);
395 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_865
);
396 CPPUNIT_TEST( MimeCharsetFromTextEncoding_SYMBOL
);
397 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ASCII_US
);
398 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_1
);
399 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_2
);
400 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_3
);
401 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_4
);
402 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_5
);
403 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_6
);
404 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_7
);
405 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_8
);
406 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_9
);
407 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_14
);
408 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_15
);
409 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_737
);
410 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_775
);
411 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_852
);
412 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_855
);
413 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_857
);
414 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_862
);
415 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_864
);
416 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_866
);
417 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_869
);
418 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_874
);
419 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1250
);
420 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1251
);
421 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1253
);
422 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1254
);
423 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1255
);
424 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1256
);
425 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1257
);
426 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1258
);
427 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CENTEURO
);
428 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CROATIAN
);
429 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CYRILLIC
);
430 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_GREEK
);
431 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_ICELAND
);
432 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_ROMANIAN
);
433 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_TURKISH
);
434 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_UKRAINIAN
);
435 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_932
);
436 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_936
);
437 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_949
);
438 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_950
);
439 CPPUNIT_TEST( MimeCharsetFromTextEncoding_KOI8_R
);
440 CPPUNIT_TEST( MimeCharsetFromTextEncoding_UTF7
);
441 CPPUNIT_TEST( MimeCharsetFromTextEncoding_UTF8
);
442 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_10
);
443 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_13
);
444 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1361
);
445 CPPUNIT_TEST( MimeCharsetFromTextEncoding_TIS_620
);
446 CPPUNIT_TEST( MimeCharsetFromTextEncoding_KOI8_U
);
447 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
448 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_JAPANESE
);
449 CPPUNIT_TEST( MimeCharsetFromTextEncoding_SHIFT_JIS
);
450 CPPUNIT_TEST( MimeCharsetFromTextEncoding_EUC_JP
);
451 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_2022_JP
);
452 CPPUNIT_TEST( MimeCharsetFromTextEncoding_JIS_X_0201
);
453 CPPUNIT_TEST( MimeCharsetFromTextEncoding_JIS_X_0208
);
454 CPPUNIT_TEST( MimeCharsetFromTextEncoding_JIS_X_0212
);
456 #if WITH_LOCALE_ALL || WITH_LOCALE_ko
457 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_KOREAN
);
458 CPPUNIT_TEST( MimeCharsetFromTextEncoding_EUC_KR
);
459 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_2022_KR
);
461 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
462 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CHINSIMP
);
463 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CHINTRAD
);
464 CPPUNIT_TEST( MimeCharsetFromTextEncoding_GB_2312
);
465 CPPUNIT_TEST( MimeCharsetFromTextEncoding_GBT_12345
);
466 CPPUNIT_TEST( MimeCharsetFromTextEncoding_GBK
);
467 CPPUNIT_TEST( MimeCharsetFromTextEncoding_BIG5
);
468 CPPUNIT_TEST( MimeCharsetFromTextEncoding_EUC_CN
);
469 CPPUNIT_TEST( MimeCharsetFromTextEncoding_EUC_TW
);
470 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_2022_CN
);
471 CPPUNIT_TEST( MimeCharsetFromTextEncoding_GB_18030
);
472 CPPUNIT_TEST( MimeCharsetFromTextEncoding_BIG5_HKSCS
);
474 #if WITH_LOCALE_ALL || WITH_LOCALE_FOR_SCRIPT_Deva
475 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISCII_DEVANAGARI
);
477 CPPUNIT_TEST_SUITE_END( );
480 class testBestUnix
: public CppUnit::TestFixture
483 void check(rtl_TextEncoding eIn
, rtl_TextEncoding eOut
)
485 const char *pCharSet
= rtl_getBestUnixCharsetFromTextEncoding(eIn
);
486 rtl_TextEncoding eTextEnc
= rtl_getTextEncodingFromUnixCharset(pCharSet
);
487 CPPUNIT_ASSERT_EQUAL_MESSAGE("rtl_getBestUnixCharsetFromTextEncoding && rtl_getTextEncodingFromUnixCharset", eOut
, eTextEnc
);
490 void UnixCharsetFromTextEncoding_MS_1252()
492 check( RTL_TEXTENCODING_MS_1252
, RTL_TEXTENCODING_ISO_8859_1
);
495 void UnixCharsetFromTextEncoding_APPLE_ROMAN()
497 check( RTL_TEXTENCODING_APPLE_ROMAN
, RTL_TEXTENCODING_ISO_8859_1
);
500 void UnixCharsetFromTextEncoding_IBM_437()
502 check( RTL_TEXTENCODING_IBM_437
, RTL_TEXTENCODING_ISO_8859_1
);
505 void UnixCharsetFromTextEncoding_IBM_850()
507 check( RTL_TEXTENCODING_IBM_850
, RTL_TEXTENCODING_ISO_8859_1
);
510 void UnixCharsetFromTextEncoding_IBM_860()
512 check( RTL_TEXTENCODING_IBM_860
, RTL_TEXTENCODING_ISO_8859_1
);
515 void UnixCharsetFromTextEncoding_IBM_861()
517 check( RTL_TEXTENCODING_IBM_861
, RTL_TEXTENCODING_ISO_8859_1
);
520 void UnixCharsetFromTextEncoding_IBM_863()
522 check( RTL_TEXTENCODING_IBM_863
, RTL_TEXTENCODING_ISO_8859_1
);
525 void UnixCharsetFromTextEncoding_IBM_865()
527 check( RTL_TEXTENCODING_IBM_865
, RTL_TEXTENCODING_ISO_8859_1
);
530 void UnixCharsetFromTextEncoding_SYMBOL()
532 check( RTL_TEXTENCODING_SYMBOL
, RTL_TEXTENCODING_SYMBOL
);
535 void UnixCharsetFromTextEncoding_ASCII_US()
537 check( RTL_TEXTENCODING_ASCII_US
, RTL_TEXTENCODING_ISO_8859_1
);
540 void UnixCharsetFromTextEncoding_ISO_8859_1()
542 check( RTL_TEXTENCODING_ISO_8859_1
, RTL_TEXTENCODING_ISO_8859_1
);
545 void UnixCharsetFromTextEncoding_ISO_8859_2()
547 check( RTL_TEXTENCODING_ISO_8859_2
, RTL_TEXTENCODING_ISO_8859_2
);
550 void UnixCharsetFromTextEncoding_ISO_8859_3()
552 check( RTL_TEXTENCODING_ISO_8859_3
, RTL_TEXTENCODING_ISO_8859_3
);
555 void UnixCharsetFromTextEncoding_ISO_8859_4()
557 check( RTL_TEXTENCODING_ISO_8859_4
, RTL_TEXTENCODING_ISO_8859_4
);
560 void UnixCharsetFromTextEncoding_ISO_8859_5()
562 check( RTL_TEXTENCODING_ISO_8859_5
, RTL_TEXTENCODING_ISO_8859_5
);
565 void UnixCharsetFromTextEncoding_ISO_8859_6()
567 check( RTL_TEXTENCODING_ISO_8859_6
, RTL_TEXTENCODING_ISO_8859_6
);
570 void UnixCharsetFromTextEncoding_ISO_8859_7()
572 check( RTL_TEXTENCODING_ISO_8859_7
, RTL_TEXTENCODING_ISO_8859_7
);
575 void UnixCharsetFromTextEncoding_ISO_8859_8()
577 check( RTL_TEXTENCODING_ISO_8859_8
, RTL_TEXTENCODING_ISO_8859_8
);
580 void UnixCharsetFromTextEncoding_ISO_8859_9()
582 check( RTL_TEXTENCODING_ISO_8859_9
, RTL_TEXTENCODING_ISO_8859_9
);
585 void UnixCharsetFromTextEncoding_ISO_8859_14()
587 check( RTL_TEXTENCODING_ISO_8859_14
, RTL_TEXTENCODING_ISO_8859_14
);
590 void UnixCharsetFromTextEncoding_ISO_8859_15()
592 check( RTL_TEXTENCODING_ISO_8859_15
, RTL_TEXTENCODING_ISO_8859_15
);
595 void UnixCharsetFromTextEncoding_IBM_737()
597 check( RTL_TEXTENCODING_IBM_737
, RTL_TEXTENCODING_ISO_8859_7
);
600 void UnixCharsetFromTextEncoding_IBM_775()
602 check( RTL_TEXTENCODING_IBM_775
, RTL_TEXTENCODING_ISO_8859_4
);
605 void UnixCharsetFromTextEncoding_IBM_852()
607 check( RTL_TEXTENCODING_IBM_852
, RTL_TEXTENCODING_ISO_8859_2
);
610 void UnixCharsetFromTextEncoding_IBM_855()
612 check( RTL_TEXTENCODING_IBM_855
, RTL_TEXTENCODING_ISO_8859_5
);
615 void UnixCharsetFromTextEncoding_IBM_857()
617 check( RTL_TEXTENCODING_IBM_857
, RTL_TEXTENCODING_ISO_8859_9
);
620 void UnixCharsetFromTextEncoding_IBM_862()
622 check( RTL_TEXTENCODING_IBM_862
, RTL_TEXTENCODING_ISO_8859_8
);
625 void UnixCharsetFromTextEncoding_IBM_864()
627 check( RTL_TEXTENCODING_IBM_864
, RTL_TEXTENCODING_ISO_8859_6
);
630 void UnixCharsetFromTextEncoding_IBM_866()
632 check( RTL_TEXTENCODING_IBM_866
, RTL_TEXTENCODING_ISO_8859_5
);
635 void UnixCharsetFromTextEncoding_IBM_869()
637 check( RTL_TEXTENCODING_IBM_869
, RTL_TEXTENCODING_ISO_8859_7
);
640 void UnixCharsetFromTextEncoding_MS_874()
642 check( RTL_TEXTENCODING_MS_874
, RTL_TEXTENCODING_ISO_8859_1
);
645 void UnixCharsetFromTextEncoding_MS_1250()
647 check( RTL_TEXTENCODING_MS_1250
, RTL_TEXTENCODING_ISO_8859_2
);
650 void UnixCharsetFromTextEncoding_MS_1251()
652 check( RTL_TEXTENCODING_MS_1251
, RTL_TEXTENCODING_ISO_8859_5
);
655 void UnixCharsetFromTextEncoding_MS_1253()
657 check( RTL_TEXTENCODING_MS_1253
, RTL_TEXTENCODING_ISO_8859_7
);
660 void UnixCharsetFromTextEncoding_MS_1254()
662 check( RTL_TEXTENCODING_MS_1254
, RTL_TEXTENCODING_ISO_8859_9
);
665 void UnixCharsetFromTextEncoding_MS_1255()
667 check( RTL_TEXTENCODING_MS_1255
, RTL_TEXTENCODING_ISO_8859_8
);
670 void UnixCharsetFromTextEncoding_MS_1256()
672 check( RTL_TEXTENCODING_MS_1256
, RTL_TEXTENCODING_ISO_8859_6
);
675 void UnixCharsetFromTextEncoding_MS_1257()
677 check( RTL_TEXTENCODING_MS_1257
, RTL_TEXTENCODING_ISO_8859_4
);
680 void UnixCharsetFromTextEncoding_MS_1258()
682 check( RTL_TEXTENCODING_MS_1258
, RTL_TEXTENCODING_ISO_8859_1
);
685 void UnixCharsetFromTextEncoding_APPLE_CENTEURO()
687 check( RTL_TEXTENCODING_APPLE_CENTEURO
, RTL_TEXTENCODING_ISO_8859_2
);
690 void UnixCharsetFromTextEncoding_APPLE_CROATIAN()
692 check( RTL_TEXTENCODING_APPLE_CROATIAN
, RTL_TEXTENCODING_ISO_8859_2
);
695 void UnixCharsetFromTextEncoding_APPLE_CYRILLIC()
697 check( RTL_TEXTENCODING_APPLE_CYRILLIC
, RTL_TEXTENCODING_ISO_8859_5
);
700 void UnixCharsetFromTextEncoding_APPLE_GREEK()
702 check( RTL_TEXTENCODING_APPLE_GREEK
, RTL_TEXTENCODING_ISO_8859_7
);
705 void UnixCharsetFromTextEncoding_APPLE_ICELAND()
707 check( RTL_TEXTENCODING_APPLE_ICELAND
, RTL_TEXTENCODING_ISO_8859_1
);
710 void UnixCharsetFromTextEncoding_APPLE_ROMANIAN()
712 check( RTL_TEXTENCODING_APPLE_ROMANIAN
, RTL_TEXTENCODING_ISO_8859_2
);
715 void UnixCharsetFromTextEncoding_APPLE_TURKISH()
717 check( RTL_TEXTENCODING_APPLE_TURKISH
, RTL_TEXTENCODING_ISO_8859_9
);
720 void UnixCharsetFromTextEncoding_APPLE_UKRAINIAN()
722 check( RTL_TEXTENCODING_APPLE_UKRAINIAN
, RTL_TEXTENCODING_ISO_8859_5
);
724 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
725 void UnixCharsetFromTextEncoding_APPLE_CHINSIMP()
727 check( RTL_TEXTENCODING_APPLE_CHINSIMP
, RTL_TEXTENCODING_DONTKNOW
);
730 void UnixCharsetFromTextEncoding_APPLE_CHINTRAD()
732 check( RTL_TEXTENCODING_APPLE_CHINTRAD
, RTL_TEXTENCODING_DONTKNOW
);
735 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
736 void UnixCharsetFromTextEncoding_APPLE_JAPANESE()
738 check( RTL_TEXTENCODING_APPLE_JAPANESE
, RTL_TEXTENCODING_DONTKNOW
);
741 #if WITH_LOCALE_ALL || WITH_LOCALE_ko
742 void UnixCharsetFromTextEncoding_APPLE_KOREAN()
744 check( RTL_TEXTENCODING_APPLE_KOREAN
, RTL_TEXTENCODING_DONTKNOW
);
747 void UnixCharsetFromTextEncoding_MS_932()
749 check( RTL_TEXTENCODING_MS_932
, RTL_TEXTENCODING_DONTKNOW
);
752 void UnixCharsetFromTextEncoding_MS_936()
754 check( RTL_TEXTENCODING_MS_936
, RTL_TEXTENCODING_DONTKNOW
);
757 void UnixCharsetFromTextEncoding_MS_949()
759 check( RTL_TEXTENCODING_MS_949
, RTL_TEXTENCODING_DONTKNOW
);
762 void UnixCharsetFromTextEncoding_MS_950()
764 check( RTL_TEXTENCODING_MS_950
, RTL_TEXTENCODING_DONTKNOW
);
766 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
767 void UnixCharsetFromTextEncoding_SHIFT_JIS()
769 check( RTL_TEXTENCODING_SHIFT_JIS
, RTL_TEXTENCODING_DONTKNOW
);
772 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
773 void UnixCharsetFromTextEncoding_GB_2312()
775 check( RTL_TEXTENCODING_GB_2312
, RTL_TEXTENCODING_DONTKNOW
);
778 void UnixCharsetFromTextEncoding_GBT_12345()
780 check( RTL_TEXTENCODING_GBT_12345
, RTL_TEXTENCODING_DONTKNOW
);
783 void UnixCharsetFromTextEncoding_GBK()
785 check( RTL_TEXTENCODING_GBK
, RTL_TEXTENCODING_DONTKNOW
);
788 void UnixCharsetFromTextEncoding_BIG5()
790 check( RTL_TEXTENCODING_BIG5
, RTL_TEXTENCODING_DONTKNOW
);
793 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
794 void UnixCharsetFromTextEncoding_EUC_JP()
796 check( RTL_TEXTENCODING_EUC_JP
, RTL_TEXTENCODING_DONTKNOW
);
799 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
800 void UnixCharsetFromTextEncoding_EUC_CN()
802 check( RTL_TEXTENCODING_EUC_CN
, RTL_TEXTENCODING_DONTKNOW
);
805 void UnixCharsetFromTextEncoding_EUC_TW()
807 check( RTL_TEXTENCODING_EUC_TW
, RTL_TEXTENCODING_DONTKNOW
);
810 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
811 void UnixCharsetFromTextEncoding_ISO_2022_JP()
813 check( RTL_TEXTENCODING_ISO_2022_JP
, RTL_TEXTENCODING_DONTKNOW
);
816 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
817 void UnixCharsetFromTextEncoding_ISO_2022_CN()
819 check( RTL_TEXTENCODING_ISO_2022_CN
, RTL_TEXTENCODING_DONTKNOW
);
822 void UnixCharsetFromTextEncoding_KOI8_R()
824 check( RTL_TEXTENCODING_KOI8_R
, RTL_TEXTENCODING_KOI8_R
);
827 void UnixCharsetFromTextEncoding_UTF7()
829 check( RTL_TEXTENCODING_UTF7
, RTL_TEXTENCODING_ISO_8859_1
);
832 void UnixCharsetFromTextEncoding_UTF8()
834 check( RTL_TEXTENCODING_UTF8
, RTL_TEXTENCODING_ISO_8859_1
);
837 void UnixCharsetFromTextEncoding_ISO_8859_10()
839 check( RTL_TEXTENCODING_ISO_8859_10
, RTL_TEXTENCODING_ISO_8859_10
);
842 void UnixCharsetFromTextEncoding_ISO_8859_13()
844 check( RTL_TEXTENCODING_ISO_8859_13
, RTL_TEXTENCODING_ISO_8859_13
);
846 #if WITH_LOCALE_ALL || WITH_LOCALE_ko
847 void UnixCharsetFromTextEncoding_EUC_KR()
849 check( RTL_TEXTENCODING_EUC_KR
, RTL_TEXTENCODING_DONTKNOW
);
852 void UnixCharsetFromTextEncoding_ISO_2022_KR()
854 check( RTL_TEXTENCODING_ISO_2022_KR
, RTL_TEXTENCODING_DONTKNOW
);
857 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
858 void UnixCharsetFromTextEncoding_JIS_X_0201()
860 check( RTL_TEXTENCODING_JIS_X_0201
, RTL_TEXTENCODING_DONTKNOW
);
863 void UnixCharsetFromTextEncoding_JIS_X_0208()
865 check( RTL_TEXTENCODING_JIS_X_0208
, RTL_TEXTENCODING_DONTKNOW
);
868 void UnixCharsetFromTextEncoding_JIS_X_0212()
870 check( RTL_TEXTENCODING_JIS_X_0212
, RTL_TEXTENCODING_DONTKNOW
);
873 void UnixCharsetFromTextEncoding_MS_1361()
875 check( RTL_TEXTENCODING_MS_1361
, RTL_TEXTENCODING_DONTKNOW
);
877 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
878 void UnixCharsetFromTextEncoding_GB_18030()
880 check( RTL_TEXTENCODING_GB_18030
, RTL_TEXTENCODING_GBK
);
883 void UnixCharsetFromTextEncoding_BIG5_HKSCS()
885 check( RTL_TEXTENCODING_BIG5_HKSCS
, RTL_TEXTENCODING_DONTKNOW
);
888 void UnixCharsetFromTextEncoding_TIS_620()
890 check( RTL_TEXTENCODING_TIS_620
, RTL_TEXTENCODING_ISO_8859_1
);
893 void UnixCharsetFromTextEncoding_KOI8_U()
895 check( RTL_TEXTENCODING_KOI8_U
, RTL_TEXTENCODING_KOI8_U
);
898 CPPUNIT_TEST_SUITE( testBestUnix
);
899 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1252
);
900 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_ROMAN
);
901 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_437
);
902 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_850
);
903 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_860
);
904 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_861
);
905 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_863
);
906 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_865
);
908 CPPUNIT_TEST( UnixCharsetFromTextEncoding_SYMBOL
);
909 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ASCII_US
);
910 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_1
);
911 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_2
);
912 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_3
);
913 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_4
);
914 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_5
);
915 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_6
);
916 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_7
);
917 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_8
);
918 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_9
);
919 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_14
);
920 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_15
);
921 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_737
);
922 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_775
);
923 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_852
);
924 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_855
);
925 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_857
);
926 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_862
);
927 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_864
);
928 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_866
);
929 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_869
);
930 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_874
);
931 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1250
);
932 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1251
);
933 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1253
);
934 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1254
);
935 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1255
);
936 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1256
);
937 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1257
);
938 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1258
);
939 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CENTEURO
);
940 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CROATIAN
);
941 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CYRILLIC
);
942 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_GREEK
);
943 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_ICELAND
);
944 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_ROMANIAN
);
945 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_TURKISH
);
946 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_UKRAINIAN
);
947 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
948 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CHINSIMP
);
949 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CHINTRAD
);
951 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
952 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_JAPANESE
);
954 #if WITH_LOCALE_ALL || WITH_LOCALE_ko
955 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_KOREAN
);
957 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_932
);
958 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_936
);
959 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_949
);
960 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_950
);
961 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
962 CPPUNIT_TEST( UnixCharsetFromTextEncoding_SHIFT_JIS
);
964 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
965 CPPUNIT_TEST( UnixCharsetFromTextEncoding_GB_2312
);
966 CPPUNIT_TEST( UnixCharsetFromTextEncoding_GBT_12345
);
967 CPPUNIT_TEST( UnixCharsetFromTextEncoding_GBK
);
968 CPPUNIT_TEST( UnixCharsetFromTextEncoding_BIG5
);
970 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
971 CPPUNIT_TEST( UnixCharsetFromTextEncoding_EUC_JP
);
973 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
974 CPPUNIT_TEST( UnixCharsetFromTextEncoding_EUC_CN
);
975 CPPUNIT_TEST( UnixCharsetFromTextEncoding_EUC_TW
);
977 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
978 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_2022_JP
);
980 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
981 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_2022_CN
);
983 CPPUNIT_TEST( UnixCharsetFromTextEncoding_KOI8_R
);
984 CPPUNIT_TEST( UnixCharsetFromTextEncoding_UTF7
);
985 CPPUNIT_TEST( UnixCharsetFromTextEncoding_UTF8
);
986 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_10
);
987 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_13
);
988 #if WITH_LOCALE_ALL || WITH_LOCALE_ko
989 CPPUNIT_TEST( UnixCharsetFromTextEncoding_EUC_KR
);
990 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_2022_KR
);
992 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
993 CPPUNIT_TEST( UnixCharsetFromTextEncoding_JIS_X_0201
);
994 CPPUNIT_TEST( UnixCharsetFromTextEncoding_JIS_X_0208
);
995 CPPUNIT_TEST( UnixCharsetFromTextEncoding_JIS_X_0212
);
997 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1361
);
998 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
999 CPPUNIT_TEST( UnixCharsetFromTextEncoding_GB_18030
);
1000 CPPUNIT_TEST( UnixCharsetFromTextEncoding_BIG5_HKSCS
);
1002 CPPUNIT_TEST( UnixCharsetFromTextEncoding_TIS_620
);
1003 CPPUNIT_TEST( UnixCharsetFromTextEncoding_KOI8_U
);
1005 CPPUNIT_TEST_SUITE_END( );
1008 class testBestWindows
: public CppUnit::TestFixture
1011 void check(rtl_TextEncoding nIn
, rtl_TextEncoding nOut
)
1013 const sal_uInt8 nCharSet
= rtl_getBestWindowsCharsetFromTextEncoding(nIn
);
1014 rtl_TextEncoding eTextEnc
= rtl_getTextEncodingFromWindowsCharset(nCharSet
);
1015 CPPUNIT_ASSERT_EQUAL_MESSAGE("rtl_getBestWindowsCharsetFromTextEncoding && rtl_getTextEncodingFromWindowsCharset differ", nOut
, eTextEnc
);
1018 void WindowsCharsetFromTextEncoding_MS_1252()
1020 check( RTL_TEXTENCODING_MS_1252
, RTL_TEXTENCODING_MS_1252
);
1023 void WindowsCharsetFromTextEncoding_APPLE_ROMAN()
1025 check( RTL_TEXTENCODING_APPLE_ROMAN
, RTL_TEXTENCODING_APPLE_ROMAN
);
1028 void WindowsCharsetFromTextEncoding_IBM_437()
1030 check( RTL_TEXTENCODING_IBM_437
, RTL_TEXTENCODING_MS_1252
);
1033 void WindowsCharsetFromTextEncoding_IBM_850()
1035 check( RTL_TEXTENCODING_IBM_850
, RTL_TEXTENCODING_MS_1252
);
1038 void WindowsCharsetFromTextEncoding_IBM_860()
1040 check( RTL_TEXTENCODING_IBM_860
, RTL_TEXTENCODING_MS_1252
);
1043 void WindowsCharsetFromTextEncoding_IBM_861()
1045 check( RTL_TEXTENCODING_IBM_861
, RTL_TEXTENCODING_MS_1252
);
1048 void WindowsCharsetFromTextEncoding_IBM_863()
1050 check( RTL_TEXTENCODING_IBM_863
, RTL_TEXTENCODING_MS_1252
);
1053 void WindowsCharsetFromTextEncoding_IBM_865()
1055 check( RTL_TEXTENCODING_IBM_865
, RTL_TEXTENCODING_MS_1252
);
1058 void WindowsCharsetFromTextEncoding_SYMBOL()
1060 check( RTL_TEXTENCODING_SYMBOL
, RTL_TEXTENCODING_SYMBOL
);
1063 void WindowsCharsetFromTextEncoding_ASCII_US()
1065 check( RTL_TEXTENCODING_ASCII_US
, RTL_TEXTENCODING_MS_1252
);
1068 void WindowsCharsetFromTextEncoding_ISO_8859_1()
1070 check( RTL_TEXTENCODING_ISO_8859_1
, RTL_TEXTENCODING_MS_1252
);
1073 void WindowsCharsetFromTextEncoding_ISO_8859_2()
1075 check( RTL_TEXTENCODING_ISO_8859_2
, RTL_TEXTENCODING_MS_1252
);
1078 void WindowsCharsetFromTextEncoding_ISO_8859_3()
1080 check( RTL_TEXTENCODING_ISO_8859_3
, RTL_TEXTENCODING_MS_1252
);
1083 void WindowsCharsetFromTextEncoding_ISO_8859_4()
1085 check( RTL_TEXTENCODING_ISO_8859_4
, RTL_TEXTENCODING_MS_1257
);
1088 void WindowsCharsetFromTextEncoding_ISO_8859_5()
1090 check( RTL_TEXTENCODING_ISO_8859_5
, RTL_TEXTENCODING_MS_1252
);
1093 void WindowsCharsetFromTextEncoding_ISO_8859_6()
1095 check( RTL_TEXTENCODING_ISO_8859_6
, RTL_TEXTENCODING_MS_1252
);
1098 void WindowsCharsetFromTextEncoding_ISO_8859_7()
1100 check( RTL_TEXTENCODING_ISO_8859_7
, RTL_TEXTENCODING_MS_1252
);
1103 void WindowsCharsetFromTextEncoding_ISO_8859_8()
1105 check( RTL_TEXTENCODING_ISO_8859_8
, RTL_TEXTENCODING_MS_1252
);
1108 void WindowsCharsetFromTextEncoding_ISO_8859_9()
1110 check( RTL_TEXTENCODING_ISO_8859_9
, RTL_TEXTENCODING_MS_1252
);
1113 void WindowsCharsetFromTextEncoding_ISO_8859_14()
1115 check( RTL_TEXTENCODING_ISO_8859_14
, RTL_TEXTENCODING_MS_1252
);
1118 void WindowsCharsetFromTextEncoding_ISO_8859_15()
1120 check( RTL_TEXTENCODING_ISO_8859_15
, RTL_TEXTENCODING_MS_1252
);
1123 void WindowsCharsetFromTextEncoding_IBM_737()
1125 check( RTL_TEXTENCODING_IBM_737
, RTL_TEXTENCODING_MS_1252
);
1128 void WindowsCharsetFromTextEncoding_IBM_775()
1130 check( RTL_TEXTENCODING_IBM_775
, RTL_TEXTENCODING_MS_1252
);
1133 void WindowsCharsetFromTextEncoding_IBM_852()
1135 check( RTL_TEXTENCODING_IBM_852
, RTL_TEXTENCODING_MS_1252
);
1138 void WindowsCharsetFromTextEncoding_IBM_855()
1140 check( RTL_TEXTENCODING_IBM_855
, RTL_TEXTENCODING_MS_1252
);
1143 void WindowsCharsetFromTextEncoding_IBM_857()
1145 check( RTL_TEXTENCODING_IBM_857
, RTL_TEXTENCODING_MS_1252
);
1148 void WindowsCharsetFromTextEncoding_IBM_862()
1150 check( RTL_TEXTENCODING_IBM_862
, RTL_TEXTENCODING_MS_1252
);
1153 void WindowsCharsetFromTextEncoding_IBM_864()
1155 check( RTL_TEXTENCODING_IBM_864
, RTL_TEXTENCODING_MS_1252
);
1158 void WindowsCharsetFromTextEncoding_IBM_866()
1160 check( RTL_TEXTENCODING_IBM_866
, RTL_TEXTENCODING_MS_1252
);
1163 void WindowsCharsetFromTextEncoding_IBM_869()
1165 check( RTL_TEXTENCODING_IBM_869
, RTL_TEXTENCODING_MS_1252
);
1168 void WindowsCharsetFromTextEncoding_MS_874()
1170 check( RTL_TEXTENCODING_MS_874
, RTL_TEXTENCODING_MS_1252
);
1173 void WindowsCharsetFromTextEncoding_MS_1250()
1175 check( RTL_TEXTENCODING_MS_1250
, RTL_TEXTENCODING_MS_1252
);
1178 void WindowsCharsetFromTextEncoding_MS_1251()
1180 check( RTL_TEXTENCODING_MS_1251
, RTL_TEXTENCODING_MS_1252
);
1183 void WindowsCharsetFromTextEncoding_MS_1253()
1185 check( RTL_TEXTENCODING_MS_1253
, RTL_TEXTENCODING_MS_1252
);
1188 void WindowsCharsetFromTextEncoding_MS_1254()
1190 check( RTL_TEXTENCODING_MS_1254
, RTL_TEXTENCODING_MS_1252
);
1193 void WindowsCharsetFromTextEncoding_MS_1255()
1195 check( RTL_TEXTENCODING_MS_1255
, RTL_TEXTENCODING_MS_1252
);
1198 void WindowsCharsetFromTextEncoding_MS_1256()
1200 check( RTL_TEXTENCODING_MS_1256
, RTL_TEXTENCODING_MS_1252
);
1203 void WindowsCharsetFromTextEncoding_MS_1257()
1205 check( RTL_TEXTENCODING_MS_1257
, RTL_TEXTENCODING_MS_1252
);
1208 void WindowsCharsetFromTextEncoding_MS_1258()
1210 check( RTL_TEXTENCODING_MS_1258
, RTL_TEXTENCODING_MS_1252
);
1213 void WindowsCharsetFromTextEncoding_APPLE_ARABIC()
1215 check( RTL_TEXTENCODING_APPLE_ARABIC
, RTL_TEXTENCODING_MS_1252
);
1218 void WindowsCharsetFromTextEncoding_APPLE_CENTEURO()
1220 check( RTL_TEXTENCODING_APPLE_CENTEURO
, RTL_TEXTENCODING_MS_1252
);
1223 void WindowsCharsetFromTextEncoding_APPLE_CROATIAN()
1225 check( RTL_TEXTENCODING_APPLE_CROATIAN
, RTL_TEXTENCODING_MS_1252
);
1228 void WindowsCharsetFromTextEncoding_APPLE_CYRILLIC()
1230 check( RTL_TEXTENCODING_APPLE_CYRILLIC
, RTL_TEXTENCODING_MS_1252
);
1233 void WindowsCharsetFromTextEncoding_APPLE_DEVANAGARI()
1235 check( RTL_TEXTENCODING_APPLE_DEVANAGARI
, RTL_TEXTENCODING_MS_1252
);
1238 void WindowsCharsetFromTextEncoding_APPLE_FARSI()
1240 check( RTL_TEXTENCODING_APPLE_FARSI
, RTL_TEXTENCODING_MS_1252
);
1243 void WindowsCharsetFromTextEncoding_APPLE_GREEK()
1245 check( RTL_TEXTENCODING_APPLE_GREEK
, RTL_TEXTENCODING_MS_1252
);
1248 void WindowsCharsetFromTextEncoding_APPLE_GUJARATI()
1250 check( RTL_TEXTENCODING_APPLE_GUJARATI
, RTL_TEXTENCODING_MS_1252
);
1253 void WindowsCharsetFromTextEncoding_APPLE_GURMUKHI()
1255 check( RTL_TEXTENCODING_APPLE_GURMUKHI
, RTL_TEXTENCODING_MS_1252
);
1258 void WindowsCharsetFromTextEncoding_APPLE_HEBREW()
1260 check( RTL_TEXTENCODING_APPLE_HEBREW
, RTL_TEXTENCODING_MS_1252
);
1263 void WindowsCharsetFromTextEncoding_APPLE_ICELAND()
1265 check( RTL_TEXTENCODING_APPLE_ICELAND
, RTL_TEXTENCODING_MS_1252
);
1268 void WindowsCharsetFromTextEncoding_APPLE_ROMANIAN()
1270 check( RTL_TEXTENCODING_APPLE_ROMANIAN
, RTL_TEXTENCODING_MS_1252
);
1273 void WindowsCharsetFromTextEncoding_APPLE_THAI()
1275 check( RTL_TEXTENCODING_APPLE_THAI
, RTL_TEXTENCODING_MS_1252
);
1278 void WindowsCharsetFromTextEncoding_APPLE_TURKISH()
1280 check( RTL_TEXTENCODING_APPLE_TURKISH
, RTL_TEXTENCODING_MS_1252
);
1283 void WindowsCharsetFromTextEncoding_APPLE_UKRAINIAN()
1285 check( RTL_TEXTENCODING_APPLE_UKRAINIAN
, RTL_TEXTENCODING_MS_1252
);
1288 void WindowsCharsetFromTextEncoding_APPLE_CHINSIMP()
1290 check( RTL_TEXTENCODING_APPLE_CHINSIMP
, RTL_TEXTENCODING_MS_1252
);
1293 void WindowsCharsetFromTextEncoding_APPLE_CHINTRAD()
1295 check( RTL_TEXTENCODING_APPLE_CHINTRAD
, RTL_TEXTENCODING_MS_1252
);
1298 void WindowsCharsetFromTextEncoding_APPLE_JAPANESE()
1300 check( RTL_TEXTENCODING_APPLE_JAPANESE
, RTL_TEXTENCODING_MS_1252
);
1303 void WindowsCharsetFromTextEncoding_APPLE_KOREAN()
1305 check( RTL_TEXTENCODING_APPLE_KOREAN
, RTL_TEXTENCODING_MS_1252
);
1308 void WindowsCharsetFromTextEncoding_MS_932()
1310 check( RTL_TEXTENCODING_MS_932
, RTL_TEXTENCODING_MS_1252
);
1313 void WindowsCharsetFromTextEncoding_MS_936()
1315 check( RTL_TEXTENCODING_MS_936
, RTL_TEXTENCODING_MS_1252
);
1318 void WindowsCharsetFromTextEncoding_MS_949()
1320 check( RTL_TEXTENCODING_MS_949
, RTL_TEXTENCODING_MS_1252
);
1323 void WindowsCharsetFromTextEncoding_MS_950()
1325 check( RTL_TEXTENCODING_MS_950
, RTL_TEXTENCODING_MS_1252
);
1328 void WindowsCharsetFromTextEncoding_SHIFT_JIS()
1330 check( RTL_TEXTENCODING_SHIFT_JIS
, RTL_TEXTENCODING_MS_1252
);
1333 void WindowsCharsetFromTextEncoding_GB_2312()
1335 check( RTL_TEXTENCODING_GB_2312
, RTL_TEXTENCODING_MS_1252
);
1338 void WindowsCharsetFromTextEncoding_GBT_12345()
1340 check( RTL_TEXTENCODING_GBT_12345
, RTL_TEXTENCODING_MS_1252
);
1343 void WindowsCharsetFromTextEncoding_GBK()
1345 check( RTL_TEXTENCODING_GBK
, RTL_TEXTENCODING_MS_1252
);
1348 void WindowsCharsetFromTextEncoding_BIG5()
1350 check( RTL_TEXTENCODING_BIG5
, RTL_TEXTENCODING_MS_1252
);
1353 void WindowsCharsetFromTextEncoding_EUC_JP()
1355 check( RTL_TEXTENCODING_EUC_JP
, RTL_TEXTENCODING_MS_1252
);
1358 void WindowsCharsetFromTextEncoding_EUC_CN()
1360 check( RTL_TEXTENCODING_EUC_CN
, RTL_TEXTENCODING_MS_1252
);
1363 void WindowsCharsetFromTextEncoding_EUC_TW()
1365 check( RTL_TEXTENCODING_EUC_TW
, RTL_TEXTENCODING_MS_1252
);
1368 void WindowsCharsetFromTextEncoding_ISO_2022_JP()
1370 check( RTL_TEXTENCODING_ISO_2022_JP
, RTL_TEXTENCODING_MS_1252
);
1373 void WindowsCharsetFromTextEncoding_ISO_2022_CN()
1375 check( RTL_TEXTENCODING_ISO_2022_CN
, RTL_TEXTENCODING_MS_1252
);
1378 void WindowsCharsetFromTextEncoding_KOI8_R()
1380 check( RTL_TEXTENCODING_KOI8_R
, RTL_TEXTENCODING_MS_1252
);
1383 void WindowsCharsetFromTextEncoding_UTF7()
1385 check( RTL_TEXTENCODING_UTF7
, RTL_TEXTENCODING_MS_1252
);
1388 void WindowsCharsetFromTextEncoding_UTF8()
1390 check( RTL_TEXTENCODING_UTF8
, RTL_TEXTENCODING_MS_1252
);
1393 void WindowsCharsetFromTextEncoding_ISO_8859_10()
1395 check( RTL_TEXTENCODING_ISO_8859_10
, RTL_TEXTENCODING_MS_1252
);
1398 void WindowsCharsetFromTextEncoding_ISO_8859_13()
1400 check( RTL_TEXTENCODING_ISO_8859_13
, RTL_TEXTENCODING_MS_1252
);
1403 void WindowsCharsetFromTextEncoding_EUC_KR()
1405 check( RTL_TEXTENCODING_EUC_KR
, RTL_TEXTENCODING_MS_1252
);
1408 void WindowsCharsetFromTextEncoding_ISO_2022_KR()
1410 check( RTL_TEXTENCODING_ISO_2022_KR
, RTL_TEXTENCODING_MS_1252
);
1413 void WindowsCharsetFromTextEncoding_JIS_X_0201()
1415 check( RTL_TEXTENCODING_JIS_X_0201
, RTL_TEXTENCODING_MS_1252
);
1418 void WindowsCharsetFromTextEncoding_JIS_X_0208()
1420 check( RTL_TEXTENCODING_JIS_X_0208
, RTL_TEXTENCODING_MS_1252
);
1423 void WindowsCharsetFromTextEncoding_JIS_X_0212()
1425 check( RTL_TEXTENCODING_JIS_X_0212
, RTL_TEXTENCODING_MS_1252
);
1428 void WindowsCharsetFromTextEncoding_MS_1361()
1430 check( RTL_TEXTENCODING_MS_1361
, RTL_TEXTENCODING_MS_1252
);
1433 void WindowsCharsetFromTextEncoding_GB_18030()
1435 check( RTL_TEXTENCODING_GB_18030
, RTL_TEXTENCODING_MS_1252
);
1438 void WindowsCharsetFromTextEncoding_BIG5_HKSCS()
1440 check( RTL_TEXTENCODING_BIG5_HKSCS
, RTL_TEXTENCODING_MS_1252
);
1443 void WindowsCharsetFromTextEncoding_TIS_620()
1445 check( RTL_TEXTENCODING_TIS_620
, RTL_TEXTENCODING_MS_1252
);
1448 void WindowsCharsetFromTextEncoding_KOI8_U()
1450 check( RTL_TEXTENCODING_KOI8_U
, RTL_TEXTENCODING_MS_1252
);
1453 void WindowsCharsetFromTextEncoding_ISCII_DEVANAGARI()
1455 check( RTL_TEXTENCODING_ISCII_DEVANAGARI
, RTL_TEXTENCODING_MS_1252
);
1458 void WindowsCharsetFromTextEncoding_JAVA_UTF8()
1460 check( RTL_TEXTENCODING_JAVA_UTF8
, RTL_TEXTENCODING_MS_1252
);
1463 CPPUNIT_TEST_SUITE( testBestWindows
);
1464 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1252
);
1465 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_ROMAN
);
1466 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_437
);
1467 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_850
);
1468 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_860
);
1469 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_861
);
1470 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_863
);
1471 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_865
);
1472 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_SYMBOL
);
1473 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ASCII_US
);
1474 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_1
);
1476 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_2
);
1478 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_3
);
1479 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_4
);
1481 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_5
);
1482 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_6
);
1483 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_7
);
1484 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_8
);
1485 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_9
);
1487 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_14
);
1488 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_15
);
1490 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_737
);
1491 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_775
);
1492 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_852
);
1493 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_855
);
1494 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_857
);
1495 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_862
);
1496 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_864
);
1497 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_866
);
1498 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_869
);
1499 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_874
);
1500 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1250
);
1501 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1251
);
1502 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1253
);
1503 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1254
);
1504 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1255
);
1505 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1256
);
1506 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1257
);
1507 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1258
);
1508 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_ARABIC
);
1509 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_CENTEURO
);
1510 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_CROATIAN
);
1511 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_CYRILLIC
);
1512 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_DEVANAGARI
);
1513 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_FARSI
);
1514 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_GREEK
);
1515 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_GUJARATI
);
1516 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_GURMUKHI
);
1517 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_HEBREW
);
1519 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_ICELAND
);
1521 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_ROMANIAN
);
1522 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_THAI
);
1523 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_TURKISH
);
1524 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_UKRAINIAN
);
1525 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_CHINSIMP
);
1526 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_CHINTRAD
);
1527 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_JAPANESE
);
1528 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_KOREAN
);
1529 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_932
);
1530 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_936
);
1531 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_949
);
1532 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_950
);
1533 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_SHIFT_JIS
);
1534 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_GB_2312
);
1535 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_GBT_12345
);
1536 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_GBK
);
1537 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_BIG5
);
1538 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_EUC_JP
);
1539 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_EUC_CN
);
1540 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_EUC_TW
);
1541 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_2022_JP
);
1542 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_2022_CN
);
1543 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_KOI8_R
);
1545 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_UTF7
);
1546 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_UTF8
);
1548 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_10
);
1549 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_13
);
1550 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_EUC_KR
);
1551 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_2022_KR
);
1552 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_JIS_X_0201
);
1553 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_JIS_X_0208
);
1554 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_JIS_X_0212
);
1555 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1361
);
1556 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_GB_18030
);
1557 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_BIG5_HKSCS
);
1558 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_TIS_620
);
1559 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_KOI8_U
);
1560 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISCII_DEVANAGARI
);
1562 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_JAVA_UTF8
);
1564 CPPUNIT_TEST_SUITE_END( );
1567 class testTextEncodingInfo
: public CppUnit::TestFixture
1570 // not implemented encoding test
1571 void testTextEncodingInfo_001()
1573 rtl_TextEncodingInfo aInfo1
, aInfo2
, aInfo3
, aInfo4
, aInfo5
;
1574 aInfo1
.StructSize
= 4;
1576 bool bRes1
= rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC
, &aInfo1
);
1578 bool bRes11
= rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC
, &aInfo1
);
1579 CPPUNIT_ASSERT_MESSAGE("should return sal_False.", !bRes1
);
1580 CPPUNIT_ASSERT_MESSAGE("should return sal_False.", !bRes11
);
1582 aInfo2
.StructSize
= 5;
1583 bool bRes2
= rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC
, &aInfo2
);
1584 bool bRes21
= rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC
, &aInfo2
);
1585 CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes2
);
1586 CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes21
);
1587 CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", aInfo2
.MinimumCharSize
>=1 );
1589 aInfo3
.StructSize
= 6;
1590 bool bRes3
= rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC
, &aInfo3
);
1591 bool bRes31
= rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC
, &aInfo3
);
1592 CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes3
);
1593 CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes31
);
1594 //&& aInfo2.MinimumCharSize >=1 );
1596 aInfo4
.StructSize
= 8;
1597 bool bRes4
= rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC
, &aInfo4
);
1598 bool bRes41
= rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC
, &aInfo4
);
1599 CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes4
);
1600 CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes41
);
1601 // && aInfo2.MinimumCharSize >=1 );
1603 aInfo5
.StructSize
= sizeof aInfo5
;
1604 bool bRes5
= rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC
, &aInfo5
);
1605 CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", !bRes5
);
1606 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1607 "StructSize<6 should return sal_True", sal_uInt32(0), aInfo5
.Flags
);
1610 CPPUNIT_TEST_SUITE(testTextEncodingInfo
);
1611 CPPUNIT_TEST(testTextEncodingInfo_001
);
1612 CPPUNIT_TEST_SUITE_END();
1615 class testEncodingFromUnix
: public CppUnit::TestFixture
1618 void testIso8859() {
1619 check(RTL_TEXTENCODING_DONTKNOW
, "ISO8859");
1620 check(RTL_TEXTENCODING_DONTKNOW
, "ISO8859-0");
1621 check(RTL_TEXTENCODING_DONTKNOW
, "ISO8859-01");
1622 check(RTL_TEXTENCODING_DONTKNOW
, "ISO8859_1");
1623 check(RTL_TEXTENCODING_DONTKNOW
, "ISO88591");
1624 check(RTL_TEXTENCODING_ISO_8859_1
, "ISO8859-1");
1625 check(RTL_TEXTENCODING_ISO_8859_2
, "ISO8859-2");
1626 check(RTL_TEXTENCODING_ISO_8859_3
, "ISO8859-3");
1627 check(RTL_TEXTENCODING_ISO_8859_4
, "ISO8859-4");
1628 check(RTL_TEXTENCODING_ISO_8859_5
, "ISO8859-5");
1629 check(RTL_TEXTENCODING_ISO_8859_6
, "ISO8859-6");
1630 check(RTL_TEXTENCODING_ISO_8859_7
, "ISO8859-7");
1631 check(RTL_TEXTENCODING_ISO_8859_8
, "ISO8859-8");
1632 check(RTL_TEXTENCODING_ISO_8859_9
, "ISO8859-9");
1633 check(RTL_TEXTENCODING_ISO_8859_10
, "ISO8859-10");
1634 check(RTL_TEXTENCODING_TIS_620
, "ISO8859-11");
1635 check(RTL_TEXTENCODING_ISO_8859_13
, "ISO8859-13");
1636 check(RTL_TEXTENCODING_ISO_8859_14
, "ISO8859-14");
1637 check(RTL_TEXTENCODING_ISO_8859_15
, "ISO8859-15");
1641 check(RTL_TEXTENCODING_DONTKNOW
, "TIS620");
1642 check(RTL_TEXTENCODING_TIS_620
, "TIS620-0");
1643 check(RTL_TEXTENCODING_DONTKNOW
, "TIS620-1");
1644 check(RTL_TEXTENCODING_TIS_620
, "TIS620-2529");
1645 check(RTL_TEXTENCODING_TIS_620
, "TIS620-2533");
1646 check(RTL_TEXTENCODING_DONTKNOW
, "TIS620.2529-0");
1647 check(RTL_TEXTENCODING_TIS_620
, "TIS620.2529-1");
1648 check(RTL_TEXTENCODING_DONTKNOW
, "TIS620.2529-2");
1649 check(RTL_TEXTENCODING_TIS_620
, "TIS620.2533-0");
1650 check(RTL_TEXTENCODING_TIS_620
, "TIS620.2533-1");
1651 check(RTL_TEXTENCODING_DONTKNOW
, "TIS620.2533-2");
1654 CPPUNIT_TEST_SUITE(testEncodingFromUnix
);
1655 CPPUNIT_TEST(testIso8859
);
1656 CPPUNIT_TEST(testTis620
);
1657 CPPUNIT_TEST_SUITE_END();
1660 void check(rtl_TextEncoding expected
, char const * input
) {
1661 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1662 input
, expected
, rtl_getTextEncodingFromUnixCharset(input
));
1668 CPPUNIT_TEST_SUITE_REGISTRATION(testBestMime
);
1669 CPPUNIT_TEST_SUITE_REGISTRATION(testBestUnix
);
1670 CPPUNIT_TEST_SUITE_REGISTRATION(testBestWindows
);
1671 CPPUNIT_TEST_SUITE_REGISTRATION(testTextEncodingInfo
);
1672 CPPUNIT_TEST_SUITE_REGISTRATION(testEncodingFromUnix
);
1674 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */