| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #if defined(OS_LINUX) | 7 #if defined(OS_LINUX) |
| 8 #include <cstdlib> | 8 #include <cstdlib> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 } | 470 } |
| 471 } | 471 } |
| 472 | 472 |
| 473 TEST_F(L10nUtilTest, GetTextDirection) { | 473 TEST_F(L10nUtilTest, GetTextDirection) { |
| 474 EXPECT_EQ(l10n_util::RIGHT_TO_LEFT, GetTextDirection("ar")); | 474 EXPECT_EQ(l10n_util::RIGHT_TO_LEFT, GetTextDirection("ar")); |
| 475 EXPECT_EQ(l10n_util::RIGHT_TO_LEFT, GetTextDirection("ar_EG")); | 475 EXPECT_EQ(l10n_util::RIGHT_TO_LEFT, GetTextDirection("ar_EG")); |
| 476 EXPECT_EQ(l10n_util::RIGHT_TO_LEFT, GetTextDirection("he")); | 476 EXPECT_EQ(l10n_util::RIGHT_TO_LEFT, GetTextDirection("he")); |
| 477 EXPECT_EQ(l10n_util::RIGHT_TO_LEFT, GetTextDirection("he_IL")); | 477 EXPECT_EQ(l10n_util::RIGHT_TO_LEFT, GetTextDirection("he_IL")); |
| 478 // iw is an obsolete code for Hebrew. | 478 // iw is an obsolete code for Hebrew. |
| 479 EXPECT_EQ(l10n_util::RIGHT_TO_LEFT, GetTextDirection("iw")); | 479 EXPECT_EQ(l10n_util::RIGHT_TO_LEFT, GetTextDirection("iw")); |
| 480 #if 0 | 480 // Although we're not yet localized to Farsi and Urdu, we |
| 481 // Enable these when we localize to Farsi, Urdu, Azerbaijani | 481 // do have the text layout direction information for them. |
| 482 // written in Arabic and Dhivehi. At the moment, our copy of | |
| 483 // ICU data does not have entry for them. | |
| 484 EXPECT_EQ(l10n_util::RIGHT_TO_LEFT, GetTextDirection("fa")); | 482 EXPECT_EQ(l10n_util::RIGHT_TO_LEFT, GetTextDirection("fa")); |
| 485 EXPECT_EQ(l10n_util::RIGHT_TO_LEFT, GetTextDirection("ur")); | 483 EXPECT_EQ(l10n_util::RIGHT_TO_LEFT, GetTextDirection("ur")); |
| 484 #if 0 |
| 485 // Enable these when we include the minimal locale data for Azerbaijani |
| 486 // written in Arabic and Dhivehi. At the moment, our copy of |
| 487 // ICU data does not have entries for them. |
| 486 EXPECT_EQ(l10n_util::RIGHT_TO_LEFT, GetTextDirection("az_Arab")); | 488 EXPECT_EQ(l10n_util::RIGHT_TO_LEFT, GetTextDirection("az_Arab")); |
| 487 // Dhivehi that uses Thaana script. | 489 // Dhivehi that uses Thaana script. |
| 488 EXPECT_EQ(l10n_util::RIGHT_TO_LEFT, GetTextDirection("dv")); | 490 EXPECT_EQ(l10n_util::RIGHT_TO_LEFT, GetTextDirection("dv")); |
| 489 #endif | 491 #endif |
| 490 EXPECT_EQ(l10n_util::LEFT_TO_RIGHT, GetTextDirection("en")); | 492 EXPECT_EQ(l10n_util::LEFT_TO_RIGHT, GetTextDirection("en")); |
| 491 // Chinese in China with '-'. | 493 // Chinese in China with '-'. |
| 492 EXPECT_EQ(l10n_util::LEFT_TO_RIGHT, GetTextDirection("zh-CN")); | 494 EXPECT_EQ(l10n_util::LEFT_TO_RIGHT, GetTextDirection("zh-CN")); |
| 493 // Filipino : 3-letter code | 495 // Filipino : 3-letter code |
| 494 EXPECT_EQ(l10n_util::LEFT_TO_RIGHT, GetTextDirection("fil")); | 496 EXPECT_EQ(l10n_util::LEFT_TO_RIGHT, GetTextDirection("fil")); |
| 495 // Russian | 497 // Russian |
| 496 EXPECT_EQ(l10n_util::LEFT_TO_RIGHT, GetTextDirection("ru")); | 498 EXPECT_EQ(l10n_util::LEFT_TO_RIGHT, GetTextDirection("ru")); |
| 497 // Japanese that uses multiple scripts | 499 // Japanese that uses multiple scripts |
| 498 EXPECT_EQ(l10n_util::LEFT_TO_RIGHT, GetTextDirection("ja")); | 500 EXPECT_EQ(l10n_util::LEFT_TO_RIGHT, GetTextDirection("ja")); |
| 499 } | 501 } |
| 500 | 502 |
| 501 // Test upper and lower case string conversion. | 503 // Test upper and lower case string conversion. |
| 502 TEST_F(L10nUtilTest, UpperLower) { | 504 TEST_F(L10nUtilTest, UpperLower) { |
| 503 string16 mixed(ASCIIToUTF16("Text with UPPer & lowER casE.")); | 505 string16 mixed(ASCIIToUTF16("Text with UPPer & lowER casE.")); |
| 504 const string16 expected_lower(ASCIIToUTF16("text with upper & lower case.")); | 506 const string16 expected_lower(ASCIIToUTF16("text with upper & lower case.")); |
| 505 const string16 expected_upper(ASCIIToUTF16("TEXT WITH UPPER & LOWER CASE.")); | 507 const string16 expected_upper(ASCIIToUTF16("TEXT WITH UPPER & LOWER CASE.")); |
| 506 | 508 |
| 507 string16 result = l10n_util::ToLower(mixed); | 509 string16 result = l10n_util::ToLower(mixed); |
| 508 EXPECT_EQ(result, expected_lower); | 510 EXPECT_EQ(result, expected_lower); |
| 509 | 511 |
| 510 result = l10n_util::ToUpper(mixed); | 512 result = l10n_util::ToUpper(mixed); |
| 511 EXPECT_EQ(result, expected_upper); | 513 EXPECT_EQ(result, expected_upper); |
| 512 } | 514 } |
| OLD | NEW |