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

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

Issue 421053002: Enable RenderTextHarfBuzz by default (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests Created 6 years, 4 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/render_text_harfbuzz.cc ('k') | no next file » | 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/i18n/break_iterator.h" 10 #include "base/i18n/break_iterator.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 expected_italic.resize(3); 179 expected_italic.resize(3);
180 EXPECT_TRUE(render_text->styles()[ITALIC].EqualsForTesting(expected_italic)); 180 EXPECT_TRUE(render_text->styles()[ITALIC].EqualsForTesting(expected_italic));
181 181
182 // Appending text should extend the terminal styles without changing breaks. 182 // Appending text should extend the terminal styles without changing breaks.
183 render_text->SetText(ASCIIToUTF16("012345678")); 183 render_text->SetText(ASCIIToUTF16("012345678"));
184 EXPECT_TRUE(render_text->styles()[ITALIC].EqualsForTesting(expected_italic)); 184 EXPECT_TRUE(render_text->styles()[ITALIC].EqualsForTesting(expected_italic));
185 } 185 }
186 186
187 #if defined(OS_LINUX) && !defined(USE_OZONE) 187 #if defined(OS_LINUX) && !defined(USE_OZONE)
188 TEST_F(RenderTextTest, PangoAttributes) { 188 TEST_F(RenderTextTest, PangoAttributes) {
189 scoped_ptr<RenderText> render_text(RenderText::CreateInstance()); 189 scoped_ptr<RenderText> render_text(RenderText::CreateNativeInstance());
190 render_text->SetText(ASCIIToUTF16("012345678")); 190 render_text->SetText(ASCIIToUTF16("012345678"));
191 191
192 // Apply ranged BOLD/ITALIC styles and check the resulting Pango attributes. 192 // Apply ranged BOLD/ITALIC styles and check the resulting Pango attributes.
193 render_text->ApplyStyle(BOLD, true, Range(2, 4)); 193 render_text->ApplyStyle(BOLD, true, Range(2, 4));
194 render_text->ApplyStyle(ITALIC, true, Range(1, 3)); 194 render_text->ApplyStyle(ITALIC, true, Range(1, 3));
195 195
196 struct { 196 struct {
197 int start; 197 int start;
198 int end; 198 int end;
199 bool bold; 199 bool bold;
(...skipping 2085 matching lines...) Expand 10 before | Expand all | Expand 10 after
2285 EXPECT_EQ(Range(0, 0), run.CharRangeToGlyphRange(Range(4, 5))); 2285 EXPECT_EQ(Range(0, 0), run.CharRangeToGlyphRange(Range(4, 5)));
2286 EXPECT_EQ(Range(0, 0), run.GetGraphemeBounds(iter.get(), 4)); 2286 EXPECT_EQ(Range(0, 0), run.GetGraphemeBounds(iter.get(), 4));
2287 Range chars; 2287 Range chars;
2288 Range glyphs; 2288 Range glyphs;
2289 run.GetClusterAt(4, &chars, &glyphs); 2289 run.GetClusterAt(4, &chars, &glyphs);
2290 EXPECT_EQ(Range(3, 8), chars); 2290 EXPECT_EQ(Range(3, 8), chars);
2291 EXPECT_EQ(Range(0, 0), glyphs); 2291 EXPECT_EQ(Range(0, 0), glyphs);
2292 } 2292 }
2293 2293
2294 } // namespace gfx 2294 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/render_text_harfbuzz.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698