tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sal / qa / rtl / textenc / rtl_tencinfo.cxx
blob123b8f12325f860331da31560630bd1bdede96bd
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
22 #include <rtl/tencinfo.h>
24 #include <cppunit/TestFixture.h>
25 #include <cppunit/extensions/HelperMacros.h>
27 namespace
29 class testBestMime : public CppUnit::TestFixture
31 public:
32 void check(rtl_TextEncoding eIn, rtl_TextEncoding eOut)
34 const char *pCharSet = rtl_getBestMimeCharsetFromTextEncoding(eIn);
35 rtl_TextEncoding eTextEnc = rtl_getTextEncodingFromMimeCharset(pCharSet);
36 CPPUNIT_ASSERT_EQUAL_MESSAGE("rtl_getBestMimeCharsetFromTextEncoding && rtl_getTextEncodingFromMimeCharset differdiffer", eOut, eTextEnc );
39 // the defines for the follows test could be found in file inc/rtl/textenc.h
41 void MimeCharsetFromTextEncoding_MS_1252()
43 check( RTL_TEXTENCODING_MS_1252, RTL_TEXTENCODING_MS_1252 );
46 void MimeCharsetFromTextEncoding_APPLE_ROMAN()
48 check( RTL_TEXTENCODING_APPLE_ROMAN, RTL_TEXTENCODING_APPLE_ROMAN);
51 void MimeCharsetFromTextEncoding_IBM_437()
53 check( RTL_TEXTENCODING_IBM_437, RTL_TEXTENCODING_IBM_437 );
56 void MimeCharsetFromTextEncoding_IBM_850()
58 check( RTL_TEXTENCODING_IBM_850, RTL_TEXTENCODING_IBM_850 );
61 void MimeCharsetFromTextEncoding_IBM_860()
63 check( RTL_TEXTENCODING_IBM_860, RTL_TEXTENCODING_IBM_860 );
66 void MimeCharsetFromTextEncoding_IBM_861()
68 check( RTL_TEXTENCODING_IBM_861, RTL_TEXTENCODING_IBM_861 );
71 void MimeCharsetFromTextEncoding_IBM_863()
73 check( RTL_TEXTENCODING_IBM_863, RTL_TEXTENCODING_IBM_863 );
76 void MimeCharsetFromTextEncoding_IBM_865()
78 check( RTL_TEXTENCODING_IBM_865, RTL_TEXTENCODING_IBM_865 );
81 void MimeCharsetFromTextEncoding_SYMBOL()
83 check( RTL_TEXTENCODING_SYMBOL, RTL_TEXTENCODING_DONTKNOW );
86 void MimeCharsetFromTextEncoding_ASCII_US()
88 check( RTL_TEXTENCODING_ASCII_US, RTL_TEXTENCODING_ASCII_US );
91 void MimeCharsetFromTextEncoding_ISO_8859_1()
93 check( RTL_TEXTENCODING_ISO_8859_1, RTL_TEXTENCODING_ISO_8859_1 );
95 void MimeCharsetFromTextEncoding_ISO_8859_2()
97 check( RTL_TEXTENCODING_ISO_8859_2, RTL_TEXTENCODING_ISO_8859_2 );
99 void MimeCharsetFromTextEncoding_ISO_8859_3()
101 check( RTL_TEXTENCODING_ISO_8859_3, RTL_TEXTENCODING_ISO_8859_3 );
103 void MimeCharsetFromTextEncoding_ISO_8859_4()
105 check( RTL_TEXTENCODING_ISO_8859_4, RTL_TEXTENCODING_ISO_8859_4 );
107 void MimeCharsetFromTextEncoding_ISO_8859_5()
109 check( RTL_TEXTENCODING_ISO_8859_5, RTL_TEXTENCODING_ISO_8859_5 );
111 void MimeCharsetFromTextEncoding_ISO_8859_6()
113 check( RTL_TEXTENCODING_ISO_8859_6, RTL_TEXTENCODING_ISO_8859_6 );
115 void MimeCharsetFromTextEncoding_ISO_8859_7()
117 check( RTL_TEXTENCODING_ISO_8859_7, RTL_TEXTENCODING_ISO_8859_7 );
119 void MimeCharsetFromTextEncoding_ISO_8859_8()
121 check( RTL_TEXTENCODING_ISO_8859_8, RTL_TEXTENCODING_ISO_8859_8 );
123 void MimeCharsetFromTextEncoding_ISO_8859_9()
125 check( RTL_TEXTENCODING_ISO_8859_9, RTL_TEXTENCODING_ISO_8859_9 );
127 void MimeCharsetFromTextEncoding_ISO_8859_14()
129 check( RTL_TEXTENCODING_ISO_8859_14, RTL_TEXTENCODING_ISO_8859_14 );
131 void MimeCharsetFromTextEncoding_ISO_8859_15()
133 check( RTL_TEXTENCODING_ISO_8859_15, RTL_TEXTENCODING_ISO_8859_15 );
135 void MimeCharsetFromTextEncoding_IBM_737()
137 check( RTL_TEXTENCODING_IBM_737, RTL_TEXTENCODING_ISO_8859_7 );
139 void MimeCharsetFromTextEncoding_IBM_775()
141 check( RTL_TEXTENCODING_IBM_775, RTL_TEXTENCODING_ISO_8859_4 );
143 void MimeCharsetFromTextEncoding_IBM_852()
145 check( RTL_TEXTENCODING_IBM_852, RTL_TEXTENCODING_IBM_852 );
147 void MimeCharsetFromTextEncoding_IBM_855()
149 check( RTL_TEXTENCODING_IBM_855, RTL_TEXTENCODING_ISO_8859_5 );
151 void MimeCharsetFromTextEncoding_IBM_857()
153 check( RTL_TEXTENCODING_IBM_857, RTL_TEXTENCODING_ISO_8859_9 );
155 void MimeCharsetFromTextEncoding_IBM_862()
157 check( RTL_TEXTENCODING_IBM_862, RTL_TEXTENCODING_IBM_862 );
159 void MimeCharsetFromTextEncoding_IBM_864()
161 check( RTL_TEXTENCODING_IBM_864, RTL_TEXTENCODING_IBM_864 );
163 void MimeCharsetFromTextEncoding_IBM_866()
165 check( RTL_TEXTENCODING_IBM_866, RTL_TEXTENCODING_IBM_866 );
167 void MimeCharsetFromTextEncoding_IBM_869()
169 check( RTL_TEXTENCODING_IBM_869, RTL_TEXTENCODING_ISO_8859_7 );
171 void MimeCharsetFromTextEncoding_MS_874()
173 check( RTL_TEXTENCODING_MS_874, RTL_TEXTENCODING_MS_874 );
175 void MimeCharsetFromTextEncoding_MS_1250()
177 check( RTL_TEXTENCODING_MS_1250, RTL_TEXTENCODING_MS_1250 );
179 void MimeCharsetFromTextEncoding_MS_1251()
181 check( RTL_TEXTENCODING_MS_1251, RTL_TEXTENCODING_MS_1251 );
183 void MimeCharsetFromTextEncoding_MS_1253()
185 check( RTL_TEXTENCODING_MS_1253, RTL_TEXTENCODING_MS_1253 );
187 void MimeCharsetFromTextEncoding_MS_1254()
189 check( RTL_TEXTENCODING_MS_1254, RTL_TEXTENCODING_MS_1254 );
191 void MimeCharsetFromTextEncoding_MS_1255()
193 check( RTL_TEXTENCODING_MS_1255, RTL_TEXTENCODING_MS_1255 );
195 void MimeCharsetFromTextEncoding_MS_1256()
197 check( RTL_TEXTENCODING_MS_1256, RTL_TEXTENCODING_MS_1256 );
199 void MimeCharsetFromTextEncoding_MS_1257()
201 check( RTL_TEXTENCODING_MS_1257, RTL_TEXTENCODING_MS_1257 );
203 void MimeCharsetFromTextEncoding_MS_1258()
205 check( RTL_TEXTENCODING_MS_1258, RTL_TEXTENCODING_MS_1258 );
207 void MimeCharsetFromTextEncoding_APPLE_CENTEURO()
209 check( RTL_TEXTENCODING_APPLE_CENTEURO, RTL_TEXTENCODING_ISO_8859_2 );
211 void MimeCharsetFromTextEncoding_APPLE_CROATIAN()
213 check( RTL_TEXTENCODING_APPLE_CROATIAN, RTL_TEXTENCODING_ISO_8859_2 );
215 void MimeCharsetFromTextEncoding_APPLE_CYRILLIC()
217 check( RTL_TEXTENCODING_APPLE_CYRILLIC, RTL_TEXTENCODING_ISO_8859_5 );
219 void MimeCharsetFromTextEncoding_APPLE_GREEK()
221 check( RTL_TEXTENCODING_APPLE_GREEK, RTL_TEXTENCODING_ISO_8859_7 );
223 void MimeCharsetFromTextEncoding_APPLE_ICELAND()
225 check( RTL_TEXTENCODING_APPLE_ICELAND, RTL_TEXTENCODING_ISO_8859_1 );
227 void MimeCharsetFromTextEncoding_APPLE_ROMANIAN()
229 check( RTL_TEXTENCODING_APPLE_ROMANIAN, RTL_TEXTENCODING_ISO_8859_2 );
231 void MimeCharsetFromTextEncoding_APPLE_TURKISH()
233 check( RTL_TEXTENCODING_APPLE_TURKISH, RTL_TEXTENCODING_ISO_8859_9 );
235 void MimeCharsetFromTextEncoding_APPLE_UKRAINIAN()
237 check( RTL_TEXTENCODING_APPLE_UKRAINIAN, RTL_TEXTENCODING_ISO_8859_5 );
239 void MimeCharsetFromTextEncoding_MS_932()
241 check( RTL_TEXTENCODING_MS_932, RTL_TEXTENCODING_SHIFT_JIS );
243 void MimeCharsetFromTextEncoding_MS_936()
245 check( RTL_TEXTENCODING_MS_936, RTL_TEXTENCODING_GB_2312 );
247 void MimeCharsetFromTextEncoding_MS_949()
249 check( RTL_TEXTENCODING_MS_949, RTL_TEXTENCODING_EUC_KR );
251 void MimeCharsetFromTextEncoding_MS_950()
253 check( RTL_TEXTENCODING_MS_950, RTL_TEXTENCODING_BIG5 );
255 void MimeCharsetFromTextEncoding_KOI8_R()
257 check( RTL_TEXTENCODING_KOI8_R, RTL_TEXTENCODING_KOI8_R );
259 void MimeCharsetFromTextEncoding_UTF7()
261 check( RTL_TEXTENCODING_UTF7, RTL_TEXTENCODING_UTF7 );
263 void MimeCharsetFromTextEncoding_UTF8()
265 check( RTL_TEXTENCODING_UTF8, RTL_TEXTENCODING_UTF8 );
267 void MimeCharsetFromTextEncoding_ISO_8859_10()
269 check( RTL_TEXTENCODING_ISO_8859_10, RTL_TEXTENCODING_ISO_8859_10 );
271 void MimeCharsetFromTextEncoding_ISO_8859_13()
273 check( RTL_TEXTENCODING_ISO_8859_13, RTL_TEXTENCODING_ISO_8859_13 );
275 void MimeCharsetFromTextEncoding_MS_1361()
277 check( RTL_TEXTENCODING_MS_1361, RTL_TEXTENCODING_EUC_KR );
279 void MimeCharsetFromTextEncoding_TIS_620()
281 check( RTL_TEXTENCODING_TIS_620, RTL_TEXTENCODING_TIS_620 );
283 void MimeCharsetFromTextEncoding_KOI8_U()
285 check( RTL_TEXTENCODING_KOI8_U, RTL_TEXTENCODING_KOI8_U );
287 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
288 void MimeCharsetFromTextEncoding_APPLE_JAPANESE()
290 check( RTL_TEXTENCODING_APPLE_JAPANESE, RTL_TEXTENCODING_SHIFT_JIS );
292 void MimeCharsetFromTextEncoding_SHIFT_JIS()
294 check( RTL_TEXTENCODING_SHIFT_JIS, RTL_TEXTENCODING_SHIFT_JIS );
296 void MimeCharsetFromTextEncoding_EUC_JP()
298 check( RTL_TEXTENCODING_EUC_JP, RTL_TEXTENCODING_EUC_JP );
300 void MimeCharsetFromTextEncoding_ISO_2022_JP()
302 check( RTL_TEXTENCODING_ISO_2022_JP, RTL_TEXTENCODING_ISO_2022_JP );
304 void MimeCharsetFromTextEncoding_JIS_X_0201()
306 check( RTL_TEXTENCODING_JIS_X_0201, RTL_TEXTENCODING_EUC_JP );
308 void MimeCharsetFromTextEncoding_JIS_X_0208()
310 check( RTL_TEXTENCODING_JIS_X_0208, RTL_TEXTENCODING_EUC_JP );
312 void MimeCharsetFromTextEncoding_JIS_X_0212()
314 check( RTL_TEXTENCODING_JIS_X_0212, RTL_TEXTENCODING_EUC_JP );
316 #endif
317 #if WITH_LOCALE_ALL || WITH_LOCALE_ko
318 void MimeCharsetFromTextEncoding_APPLE_KOREAN()
320 check( RTL_TEXTENCODING_APPLE_KOREAN, RTL_TEXTENCODING_EUC_KR );
322 void MimeCharsetFromTextEncoding_EUC_KR()
324 check( RTL_TEXTENCODING_EUC_KR, RTL_TEXTENCODING_EUC_KR );
326 void MimeCharsetFromTextEncoding_ISO_2022_KR()
328 check( RTL_TEXTENCODING_ISO_2022_KR, RTL_TEXTENCODING_ISO_2022_KR );
330 #endif
331 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
332 void MimeCharsetFromTextEncoding_APPLE_CHINSIMP()
334 check( RTL_TEXTENCODING_APPLE_CHINSIMP, RTL_TEXTENCODING_GB_2312 );
336 void MimeCharsetFromTextEncoding_APPLE_CHINTRAD()
338 check( RTL_TEXTENCODING_APPLE_CHINTRAD, RTL_TEXTENCODING_BIG5 );
340 void MimeCharsetFromTextEncoding_GB_2312()
342 check( RTL_TEXTENCODING_GB_2312, RTL_TEXTENCODING_GB_2312 );
344 void MimeCharsetFromTextEncoding_GBT_12345()
346 check( RTL_TEXTENCODING_GBT_12345, RTL_TEXTENCODING_GBT_12345 );
348 void MimeCharsetFromTextEncoding_GBK()
350 check( RTL_TEXTENCODING_GBK, RTL_TEXTENCODING_GBK );
352 void MimeCharsetFromTextEncoding_BIG5()
354 check( RTL_TEXTENCODING_BIG5, RTL_TEXTENCODING_BIG5 );
356 void MimeCharsetFromTextEncoding_EUC_CN()
358 check( RTL_TEXTENCODING_EUC_CN, RTL_TEXTENCODING_GB_2312 );
360 void MimeCharsetFromTextEncoding_EUC_TW()
362 check( RTL_TEXTENCODING_EUC_TW, RTL_TEXTENCODING_BIG5 );
364 void MimeCharsetFromTextEncoding_ISO_2022_CN()
366 check( RTL_TEXTENCODING_ISO_2022_CN, RTL_TEXTENCODING_ISO_2022_CN );
368 void MimeCharsetFromTextEncoding_GB_18030()
370 check( RTL_TEXTENCODING_GB_18030, RTL_TEXTENCODING_GB_18030 );
372 void MimeCharsetFromTextEncoding_BIG5_HKSCS()
374 check( RTL_TEXTENCODING_BIG5_HKSCS, RTL_TEXTENCODING_BIG5_HKSCS );
376 #endif
377 #if WITH_LOCALE_ALL || WITH_LOCALE_FOR_SCRIPT_Deva
378 void MimeCharsetFromTextEncoding_ISCII_DEVANAGARI()
380 check( RTL_TEXTENCODING_ISCII_DEVANAGARI, RTL_TEXTENCODING_ISCII_DEVANAGARI );
382 #endif
383 CPPUNIT_TEST_SUITE( testBestMime );
385 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1252 );
386 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_ROMAN );
387 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_437 );
388 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_850 );
389 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_860 );
390 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_861 );
391 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_863 );
392 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_865 );
393 CPPUNIT_TEST( MimeCharsetFromTextEncoding_SYMBOL );
394 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ASCII_US );
395 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_1 );
396 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_2 );
397 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_3 );
398 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_4 );
399 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_5 );
400 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_6 );
401 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_7 );
402 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_8 );
403 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_9 );
404 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_14 );
405 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_15 );
406 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_737 );
407 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_775 );
408 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_852 );
409 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_855 );
410 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_857 );
411 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_862 );
412 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_864 );
413 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_866 );
414 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_869 );
415 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_874 );
416 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1250 );
417 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1251 );
418 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1253 );
419 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1254 );
420 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1255 );
421 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1256 );
422 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1257 );
423 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1258 );
424 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CENTEURO );
425 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CROATIAN );
426 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CYRILLIC );
427 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_GREEK );
428 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_ICELAND );
429 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_ROMANIAN );
430 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_TURKISH );
431 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_UKRAINIAN );
432 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_932 );
433 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_936 );
434 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_949 );
435 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_950 );
436 CPPUNIT_TEST( MimeCharsetFromTextEncoding_KOI8_R );
437 CPPUNIT_TEST( MimeCharsetFromTextEncoding_UTF7 );
438 CPPUNIT_TEST( MimeCharsetFromTextEncoding_UTF8 );
439 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_10 );
440 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_13 );
441 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1361 );
442 CPPUNIT_TEST( MimeCharsetFromTextEncoding_TIS_620 );
443 CPPUNIT_TEST( MimeCharsetFromTextEncoding_KOI8_U );
444 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
445 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_JAPANESE );
446 CPPUNIT_TEST( MimeCharsetFromTextEncoding_SHIFT_JIS );
447 CPPUNIT_TEST( MimeCharsetFromTextEncoding_EUC_JP );
448 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_2022_JP );
449 CPPUNIT_TEST( MimeCharsetFromTextEncoding_JIS_X_0201 );
450 CPPUNIT_TEST( MimeCharsetFromTextEncoding_JIS_X_0208 );
451 CPPUNIT_TEST( MimeCharsetFromTextEncoding_JIS_X_0212 );
452 #endif
453 #if WITH_LOCALE_ALL || WITH_LOCALE_ko
454 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_KOREAN );
455 CPPUNIT_TEST( MimeCharsetFromTextEncoding_EUC_KR );
456 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_2022_KR );
457 #endif
458 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
459 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CHINSIMP );
460 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CHINTRAD );
461 CPPUNIT_TEST( MimeCharsetFromTextEncoding_GB_2312 );
462 CPPUNIT_TEST( MimeCharsetFromTextEncoding_GBT_12345 );
463 CPPUNIT_TEST( MimeCharsetFromTextEncoding_GBK );
464 CPPUNIT_TEST( MimeCharsetFromTextEncoding_BIG5 );
465 CPPUNIT_TEST( MimeCharsetFromTextEncoding_EUC_CN );
466 CPPUNIT_TEST( MimeCharsetFromTextEncoding_EUC_TW );
467 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_2022_CN );
468 CPPUNIT_TEST( MimeCharsetFromTextEncoding_GB_18030 );
469 CPPUNIT_TEST( MimeCharsetFromTextEncoding_BIG5_HKSCS );
470 #endif
471 #if WITH_LOCALE_ALL || WITH_LOCALE_FOR_SCRIPT_Deva
472 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISCII_DEVANAGARI );
473 #endif
474 CPPUNIT_TEST_SUITE_END( );
477 class testBestUnix : public CppUnit::TestFixture
479 public:
480 void check(rtl_TextEncoding eIn, rtl_TextEncoding eOut)
482 const char *pCharSet = rtl_getBestUnixCharsetFromTextEncoding(eIn);
483 rtl_TextEncoding eTextEnc = rtl_getTextEncodingFromUnixCharset(pCharSet);
484 CPPUNIT_ASSERT_EQUAL_MESSAGE("rtl_getBestUnixCharsetFromTextEncoding && rtl_getTextEncodingFromUnixCharset", eOut, eTextEnc );
487 void UnixCharsetFromTextEncoding_MS_1252()
489 check( RTL_TEXTENCODING_MS_1252, RTL_TEXTENCODING_ISO_8859_1 );
492 void UnixCharsetFromTextEncoding_APPLE_ROMAN()
494 check( RTL_TEXTENCODING_APPLE_ROMAN, RTL_TEXTENCODING_ISO_8859_1 );
497 void UnixCharsetFromTextEncoding_IBM_437()
499 check( RTL_TEXTENCODING_IBM_437, RTL_TEXTENCODING_ISO_8859_1 );
502 void UnixCharsetFromTextEncoding_IBM_850()
504 check( RTL_TEXTENCODING_IBM_850, RTL_TEXTENCODING_ISO_8859_1 );
507 void UnixCharsetFromTextEncoding_IBM_860()
509 check( RTL_TEXTENCODING_IBM_860, RTL_TEXTENCODING_ISO_8859_1 );
512 void UnixCharsetFromTextEncoding_IBM_861()
514 check( RTL_TEXTENCODING_IBM_861, RTL_TEXTENCODING_ISO_8859_1 );
517 void UnixCharsetFromTextEncoding_IBM_863()
519 check( RTL_TEXTENCODING_IBM_863, RTL_TEXTENCODING_ISO_8859_1 );
522 void UnixCharsetFromTextEncoding_IBM_865()
524 check( RTL_TEXTENCODING_IBM_865, RTL_TEXTENCODING_ISO_8859_1 );
527 void UnixCharsetFromTextEncoding_SYMBOL()
529 check( RTL_TEXTENCODING_SYMBOL, RTL_TEXTENCODING_SYMBOL );
532 void UnixCharsetFromTextEncoding_ASCII_US()
534 check( RTL_TEXTENCODING_ASCII_US, RTL_TEXTENCODING_ISO_8859_1 );
537 void UnixCharsetFromTextEncoding_ISO_8859_1()
539 check( RTL_TEXTENCODING_ISO_8859_1, RTL_TEXTENCODING_ISO_8859_1 );
542 void UnixCharsetFromTextEncoding_ISO_8859_2()
544 check( RTL_TEXTENCODING_ISO_8859_2, RTL_TEXTENCODING_ISO_8859_2 );
547 void UnixCharsetFromTextEncoding_ISO_8859_3()
549 check( RTL_TEXTENCODING_ISO_8859_3, RTL_TEXTENCODING_ISO_8859_3 );
552 void UnixCharsetFromTextEncoding_ISO_8859_4()
554 check( RTL_TEXTENCODING_ISO_8859_4, RTL_TEXTENCODING_ISO_8859_4 );
557 void UnixCharsetFromTextEncoding_ISO_8859_5()
559 check( RTL_TEXTENCODING_ISO_8859_5, RTL_TEXTENCODING_ISO_8859_5 );
562 void UnixCharsetFromTextEncoding_ISO_8859_6()
564 check( RTL_TEXTENCODING_ISO_8859_6, RTL_TEXTENCODING_ISO_8859_6 );
567 void UnixCharsetFromTextEncoding_ISO_8859_7()
569 check( RTL_TEXTENCODING_ISO_8859_7, RTL_TEXTENCODING_ISO_8859_7 );
572 void UnixCharsetFromTextEncoding_ISO_8859_8()
574 check( RTL_TEXTENCODING_ISO_8859_8, RTL_TEXTENCODING_ISO_8859_8 );
577 void UnixCharsetFromTextEncoding_ISO_8859_9()
579 check( RTL_TEXTENCODING_ISO_8859_9, RTL_TEXTENCODING_ISO_8859_9 );
582 void UnixCharsetFromTextEncoding_ISO_8859_14()
584 check( RTL_TEXTENCODING_ISO_8859_14, RTL_TEXTENCODING_ISO_8859_14 );
587 void UnixCharsetFromTextEncoding_ISO_8859_15()
589 check( RTL_TEXTENCODING_ISO_8859_15, RTL_TEXTENCODING_ISO_8859_15 );
592 void UnixCharsetFromTextEncoding_IBM_737()
594 check( RTL_TEXTENCODING_IBM_737, RTL_TEXTENCODING_ISO_8859_7 );
597 void UnixCharsetFromTextEncoding_IBM_775()
599 check( RTL_TEXTENCODING_IBM_775, RTL_TEXTENCODING_ISO_8859_4 );
602 void UnixCharsetFromTextEncoding_IBM_852()
604 check( RTL_TEXTENCODING_IBM_852, RTL_TEXTENCODING_ISO_8859_2 );
607 void UnixCharsetFromTextEncoding_IBM_855()
609 check( RTL_TEXTENCODING_IBM_855, RTL_TEXTENCODING_ISO_8859_5 );
612 void UnixCharsetFromTextEncoding_IBM_857()
614 check( RTL_TEXTENCODING_IBM_857, RTL_TEXTENCODING_ISO_8859_9 );
617 void UnixCharsetFromTextEncoding_IBM_862()
619 check( RTL_TEXTENCODING_IBM_862, RTL_TEXTENCODING_ISO_8859_8 );
622 void UnixCharsetFromTextEncoding_IBM_864()
624 check( RTL_TEXTENCODING_IBM_864, RTL_TEXTENCODING_ISO_8859_6 );
627 void UnixCharsetFromTextEncoding_IBM_866()
629 check( RTL_TEXTENCODING_IBM_866, RTL_TEXTENCODING_ISO_8859_5 );
632 void UnixCharsetFromTextEncoding_IBM_869()
634 check( RTL_TEXTENCODING_IBM_869, RTL_TEXTENCODING_ISO_8859_7 );
637 void UnixCharsetFromTextEncoding_MS_874()
639 check( RTL_TEXTENCODING_MS_874, RTL_TEXTENCODING_ISO_8859_1 );
642 void UnixCharsetFromTextEncoding_MS_1250()
644 check( RTL_TEXTENCODING_MS_1250, RTL_TEXTENCODING_ISO_8859_2 );
647 void UnixCharsetFromTextEncoding_MS_1251()
649 check( RTL_TEXTENCODING_MS_1251, RTL_TEXTENCODING_ISO_8859_5 );
652 void UnixCharsetFromTextEncoding_MS_1253()
654 check( RTL_TEXTENCODING_MS_1253, RTL_TEXTENCODING_ISO_8859_7 );
657 void UnixCharsetFromTextEncoding_MS_1254()
659 check( RTL_TEXTENCODING_MS_1254, RTL_TEXTENCODING_ISO_8859_9 );
662 void UnixCharsetFromTextEncoding_MS_1255()
664 check( RTL_TEXTENCODING_MS_1255, RTL_TEXTENCODING_ISO_8859_8 );
667 void UnixCharsetFromTextEncoding_MS_1256()
669 check( RTL_TEXTENCODING_MS_1256, RTL_TEXTENCODING_ISO_8859_6 );
672 void UnixCharsetFromTextEncoding_MS_1257()
674 check( RTL_TEXTENCODING_MS_1257, RTL_TEXTENCODING_ISO_8859_4 );
677 void UnixCharsetFromTextEncoding_MS_1258()
679 check( RTL_TEXTENCODING_MS_1258, RTL_TEXTENCODING_ISO_8859_1 );
682 void UnixCharsetFromTextEncoding_APPLE_CENTEURO()
684 check( RTL_TEXTENCODING_APPLE_CENTEURO, RTL_TEXTENCODING_ISO_8859_2 );
687 void UnixCharsetFromTextEncoding_APPLE_CROATIAN()
689 check( RTL_TEXTENCODING_APPLE_CROATIAN, RTL_TEXTENCODING_ISO_8859_2 );
692 void UnixCharsetFromTextEncoding_APPLE_CYRILLIC()
694 check( RTL_TEXTENCODING_APPLE_CYRILLIC, RTL_TEXTENCODING_ISO_8859_5 );
697 void UnixCharsetFromTextEncoding_APPLE_GREEK()
699 check( RTL_TEXTENCODING_APPLE_GREEK, RTL_TEXTENCODING_ISO_8859_7 );
702 void UnixCharsetFromTextEncoding_APPLE_ICELAND()
704 check( RTL_TEXTENCODING_APPLE_ICELAND, RTL_TEXTENCODING_ISO_8859_1 );
707 void UnixCharsetFromTextEncoding_APPLE_ROMANIAN()
709 check( RTL_TEXTENCODING_APPLE_ROMANIAN, RTL_TEXTENCODING_ISO_8859_2 );
712 void UnixCharsetFromTextEncoding_APPLE_TURKISH()
714 check( RTL_TEXTENCODING_APPLE_TURKISH, RTL_TEXTENCODING_ISO_8859_9 );
717 void UnixCharsetFromTextEncoding_APPLE_UKRAINIAN()
719 check( RTL_TEXTENCODING_APPLE_UKRAINIAN, RTL_TEXTENCODING_ISO_8859_5 );
721 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
722 void UnixCharsetFromTextEncoding_APPLE_CHINSIMP()
724 check( RTL_TEXTENCODING_APPLE_CHINSIMP, RTL_TEXTENCODING_DONTKNOW );
727 void UnixCharsetFromTextEncoding_APPLE_CHINTRAD()
729 check( RTL_TEXTENCODING_APPLE_CHINTRAD, RTL_TEXTENCODING_DONTKNOW );
731 #endif
732 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
733 void UnixCharsetFromTextEncoding_APPLE_JAPANESE()
735 check( RTL_TEXTENCODING_APPLE_JAPANESE, RTL_TEXTENCODING_DONTKNOW );
737 #endif
738 #if WITH_LOCALE_ALL || WITH_LOCALE_ko
739 void UnixCharsetFromTextEncoding_APPLE_KOREAN()
741 check( RTL_TEXTENCODING_APPLE_KOREAN, RTL_TEXTENCODING_DONTKNOW );
743 #endif
744 void UnixCharsetFromTextEncoding_MS_932()
746 check( RTL_TEXTENCODING_MS_932, RTL_TEXTENCODING_DONTKNOW );
749 void UnixCharsetFromTextEncoding_MS_936()
751 check( RTL_TEXTENCODING_MS_936, RTL_TEXTENCODING_DONTKNOW );
754 void UnixCharsetFromTextEncoding_MS_949()
756 check( RTL_TEXTENCODING_MS_949, RTL_TEXTENCODING_DONTKNOW );
759 void UnixCharsetFromTextEncoding_MS_950()
761 check( RTL_TEXTENCODING_MS_950, RTL_TEXTENCODING_DONTKNOW );
763 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
764 void UnixCharsetFromTextEncoding_SHIFT_JIS()
766 check( RTL_TEXTENCODING_SHIFT_JIS, RTL_TEXTENCODING_DONTKNOW );
768 #endif
769 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
770 void UnixCharsetFromTextEncoding_GB_2312()
772 check( RTL_TEXTENCODING_GB_2312, RTL_TEXTENCODING_DONTKNOW );
775 void UnixCharsetFromTextEncoding_GBT_12345()
777 check( RTL_TEXTENCODING_GBT_12345, RTL_TEXTENCODING_DONTKNOW );
780 void UnixCharsetFromTextEncoding_GBK()
782 check( RTL_TEXTENCODING_GBK, RTL_TEXTENCODING_DONTKNOW );
785 void UnixCharsetFromTextEncoding_BIG5()
787 check( RTL_TEXTENCODING_BIG5, RTL_TEXTENCODING_DONTKNOW );
789 #endif
790 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
791 void UnixCharsetFromTextEncoding_EUC_JP()
793 check( RTL_TEXTENCODING_EUC_JP, RTL_TEXTENCODING_DONTKNOW );
795 #endif
796 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
797 void UnixCharsetFromTextEncoding_EUC_CN()
799 check( RTL_TEXTENCODING_EUC_CN, RTL_TEXTENCODING_DONTKNOW );
802 void UnixCharsetFromTextEncoding_EUC_TW()
804 check( RTL_TEXTENCODING_EUC_TW, RTL_TEXTENCODING_DONTKNOW );
806 #endif
807 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
808 void UnixCharsetFromTextEncoding_ISO_2022_JP()
810 check( RTL_TEXTENCODING_ISO_2022_JP, RTL_TEXTENCODING_DONTKNOW );
812 #endif
813 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
814 void UnixCharsetFromTextEncoding_ISO_2022_CN()
816 check( RTL_TEXTENCODING_ISO_2022_CN, RTL_TEXTENCODING_DONTKNOW );
818 #endif
819 void UnixCharsetFromTextEncoding_KOI8_R()
821 check( RTL_TEXTENCODING_KOI8_R, RTL_TEXTENCODING_KOI8_R );
824 void UnixCharsetFromTextEncoding_UTF7()
826 check( RTL_TEXTENCODING_UTF7, RTL_TEXTENCODING_ISO_8859_1 );
829 void UnixCharsetFromTextEncoding_UTF8()
831 check( RTL_TEXTENCODING_UTF8, RTL_TEXTENCODING_ISO_8859_1 );
834 void UnixCharsetFromTextEncoding_ISO_8859_10()
836 check( RTL_TEXTENCODING_ISO_8859_10, RTL_TEXTENCODING_ISO_8859_10 );
839 void UnixCharsetFromTextEncoding_ISO_8859_13()
841 check( RTL_TEXTENCODING_ISO_8859_13, RTL_TEXTENCODING_ISO_8859_13 );
843 #if WITH_LOCALE_ALL || WITH_LOCALE_ko
844 void UnixCharsetFromTextEncoding_EUC_KR()
846 check( RTL_TEXTENCODING_EUC_KR, RTL_TEXTENCODING_DONTKNOW );
849 void UnixCharsetFromTextEncoding_ISO_2022_KR()
851 check( RTL_TEXTENCODING_ISO_2022_KR, RTL_TEXTENCODING_DONTKNOW );
853 #endif
854 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
855 void UnixCharsetFromTextEncoding_JIS_X_0201()
857 check( RTL_TEXTENCODING_JIS_X_0201, RTL_TEXTENCODING_DONTKNOW );
860 void UnixCharsetFromTextEncoding_JIS_X_0208()
862 check( RTL_TEXTENCODING_JIS_X_0208, RTL_TEXTENCODING_DONTKNOW );
865 void UnixCharsetFromTextEncoding_JIS_X_0212()
867 check( RTL_TEXTENCODING_JIS_X_0212, RTL_TEXTENCODING_DONTKNOW );
869 #endif
870 void UnixCharsetFromTextEncoding_MS_1361()
872 check( RTL_TEXTENCODING_MS_1361, RTL_TEXTENCODING_DONTKNOW );
874 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
875 void UnixCharsetFromTextEncoding_GB_18030()
877 check( RTL_TEXTENCODING_GB_18030, RTL_TEXTENCODING_GBK );
880 void UnixCharsetFromTextEncoding_BIG5_HKSCS()
882 check( RTL_TEXTENCODING_BIG5_HKSCS, RTL_TEXTENCODING_DONTKNOW );
884 #endif
885 void UnixCharsetFromTextEncoding_TIS_620()
887 check( RTL_TEXTENCODING_TIS_620, RTL_TEXTENCODING_ISO_8859_1 );
890 void UnixCharsetFromTextEncoding_KOI8_U()
892 check( RTL_TEXTENCODING_KOI8_U, RTL_TEXTENCODING_KOI8_U );
895 CPPUNIT_TEST_SUITE( testBestUnix );
896 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1252 );
897 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_ROMAN );
898 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_437 );
899 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_850 );
900 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_860 );
901 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_861 );
902 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_863 );
903 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_865 );
905 CPPUNIT_TEST( UnixCharsetFromTextEncoding_SYMBOL );
906 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ASCII_US );
907 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_1 );
908 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_2 );
909 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_3 );
910 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_4 );
911 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_5 );
912 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_6 );
913 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_7 );
914 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_8 );
915 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_9 );
916 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_14 );
917 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_15 );
918 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_737 );
919 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_775 );
920 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_852 );
921 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_855 );
922 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_857 );
923 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_862 );
924 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_864 );
925 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_866 );
926 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_869 );
927 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_874 );
928 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1250 );
929 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1251 );
930 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1253 );
931 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1254 );
932 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1255 );
933 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1256 );
934 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1257 );
935 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1258 );
936 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CENTEURO );
937 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CROATIAN );
938 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CYRILLIC );
939 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_GREEK );
940 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_ICELAND );
941 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_ROMANIAN );
942 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_TURKISH );
943 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_UKRAINIAN );
944 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
945 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CHINSIMP );
946 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CHINTRAD );
947 #endif
948 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
949 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_JAPANESE );
950 #endif
951 #if WITH_LOCALE_ALL || WITH_LOCALE_ko
952 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_KOREAN );
953 #endif
954 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_932 );
955 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_936 );
956 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_949 );
957 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_950 );
958 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
959 CPPUNIT_TEST( UnixCharsetFromTextEncoding_SHIFT_JIS );
960 #endif
961 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
962 CPPUNIT_TEST( UnixCharsetFromTextEncoding_GB_2312 );
963 CPPUNIT_TEST( UnixCharsetFromTextEncoding_GBT_12345 );
964 CPPUNIT_TEST( UnixCharsetFromTextEncoding_GBK );
965 CPPUNIT_TEST( UnixCharsetFromTextEncoding_BIG5 );
966 #endif
967 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
968 CPPUNIT_TEST( UnixCharsetFromTextEncoding_EUC_JP );
969 #endif
970 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
971 CPPUNIT_TEST( UnixCharsetFromTextEncoding_EUC_CN );
972 CPPUNIT_TEST( UnixCharsetFromTextEncoding_EUC_TW );
973 #endif
974 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
975 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_2022_JP );
976 #endif
977 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
978 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_2022_CN );
979 #endif
980 CPPUNIT_TEST( UnixCharsetFromTextEncoding_KOI8_R );
981 CPPUNIT_TEST( UnixCharsetFromTextEncoding_UTF7 );
982 CPPUNIT_TEST( UnixCharsetFromTextEncoding_UTF8 );
983 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_10 );
984 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_13 );
985 #if WITH_LOCALE_ALL || WITH_LOCALE_ko
986 CPPUNIT_TEST( UnixCharsetFromTextEncoding_EUC_KR );
987 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_2022_KR );
988 #endif
989 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
990 CPPUNIT_TEST( UnixCharsetFromTextEncoding_JIS_X_0201 );
991 CPPUNIT_TEST( UnixCharsetFromTextEncoding_JIS_X_0208 );
992 CPPUNIT_TEST( UnixCharsetFromTextEncoding_JIS_X_0212 );
993 #endif
994 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1361 );
995 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
996 CPPUNIT_TEST( UnixCharsetFromTextEncoding_GB_18030 );
997 CPPUNIT_TEST( UnixCharsetFromTextEncoding_BIG5_HKSCS );
998 #endif
999 CPPUNIT_TEST( UnixCharsetFromTextEncoding_TIS_620 );
1000 CPPUNIT_TEST( UnixCharsetFromTextEncoding_KOI8_U );
1002 CPPUNIT_TEST_SUITE_END( );
1005 class testBestWindows : public CppUnit::TestFixture
1007 public:
1008 void check(rtl_TextEncoding nIn, rtl_TextEncoding nOut)
1010 const sal_uInt8 nCharSet = rtl_getBestWindowsCharsetFromTextEncoding(nIn);
1011 rtl_TextEncoding eTextEnc = rtl_getTextEncodingFromWindowsCharset(nCharSet);
1012 CPPUNIT_ASSERT_EQUAL_MESSAGE("rtl_getBestWindowsCharsetFromTextEncoding && rtl_getTextEncodingFromWindowsCharset differ", nOut, eTextEnc );
1015 void WindowsCharsetFromTextEncoding_MS_1252()
1017 check( RTL_TEXTENCODING_MS_1252, RTL_TEXTENCODING_MS_1252 );
1020 void WindowsCharsetFromTextEncoding_APPLE_ROMAN()
1022 check( RTL_TEXTENCODING_APPLE_ROMAN, RTL_TEXTENCODING_APPLE_ROMAN );
1025 void WindowsCharsetFromTextEncoding_IBM_437()
1027 check( RTL_TEXTENCODING_IBM_437, RTL_TEXTENCODING_MS_1252 );
1030 void WindowsCharsetFromTextEncoding_IBM_850()
1032 check( RTL_TEXTENCODING_IBM_850, RTL_TEXTENCODING_MS_1252 );
1035 void WindowsCharsetFromTextEncoding_IBM_860()
1037 check( RTL_TEXTENCODING_IBM_860, RTL_TEXTENCODING_MS_1252 );
1040 void WindowsCharsetFromTextEncoding_IBM_861()
1042 check( RTL_TEXTENCODING_IBM_861, RTL_TEXTENCODING_MS_1252 );
1045 void WindowsCharsetFromTextEncoding_IBM_863()
1047 check( RTL_TEXTENCODING_IBM_863, RTL_TEXTENCODING_MS_1252 );
1050 void WindowsCharsetFromTextEncoding_IBM_865()
1052 check( RTL_TEXTENCODING_IBM_865, RTL_TEXTENCODING_MS_1252 );
1055 void WindowsCharsetFromTextEncoding_SYMBOL()
1057 check( RTL_TEXTENCODING_SYMBOL, RTL_TEXTENCODING_SYMBOL );
1060 void WindowsCharsetFromTextEncoding_ASCII_US()
1062 check( RTL_TEXTENCODING_ASCII_US, RTL_TEXTENCODING_MS_1252 );
1065 void WindowsCharsetFromTextEncoding_ISO_8859_1()
1067 check( RTL_TEXTENCODING_ISO_8859_1, RTL_TEXTENCODING_MS_1252 );
1069 #if 0
1070 void WindowsCharsetFromTextEncoding_ISO_8859_2()
1072 check( RTL_TEXTENCODING_ISO_8859_2, RTL_TEXTENCODING_MS_1252 );
1074 #endif
1075 void WindowsCharsetFromTextEncoding_ISO_8859_3()
1077 check( RTL_TEXTENCODING_ISO_8859_3, RTL_TEXTENCODING_MS_1252 );
1080 void WindowsCharsetFromTextEncoding_ISO_8859_4()
1082 check( RTL_TEXTENCODING_ISO_8859_4, RTL_TEXTENCODING_MS_1257 );
1084 #if 0
1085 void WindowsCharsetFromTextEncoding_ISO_8859_5()
1087 check( RTL_TEXTENCODING_ISO_8859_5, RTL_TEXTENCODING_MS_1252 );
1090 void WindowsCharsetFromTextEncoding_ISO_8859_6()
1092 check( RTL_TEXTENCODING_ISO_8859_6, RTL_TEXTENCODING_MS_1252 );
1095 void WindowsCharsetFromTextEncoding_ISO_8859_7()
1097 check( RTL_TEXTENCODING_ISO_8859_7, RTL_TEXTENCODING_MS_1252 );
1100 void WindowsCharsetFromTextEncoding_ISO_8859_8()
1102 check( RTL_TEXTENCODING_ISO_8859_8, RTL_TEXTENCODING_MS_1252 );
1105 void WindowsCharsetFromTextEncoding_ISO_8859_9()
1107 check( RTL_TEXTENCODING_ISO_8859_9, RTL_TEXTENCODING_MS_1252 );
1109 #endif
1110 void WindowsCharsetFromTextEncoding_ISO_8859_14()
1112 check( RTL_TEXTENCODING_ISO_8859_14, RTL_TEXTENCODING_MS_1252 );
1115 void WindowsCharsetFromTextEncoding_ISO_8859_15()
1117 check( RTL_TEXTENCODING_ISO_8859_15, RTL_TEXTENCODING_MS_1252 );
1119 #if 0
1120 void WindowsCharsetFromTextEncoding_IBM_737()
1122 check( RTL_TEXTENCODING_IBM_737, RTL_TEXTENCODING_MS_1252 );
1125 void WindowsCharsetFromTextEncoding_IBM_775()
1127 check( RTL_TEXTENCODING_IBM_775, RTL_TEXTENCODING_MS_1252 );
1130 void WindowsCharsetFromTextEncoding_IBM_852()
1132 check( RTL_TEXTENCODING_IBM_852, RTL_TEXTENCODING_MS_1252 );
1135 void WindowsCharsetFromTextEncoding_IBM_855()
1137 check( RTL_TEXTENCODING_IBM_855, RTL_TEXTENCODING_MS_1252 );
1140 void WindowsCharsetFromTextEncoding_IBM_857()
1142 check( RTL_TEXTENCODING_IBM_857, RTL_TEXTENCODING_MS_1252 );
1145 void WindowsCharsetFromTextEncoding_IBM_862()
1147 check( RTL_TEXTENCODING_IBM_862, RTL_TEXTENCODING_MS_1252 );
1150 void WindowsCharsetFromTextEncoding_IBM_864()
1152 check( RTL_TEXTENCODING_IBM_864, RTL_TEXTENCODING_MS_1252 );
1155 void WindowsCharsetFromTextEncoding_IBM_866()
1157 check( RTL_TEXTENCODING_IBM_866, RTL_TEXTENCODING_MS_1252 );
1160 void WindowsCharsetFromTextEncoding_IBM_869()
1162 check( RTL_TEXTENCODING_IBM_869, RTL_TEXTENCODING_MS_1252 );
1165 void WindowsCharsetFromTextEncoding_MS_874()
1167 check( RTL_TEXTENCODING_MS_874, RTL_TEXTENCODING_MS_1252 );
1170 void WindowsCharsetFromTextEncoding_MS_1250()
1172 check( RTL_TEXTENCODING_MS_1250, RTL_TEXTENCODING_MS_1252 );
1175 void WindowsCharsetFromTextEncoding_MS_1251()
1177 check( RTL_TEXTENCODING_MS_1251, RTL_TEXTENCODING_MS_1252 );
1180 void WindowsCharsetFromTextEncoding_MS_1253()
1182 check( RTL_TEXTENCODING_MS_1253, RTL_TEXTENCODING_MS_1252 );
1185 void WindowsCharsetFromTextEncoding_MS_1254()
1187 check( RTL_TEXTENCODING_MS_1254, RTL_TEXTENCODING_MS_1252 );
1190 void WindowsCharsetFromTextEncoding_MS_1255()
1192 check( RTL_TEXTENCODING_MS_1255, RTL_TEXTENCODING_MS_1252 );
1195 void WindowsCharsetFromTextEncoding_MS_1256()
1197 check( RTL_TEXTENCODING_MS_1256, RTL_TEXTENCODING_MS_1252 );
1200 void WindowsCharsetFromTextEncoding_MS_1257()
1202 check( RTL_TEXTENCODING_MS_1257, RTL_TEXTENCODING_MS_1252 );
1205 void WindowsCharsetFromTextEncoding_MS_1258()
1207 check( RTL_TEXTENCODING_MS_1258, RTL_TEXTENCODING_MS_1252 );
1210 void WindowsCharsetFromTextEncoding_APPLE_ARABIC()
1212 check( RTL_TEXTENCODING_APPLE_ARABIC, RTL_TEXTENCODING_MS_1252 );
1215 void WindowsCharsetFromTextEncoding_APPLE_CENTEURO()
1217 check( RTL_TEXTENCODING_APPLE_CENTEURO, RTL_TEXTENCODING_MS_1252 );
1220 void WindowsCharsetFromTextEncoding_APPLE_CROATIAN()
1222 check( RTL_TEXTENCODING_APPLE_CROATIAN, RTL_TEXTENCODING_MS_1252 );
1225 void WindowsCharsetFromTextEncoding_APPLE_CYRILLIC()
1227 check( RTL_TEXTENCODING_APPLE_CYRILLIC, RTL_TEXTENCODING_MS_1252 );
1230 void WindowsCharsetFromTextEncoding_APPLE_DEVANAGARI()
1232 check( RTL_TEXTENCODING_APPLE_DEVANAGARI, RTL_TEXTENCODING_MS_1252 );
1235 void WindowsCharsetFromTextEncoding_APPLE_FARSI()
1237 check( RTL_TEXTENCODING_APPLE_FARSI, RTL_TEXTENCODING_MS_1252 );
1240 void WindowsCharsetFromTextEncoding_APPLE_GREEK()
1242 check( RTL_TEXTENCODING_APPLE_GREEK, RTL_TEXTENCODING_MS_1252 );
1245 void WindowsCharsetFromTextEncoding_APPLE_GUJARATI()
1247 check( RTL_TEXTENCODING_APPLE_GUJARATI, RTL_TEXTENCODING_MS_1252 );
1250 void WindowsCharsetFromTextEncoding_APPLE_GURMUKHI()
1252 check( RTL_TEXTENCODING_APPLE_GURMUKHI, RTL_TEXTENCODING_MS_1252 );
1255 void WindowsCharsetFromTextEncoding_APPLE_HEBREW()
1257 check( RTL_TEXTENCODING_APPLE_HEBREW, RTL_TEXTENCODING_MS_1252 );
1259 #endif
1260 void WindowsCharsetFromTextEncoding_APPLE_ICELAND()
1262 check( RTL_TEXTENCODING_APPLE_ICELAND, RTL_TEXTENCODING_MS_1252 );
1264 #if 0
1265 void WindowsCharsetFromTextEncoding_APPLE_ROMANIAN()
1267 check( RTL_TEXTENCODING_APPLE_ROMANIAN, RTL_TEXTENCODING_MS_1252 );
1270 void WindowsCharsetFromTextEncoding_APPLE_THAI()
1272 check( RTL_TEXTENCODING_APPLE_THAI, RTL_TEXTENCODING_MS_1252 );
1275 void WindowsCharsetFromTextEncoding_APPLE_TURKISH()
1277 check( RTL_TEXTENCODING_APPLE_TURKISH, RTL_TEXTENCODING_MS_1252 );
1280 void WindowsCharsetFromTextEncoding_APPLE_UKRAINIAN()
1282 check( RTL_TEXTENCODING_APPLE_UKRAINIAN, RTL_TEXTENCODING_MS_1252 );
1285 void WindowsCharsetFromTextEncoding_APPLE_CHINSIMP()
1287 check( RTL_TEXTENCODING_APPLE_CHINSIMP, RTL_TEXTENCODING_MS_1252 );
1290 void WindowsCharsetFromTextEncoding_APPLE_CHINTRAD()
1292 check( RTL_TEXTENCODING_APPLE_CHINTRAD, RTL_TEXTENCODING_MS_1252 );
1295 void WindowsCharsetFromTextEncoding_APPLE_JAPANESE()
1297 check( RTL_TEXTENCODING_APPLE_JAPANESE, RTL_TEXTENCODING_MS_1252 );
1300 void WindowsCharsetFromTextEncoding_APPLE_KOREAN()
1302 check( RTL_TEXTENCODING_APPLE_KOREAN, RTL_TEXTENCODING_MS_1252 );
1305 void WindowsCharsetFromTextEncoding_MS_932()
1307 check( RTL_TEXTENCODING_MS_932, RTL_TEXTENCODING_MS_1252 );
1310 void WindowsCharsetFromTextEncoding_MS_936()
1312 check( RTL_TEXTENCODING_MS_936, RTL_TEXTENCODING_MS_1252 );
1315 void WindowsCharsetFromTextEncoding_MS_949()
1317 check( RTL_TEXTENCODING_MS_949, RTL_TEXTENCODING_MS_1252 );
1320 void WindowsCharsetFromTextEncoding_MS_950()
1322 check( RTL_TEXTENCODING_MS_950, RTL_TEXTENCODING_MS_1252 );
1325 void WindowsCharsetFromTextEncoding_SHIFT_JIS()
1327 check( RTL_TEXTENCODING_SHIFT_JIS, RTL_TEXTENCODING_MS_1252 );
1330 void WindowsCharsetFromTextEncoding_GB_2312()
1332 check( RTL_TEXTENCODING_GB_2312, RTL_TEXTENCODING_MS_1252 );
1335 void WindowsCharsetFromTextEncoding_GBT_12345()
1337 check( RTL_TEXTENCODING_GBT_12345, RTL_TEXTENCODING_MS_1252 );
1340 void WindowsCharsetFromTextEncoding_GBK()
1342 check( RTL_TEXTENCODING_GBK, RTL_TEXTENCODING_MS_1252 );
1345 void WindowsCharsetFromTextEncoding_BIG5()
1347 check( RTL_TEXTENCODING_BIG5, RTL_TEXTENCODING_MS_1252 );
1350 void WindowsCharsetFromTextEncoding_EUC_JP()
1352 check( RTL_TEXTENCODING_EUC_JP, RTL_TEXTENCODING_MS_1252 );
1355 void WindowsCharsetFromTextEncoding_EUC_CN()
1357 check( RTL_TEXTENCODING_EUC_CN, RTL_TEXTENCODING_MS_1252 );
1360 void WindowsCharsetFromTextEncoding_EUC_TW()
1362 check( RTL_TEXTENCODING_EUC_TW, RTL_TEXTENCODING_MS_1252 );
1365 void WindowsCharsetFromTextEncoding_ISO_2022_JP()
1367 check( RTL_TEXTENCODING_ISO_2022_JP, RTL_TEXTENCODING_MS_1252 );
1370 void WindowsCharsetFromTextEncoding_ISO_2022_CN()
1372 check( RTL_TEXTENCODING_ISO_2022_CN, RTL_TEXTENCODING_MS_1252 );
1375 void WindowsCharsetFromTextEncoding_KOI8_R()
1377 check( RTL_TEXTENCODING_KOI8_R, RTL_TEXTENCODING_MS_1252 );
1379 #endif
1380 void WindowsCharsetFromTextEncoding_UTF7()
1382 check( RTL_TEXTENCODING_UTF7, RTL_TEXTENCODING_MS_1252 );
1385 void WindowsCharsetFromTextEncoding_UTF8()
1387 check( RTL_TEXTENCODING_UTF8, RTL_TEXTENCODING_MS_1252 );
1389 #if 0
1390 void WindowsCharsetFromTextEncoding_ISO_8859_10()
1392 check( RTL_TEXTENCODING_ISO_8859_10, RTL_TEXTENCODING_MS_1252 );
1395 void WindowsCharsetFromTextEncoding_ISO_8859_13()
1397 check( RTL_TEXTENCODING_ISO_8859_13, RTL_TEXTENCODING_MS_1252 );
1400 void WindowsCharsetFromTextEncoding_EUC_KR()
1402 check( RTL_TEXTENCODING_EUC_KR, RTL_TEXTENCODING_MS_1252 );
1405 void WindowsCharsetFromTextEncoding_ISO_2022_KR()
1407 check( RTL_TEXTENCODING_ISO_2022_KR, RTL_TEXTENCODING_MS_1252 );
1410 void WindowsCharsetFromTextEncoding_JIS_X_0201()
1412 check( RTL_TEXTENCODING_JIS_X_0201, RTL_TEXTENCODING_MS_1252 );
1415 void WindowsCharsetFromTextEncoding_JIS_X_0208()
1417 check( RTL_TEXTENCODING_JIS_X_0208, RTL_TEXTENCODING_MS_1252 );
1420 void WindowsCharsetFromTextEncoding_JIS_X_0212()
1422 check( RTL_TEXTENCODING_JIS_X_0212, RTL_TEXTENCODING_MS_1252 );
1425 void WindowsCharsetFromTextEncoding_MS_1361()
1427 check( RTL_TEXTENCODING_MS_1361, RTL_TEXTENCODING_MS_1252 );
1430 void WindowsCharsetFromTextEncoding_GB_18030()
1432 check( RTL_TEXTENCODING_GB_18030, RTL_TEXTENCODING_MS_1252 );
1435 void WindowsCharsetFromTextEncoding_BIG5_HKSCS()
1437 check( RTL_TEXTENCODING_BIG5_HKSCS, RTL_TEXTENCODING_MS_1252 );
1440 void WindowsCharsetFromTextEncoding_TIS_620()
1442 check( RTL_TEXTENCODING_TIS_620, RTL_TEXTENCODING_MS_1252 );
1445 void WindowsCharsetFromTextEncoding_KOI8_U()
1447 check( RTL_TEXTENCODING_KOI8_U, RTL_TEXTENCODING_MS_1252 );
1450 void WindowsCharsetFromTextEncoding_ISCII_DEVANAGARI()
1452 check( RTL_TEXTENCODING_ISCII_DEVANAGARI, RTL_TEXTENCODING_MS_1252 );
1454 #endif
1455 void WindowsCharsetFromTextEncoding_JAVA_UTF8()
1457 check( RTL_TEXTENCODING_JAVA_UTF8, RTL_TEXTENCODING_MS_1252 );
1460 CPPUNIT_TEST_SUITE( testBestWindows );
1461 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1252 );
1462 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_ROMAN );
1463 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_437 );
1464 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_850 );
1465 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_860 );
1466 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_861 );
1467 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_863 );
1468 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_865 );
1469 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_SYMBOL );
1470 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ASCII_US );
1471 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_1 );
1472 #if 0
1473 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_2 );
1474 #endif
1475 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_3 );
1476 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_4 );
1477 #if 0
1478 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_5 );
1479 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_6 );
1480 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_7 );
1481 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_8 );
1482 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_9 );
1483 #endif
1484 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_14 );
1485 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_15 );
1486 #if 0
1487 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_737 );
1488 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_775 );
1489 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_852 );
1490 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_855 );
1491 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_857 );
1492 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_862 );
1493 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_864 );
1494 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_866 );
1495 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_869 );
1496 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_874 );
1497 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1250 );
1498 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1251 );
1499 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1253 );
1500 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1254 );
1501 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1255 );
1502 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1256 );
1503 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1257 );
1504 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1258 );
1505 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_ARABIC );
1506 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_CENTEURO );
1507 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_CROATIAN );
1508 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_CYRILLIC );
1509 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_DEVANAGARI );
1510 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_FARSI );
1511 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_GREEK );
1512 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_GUJARATI );
1513 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_GURMUKHI );
1514 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_HEBREW );
1515 #endif
1516 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_ICELAND );
1517 #if 0
1518 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_ROMANIAN );
1519 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_THAI );
1520 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_TURKISH );
1521 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_UKRAINIAN );
1522 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_CHINSIMP );
1523 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_CHINTRAD );
1524 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_JAPANESE );
1525 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_KOREAN );
1526 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_932 );
1527 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_936 );
1528 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_949 );
1529 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_950 );
1530 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_SHIFT_JIS );
1531 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_GB_2312 );
1532 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_GBT_12345 );
1533 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_GBK );
1534 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_BIG5 );
1535 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_EUC_JP );
1536 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_EUC_CN );
1537 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_EUC_TW );
1538 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_2022_JP );
1539 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_2022_CN );
1540 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_KOI8_R );
1541 #endif
1542 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_UTF7 );
1543 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_UTF8 );
1544 #if 0
1545 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_10 );
1546 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_13 );
1547 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_EUC_KR );
1548 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_2022_KR );
1549 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_JIS_X_0201 );
1550 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_JIS_X_0208 );
1551 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_JIS_X_0212 );
1552 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1361 );
1553 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_GB_18030 );
1554 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_BIG5_HKSCS );
1555 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_TIS_620 );
1556 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_KOI8_U );
1557 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISCII_DEVANAGARI );
1558 #endif
1559 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_JAVA_UTF8 );
1561 CPPUNIT_TEST_SUITE_END( );
1564 class testTextEncodingInfo: public CppUnit::TestFixture
1566 public:
1567 // not implemented encoding test
1568 void testTextEncodingInfo_001()
1570 rtl_TextEncodingInfo aInfo1, aInfo2, aInfo3, aInfo4, aInfo5;
1571 aInfo1.StructSize = 4;
1572 // not implemented
1573 bool bRes1 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC, &aInfo1 );
1574 // implemented
1575 bool bRes11 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC, &aInfo1 );
1576 CPPUNIT_ASSERT_MESSAGE("should return sal_False.", !bRes1);
1577 CPPUNIT_ASSERT_MESSAGE("should return sal_False.", !bRes11);
1579 aInfo2.StructSize = 5;
1580 bool bRes2 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC, &aInfo2 );
1581 bool bRes21 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC, &aInfo2 );
1582 CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes2);
1583 CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes21);
1584 CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", aInfo2.MinimumCharSize >=1 );
1586 aInfo3.StructSize = 6;
1587 bool bRes3 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC, &aInfo3 );
1588 bool bRes31 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC, &aInfo3 );
1589 CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes3);
1590 CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes31);
1591 //&& aInfo2.MinimumCharSize >=1 );
1593 aInfo4.StructSize = 8;
1594 bool bRes4 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC, &aInfo4 );
1595 bool bRes41 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC, &aInfo4);
1596 CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes4);
1597 CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes41);
1598 // && aInfo2.MinimumCharSize >=1 );
1600 aInfo5.StructSize = sizeof aInfo5;
1601 bool bRes5 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC, &aInfo5 );
1602 CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", !bRes5);
1603 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1604 "StructSize<6 should return sal_True", sal_uInt32(0), aInfo5.Flags);
1607 CPPUNIT_TEST_SUITE(testTextEncodingInfo);
1608 CPPUNIT_TEST(testTextEncodingInfo_001);
1609 CPPUNIT_TEST_SUITE_END();
1612 class testEncodingFromUnix: public CppUnit::TestFixture
1614 public:
1615 void testIso8859() {
1616 check(RTL_TEXTENCODING_DONTKNOW, "ISO8859");
1617 check(RTL_TEXTENCODING_DONTKNOW, "ISO8859-0");
1618 check(RTL_TEXTENCODING_DONTKNOW, "ISO8859-01");
1619 check(RTL_TEXTENCODING_DONTKNOW, "ISO8859_1");
1620 check(RTL_TEXTENCODING_DONTKNOW, "ISO88591");
1621 check(RTL_TEXTENCODING_ISO_8859_1, "ISO8859-1");
1622 check(RTL_TEXTENCODING_ISO_8859_2, "ISO8859-2");
1623 check(RTL_TEXTENCODING_ISO_8859_3, "ISO8859-3");
1624 check(RTL_TEXTENCODING_ISO_8859_4, "ISO8859-4");
1625 check(RTL_TEXTENCODING_ISO_8859_5, "ISO8859-5");
1626 check(RTL_TEXTENCODING_ISO_8859_6, "ISO8859-6");
1627 check(RTL_TEXTENCODING_ISO_8859_7, "ISO8859-7");
1628 check(RTL_TEXTENCODING_ISO_8859_8, "ISO8859-8");
1629 check(RTL_TEXTENCODING_ISO_8859_9, "ISO8859-9");
1630 check(RTL_TEXTENCODING_ISO_8859_10, "ISO8859-10");
1631 check(RTL_TEXTENCODING_TIS_620, "ISO8859-11");
1632 check(RTL_TEXTENCODING_ISO_8859_13, "ISO8859-13");
1633 check(RTL_TEXTENCODING_ISO_8859_14, "ISO8859-14");
1634 check(RTL_TEXTENCODING_ISO_8859_15, "ISO8859-15");
1637 void testTis620() {
1638 check(RTL_TEXTENCODING_DONTKNOW, "TIS620");
1639 check(RTL_TEXTENCODING_TIS_620, "TIS620-0");
1640 check(RTL_TEXTENCODING_DONTKNOW, "TIS620-1");
1641 check(RTL_TEXTENCODING_TIS_620, "TIS620-2529");
1642 check(RTL_TEXTENCODING_TIS_620, "TIS620-2533");
1643 check(RTL_TEXTENCODING_DONTKNOW, "TIS620.2529-0");
1644 check(RTL_TEXTENCODING_TIS_620, "TIS620.2529-1");
1645 check(RTL_TEXTENCODING_DONTKNOW, "TIS620.2529-2");
1646 check(RTL_TEXTENCODING_TIS_620, "TIS620.2533-0");
1647 check(RTL_TEXTENCODING_TIS_620, "TIS620.2533-1");
1648 check(RTL_TEXTENCODING_DONTKNOW, "TIS620.2533-2");
1651 CPPUNIT_TEST_SUITE(testEncodingFromUnix);
1652 CPPUNIT_TEST(testIso8859);
1653 CPPUNIT_TEST(testTis620);
1654 CPPUNIT_TEST_SUITE_END();
1656 private:
1657 void check(rtl_TextEncoding expected, char const * input) {
1658 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1659 input, expected, rtl_getTextEncodingFromUnixCharset(input));
1665 CPPUNIT_TEST_SUITE_REGISTRATION(testBestMime);
1666 CPPUNIT_TEST_SUITE_REGISTRATION(testBestUnix);
1667 CPPUNIT_TEST_SUITE_REGISTRATION(testBestWindows);
1668 CPPUNIT_TEST_SUITE_REGISTRATION(testTextEncodingInfo);
1669 CPPUNIT_TEST_SUITE_REGISTRATION(testEncodingFromUnix);
1671 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */