Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: base/i18n/rtl_unittest.cc

Issue 232773008: More removal of GTK code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/i18n/rtl.h" 5 #include "base/i18n/rtl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "base/strings/sys_string_conversions.h" 11 #include "base/strings/sys_string_conversions.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "testing/platform_test.h" 14 #include "testing/platform_test.h"
15 #include "third_party/icu/source/i18n/unicode/usearch.h" 15 #include "third_party/icu/source/i18n/unicode/usearch.h"
16 16
17 #if defined(TOOLKIT_GTK)
18 #include <gtk/gtk.h>
19 #endif
20
21 namespace base { 17 namespace base {
22 namespace i18n { 18 namespace i18n {
23 19
24 namespace { 20 namespace {
25 21
26 // A test utility function to set the application default text direction. 22 // A test utility function to set the application default text direction.
27 void SetRTL(bool rtl) { 23 void SetRTL(bool rtl) {
28 // Override the current locale/direction. 24 // Override the current locale/direction.
29 SetICUDefaultLocale(rtl ? "he" : "en"); 25 SetICUDefaultLocale(rtl ? "he" : "en");
30 #if defined(TOOLKIT_GTK)
31 // Do the same for GTK, which does not rely on the ICU default locale.
32 gtk_widget_set_default_direction(rtl ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
33 #endif
34 EXPECT_EQ(rtl, IsRTL()); 26 EXPECT_EQ(rtl, IsRTL());
35 } 27 }
36 28
37 } // namespace 29 } // namespace
38 30
39 class RTLTest : public PlatformTest { 31 class RTLTest : public PlatformTest {
40 }; 32 };
41 33
42 TEST_F(RTLTest, GetFirstStrongCharacterDirection) { 34 TEST_F(RTLTest, GetFirstStrongCharacterDirection) {
43 struct { 35 struct {
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 EXPECT_EQ(test_case, adjusted_string) << " for test case [" << test_case 432 EXPECT_EQ(test_case, adjusted_string) << " for test case [" << test_case
441 << "] with IsRTL() == " << IsRTL(); 433 << "] with IsRTL() == " << IsRTL();
442 } 434 }
443 } 435 }
444 436
445 EXPECT_EQ(was_rtl, IsRTL()); 437 EXPECT_EQ(was_rtl, IsRTL());
446 } 438 }
447 439
448 } // namespace i18n 440 } // namespace i18n
449 } // namespace base 441 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698