1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 29 // MARKER(update_precomp.py): autogen include statement, do not remove 30 #include "precompiled_sal.hxx" 31 #include <string.h> 32 33 #include <osl/thread.h> 34 #include <rtl/tencinfo.h> 35 36 #include <testshl/simpleheader.hxx> 37 38 // ----------------------------------------------------------------------------- 39 40 namespace rtl_tencinfo 41 { 42 class getBestMime : public CppUnit::TestFixture 43 { 44 public: 45 void setUp() 46 { 47 } 48 49 void check( const sal_Char* _pRTL_TEXTENCODING, rtl_TextEncoding _aCurrentEncode ) 50 { 51 const sal_Char *pCharSet = rtl_getBestMimeCharsetFromTextEncoding( _aCurrentEncode ); 52 if (pCharSet == 0) 53 { 54 t_print("rtl_getBestMimeCharsetFromTextEncoding(%s) (%d) doesn't seem to exist.\n\n", _pRTL_TEXTENCODING, _aCurrentEncode); 55 } 56 else 57 { 58 t_print(T_VERBOSE, "'%s' is charset: '%s'\n", _pRTL_TEXTENCODING, pCharSet); 59 60 rtl_TextEncoding eTextEnc = rtl_getTextEncodingFromMimeCharset( pCharSet ); 61 if (_aCurrentEncode != eTextEnc && 62 eTextEnc != RTL_TEXTENCODING_DONTKNOW) 63 { 64 t_print("rtl_getBestMimeCharsetFromTextEncoding(%s) is charset: %s\n", _pRTL_TEXTENCODING, pCharSet); 65 t_print("rtl_getTextEncodingFromMimeCharset() differ: %s %d -> %d\n\n", _pRTL_TEXTENCODING, _aCurrentEncode, eTextEnc ); 66 } 67 // rtl::OString sError = "getTextEncodingFromMimeCharset("; 68 // sError += pCharSet; 69 // sError += ") returns null"; 70 // CPPUNIT_ASSERT_MESSAGE(sError.getStr(), eTextEnc != RTL_TEXTENCODING_DONTKNOW); 71 // CPPUNIT_ASSERT_MESSAGE("Does not realize itself", _aCurrentEncode == eTextEnc ); 72 } 73 } 74 75 // the defines for the follows test could be found in file inc/rtl/textenc.h 76 77 // ---------------------------------------- 78 void MimeCharsetFromTextEncoding_MS_1252() 79 { 80 check( "RTL_TEXTENCODING_MS_1252", RTL_TEXTENCODING_MS_1252 ); 81 } 82 // ---------------------------------------- 83 void MimeCharsetFromTextEncoding_APPLE_ROMAN() 84 { 85 check( "RTL_TEXTENCODING_APPLE_ROMAN", RTL_TEXTENCODING_APPLE_ROMAN ); 86 } 87 // ---------------------------------------- 88 void MimeCharsetFromTextEncoding_IBM_437() 89 { 90 check( "RTL_TEXTENCODING_IBM_437", RTL_TEXTENCODING_IBM_437 ); 91 } 92 // ---------------------------------------- 93 void MimeCharsetFromTextEncoding_IBM_850() 94 { 95 check( "RTL_TEXTENCODING_IBM_850", RTL_TEXTENCODING_IBM_850 ); 96 } 97 // ---------------------------------------- 98 void MimeCharsetFromTextEncoding_IBM_860() 99 { 100 check( "RTL_TEXTENCODING_IBM_860", RTL_TEXTENCODING_IBM_860 ); 101 } 102 // ---------------------------------------- 103 void MimeCharsetFromTextEncoding_IBM_861() 104 { 105 check( "RTL_TEXTENCODING_IBM_861", RTL_TEXTENCODING_IBM_861 ); 106 } 107 // ---------------------------------------- 108 void MimeCharsetFromTextEncoding_IBM_863() 109 { 110 check( "RTL_TEXTENCODING_IBM_863", RTL_TEXTENCODING_IBM_863 ); 111 } 112 // ---------------------------------------- 113 void MimeCharsetFromTextEncoding_IBM_865() 114 { 115 check( "RTL_TEXTENCODING_IBM_865", RTL_TEXTENCODING_IBM_865 ); 116 } 117 // ---------------------------------------- 118 void MimeCharsetFromTextEncoding_SYMBOL() 119 { 120 check( "RTL_TEXTENCODING_SYMBOL", RTL_TEXTENCODING_SYMBOL ); 121 } 122 // ---------------------------------------- 123 void MimeCharsetFromTextEncoding_ASCII_US() 124 { 125 check( "RTL_TEXTENCODING_ASCII_US", RTL_TEXTENCODING_ASCII_US ); 126 } 127 // ---------------------------------------- 128 void MimeCharsetFromTextEncoding_ISO_8859_1() 129 { 130 check( "RTL_TEXTENCODING_ISO_8859_1", RTL_TEXTENCODING_ISO_8859_1 ); 131 } 132 // ---------------------------------------- 133 void MimeCharsetFromTextEncoding_ISO_8859_2() 134 { 135 check( "RTL_TEXTENCODING_ISO_8859_2", RTL_TEXTENCODING_ISO_8859_2 ); 136 } 137 // ---------------------------------------- 138 void MimeCharsetFromTextEncoding_ISO_8859_3() 139 { 140 check( "RTL_TEXTENCODING_ISO_8859_3", RTL_TEXTENCODING_ISO_8859_3 ); 141 } 142 // ---------------------------------------- 143 void MimeCharsetFromTextEncoding_ISO_8859_4() 144 { 145 check( "RTL_TEXTENCODING_ISO_8859_4", RTL_TEXTENCODING_ISO_8859_4 ); 146 } 147 // ---------------------------------------- 148 void MimeCharsetFromTextEncoding_ISO_8859_5() 149 { 150 check( "RTL_TEXTENCODING_ISO_8859_5", RTL_TEXTENCODING_ISO_8859_5 ); 151 } 152 // ---------------------------------------- 153 void MimeCharsetFromTextEncoding_ISO_8859_6() 154 { 155 check( "RTL_TEXTENCODING_ISO_8859_6", RTL_TEXTENCODING_ISO_8859_6 ); 156 } 157 // ---------------------------------------- 158 void MimeCharsetFromTextEncoding_ISO_8859_7() 159 { 160 check( "RTL_TEXTENCODING_ISO_8859_7", RTL_TEXTENCODING_ISO_8859_7 ); 161 } 162 // ---------------------------------------- 163 void MimeCharsetFromTextEncoding_ISO_8859_8() 164 { 165 check( "RTL_TEXTENCODING_ISO_8859_8", RTL_TEXTENCODING_ISO_8859_8 ); 166 } 167 // ---------------------------------------- 168 void MimeCharsetFromTextEncoding_ISO_8859_9() 169 { 170 check( "RTL_TEXTENCODING_ISO_8859_9", RTL_TEXTENCODING_ISO_8859_9 ); 171 } 172 // ---------------------------------------- 173 void MimeCharsetFromTextEncoding_ISO_8859_14() 174 { 175 check( "RTL_TEXTENCODING_ISO_8859_14", RTL_TEXTENCODING_ISO_8859_14 ); 176 } 177 // ---------------------------------------- 178 void MimeCharsetFromTextEncoding_ISO_8859_15() 179 { 180 check( "RTL_TEXTENCODING_ISO_8859_15", RTL_TEXTENCODING_ISO_8859_15 ); 181 } 182 // ---------------------------------------- 183 void MimeCharsetFromTextEncoding_IBM_737() 184 { 185 check( "RTL_TEXTENCODING_IBM_737", RTL_TEXTENCODING_IBM_737 ); 186 } 187 // ---------------------------------------- 188 void MimeCharsetFromTextEncoding_IBM_775() 189 { 190 check( "RTL_TEXTENCODING_IBM_775", RTL_TEXTENCODING_IBM_775 ); 191 } 192 // ---------------------------------------- 193 void MimeCharsetFromTextEncoding_IBM_852() 194 { 195 check( "RTL_TEXTENCODING_IBM_852", RTL_TEXTENCODING_IBM_852 ); 196 } 197 // ---------------------------------------- 198 void MimeCharsetFromTextEncoding_IBM_855() 199 { 200 check( "RTL_TEXTENCODING_IBM_855", RTL_TEXTENCODING_IBM_855 ); 201 } 202 // ---------------------------------------- 203 void MimeCharsetFromTextEncoding_IBM_857() 204 { 205 check( "RTL_TEXTENCODING_IBM_857", RTL_TEXTENCODING_IBM_857 ); 206 } 207 // ---------------------------------------- 208 void MimeCharsetFromTextEncoding_IBM_862() 209 { 210 check( "RTL_TEXTENCODING_IBM_862", RTL_TEXTENCODING_IBM_862 ); 211 } 212 // ---------------------------------------- 213 void MimeCharsetFromTextEncoding_IBM_864() 214 { 215 check( "RTL_TEXTENCODING_IBM_864", RTL_TEXTENCODING_IBM_864 ); 216 } 217 // ---------------------------------------- 218 void MimeCharsetFromTextEncoding_IBM_866() 219 { 220 check( "RTL_TEXTENCODING_IBM_866", RTL_TEXTENCODING_IBM_866 ); 221 } 222 // ---------------------------------------- 223 void MimeCharsetFromTextEncoding_IBM_869() 224 { 225 check( "RTL_TEXTENCODING_IBM_869", RTL_TEXTENCODING_IBM_869 ); 226 } 227 // ---------------------------------------- 228 void MimeCharsetFromTextEncoding_MS_874() 229 { 230 check( "RTL_TEXTENCODING_MS_874", RTL_TEXTENCODING_MS_874 ); 231 } 232 // ---------------------------------------- 233 void MimeCharsetFromTextEncoding_MS_1250() 234 { 235 check( "RTL_TEXTENCODING_MS_1250", RTL_TEXTENCODING_MS_1250 ); 236 } 237 // ---------------------------------------- 238 void MimeCharsetFromTextEncoding_MS_1251() 239 { 240 check( "RTL_TEXTENCODING_MS_1251", RTL_TEXTENCODING_MS_1251 ); 241 } 242 // ---------------------------------------- 243 void MimeCharsetFromTextEncoding_MS_1253() 244 { 245 check( "RTL_TEXTENCODING_MS_1253", RTL_TEXTENCODING_MS_1253 ); 246 } 247 // ---------------------------------------- 248 void MimeCharsetFromTextEncoding_MS_1254() 249 { 250 check( "RTL_TEXTENCODING_MS_1254", RTL_TEXTENCODING_MS_1254 ); 251 } 252 // ---------------------------------------- 253 void MimeCharsetFromTextEncoding_MS_1255() 254 { 255 check( "RTL_TEXTENCODING_MS_1255", RTL_TEXTENCODING_MS_1255 ); 256 } 257 // ---------------------------------------- 258 void MimeCharsetFromTextEncoding_MS_1256() 259 { 260 check( "RTL_TEXTENCODING_MS_1256", RTL_TEXTENCODING_MS_1256 ); 261 } 262 // ---------------------------------------- 263 void MimeCharsetFromTextEncoding_MS_1257() 264 { 265 check( "RTL_TEXTENCODING_MS_1257", RTL_TEXTENCODING_MS_1257 ); 266 } 267 // ---------------------------------------- 268 void MimeCharsetFromTextEncoding_MS_1258() 269 { 270 check( "RTL_TEXTENCODING_MS_1258", RTL_TEXTENCODING_MS_1258 ); 271 } 272 // ---------------------------------------- 273 void MimeCharsetFromTextEncoding_APPLE_ARABIC() 274 { 275 check( "RTL_TEXTENCODING_APPLE_ARABIC", RTL_TEXTENCODING_APPLE_ARABIC ); 276 } 277 // ---------------------------------------- 278 void MimeCharsetFromTextEncoding_APPLE_CENTEURO() 279 { 280 check( "RTL_TEXTENCODING_APPLE_CENTEURO", RTL_TEXTENCODING_APPLE_CENTEURO ); 281 } 282 // ---------------------------------------- 283 void MimeCharsetFromTextEncoding_APPLE_CROATIAN() 284 { 285 check( "RTL_TEXTENCODING_APPLE_CROATIAN", RTL_TEXTENCODING_APPLE_CROATIAN ); 286 } 287 // ---------------------------------------- 288 void MimeCharsetFromTextEncoding_APPLE_CYRILLIC() 289 { 290 check( "RTL_TEXTENCODING_APPLE_CYRILLIC", RTL_TEXTENCODING_APPLE_CYRILLIC ); 291 } 292 // ---------------------------------------- 293 void MimeCharsetFromTextEncoding_APPLE_DEVANAGARI() 294 { 295 check( "RTL_TEXTENCODING_APPLE_DEVANAGARI", RTL_TEXTENCODING_APPLE_DEVANAGARI ); 296 } 297 // ---------------------------------------- 298 void MimeCharsetFromTextEncoding_APPLE_FARSI() 299 { 300 check( "RTL_TEXTENCODING_APPLE_FARSI", RTL_TEXTENCODING_APPLE_FARSI ); 301 } 302 // ---------------------------------------- 303 void MimeCharsetFromTextEncoding_APPLE_GREEK() 304 { 305 check( "RTL_TEXTENCODING_APPLE_GREEK", RTL_TEXTENCODING_APPLE_GREEK ); 306 } 307 // ---------------------------------------- 308 void MimeCharsetFromTextEncoding_APPLE_GUJARATI() 309 { 310 check( "RTL_TEXTENCODING_APPLE_GUJARATI", RTL_TEXTENCODING_APPLE_GUJARATI ); 311 } 312 // ---------------------------------------- 313 void MimeCharsetFromTextEncoding_APPLE_GURMUKHI() 314 { 315 check( "RTL_TEXTENCODING_APPLE_GURMUKHI", RTL_TEXTENCODING_APPLE_GURMUKHI ); 316 } 317 // ---------------------------------------- 318 void MimeCharsetFromTextEncoding_APPLE_HEBREW() 319 { 320 check( "RTL_TEXTENCODING_APPLE_HEBREW", RTL_TEXTENCODING_APPLE_HEBREW ); 321 } 322 // ---------------------------------------- 323 void MimeCharsetFromTextEncoding_APPLE_ICELAND() 324 { 325 check( "RTL_TEXTENCODING_APPLE_ICELAND", RTL_TEXTENCODING_APPLE_ICELAND ); 326 } 327 // ---------------------------------------- 328 void MimeCharsetFromTextEncoding_APPLE_ROMANIAN() 329 { 330 check( "RTL_TEXTENCODING_APPLE_ROMANIAN", RTL_TEXTENCODING_APPLE_ROMANIAN ); 331 } 332 // ---------------------------------------- 333 void MimeCharsetFromTextEncoding_APPLE_THAI() 334 { 335 check( "RTL_TEXTENCODING_APPLE_THAI", RTL_TEXTENCODING_APPLE_THAI ); 336 } 337 // ---------------------------------------- 338 void MimeCharsetFromTextEncoding_APPLE_TURKISH() 339 { 340 check( "RTL_TEXTENCODING_APPLE_TURKISH", RTL_TEXTENCODING_APPLE_TURKISH ); 341 } 342 // ---------------------------------------- 343 void MimeCharsetFromTextEncoding_APPLE_UKRAINIAN() 344 { 345 check( "RTL_TEXTENCODING_APPLE_UKRAINIAN", RTL_TEXTENCODING_APPLE_UKRAINIAN ); 346 } 347 // ---------------------------------------- 348 void MimeCharsetFromTextEncoding_APPLE_CHINSIMP() 349 { 350 check( "RTL_TEXTENCODING_APPLE_CHINSIMP", RTL_TEXTENCODING_APPLE_CHINSIMP ); 351 } 352 // ---------------------------------------- 353 void MimeCharsetFromTextEncoding_APPLE_CHINTRAD() 354 { 355 check( "RTL_TEXTENCODING_APPLE_CHINTRAD", RTL_TEXTENCODING_APPLE_CHINTRAD ); 356 } 357 // ---------------------------------------- 358 void MimeCharsetFromTextEncoding_APPLE_JAPANESE() 359 { 360 check( "RTL_TEXTENCODING_APPLE_JAPANESE", RTL_TEXTENCODING_APPLE_JAPANESE ); 361 } 362 // ---------------------------------------- 363 void MimeCharsetFromTextEncoding_APPLE_KOREAN() 364 { 365 check( "RTL_TEXTENCODING_APPLE_KOREAN", RTL_TEXTENCODING_APPLE_KOREAN ); 366 } 367 // ---------------------------------------- 368 void MimeCharsetFromTextEncoding_MS_932() 369 { 370 check( "RTL_TEXTENCODING_MS_932", RTL_TEXTENCODING_MS_932 ); 371 } 372 // ---------------------------------------- 373 void MimeCharsetFromTextEncoding_MS_936() 374 { 375 check( "RTL_TEXTENCODING_MS_936", RTL_TEXTENCODING_MS_936 ); 376 } 377 // ---------------------------------------- 378 void MimeCharsetFromTextEncoding_MS_949() 379 { 380 check( "RTL_TEXTENCODING_MS_949", RTL_TEXTENCODING_MS_949 ); 381 } 382 // ---------------------------------------- 383 void MimeCharsetFromTextEncoding_MS_950() 384 { 385 check( "RTL_TEXTENCODING_MS_950", RTL_TEXTENCODING_MS_950 ); 386 } 387 // ---------------------------------------- 388 void MimeCharsetFromTextEncoding_SHIFT_JIS() 389 { 390 check( "RTL_TEXTENCODING_SHIFT_JIS", RTL_TEXTENCODING_SHIFT_JIS ); 391 } 392 // ---------------------------------------- 393 void MimeCharsetFromTextEncoding_GB_2312() 394 { 395 check( "RTL_TEXTENCODING_GB_2312", RTL_TEXTENCODING_GB_2312 ); 396 } 397 // ---------------------------------------- 398 void MimeCharsetFromTextEncoding_GBT_12345() 399 { 400 check( "RTL_TEXTENCODING_GBT_12345", RTL_TEXTENCODING_GBT_12345 ); 401 } 402 // ---------------------------------------- 403 void MimeCharsetFromTextEncoding_GBK() 404 { 405 check( "RTL_TEXTENCODING_GBK", RTL_TEXTENCODING_GBK ); 406 } 407 // ---------------------------------------- 408 void MimeCharsetFromTextEncoding_BIG5() 409 { 410 check( "RTL_TEXTENCODING_BIG5", RTL_TEXTENCODING_BIG5 ); 411 } 412 // ---------------------------------------- 413 void MimeCharsetFromTextEncoding_EUC_JP() 414 { 415 check( "RTL_TEXTENCODING_EUC_JP", RTL_TEXTENCODING_EUC_JP ); 416 } 417 // ---------------------------------------- 418 void MimeCharsetFromTextEncoding_EUC_CN() 419 { 420 check( "RTL_TEXTENCODING_EUC_CN", RTL_TEXTENCODING_EUC_CN ); 421 } 422 // ---------------------------------------- 423 void MimeCharsetFromTextEncoding_EUC_TW() 424 { 425 check( "RTL_TEXTENCODING_EUC_TW", RTL_TEXTENCODING_EUC_TW ); 426 } 427 // ---------------------------------------- 428 void MimeCharsetFromTextEncoding_ISO_2022_JP() 429 { 430 check( "RTL_TEXTENCODING_ISO_2022_JP", RTL_TEXTENCODING_ISO_2022_JP ); 431 } 432 // ---------------------------------------- 433 void MimeCharsetFromTextEncoding_ISO_2022_CN() 434 { 435 check( "RTL_TEXTENCODING_ISO_2022_CN", RTL_TEXTENCODING_ISO_2022_CN ); 436 } 437 // ---------------------------------------- 438 void MimeCharsetFromTextEncoding_KOI8_R() 439 { 440 check( "RTL_TEXTENCODING_KOI8_R", RTL_TEXTENCODING_KOI8_R ); 441 } 442 // ---------------------------------------- 443 void MimeCharsetFromTextEncoding_UTF7() 444 { 445 check( "RTL_TEXTENCODING_UTF7", RTL_TEXTENCODING_UTF7 ); 446 } 447 // ---------------------------------------- 448 void MimeCharsetFromTextEncoding_UTF8() 449 { 450 check( "RTL_TEXTENCODING_UTF8", RTL_TEXTENCODING_UTF8 ); 451 } 452 // ---------------------------------------- 453 void MimeCharsetFromTextEncoding_ISO_8859_10() 454 { 455 check( "RTL_TEXTENCODING_ISO_8859_10", RTL_TEXTENCODING_ISO_8859_10 ); 456 } 457 // ---------------------------------------- 458 void MimeCharsetFromTextEncoding_ISO_8859_13() 459 { 460 check( "RTL_TEXTENCODING_ISO_8859_13", RTL_TEXTENCODING_ISO_8859_13 ); 461 } 462 // ---------------------------------------- 463 void MimeCharsetFromTextEncoding_EUC_KR() 464 { 465 check( "RTL_TEXTENCODING_EUC_KR", RTL_TEXTENCODING_EUC_KR ); 466 } 467 // ---------------------------------------- 468 void MimeCharsetFromTextEncoding_ISO_2022_KR() 469 { 470 check( "RTL_TEXTENCODING_ISO_2022_KR", RTL_TEXTENCODING_ISO_2022_KR ); 471 } 472 // ---------------------------------------- 473 void MimeCharsetFromTextEncoding_JIS_X_0201() 474 { 475 check( "RTL_TEXTENCODING_JIS_X_0201", RTL_TEXTENCODING_JIS_X_0201 ); 476 } 477 // ---------------------------------------- 478 void MimeCharsetFromTextEncoding_JIS_X_0208() 479 { 480 check( "RTL_TEXTENCODING_JIS_X_0208", RTL_TEXTENCODING_JIS_X_0208 ); 481 } 482 // ---------------------------------------- 483 void MimeCharsetFromTextEncoding_JIS_X_0212() 484 { 485 check( "RTL_TEXTENCODING_JIS_X_0212", RTL_TEXTENCODING_JIS_X_0212 ); 486 } 487 // ---------------------------------------- 488 void MimeCharsetFromTextEncoding_MS_1361() 489 { 490 check( "RTL_TEXTENCODING_MS_1361", RTL_TEXTENCODING_MS_1361 ); 491 } 492 // ---------------------------------------- 493 void MimeCharsetFromTextEncoding_GB_18030() 494 { 495 check( "RTL_TEXTENCODING_GB_18030", RTL_TEXTENCODING_GB_18030 ); 496 } 497 // ---------------------------------------- 498 void MimeCharsetFromTextEncoding_BIG5_HKSCS() 499 { 500 check( "RTL_TEXTENCODING_BIG5_HKSCS", RTL_TEXTENCODING_BIG5_HKSCS ); 501 } 502 // ---------------------------------------- 503 void MimeCharsetFromTextEncoding_TIS_620() 504 { 505 check( "RTL_TEXTENCODING_TIS_620", RTL_TEXTENCODING_TIS_620 ); 506 } 507 // ---------------------------------------- 508 void MimeCharsetFromTextEncoding_KOI8_U() 509 { 510 check( "RTL_TEXTENCODING_KOI8_U", RTL_TEXTENCODING_KOI8_U ); 511 } 512 // ---------------------------------------- 513 void MimeCharsetFromTextEncoding_ISCII_DEVANAGARI() 514 { 515 check( "RTL_TEXTENCODING_ISCII_DEVANAGARI", RTL_TEXTENCODING_ISCII_DEVANAGARI ); 516 } 517 // ---------------------------------------- 518 void MimeCharsetFromTextEncoding_JAVA_UTF8() 519 { 520 check( "RTL_TEXTENCODING_JAVA_UTF8", RTL_TEXTENCODING_JAVA_UTF8 ); 521 } 522 523 /* ATTENTION! Whenever some encoding is added here, make sure to update 524 * rtl_isOctetEncoding in tencinfo.c. 525 */ 526 527 // RTL_TEXTENCODING_USER_START 528 // RTL_TEXTENCODING_USER_END 529 530 // check( "RTL_TEXTENCODING_UCS4", RTL_TEXTENCODING_UCS4 ); 531 // check( "RTL_TEXTENCODING_UCS2", RTL_TEXTENCODING_UCS2 ); 532 // check( "RTL_TEXTENCODING_UNICODE", RTL_TEXTENCODING_UNICODE /* RTL_TEXTENCODING_UCS2 */ ); 533 534 CPPUNIT_TEST_SUITE( getBestMime ); 535 536 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1252 ); 537 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_ROMAN ); 538 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_437 ); 539 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_850 ); 540 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_860 ); 541 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_861 ); 542 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_863 ); 543 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_865 ); 544 CPPUNIT_TEST( MimeCharsetFromTextEncoding_SYMBOL ); 545 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ASCII_US ); 546 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_1 ); 547 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_2 ); 548 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_3 ); 549 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_4 ); 550 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_5 ); 551 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_6 ); 552 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_7 ); 553 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_8 ); 554 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_9 ); 555 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_14 ); 556 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_15 ); 557 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_737 ); 558 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_775 ); 559 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_852 ); 560 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_855 ); 561 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_857 ); 562 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_862 ); 563 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_864 ); 564 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_866 ); 565 CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_869 ); 566 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_874 ); 567 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1250 ); 568 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1251 ); 569 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1253 ); 570 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1254 ); 571 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1255 ); 572 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1256 ); 573 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1257 ); 574 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1258 ); 575 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_ARABIC ); 576 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CENTEURO ); 577 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CROATIAN ); 578 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CYRILLIC ); 579 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_DEVANAGARI ); 580 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_FARSI ); 581 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_GREEK ); 582 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_GUJARATI ); 583 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_GURMUKHI ); 584 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_HEBREW ); 585 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_ICELAND ); 586 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_ROMANIAN ); 587 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_THAI ); 588 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_TURKISH ); 589 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_UKRAINIAN ); 590 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CHINSIMP ); 591 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CHINTRAD ); 592 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_JAPANESE ); 593 CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_KOREAN ); 594 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_932 ); 595 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_936 ); 596 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_949 ); 597 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_950 ); 598 CPPUNIT_TEST( MimeCharsetFromTextEncoding_SHIFT_JIS ); 599 CPPUNIT_TEST( MimeCharsetFromTextEncoding_GB_2312 ); 600 CPPUNIT_TEST( MimeCharsetFromTextEncoding_GBT_12345 ); 601 CPPUNIT_TEST( MimeCharsetFromTextEncoding_GBK ); 602 CPPUNIT_TEST( MimeCharsetFromTextEncoding_BIG5 ); 603 CPPUNIT_TEST( MimeCharsetFromTextEncoding_EUC_JP ); 604 CPPUNIT_TEST( MimeCharsetFromTextEncoding_EUC_CN ); 605 CPPUNIT_TEST( MimeCharsetFromTextEncoding_EUC_TW ); 606 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_2022_JP ); 607 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_2022_CN ); 608 CPPUNIT_TEST( MimeCharsetFromTextEncoding_KOI8_R ); 609 CPPUNIT_TEST( MimeCharsetFromTextEncoding_UTF7 ); 610 CPPUNIT_TEST( MimeCharsetFromTextEncoding_UTF8 ); 611 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_10 ); 612 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_13 ); 613 CPPUNIT_TEST( MimeCharsetFromTextEncoding_EUC_KR ); 614 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_2022_KR ); 615 CPPUNIT_TEST( MimeCharsetFromTextEncoding_JIS_X_0201 ); 616 CPPUNIT_TEST( MimeCharsetFromTextEncoding_JIS_X_0208 ); 617 CPPUNIT_TEST( MimeCharsetFromTextEncoding_JIS_X_0212 ); 618 CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1361 ); 619 CPPUNIT_TEST( MimeCharsetFromTextEncoding_GB_18030 ); 620 CPPUNIT_TEST( MimeCharsetFromTextEncoding_BIG5_HKSCS ); 621 CPPUNIT_TEST( MimeCharsetFromTextEncoding_TIS_620 ); 622 CPPUNIT_TEST( MimeCharsetFromTextEncoding_KOI8_U ); 623 CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISCII_DEVANAGARI ); 624 CPPUNIT_TEST( MimeCharsetFromTextEncoding_JAVA_UTF8 ); 625 626 CPPUNIT_TEST_SUITE_END( ); 627 }; 628 629 // ----------------------------------------------------------------------------- 630 631 class getBestUnix : public CppUnit::TestFixture 632 { 633 public: 634 void setUp() 635 { 636 } 637 638 void check( const sal_Char* _pRTL_TEXTENCODING, rtl_TextEncoding _aCurrentEncode ) 639 { 640 const sal_Char *pCharSet = rtl_getBestUnixCharsetFromTextEncoding( _aCurrentEncode ); 641 if (pCharSet == 0) 642 { 643 t_print("rtl_getBestUnixCharsetFromTextEncoding(%s) (%d) doesn't seem to exist.\n\n", _pRTL_TEXTENCODING, _aCurrentEncode); 644 } 645 else 646 { 647 t_print(T_VERBOSE, "'%s' is charset: '%s'\n", _pRTL_TEXTENCODING, pCharSet); 648 649 rtl_TextEncoding eTextEnc = rtl_getTextEncodingFromUnixCharset( pCharSet ); 650 if (_aCurrentEncode != eTextEnc && 651 eTextEnc != RTL_TEXTENCODING_DONTKNOW) 652 { 653 t_print("rtl_getBestUnixCharsetFromTextEncoding(%s) is charset: %s\n", _pRTL_TEXTENCODING, pCharSet); 654 t_print("rtl_getTextEncodingFromUnixCharset() differ: %s %d -> %d\n\n", _pRTL_TEXTENCODING, _aCurrentEncode, eTextEnc ); 655 } 656 // rtl::OString sError = "getTextEncodingFromUnixCharset("; 657 // sError += pCharSet; 658 // sError += ") returns null"; 659 // CPPUNIT_ASSERT_MESSAGE(sError.getStr(), eTextEnc != RTL_TEXTENCODING_DONTKNOW); 660 // CPPUNIT_ASSERT_MESSAGE("Does not realize itself", _aCurrentEncode == eTextEnc ); 661 } 662 } 663 664 665 // ---------------------------------------- 666 void UnixCharsetFromTextEncoding_MS_1252() 667 { 668 check( "RTL_TEXTENCODING_MS_1252", RTL_TEXTENCODING_MS_1252 ); 669 } 670 // ---------------------------------------- 671 void UnixCharsetFromTextEncoding_APPLE_ROMAN() 672 { 673 check( "RTL_TEXTENCODING_APPLE_ROMAN", RTL_TEXTENCODING_APPLE_ROMAN ); 674 } 675 // ---------------------------------------- 676 void UnixCharsetFromTextEncoding_IBM_437() 677 { 678 check( "RTL_TEXTENCODING_IBM_437", RTL_TEXTENCODING_IBM_437 ); 679 } 680 // ---------------------------------------- 681 void UnixCharsetFromTextEncoding_IBM_850() 682 { 683 check( "RTL_TEXTENCODING_IBM_850", RTL_TEXTENCODING_IBM_850 ); 684 } 685 // ---------------------------------------- 686 void UnixCharsetFromTextEncoding_IBM_860() 687 { 688 check( "RTL_TEXTENCODING_IBM_860", RTL_TEXTENCODING_IBM_860 ); 689 } 690 // ---------------------------------------- 691 void UnixCharsetFromTextEncoding_IBM_861() 692 { 693 check( "RTL_TEXTENCODING_IBM_861", RTL_TEXTENCODING_IBM_861 ); 694 } 695 // ---------------------------------------- 696 void UnixCharsetFromTextEncoding_IBM_863() 697 { 698 check( "RTL_TEXTENCODING_IBM_863", RTL_TEXTENCODING_IBM_863 ); 699 } 700 // ---------------------------------------- 701 void UnixCharsetFromTextEncoding_IBM_865() 702 { 703 check( "RTL_TEXTENCODING_IBM_865", RTL_TEXTENCODING_IBM_865 ); 704 } 705 // ---------------------------------------- 706 void UnixCharsetFromTextEncoding_SYMBOL() 707 { 708 check( "RTL_TEXTENCODING_SYMBOL", RTL_TEXTENCODING_SYMBOL ); 709 } 710 // ---------------------------------------- 711 void UnixCharsetFromTextEncoding_ASCII_US() 712 { 713 check( "RTL_TEXTENCODING_ASCII_US", RTL_TEXTENCODING_ASCII_US ); 714 } 715 // ---------------------------------------- 716 void UnixCharsetFromTextEncoding_ISO_8859_1() 717 { 718 check( "RTL_TEXTENCODING_ISO_8859_1", RTL_TEXTENCODING_ISO_8859_1 ); 719 } 720 // ---------------------------------------- 721 void UnixCharsetFromTextEncoding_ISO_8859_2() 722 { 723 check( "RTL_TEXTENCODING_ISO_8859_2", RTL_TEXTENCODING_ISO_8859_2 ); 724 } 725 // ---------------------------------------- 726 void UnixCharsetFromTextEncoding_ISO_8859_3() 727 { 728 check( "RTL_TEXTENCODING_ISO_8859_3", RTL_TEXTENCODING_ISO_8859_3 ); 729 } 730 // ---------------------------------------- 731 void UnixCharsetFromTextEncoding_ISO_8859_4() 732 { 733 check( "RTL_TEXTENCODING_ISO_8859_4", RTL_TEXTENCODING_ISO_8859_4 ); 734 } 735 // ---------------------------------------- 736 void UnixCharsetFromTextEncoding_ISO_8859_5() 737 { 738 check( "RTL_TEXTENCODING_ISO_8859_5", RTL_TEXTENCODING_ISO_8859_5 ); 739 } 740 // ---------------------------------------- 741 void UnixCharsetFromTextEncoding_ISO_8859_6() 742 { 743 check( "RTL_TEXTENCODING_ISO_8859_6", RTL_TEXTENCODING_ISO_8859_6 ); 744 } 745 // ---------------------------------------- 746 void UnixCharsetFromTextEncoding_ISO_8859_7() 747 { 748 check( "RTL_TEXTENCODING_ISO_8859_7", RTL_TEXTENCODING_ISO_8859_7 ); 749 } 750 // ---------------------------------------- 751 void UnixCharsetFromTextEncoding_ISO_8859_8() 752 { 753 check( "RTL_TEXTENCODING_ISO_8859_8", RTL_TEXTENCODING_ISO_8859_8 ); 754 } 755 // ---------------------------------------- 756 void UnixCharsetFromTextEncoding_ISO_8859_9() 757 { 758 check( "RTL_TEXTENCODING_ISO_8859_9", RTL_TEXTENCODING_ISO_8859_9 ); 759 } 760 // ---------------------------------------- 761 void UnixCharsetFromTextEncoding_ISO_8859_14() 762 { 763 check( "RTL_TEXTENCODING_ISO_8859_14", RTL_TEXTENCODING_ISO_8859_14 ); 764 } 765 // ---------------------------------------- 766 void UnixCharsetFromTextEncoding_ISO_8859_15() 767 { 768 check( "RTL_TEXTENCODING_ISO_8859_15", RTL_TEXTENCODING_ISO_8859_15 ); 769 } 770 // ---------------------------------------- 771 void UnixCharsetFromTextEncoding_IBM_737() 772 { 773 check( "RTL_TEXTENCODING_IBM_737", RTL_TEXTENCODING_IBM_737 ); 774 } 775 // ---------------------------------------- 776 void UnixCharsetFromTextEncoding_IBM_775() 777 { 778 check( "RTL_TEXTENCODING_IBM_775", RTL_TEXTENCODING_IBM_775 ); 779 } 780 // ---------------------------------------- 781 void UnixCharsetFromTextEncoding_IBM_852() 782 { 783 check( "RTL_TEXTENCODING_IBM_852", RTL_TEXTENCODING_IBM_852 ); 784 } 785 // ---------------------------------------- 786 void UnixCharsetFromTextEncoding_IBM_855() 787 { 788 check( "RTL_TEXTENCODING_IBM_855", RTL_TEXTENCODING_IBM_855 ); 789 } 790 // ---------------------------------------- 791 void UnixCharsetFromTextEncoding_IBM_857() 792 { 793 check( "RTL_TEXTENCODING_IBM_857", RTL_TEXTENCODING_IBM_857 ); 794 } 795 // ---------------------------------------- 796 void UnixCharsetFromTextEncoding_IBM_862() 797 { 798 check( "RTL_TEXTENCODING_IBM_862", RTL_TEXTENCODING_IBM_862 ); 799 } 800 // ---------------------------------------- 801 void UnixCharsetFromTextEncoding_IBM_864() 802 { 803 check( "RTL_TEXTENCODING_IBM_864", RTL_TEXTENCODING_IBM_864 ); 804 } 805 // ---------------------------------------- 806 void UnixCharsetFromTextEncoding_IBM_866() 807 { 808 check( "RTL_TEXTENCODING_IBM_866", RTL_TEXTENCODING_IBM_866 ); 809 } 810 // ---------------------------------------- 811 void UnixCharsetFromTextEncoding_IBM_869() 812 { 813 check( "RTL_TEXTENCODING_IBM_869", RTL_TEXTENCODING_IBM_869 ); 814 } 815 // ---------------------------------------- 816 void UnixCharsetFromTextEncoding_MS_874() 817 { 818 check( "RTL_TEXTENCODING_MS_874", RTL_TEXTENCODING_MS_874 ); 819 } 820 // ---------------------------------------- 821 void UnixCharsetFromTextEncoding_MS_1250() 822 { 823 check( "RTL_TEXTENCODING_MS_1250", RTL_TEXTENCODING_MS_1250 ); 824 } 825 // ---------------------------------------- 826 void UnixCharsetFromTextEncoding_MS_1251() 827 { 828 check( "RTL_TEXTENCODING_MS_1251", RTL_TEXTENCODING_MS_1251 ); 829 } 830 // ---------------------------------------- 831 void UnixCharsetFromTextEncoding_MS_1253() 832 { 833 check( "RTL_TEXTENCODING_MS_1253", RTL_TEXTENCODING_MS_1253 ); 834 } 835 // ---------------------------------------- 836 void UnixCharsetFromTextEncoding_MS_1254() 837 { 838 check( "RTL_TEXTENCODING_MS_1254", RTL_TEXTENCODING_MS_1254 ); 839 } 840 // ---------------------------------------- 841 void UnixCharsetFromTextEncoding_MS_1255() 842 { 843 check( "RTL_TEXTENCODING_MS_1255", RTL_TEXTENCODING_MS_1255 ); 844 } 845 // ---------------------------------------- 846 void UnixCharsetFromTextEncoding_MS_1256() 847 { 848 check( "RTL_TEXTENCODING_MS_1256", RTL_TEXTENCODING_MS_1256 ); 849 } 850 // ---------------------------------------- 851 void UnixCharsetFromTextEncoding_MS_1257() 852 { 853 check( "RTL_TEXTENCODING_MS_1257", RTL_TEXTENCODING_MS_1257 ); 854 } 855 // ---------------------------------------- 856 void UnixCharsetFromTextEncoding_MS_1258() 857 { 858 check( "RTL_TEXTENCODING_MS_1258", RTL_TEXTENCODING_MS_1258 ); 859 } 860 // ---------------------------------------- 861 void UnixCharsetFromTextEncoding_APPLE_ARABIC() 862 { 863 check( "RTL_TEXTENCODING_APPLE_ARABIC", RTL_TEXTENCODING_APPLE_ARABIC ); 864 } 865 // ---------------------------------------- 866 void UnixCharsetFromTextEncoding_APPLE_CENTEURO() 867 { 868 check( "RTL_TEXTENCODING_APPLE_CENTEURO", RTL_TEXTENCODING_APPLE_CENTEURO ); 869 } 870 // ---------------------------------------- 871 void UnixCharsetFromTextEncoding_APPLE_CROATIAN() 872 { 873 check( "RTL_TEXTENCODING_APPLE_CROATIAN", RTL_TEXTENCODING_APPLE_CROATIAN ); 874 } 875 // ---------------------------------------- 876 void UnixCharsetFromTextEncoding_APPLE_CYRILLIC() 877 { 878 check( "RTL_TEXTENCODING_APPLE_CYRILLIC", RTL_TEXTENCODING_APPLE_CYRILLIC ); 879 } 880 // ---------------------------------------- 881 void UnixCharsetFromTextEncoding_APPLE_DEVANAGARI() 882 { 883 check( "RTL_TEXTENCODING_APPLE_DEVANAGARI", RTL_TEXTENCODING_APPLE_DEVANAGARI ); 884 } 885 // ---------------------------------------- 886 void UnixCharsetFromTextEncoding_APPLE_FARSI() 887 { 888 check( "RTL_TEXTENCODING_APPLE_FARSI", RTL_TEXTENCODING_APPLE_FARSI ); 889 } 890 // ---------------------------------------- 891 void UnixCharsetFromTextEncoding_APPLE_GREEK() 892 { 893 check( "RTL_TEXTENCODING_APPLE_GREEK", RTL_TEXTENCODING_APPLE_GREEK ); 894 } 895 // ---------------------------------------- 896 void UnixCharsetFromTextEncoding_APPLE_GUJARATI() 897 { 898 check( "RTL_TEXTENCODING_APPLE_GUJARATI", RTL_TEXTENCODING_APPLE_GUJARATI ); 899 } 900 // ---------------------------------------- 901 void UnixCharsetFromTextEncoding_APPLE_GURMUKHI() 902 { 903 check( "RTL_TEXTENCODING_APPLE_GURMUKHI", RTL_TEXTENCODING_APPLE_GURMUKHI ); 904 } 905 // ---------------------------------------- 906 void UnixCharsetFromTextEncoding_APPLE_HEBREW() 907 { 908 check( "RTL_TEXTENCODING_APPLE_HEBREW", RTL_TEXTENCODING_APPLE_HEBREW ); 909 } 910 // ---------------------------------------- 911 void UnixCharsetFromTextEncoding_APPLE_ICELAND() 912 { 913 check( "RTL_TEXTENCODING_APPLE_ICELAND", RTL_TEXTENCODING_APPLE_ICELAND ); 914 } 915 // ---------------------------------------- 916 void UnixCharsetFromTextEncoding_APPLE_ROMANIAN() 917 { 918 check( "RTL_TEXTENCODING_APPLE_ROMANIAN", RTL_TEXTENCODING_APPLE_ROMANIAN ); 919 } 920 // ---------------------------------------- 921 void UnixCharsetFromTextEncoding_APPLE_THAI() 922 { 923 check( "RTL_TEXTENCODING_APPLE_THAI", RTL_TEXTENCODING_APPLE_THAI ); 924 } 925 // ---------------------------------------- 926 void UnixCharsetFromTextEncoding_APPLE_TURKISH() 927 { 928 check( "RTL_TEXTENCODING_APPLE_TURKISH", RTL_TEXTENCODING_APPLE_TURKISH ); 929 } 930 // ---------------------------------------- 931 void UnixCharsetFromTextEncoding_APPLE_UKRAINIAN() 932 { 933 check( "RTL_TEXTENCODING_APPLE_UKRAINIAN", RTL_TEXTENCODING_APPLE_UKRAINIAN ); 934 } 935 // ---------------------------------------- 936 void UnixCharsetFromTextEncoding_APPLE_CHINSIMP() 937 { 938 check( "RTL_TEXTENCODING_APPLE_CHINSIMP", RTL_TEXTENCODING_APPLE_CHINSIMP ); 939 } 940 // ---------------------------------------- 941 void UnixCharsetFromTextEncoding_APPLE_CHINTRAD() 942 { 943 check( "RTL_TEXTENCODING_APPLE_CHINTRAD", RTL_TEXTENCODING_APPLE_CHINTRAD ); 944 } 945 // ---------------------------------------- 946 void UnixCharsetFromTextEncoding_APPLE_JAPANESE() 947 { 948 check( "RTL_TEXTENCODING_APPLE_JAPANESE", RTL_TEXTENCODING_APPLE_JAPANESE ); 949 } 950 // ---------------------------------------- 951 void UnixCharsetFromTextEncoding_APPLE_KOREAN() 952 { 953 check( "RTL_TEXTENCODING_APPLE_KOREAN", RTL_TEXTENCODING_APPLE_KOREAN ); 954 } 955 // ---------------------------------------- 956 void UnixCharsetFromTextEncoding_MS_932() 957 { 958 check( "RTL_TEXTENCODING_MS_932", RTL_TEXTENCODING_MS_932 ); 959 } 960 // ---------------------------------------- 961 void UnixCharsetFromTextEncoding_MS_936() 962 { 963 check( "RTL_TEXTENCODING_MS_936", RTL_TEXTENCODING_MS_936 ); 964 } 965 // ---------------------------------------- 966 void UnixCharsetFromTextEncoding_MS_949() 967 { 968 check( "RTL_TEXTENCODING_MS_949", RTL_TEXTENCODING_MS_949 ); 969 } 970 // ---------------------------------------- 971 void UnixCharsetFromTextEncoding_MS_950() 972 { 973 check( "RTL_TEXTENCODING_MS_950", RTL_TEXTENCODING_MS_950 ); 974 } 975 // ---------------------------------------- 976 void UnixCharsetFromTextEncoding_SHIFT_JIS() 977 { 978 check( "RTL_TEXTENCODING_SHIFT_JIS", RTL_TEXTENCODING_SHIFT_JIS ); 979 } 980 // ---------------------------------------- 981 void UnixCharsetFromTextEncoding_GB_2312() 982 { 983 check( "RTL_TEXTENCODING_GB_2312", RTL_TEXTENCODING_GB_2312 ); 984 } 985 // ---------------------------------------- 986 void UnixCharsetFromTextEncoding_GBT_12345() 987 { 988 check( "RTL_TEXTENCODING_GBT_12345", RTL_TEXTENCODING_GBT_12345 ); 989 } 990 // ---------------------------------------- 991 void UnixCharsetFromTextEncoding_GBK() 992 { 993 check( "RTL_TEXTENCODING_GBK", RTL_TEXTENCODING_GBK ); 994 } 995 // ---------------------------------------- 996 void UnixCharsetFromTextEncoding_BIG5() 997 { 998 check( "RTL_TEXTENCODING_BIG5", RTL_TEXTENCODING_BIG5 ); 999 } 1000 // ---------------------------------------- 1001 void UnixCharsetFromTextEncoding_EUC_JP() 1002 { 1003 check( "RTL_TEXTENCODING_EUC_JP", RTL_TEXTENCODING_EUC_JP ); 1004 } 1005 // ---------------------------------------- 1006 void UnixCharsetFromTextEncoding_EUC_CN() 1007 { 1008 check( "RTL_TEXTENCODING_EUC_CN", RTL_TEXTENCODING_EUC_CN ); 1009 } 1010 // ---------------------------------------- 1011 void UnixCharsetFromTextEncoding_EUC_TW() 1012 { 1013 check( "RTL_TEXTENCODING_EUC_TW", RTL_TEXTENCODING_EUC_TW ); 1014 } 1015 // ---------------------------------------- 1016 void UnixCharsetFromTextEncoding_ISO_2022_JP() 1017 { 1018 check( "RTL_TEXTENCODING_ISO_2022_JP", RTL_TEXTENCODING_ISO_2022_JP ); 1019 } 1020 // ---------------------------------------- 1021 void UnixCharsetFromTextEncoding_ISO_2022_CN() 1022 { 1023 check( "RTL_TEXTENCODING_ISO_2022_CN", RTL_TEXTENCODING_ISO_2022_CN ); 1024 } 1025 // ---------------------------------------- 1026 void UnixCharsetFromTextEncoding_KOI8_R() 1027 { 1028 check( "RTL_TEXTENCODING_KOI8_R", RTL_TEXTENCODING_KOI8_R ); 1029 } 1030 // ---------------------------------------- 1031 void UnixCharsetFromTextEncoding_UTF7() 1032 { 1033 check( "RTL_TEXTENCODING_UTF7", RTL_TEXTENCODING_UTF7 ); 1034 } 1035 // ---------------------------------------- 1036 void UnixCharsetFromTextEncoding_UTF8() 1037 { 1038 check( "RTL_TEXTENCODING_UTF8", RTL_TEXTENCODING_UTF8 ); 1039 } 1040 // ---------------------------------------- 1041 void UnixCharsetFromTextEncoding_ISO_8859_10() 1042 { 1043 check( "RTL_TEXTENCODING_ISO_8859_10", RTL_TEXTENCODING_ISO_8859_10 ); 1044 } 1045 // ---------------------------------------- 1046 void UnixCharsetFromTextEncoding_ISO_8859_13() 1047 { 1048 check( "RTL_TEXTENCODING_ISO_8859_13", RTL_TEXTENCODING_ISO_8859_13 ); 1049 } 1050 // ---------------------------------------- 1051 void UnixCharsetFromTextEncoding_EUC_KR() 1052 { 1053 check( "RTL_TEXTENCODING_EUC_KR", RTL_TEXTENCODING_EUC_KR ); 1054 } 1055 // ---------------------------------------- 1056 void UnixCharsetFromTextEncoding_ISO_2022_KR() 1057 { 1058 check( "RTL_TEXTENCODING_ISO_2022_KR", RTL_TEXTENCODING_ISO_2022_KR ); 1059 } 1060 // ---------------------------------------- 1061 void UnixCharsetFromTextEncoding_JIS_X_0201() 1062 { 1063 check( "RTL_TEXTENCODING_JIS_X_0201", RTL_TEXTENCODING_JIS_X_0201 ); 1064 } 1065 // ---------------------------------------- 1066 void UnixCharsetFromTextEncoding_JIS_X_0208() 1067 { 1068 check( "RTL_TEXTENCODING_JIS_X_0208", RTL_TEXTENCODING_JIS_X_0208 ); 1069 } 1070 // ---------------------------------------- 1071 void UnixCharsetFromTextEncoding_JIS_X_0212() 1072 { 1073 check( "RTL_TEXTENCODING_JIS_X_0212", RTL_TEXTENCODING_JIS_X_0212 ); 1074 } 1075 // ---------------------------------------- 1076 void UnixCharsetFromTextEncoding_MS_1361() 1077 { 1078 check( "RTL_TEXTENCODING_MS_1361", RTL_TEXTENCODING_MS_1361 ); 1079 } 1080 // ---------------------------------------- 1081 void UnixCharsetFromTextEncoding_GB_18030() 1082 { 1083 check( "RTL_TEXTENCODING_GB_18030", RTL_TEXTENCODING_GB_18030 ); 1084 } 1085 // ---------------------------------------- 1086 void UnixCharsetFromTextEncoding_BIG5_HKSCS() 1087 { 1088 check( "RTL_TEXTENCODING_BIG5_HKSCS", RTL_TEXTENCODING_BIG5_HKSCS ); 1089 } 1090 // ---------------------------------------- 1091 void UnixCharsetFromTextEncoding_TIS_620() 1092 { 1093 check( "RTL_TEXTENCODING_TIS_620", RTL_TEXTENCODING_TIS_620 ); 1094 } 1095 // ---------------------------------------- 1096 void UnixCharsetFromTextEncoding_KOI8_U() 1097 { 1098 check( "RTL_TEXTENCODING_KOI8_U", RTL_TEXTENCODING_KOI8_U ); 1099 } 1100 // ---------------------------------------- 1101 void UnixCharsetFromTextEncoding_ISCII_DEVANAGARI() 1102 { 1103 check( "RTL_TEXTENCODING_ISCII_DEVANAGARI", RTL_TEXTENCODING_ISCII_DEVANAGARI ); 1104 } 1105 // ---------------------------------------- 1106 void UnixCharsetFromTextEncoding_JAVA_UTF8() 1107 { 1108 check( "RTL_TEXTENCODING_JAVA_UTF8", RTL_TEXTENCODING_JAVA_UTF8 ); 1109 } 1110 // ---------------------------------------- 1111 1112 CPPUNIT_TEST_SUITE( getBestUnix ); 1113 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1252 ); 1114 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_ROMAN ); 1115 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_437 ); 1116 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_850 ); 1117 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_860 ); 1118 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_861 ); 1119 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_863 ); 1120 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_865 ); 1121 1122 CPPUNIT_TEST( UnixCharsetFromTextEncoding_SYMBOL ); 1123 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ASCII_US ); 1124 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_1 ); 1125 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_2 ); 1126 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_3 ); 1127 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_4 ); 1128 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_5 ); 1129 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_6 ); 1130 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_7 ); 1131 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_8 ); 1132 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_9 ); 1133 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_14 ); 1134 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_15 ); 1135 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_737 ); 1136 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_775 ); 1137 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_852 ); 1138 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_855 ); 1139 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_857 ); 1140 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_862 ); 1141 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_864 ); 1142 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_866 ); 1143 CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_869 ); 1144 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_874 ); 1145 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1250 ); 1146 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1251 ); 1147 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1253 ); 1148 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1254 ); 1149 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1255 ); 1150 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1256 ); 1151 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1257 ); 1152 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1258 ); 1153 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_ARABIC ); 1154 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CENTEURO ); 1155 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CROATIAN ); 1156 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CYRILLIC ); 1157 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_DEVANAGARI ); 1158 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_FARSI ); 1159 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_GREEK ); 1160 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_GUJARATI ); 1161 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_GURMUKHI ); 1162 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_HEBREW ); 1163 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_ICELAND ); 1164 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_ROMANIAN ); 1165 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_THAI ); 1166 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_TURKISH ); 1167 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_UKRAINIAN ); 1168 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CHINSIMP ); 1169 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CHINTRAD ); 1170 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_JAPANESE ); 1171 CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_KOREAN ); 1172 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_932 ); 1173 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_936 ); 1174 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_949 ); 1175 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_950 ); 1176 CPPUNIT_TEST( UnixCharsetFromTextEncoding_SHIFT_JIS ); 1177 CPPUNIT_TEST( UnixCharsetFromTextEncoding_GB_2312 ); 1178 CPPUNIT_TEST( UnixCharsetFromTextEncoding_GBT_12345 ); 1179 CPPUNIT_TEST( UnixCharsetFromTextEncoding_GBK ); 1180 CPPUNIT_TEST( UnixCharsetFromTextEncoding_BIG5 ); 1181 CPPUNIT_TEST( UnixCharsetFromTextEncoding_EUC_JP ); 1182 CPPUNIT_TEST( UnixCharsetFromTextEncoding_EUC_CN ); 1183 CPPUNIT_TEST( UnixCharsetFromTextEncoding_EUC_TW ); 1184 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_2022_JP ); 1185 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_2022_CN ); 1186 CPPUNIT_TEST( UnixCharsetFromTextEncoding_KOI8_R ); 1187 CPPUNIT_TEST( UnixCharsetFromTextEncoding_UTF7 ); 1188 CPPUNIT_TEST( UnixCharsetFromTextEncoding_UTF8 ); 1189 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_10 ); 1190 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_13 ); 1191 CPPUNIT_TEST( UnixCharsetFromTextEncoding_EUC_KR ); 1192 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_2022_KR ); 1193 CPPUNIT_TEST( UnixCharsetFromTextEncoding_JIS_X_0201 ); 1194 CPPUNIT_TEST( UnixCharsetFromTextEncoding_JIS_X_0208 ); 1195 CPPUNIT_TEST( UnixCharsetFromTextEncoding_JIS_X_0212 ); 1196 CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1361 ); 1197 CPPUNIT_TEST( UnixCharsetFromTextEncoding_GB_18030 ); 1198 CPPUNIT_TEST( UnixCharsetFromTextEncoding_BIG5_HKSCS ); 1199 CPPUNIT_TEST( UnixCharsetFromTextEncoding_TIS_620 ); 1200 CPPUNIT_TEST( UnixCharsetFromTextEncoding_KOI8_U ); 1201 CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISCII_DEVANAGARI ); 1202 CPPUNIT_TEST( UnixCharsetFromTextEncoding_JAVA_UTF8 ); 1203 1204 CPPUNIT_TEST_SUITE_END( ); 1205 }; 1206 1207 // ----------------------------------------------------------------------------- 1208 1209 1210 class getBestWindows : public CppUnit::TestFixture 1211 { 1212 public: 1213 void setUp() 1214 { 1215 } 1216 1217 void check( const sal_Char* _pRTL_TEXTENCODING, rtl_TextEncoding _aCurrentEncode ) 1218 { 1219 const sal_uInt8 nCharSet = rtl_getBestWindowsCharsetFromTextEncoding( _aCurrentEncode ); 1220 if (nCharSet == 1) 1221 { 1222 t_print("rtl_getBestWindowsCharsetFromTextEncoding(%s) (%d) doesn't seem to exist.\n\n", _pRTL_TEXTENCODING, _aCurrentEncode); 1223 } 1224 else 1225 { 1226 t_print(T_VERBOSE, "'%s' is charset: '%d'\n", _pRTL_TEXTENCODING, nCharSet); 1227 1228 rtl_TextEncoding eTextEnc = rtl_getTextEncodingFromWindowsCharset( nCharSet ); 1229 if (_aCurrentEncode != eTextEnc && 1230 eTextEnc != RTL_TEXTENCODING_DONTKNOW) 1231 { 1232 t_print("rtl_getBestUnixCharsetFromTextEncoding(%s) is charset: %d\n", _pRTL_TEXTENCODING, nCharSet); 1233 t_print("rtl_getTextEncodingFromWindowsCharset() differ: %s %d -> %d\n\n", _pRTL_TEXTENCODING, _aCurrentEncode, eTextEnc ); 1234 } 1235 // rtl::OString sError = "getTextEncodingFromWindowsCharset("; 1236 // sError += rtl::OString::valueOf(nCharSet); 1237 // sError += ") returns nul."; 1238 1239 // CPPUNIT_ASSERT_MESSAGE(sError.getStr(), eTextEnc != RTL_TEXTENCODING_DONTKNOW); 1240 // CPPUNIT_ASSERT_MESSAGE("Does not realize itself", _aCurrentEncode == eTextEnc ); 1241 } 1242 } 1243 1244 // ---------------------------------------- 1245 void WindowsCharsetFromTextEncoding_MS_1252() 1246 { 1247 check( "RTL_TEXTENCODING_MS_1252", RTL_TEXTENCODING_MS_1252 ); 1248 } 1249 // ---------------------------------------- 1250 void WindowsCharsetFromTextEncoding_APPLE_ROMAN() 1251 { 1252 check( "RTL_TEXTENCODING_APPLE_ROMAN", RTL_TEXTENCODING_APPLE_ROMAN ); 1253 } 1254 // ---------------------------------------- 1255 void WindowsCharsetFromTextEncoding_IBM_437() 1256 { 1257 check( "RTL_TEXTENCODING_IBM_437", RTL_TEXTENCODING_IBM_437 ); 1258 } 1259 // ---------------------------------------- 1260 void WindowsCharsetFromTextEncoding_IBM_850() 1261 { 1262 check( "RTL_TEXTENCODING_IBM_850", RTL_TEXTENCODING_IBM_850 ); 1263 } 1264 // ---------------------------------------- 1265 void WindowsCharsetFromTextEncoding_IBM_860() 1266 { 1267 check( "RTL_TEXTENCODING_IBM_860", RTL_TEXTENCODING_IBM_860 ); 1268 } 1269 // ---------------------------------------- 1270 void WindowsCharsetFromTextEncoding_IBM_861() 1271 { 1272 check( "RTL_TEXTENCODING_IBM_861", RTL_TEXTENCODING_IBM_861 ); 1273 } 1274 // ---------------------------------------- 1275 void WindowsCharsetFromTextEncoding_IBM_863() 1276 { 1277 check( "RTL_TEXTENCODING_IBM_863", RTL_TEXTENCODING_IBM_863 ); 1278 } 1279 // ---------------------------------------- 1280 void WindowsCharsetFromTextEncoding_IBM_865() 1281 { 1282 check( "RTL_TEXTENCODING_IBM_865", RTL_TEXTENCODING_IBM_865 ); 1283 } 1284 // ---------------------------------------- 1285 void WindowsCharsetFromTextEncoding_SYMBOL() 1286 { 1287 check( "RTL_TEXTENCODING_SYMBOL", RTL_TEXTENCODING_SYMBOL ); 1288 } 1289 // ---------------------------------------- 1290 void WindowsCharsetFromTextEncoding_ASCII_US() 1291 { 1292 check( "RTL_TEXTENCODING_ASCII_US", RTL_TEXTENCODING_ASCII_US ); 1293 } 1294 // ---------------------------------------- 1295 void WindowsCharsetFromTextEncoding_ISO_8859_1() 1296 { 1297 check( "RTL_TEXTENCODING_ISO_8859_1", RTL_TEXTENCODING_ISO_8859_1 ); 1298 } 1299 // ---------------------------------------- 1300 void WindowsCharsetFromTextEncoding_ISO_8859_2() 1301 { 1302 check( "RTL_TEXTENCODING_ISO_8859_2", RTL_TEXTENCODING_ISO_8859_2 ); 1303 } 1304 // ---------------------------------------- 1305 void WindowsCharsetFromTextEncoding_ISO_8859_3() 1306 { 1307 check( "RTL_TEXTENCODING_ISO_8859_3", RTL_TEXTENCODING_ISO_8859_3 ); 1308 } 1309 // ---------------------------------------- 1310 void WindowsCharsetFromTextEncoding_ISO_8859_4() 1311 { 1312 check( "RTL_TEXTENCODING_ISO_8859_4", RTL_TEXTENCODING_ISO_8859_4 ); 1313 } 1314 // ---------------------------------------- 1315 void WindowsCharsetFromTextEncoding_ISO_8859_5() 1316 { 1317 check( "RTL_TEXTENCODING_ISO_8859_5", RTL_TEXTENCODING_ISO_8859_5 ); 1318 } 1319 // ---------------------------------------- 1320 void WindowsCharsetFromTextEncoding_ISO_8859_6() 1321 { 1322 check( "RTL_TEXTENCODING_ISO_8859_6", RTL_TEXTENCODING_ISO_8859_6 ); 1323 } 1324 // ---------------------------------------- 1325 void WindowsCharsetFromTextEncoding_ISO_8859_7() 1326 { 1327 check( "RTL_TEXTENCODING_ISO_8859_7", RTL_TEXTENCODING_ISO_8859_7 ); 1328 } 1329 // ---------------------------------------- 1330 void WindowsCharsetFromTextEncoding_ISO_8859_8() 1331 { 1332 check( "RTL_TEXTENCODING_ISO_8859_8", RTL_TEXTENCODING_ISO_8859_8 ); 1333 } 1334 // ---------------------------------------- 1335 void WindowsCharsetFromTextEncoding_ISO_8859_9() 1336 { 1337 check( "RTL_TEXTENCODING_ISO_8859_9", RTL_TEXTENCODING_ISO_8859_9 ); 1338 } 1339 // ---------------------------------------- 1340 void WindowsCharsetFromTextEncoding_ISO_8859_14() 1341 { 1342 check( "RTL_TEXTENCODING_ISO_8859_14", RTL_TEXTENCODING_ISO_8859_14 ); 1343 } 1344 // ---------------------------------------- 1345 void WindowsCharsetFromTextEncoding_ISO_8859_15() 1346 { 1347 check( "RTL_TEXTENCODING_ISO_8859_15", RTL_TEXTENCODING_ISO_8859_15 ); 1348 } 1349 // ---------------------------------------- 1350 void WindowsCharsetFromTextEncoding_IBM_737() 1351 { 1352 check( "RTL_TEXTENCODING_IBM_737", RTL_TEXTENCODING_IBM_737 ); 1353 } 1354 // ---------------------------------------- 1355 void WindowsCharsetFromTextEncoding_IBM_775() 1356 { 1357 check( "RTL_TEXTENCODING_IBM_775", RTL_TEXTENCODING_IBM_775 ); 1358 } 1359 // ---------------------------------------- 1360 void WindowsCharsetFromTextEncoding_IBM_852() 1361 { 1362 check( "RTL_TEXTENCODING_IBM_852", RTL_TEXTENCODING_IBM_852 ); 1363 } 1364 // ---------------------------------------- 1365 void WindowsCharsetFromTextEncoding_IBM_855() 1366 { 1367 check( "RTL_TEXTENCODING_IBM_855", RTL_TEXTENCODING_IBM_855 ); 1368 } 1369 // ---------------------------------------- 1370 void WindowsCharsetFromTextEncoding_IBM_857() 1371 { 1372 check( "RTL_TEXTENCODING_IBM_857", RTL_TEXTENCODING_IBM_857 ); 1373 } 1374 // ---------------------------------------- 1375 void WindowsCharsetFromTextEncoding_IBM_862() 1376 { 1377 check( "RTL_TEXTENCODING_IBM_862", RTL_TEXTENCODING_IBM_862 ); 1378 } 1379 // ---------------------------------------- 1380 void WindowsCharsetFromTextEncoding_IBM_864() 1381 { 1382 check( "RTL_TEXTENCODING_IBM_864", RTL_TEXTENCODING_IBM_864 ); 1383 } 1384 // ---------------------------------------- 1385 void WindowsCharsetFromTextEncoding_IBM_866() 1386 { 1387 check( "RTL_TEXTENCODING_IBM_866", RTL_TEXTENCODING_IBM_866 ); 1388 } 1389 // ---------------------------------------- 1390 void WindowsCharsetFromTextEncoding_IBM_869() 1391 { 1392 check( "RTL_TEXTENCODING_IBM_869", RTL_TEXTENCODING_IBM_869 ); 1393 } 1394 // ---------------------------------------- 1395 void WindowsCharsetFromTextEncoding_MS_874() 1396 { 1397 check( "RTL_TEXTENCODING_MS_874", RTL_TEXTENCODING_MS_874 ); 1398 } 1399 // ---------------------------------------- 1400 void WindowsCharsetFromTextEncoding_MS_1250() 1401 { 1402 check( "RTL_TEXTENCODING_MS_1250", RTL_TEXTENCODING_MS_1250 ); 1403 } 1404 // ---------------------------------------- 1405 void WindowsCharsetFromTextEncoding_MS_1251() 1406 { 1407 check( "RTL_TEXTENCODING_MS_1251", RTL_TEXTENCODING_MS_1251 ); 1408 } 1409 // ---------------------------------------- 1410 void WindowsCharsetFromTextEncoding_MS_1253() 1411 { 1412 check( "RTL_TEXTENCODING_MS_1253", RTL_TEXTENCODING_MS_1253 ); 1413 } 1414 // ---------------------------------------- 1415 void WindowsCharsetFromTextEncoding_MS_1254() 1416 { 1417 check( "RTL_TEXTENCODING_MS_1254", RTL_TEXTENCODING_MS_1254 ); 1418 } 1419 // ---------------------------------------- 1420 void WindowsCharsetFromTextEncoding_MS_1255() 1421 { 1422 check( "RTL_TEXTENCODING_MS_1255", RTL_TEXTENCODING_MS_1255 ); 1423 } 1424 // ---------------------------------------- 1425 void WindowsCharsetFromTextEncoding_MS_1256() 1426 { 1427 check( "RTL_TEXTENCODING_MS_1256", RTL_TEXTENCODING_MS_1256 ); 1428 } 1429 // ---------------------------------------- 1430 void WindowsCharsetFromTextEncoding_MS_1257() 1431 { 1432 check( "RTL_TEXTENCODING_MS_1257", RTL_TEXTENCODING_MS_1257 ); 1433 } 1434 // ---------------------------------------- 1435 void WindowsCharsetFromTextEncoding_MS_1258() 1436 { 1437 check( "RTL_TEXTENCODING_MS_1258", RTL_TEXTENCODING_MS_1258 ); 1438 } 1439 // ---------------------------------------- 1440 void WindowsCharsetFromTextEncoding_APPLE_ARABIC() 1441 { 1442 check( "RTL_TEXTENCODING_APPLE_ARABIC", RTL_TEXTENCODING_APPLE_ARABIC ); 1443 } 1444 // ---------------------------------------- 1445 void WindowsCharsetFromTextEncoding_APPLE_CENTEURO() 1446 { 1447 check( "RTL_TEXTENCODING_APPLE_CENTEURO", RTL_TEXTENCODING_APPLE_CENTEURO ); 1448 } 1449 // ---------------------------------------- 1450 void WindowsCharsetFromTextEncoding_APPLE_CROATIAN() 1451 { 1452 check( "RTL_TEXTENCODING_APPLE_CROATIAN", RTL_TEXTENCODING_APPLE_CROATIAN ); 1453 } 1454 // ---------------------------------------- 1455 void WindowsCharsetFromTextEncoding_APPLE_CYRILLIC() 1456 { 1457 check( "RTL_TEXTENCODING_APPLE_CYRILLIC", RTL_TEXTENCODING_APPLE_CYRILLIC ); 1458 } 1459 // ---------------------------------------- 1460 void WindowsCharsetFromTextEncoding_APPLE_DEVANAGARI() 1461 { 1462 check( "RTL_TEXTENCODING_APPLE_DEVANAGARI", RTL_TEXTENCODING_APPLE_DEVANAGARI ); 1463 } 1464 // ---------------------------------------- 1465 void WindowsCharsetFromTextEncoding_APPLE_FARSI() 1466 { 1467 check( "RTL_TEXTENCODING_APPLE_FARSI", RTL_TEXTENCODING_APPLE_FARSI ); 1468 } 1469 // ---------------------------------------- 1470 void WindowsCharsetFromTextEncoding_APPLE_GREEK() 1471 { 1472 check( "RTL_TEXTENCODING_APPLE_GREEK", RTL_TEXTENCODING_APPLE_GREEK ); 1473 } 1474 // ---------------------------------------- 1475 void WindowsCharsetFromTextEncoding_APPLE_GUJARATI() 1476 { 1477 check( "RTL_TEXTENCODING_APPLE_GUJARATI", RTL_TEXTENCODING_APPLE_GUJARATI ); 1478 } 1479 // ---------------------------------------- 1480 void WindowsCharsetFromTextEncoding_APPLE_GURMUKHI() 1481 { 1482 check( "RTL_TEXTENCODING_APPLE_GURMUKHI", RTL_TEXTENCODING_APPLE_GURMUKHI ); 1483 } 1484 // ---------------------------------------- 1485 void WindowsCharsetFromTextEncoding_APPLE_HEBREW() 1486 { 1487 check( "RTL_TEXTENCODING_APPLE_HEBREW", RTL_TEXTENCODING_APPLE_HEBREW ); 1488 } 1489 // ---------------------------------------- 1490 void WindowsCharsetFromTextEncoding_APPLE_ICELAND() 1491 { 1492 check( "RTL_TEXTENCODING_APPLE_ICELAND", RTL_TEXTENCODING_APPLE_ICELAND ); 1493 } 1494 // ---------------------------------------- 1495 void WindowsCharsetFromTextEncoding_APPLE_ROMANIAN() 1496 { 1497 check( "RTL_TEXTENCODING_APPLE_ROMANIAN", RTL_TEXTENCODING_APPLE_ROMANIAN ); 1498 } 1499 // ---------------------------------------- 1500 void WindowsCharsetFromTextEncoding_APPLE_THAI() 1501 { 1502 check( "RTL_TEXTENCODING_APPLE_THAI", RTL_TEXTENCODING_APPLE_THAI ); 1503 } 1504 // ---------------------------------------- 1505 void WindowsCharsetFromTextEncoding_APPLE_TURKISH() 1506 { 1507 check( "RTL_TEXTENCODING_APPLE_TURKISH", RTL_TEXTENCODING_APPLE_TURKISH ); 1508 } 1509 // ---------------------------------------- 1510 void WindowsCharsetFromTextEncoding_APPLE_UKRAINIAN() 1511 { 1512 check( "RTL_TEXTENCODING_APPLE_UKRAINIAN", RTL_TEXTENCODING_APPLE_UKRAINIAN ); 1513 } 1514 // ---------------------------------------- 1515 void WindowsCharsetFromTextEncoding_APPLE_CHINSIMP() 1516 { 1517 check( "RTL_TEXTENCODING_APPLE_CHINSIMP", RTL_TEXTENCODING_APPLE_CHINSIMP ); 1518 } 1519 // ---------------------------------------- 1520 void WindowsCharsetFromTextEncoding_APPLE_CHINTRAD() 1521 { 1522 check( "RTL_TEXTENCODING_APPLE_CHINTRAD", RTL_TEXTENCODING_APPLE_CHINTRAD ); 1523 } 1524 // ---------------------------------------- 1525 void WindowsCharsetFromTextEncoding_APPLE_JAPANESE() 1526 { 1527 check( "RTL_TEXTENCODING_APPLE_JAPANESE", RTL_TEXTENCODING_APPLE_JAPANESE ); 1528 } 1529 // ---------------------------------------- 1530 void WindowsCharsetFromTextEncoding_APPLE_KOREAN() 1531 { 1532 check( "RTL_TEXTENCODING_APPLE_KOREAN", RTL_TEXTENCODING_APPLE_KOREAN ); 1533 } 1534 // ---------------------------------------- 1535 void WindowsCharsetFromTextEncoding_MS_932() 1536 { 1537 check( "RTL_TEXTENCODING_MS_932", RTL_TEXTENCODING_MS_932 ); 1538 } 1539 // ---------------------------------------- 1540 void WindowsCharsetFromTextEncoding_MS_936() 1541 { 1542 check( "RTL_TEXTENCODING_MS_936", RTL_TEXTENCODING_MS_936 ); 1543 } 1544 // ---------------------------------------- 1545 void WindowsCharsetFromTextEncoding_MS_949() 1546 { 1547 check( "RTL_TEXTENCODING_MS_949", RTL_TEXTENCODING_MS_949 ); 1548 } 1549 // ---------------------------------------- 1550 void WindowsCharsetFromTextEncoding_MS_950() 1551 { 1552 check( "RTL_TEXTENCODING_MS_950", RTL_TEXTENCODING_MS_950 ); 1553 } 1554 // ---------------------------------------- 1555 void WindowsCharsetFromTextEncoding_SHIFT_JIS() 1556 { 1557 check( "RTL_TEXTENCODING_SHIFT_JIS", RTL_TEXTENCODING_SHIFT_JIS ); 1558 } 1559 // ---------------------------------------- 1560 void WindowsCharsetFromTextEncoding_GB_2312() 1561 { 1562 check( "RTL_TEXTENCODING_GB_2312", RTL_TEXTENCODING_GB_2312 ); 1563 } 1564 // ---------------------------------------- 1565 void WindowsCharsetFromTextEncoding_GBT_12345() 1566 { 1567 check( "RTL_TEXTENCODING_GBT_12345", RTL_TEXTENCODING_GBT_12345 ); 1568 } 1569 // ---------------------------------------- 1570 void WindowsCharsetFromTextEncoding_GBK() 1571 { 1572 check( "RTL_TEXTENCODING_GBK", RTL_TEXTENCODING_GBK ); 1573 } 1574 // ---------------------------------------- 1575 void WindowsCharsetFromTextEncoding_BIG5() 1576 { 1577 check( "RTL_TEXTENCODING_BIG5", RTL_TEXTENCODING_BIG5 ); 1578 } 1579 // ---------------------------------------- 1580 void WindowsCharsetFromTextEncoding_EUC_JP() 1581 { 1582 check( "RTL_TEXTENCODING_EUC_JP", RTL_TEXTENCODING_EUC_JP ); 1583 } 1584 // ---------------------------------------- 1585 void WindowsCharsetFromTextEncoding_EUC_CN() 1586 { 1587 check( "RTL_TEXTENCODING_EUC_CN", RTL_TEXTENCODING_EUC_CN ); 1588 } 1589 // ---------------------------------------- 1590 void WindowsCharsetFromTextEncoding_EUC_TW() 1591 { 1592 check( "RTL_TEXTENCODING_EUC_TW", RTL_TEXTENCODING_EUC_TW ); 1593 } 1594 // ---------------------------------------- 1595 void WindowsCharsetFromTextEncoding_ISO_2022_JP() 1596 { 1597 check( "RTL_TEXTENCODING_ISO_2022_JP", RTL_TEXTENCODING_ISO_2022_JP ); 1598 } 1599 // ---------------------------------------- 1600 void WindowsCharsetFromTextEncoding_ISO_2022_CN() 1601 { 1602 check( "RTL_TEXTENCODING_ISO_2022_CN", RTL_TEXTENCODING_ISO_2022_CN ); 1603 } 1604 // ---------------------------------------- 1605 void WindowsCharsetFromTextEncoding_KOI8_R() 1606 { 1607 check( "RTL_TEXTENCODING_KOI8_R", RTL_TEXTENCODING_KOI8_R ); 1608 } 1609 // ---------------------------------------- 1610 void WindowsCharsetFromTextEncoding_UTF7() 1611 { 1612 check( "RTL_TEXTENCODING_UTF7", RTL_TEXTENCODING_UTF7 ); 1613 } 1614 // ---------------------------------------- 1615 void WindowsCharsetFromTextEncoding_UTF8() 1616 { 1617 check( "RTL_TEXTENCODING_UTF8", RTL_TEXTENCODING_UTF8 ); 1618 } 1619 // ---------------------------------------- 1620 void WindowsCharsetFromTextEncoding_ISO_8859_10() 1621 { 1622 check( "RTL_TEXTENCODING_ISO_8859_10", RTL_TEXTENCODING_ISO_8859_10 ); 1623 } 1624 // ---------------------------------------- 1625 void WindowsCharsetFromTextEncoding_ISO_8859_13() 1626 { 1627 check( "RTL_TEXTENCODING_ISO_8859_13", RTL_TEXTENCODING_ISO_8859_13 ); 1628 } 1629 // ---------------------------------------- 1630 void WindowsCharsetFromTextEncoding_EUC_KR() 1631 { 1632 check( "RTL_TEXTENCODING_EUC_KR", RTL_TEXTENCODING_EUC_KR ); 1633 } 1634 // ---------------------------------------- 1635 void WindowsCharsetFromTextEncoding_ISO_2022_KR() 1636 { 1637 check( "RTL_TEXTENCODING_ISO_2022_KR", RTL_TEXTENCODING_ISO_2022_KR ); 1638 } 1639 // ---------------------------------------- 1640 void WindowsCharsetFromTextEncoding_JIS_X_0201() 1641 { 1642 check( "RTL_TEXTENCODING_JIS_X_0201", RTL_TEXTENCODING_JIS_X_0201 ); 1643 } 1644 // ---------------------------------------- 1645 void WindowsCharsetFromTextEncoding_JIS_X_0208() 1646 { 1647 check( "RTL_TEXTENCODING_JIS_X_0208", RTL_TEXTENCODING_JIS_X_0208 ); 1648 } 1649 // ---------------------------------------- 1650 void WindowsCharsetFromTextEncoding_JIS_X_0212() 1651 { 1652 check( "RTL_TEXTENCODING_JIS_X_0212", RTL_TEXTENCODING_JIS_X_0212 ); 1653 } 1654 // ---------------------------------------- 1655 void WindowsCharsetFromTextEncoding_MS_1361() 1656 { 1657 check( "RTL_TEXTENCODING_MS_1361", RTL_TEXTENCODING_MS_1361 ); 1658 } 1659 // ---------------------------------------- 1660 void WindowsCharsetFromTextEncoding_GB_18030() 1661 { 1662 check( "RTL_TEXTENCODING_GB_18030", RTL_TEXTENCODING_GB_18030 ); 1663 } 1664 // ---------------------------------------- 1665 void WindowsCharsetFromTextEncoding_BIG5_HKSCS() 1666 { 1667 check( "RTL_TEXTENCODING_BIG5_HKSCS", RTL_TEXTENCODING_BIG5_HKSCS ); 1668 } 1669 // ---------------------------------------- 1670 void WindowsCharsetFromTextEncoding_TIS_620() 1671 { 1672 check( "RTL_TEXTENCODING_TIS_620", RTL_TEXTENCODING_TIS_620 ); 1673 } 1674 // ---------------------------------------- 1675 void WindowsCharsetFromTextEncoding_KOI8_U() 1676 { 1677 check( "RTL_TEXTENCODING_KOI8_U", RTL_TEXTENCODING_KOI8_U ); 1678 } 1679 // ---------------------------------------- 1680 void WindowsCharsetFromTextEncoding_ISCII_DEVANAGARI() 1681 { 1682 check( "RTL_TEXTENCODING_ISCII_DEVANAGARI", RTL_TEXTENCODING_ISCII_DEVANAGARI ); 1683 } 1684 // ---------------------------------------- 1685 void WindowsCharsetFromTextEncoding_JAVA_UTF8() 1686 { 1687 check( "RTL_TEXTENCODING_JAVA_UTF8", RTL_TEXTENCODING_JAVA_UTF8 ); 1688 } 1689 // ---------------------------------------- 1690 1691 CPPUNIT_TEST_SUITE( getBestWindows ); 1692 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1252 ); 1693 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_ROMAN ); 1694 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_437 ); 1695 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_850 ); 1696 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_860 ); 1697 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_861 ); 1698 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_863 ); 1699 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_865 ); 1700 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_SYMBOL ); 1701 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ASCII_US ); 1702 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_1 ); 1703 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_2 ); 1704 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_3 ); 1705 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_4 ); 1706 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_5 ); 1707 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_6 ); 1708 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_7 ); 1709 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_8 ); 1710 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_9 ); 1711 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_14 ); 1712 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_15 ); 1713 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_737 ); 1714 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_775 ); 1715 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_852 ); 1716 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_855 ); 1717 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_857 ); 1718 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_862 ); 1719 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_864 ); 1720 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_866 ); 1721 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_869 ); 1722 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_874 ); 1723 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1250 ); 1724 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1251 ); 1725 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1253 ); 1726 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1254 ); 1727 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1255 ); 1728 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1256 ); 1729 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1257 ); 1730 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1258 ); 1731 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_ARABIC ); 1732 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_CENTEURO ); 1733 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_CROATIAN ); 1734 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_CYRILLIC ); 1735 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_DEVANAGARI ); 1736 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_FARSI ); 1737 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_GREEK ); 1738 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_GUJARATI ); 1739 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_GURMUKHI ); 1740 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_HEBREW ); 1741 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_ICELAND ); 1742 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_ROMANIAN ); 1743 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_THAI ); 1744 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_TURKISH ); 1745 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_UKRAINIAN ); 1746 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_CHINSIMP ); 1747 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_CHINTRAD ); 1748 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_JAPANESE ); 1749 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_KOREAN ); 1750 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_932 ); 1751 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_936 ); 1752 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_949 ); 1753 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_950 ); 1754 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_SHIFT_JIS ); 1755 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_GB_2312 ); 1756 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_GBT_12345 ); 1757 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_GBK ); 1758 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_BIG5 ); 1759 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_EUC_JP ); 1760 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_EUC_CN ); 1761 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_EUC_TW ); 1762 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_2022_JP ); 1763 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_2022_CN ); 1764 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_KOI8_R ); 1765 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_UTF7 ); 1766 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_UTF8 ); 1767 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_10 ); 1768 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_13 ); 1769 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_EUC_KR ); 1770 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_2022_KR ); 1771 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_JIS_X_0201 ); 1772 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_JIS_X_0208 ); 1773 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_JIS_X_0212 ); 1774 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1361 ); 1775 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_GB_18030 ); 1776 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_BIG5_HKSCS ); 1777 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_TIS_620 ); 1778 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_KOI8_U ); 1779 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISCII_DEVANAGARI ); 1780 CPPUNIT_TEST( WindowsCharsetFromTextEncoding_JAVA_UTF8 ); 1781 1782 CPPUNIT_TEST_SUITE_END( ); 1783 }; 1784 class getTextEncodingInfo: public CppUnit::TestFixture 1785 { 1786 public: 1787 // initialise your test code values here. 1788 void setUp() 1789 { 1790 } 1791 1792 void tearDown() 1793 { 1794 } 1795 1796 // not implemented encoding test 1797 void getTextEncodingInfo_001() 1798 { 1799 rtl_TextEncodingInfo aInfo1, aInfo2, aInfo3, aInfo4, aInfo5; 1800 aInfo1.StructSize = 4; 1801 // not implemented 1802 sal_Bool bRes1 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC, &aInfo1 ); 1803 // implemented 1804 sal_Bool bRes11 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC, &aInfo1 ); 1805 CPPUNIT_ASSERT_MESSAGE("should return sal_False.", bRes1 == sal_False && bRes11 == sal_False ); 1806 1807 aInfo2.StructSize = 5; 1808 sal_Bool bRes2 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC, &aInfo2 ); 1809 sal_Bool bRes21 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC, &aInfo2 ); 1810 CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes2 == sal_True && bRes21 == sal_True && aInfo2.MinimumCharSize >=1 ); 1811 1812 aInfo3.StructSize = 6; 1813 sal_Bool bRes3 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC, &aInfo3 ); 1814 sal_Bool bRes31 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC, &aInfo3 ); 1815 CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes3 == sal_True && bRes31 == sal_True ); 1816 //&& aInfo2.MinimumCharSize >=1 ); 1817 1818 aInfo4.StructSize = 8; 1819 sal_Bool bRes4 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC, &aInfo4 ); 1820 sal_Bool bRes41 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC, &aInfo4); 1821 CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes4 == sal_True && bRes41 == sal_True); 1822 // && aInfo2.MinimumCharSize >=1 ); 1823 1824 aInfo5.StructSize = sizeof aInfo5; 1825 sal_Bool bRes5 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC, &aInfo5 ); 1826 CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes5 == sal_False && aInfo5.Flags == 0); 1827 1828 } 1829 CPPUNIT_TEST_SUITE(getTextEncodingInfo); 1830 CPPUNIT_TEST(getTextEncodingInfo_001); 1831 //CPPUNIT_TEST(getTextEncodingInfo_002); 1832 CPPUNIT_TEST_SUITE_END(); 1833 }; 1834 } 1835 1836 namespace { 1837 1838 class TestEncodingFromUnix: public CppUnit::TestFixture { 1839 public: 1840 void testIso8859() { 1841 check(RTL_TEXTENCODING_DONTKNOW, "ISO8859"); 1842 check(RTL_TEXTENCODING_DONTKNOW, "ISO8859-0"); 1843 check(RTL_TEXTENCODING_DONTKNOW, "ISO8859-01"); 1844 check(RTL_TEXTENCODING_DONTKNOW, "ISO8859_1"); 1845 check(RTL_TEXTENCODING_DONTKNOW, "ISO88591"); 1846 check(RTL_TEXTENCODING_ISO_8859_1, "ISO8859-1"); 1847 check(RTL_TEXTENCODING_ISO_8859_2, "ISO8859-2"); 1848 check(RTL_TEXTENCODING_ISO_8859_3, "ISO8859-3"); 1849 check(RTL_TEXTENCODING_ISO_8859_4, "ISO8859-4"); 1850 check(RTL_TEXTENCODING_ISO_8859_5, "ISO8859-5"); 1851 check(RTL_TEXTENCODING_ISO_8859_6, "ISO8859-6"); 1852 check(RTL_TEXTENCODING_ISO_8859_7, "ISO8859-7"); 1853 check(RTL_TEXTENCODING_ISO_8859_8, "ISO8859-8"); 1854 check(RTL_TEXTENCODING_ISO_8859_9, "ISO8859-9"); 1855 check(RTL_TEXTENCODING_ISO_8859_10, "ISO8859-10"); 1856 check(RTL_TEXTENCODING_TIS_620, "ISO8859-11"); 1857 check(RTL_TEXTENCODING_ISO_8859_13, "ISO8859-13"); 1858 check(RTL_TEXTENCODING_ISO_8859_14, "ISO8859-14"); 1859 check(RTL_TEXTENCODING_ISO_8859_15, "ISO8859-15"); 1860 } 1861 1862 void testTis620() { 1863 check(RTL_TEXTENCODING_DONTKNOW, "TIS620"); 1864 check(RTL_TEXTENCODING_TIS_620, "TIS620-0"); 1865 check(RTL_TEXTENCODING_DONTKNOW, "TIS620-1"); 1866 check(RTL_TEXTENCODING_TIS_620, "TIS620-2529"); 1867 check(RTL_TEXTENCODING_TIS_620, "TIS620-2533"); 1868 check(RTL_TEXTENCODING_DONTKNOW, "TIS620.2529-0"); 1869 check(RTL_TEXTENCODING_TIS_620, "TIS620.2529-1"); 1870 check(RTL_TEXTENCODING_DONTKNOW, "TIS620.2529-2"); 1871 check(RTL_TEXTENCODING_TIS_620, "TIS620.2533-0"); 1872 check(RTL_TEXTENCODING_TIS_620, "TIS620.2533-1"); 1873 check(RTL_TEXTENCODING_DONTKNOW, "TIS620.2533-2"); 1874 } 1875 1876 CPPUNIT_TEST_SUITE(TestEncodingFromUnix); 1877 CPPUNIT_TEST(testIso8859); 1878 CPPUNIT_TEST(testTis620); 1879 CPPUNIT_TEST_SUITE_END(); 1880 1881 private: 1882 void check(rtl_TextEncoding expected, char const * input) { 1883 CPPUNIT_ASSERT_EQUAL_MESSAGE( 1884 input, expected, rtl_getTextEncodingFromUnixCharset(input)); 1885 } 1886 }; 1887 1888 } 1889 1890 // ----------------------------------------------------------------------------- 1891 1892 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( rtl_tencinfo::getBestMime, "rtl_tencinfo" ); 1893 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( rtl_tencinfo::getBestUnix, "rtl_tencinfo" ); 1894 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( rtl_tencinfo::getBestWindows, "rtl_tencinfo" ); 1895 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( rtl_tencinfo::getTextEncodingInfo, "rtl_tencinfo" ); 1896 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( 1897 TestEncodingFromUnix, "TestEncodingFromUnix"); 1898 1899 // ----------------------------------------------------------------------------- 1900 1901 NOADDITIONAL; 1902