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

Side by Side Diff: ui/gfx/render_text_unittest.cc

Issue 10977073: Delete some unused code found by -Wunused-function (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: leiz Created 8 years, 2 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
« no previous file with comments | « ui/gfx/codec/jpeg_codec.cc ('k') | webkit/fileapi/isolated_mount_point_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/gfx/render_text.h" 5 #include "ui/gfx/render_text.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/base/l10n/l10n_util.h" 10 #include "ui/base/l10n/l10n_util.h"
(...skipping 20 matching lines...) Expand all
31 const wchar_t kRtlLtr[] = L"\x5d0\x5d1"L"a"; 31 const wchar_t kRtlLtr[] = L"\x5d0\x5d1"L"a";
32 const wchar_t kRtlLtrRtl[] = L"\x5d0"L"a"L"\x5d1"; 32 const wchar_t kRtlLtrRtl[] = L"\x5d0"L"a"L"\x5d1";
33 33
34 // Checks whether |range| contains |index|. This is not the same as calling 34 // Checks whether |range| contains |index|. This is not the same as calling
35 // |range.Contains(ui::Range(index))| - as that would return true when 35 // |range.Contains(ui::Range(index))| - as that would return true when
36 // |index| == |range.end()|. 36 // |index| == |range.end()|.
37 bool IndexInRange(const ui::Range& range, size_t index) { 37 bool IndexInRange(const ui::Range& range, size_t index) {
38 return index >= range.start() && index < range.end(); 38 return index >= range.start() && index < range.end();
39 } 39 }
40 40
41 #if !defined(OS_MACOSX)
41 // A test utility function to set the application default text direction. 42 // A test utility function to set the application default text direction.
42 void SetRTL(bool rtl) { 43 void SetRTL(bool rtl) {
43 // Override the current locale/direction. 44 // Override the current locale/direction.
44 base::i18n::SetICUDefaultLocale(rtl ? "he" : "en"); 45 base::i18n::SetICUDefaultLocale(rtl ? "he" : "en");
45 #if defined(TOOLKIT_GTK) 46 #if defined(TOOLKIT_GTK)
46 // Do the same for GTK, which does not rely on the ICU default locale. 47 // Do the same for GTK, which does not rely on the ICU default locale.
47 gtk_widget_set_default_direction(rtl ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); 48 gtk_widget_set_default_direction(rtl ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
48 #endif 49 #endif
49 EXPECT_EQ(rtl, base::i18n::IsRTL()); 50 EXPECT_EQ(rtl, base::i18n::IsRTL());
50 } 51 }
52 #endif
51 53
52 } // namespace 54 } // namespace
53 55
54 class RenderTextTest : public testing::Test { 56 class RenderTextTest : public testing::Test {
55 }; 57 };
56 58
57 TEST_F(RenderTextTest, DefaultStyle) { 59 TEST_F(RenderTextTest, DefaultStyle) {
58 // Defaults to empty text with no styles. 60 // Defaults to empty text with no styles.
59 scoped_ptr<RenderText> render_text(RenderText::CreateInstance()); 61 scoped_ptr<RenderText> render_text(RenderText::CreateInstance());
60 EXPECT_TRUE(render_text->text().empty()); 62 EXPECT_TRUE(render_text->text().empty());
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 EXPECT_EQ(render_text->display_rect().width() - width - 1, 1306 EXPECT_EQ(render_text->display_rect().width() - width - 1,
1305 render_text->GetUpdatedCursorBounds().x()); 1307 render_text->GetUpdatedCursorBounds().x());
1306 1308
1307 // Reset the application default text direction to LTR. 1309 // Reset the application default text direction to LTR.
1308 SetRTL(was_rtl); 1310 SetRTL(was_rtl);
1309 EXPECT_EQ(was_rtl, base::i18n::IsRTL()); 1311 EXPECT_EQ(was_rtl, base::i18n::IsRTL());
1310 } 1312 }
1311 #endif // !defined(OS_MACOSX) 1313 #endif // !defined(OS_MACOSX)
1312 1314
1313 } // namespace gfx 1315 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/codec/jpeg_codec.cc ('k') | webkit/fileapi/isolated_mount_point_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698