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

Side by Side Diff: ui/gfx/render_text_harfbuzz.h

Issue 2346733002: Cleanup render text tests to use RenderTextTestApi. (Closed)
Patch Set: Remove redundant headers. Created 4 years, 3 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
« no previous file with comments | « ui/gfx/render_text.h ('k') | ui/gfx/render_text_mac.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef UI_GFX_RENDER_TEXT_HARFBUZZ_H_ 5 #ifndef UI_GFX_RENDER_TEXT_HARFBUZZ_H_
6 #define UI_GFX_RENDER_TEXT_HARFBUZZ_H_ 6 #define UI_GFX_RENDER_TEXT_HARFBUZZ_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory> 11 #include <memory>
12 12
13 #include "base/gtest_prod_util.h"
14 #include "base/macros.h" 13 #include "base/macros.h"
15 #include "base/memory/scoped_vector.h" 14 #include "base/memory/scoped_vector.h"
16 #include "third_party/harfbuzz-ng/src/hb.h" 15 #include "third_party/harfbuzz-ng/src/hb.h"
17 #include "third_party/icu/source/common/unicode/ubidi.h" 16 #include "third_party/icu/source/common/unicode/ubidi.h"
18 #include "third_party/icu/source/common/unicode/uscript.h" 17 #include "third_party/icu/source/common/unicode/uscript.h"
19 #include "ui/gfx/render_text.h" 18 #include "ui/gfx/render_text.h"
20 19
21 namespace base { 20 namespace base {
22 namespace i18n { 21 namespace i18n {
23 class BreakIterator; 22 class BreakIterator;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 size_t TextIndexToDisplayIndex(size_t index) override; 170 size_t TextIndexToDisplayIndex(size_t index) override;
172 size_t DisplayIndexToTextIndex(size_t index) override; 171 size_t DisplayIndexToTextIndex(size_t index) override;
173 bool IsValidCursorIndex(size_t index) override; 172 bool IsValidCursorIndex(size_t index) override;
174 void OnLayoutTextAttributeChanged(bool text_changed) override; 173 void OnLayoutTextAttributeChanged(bool text_changed) override;
175 void OnDisplayTextAttributeChanged() override; 174 void OnDisplayTextAttributeChanged() override;
176 void EnsureLayout() override; 175 void EnsureLayout() override;
177 void DrawVisualText(internal::SkiaTextRenderer* renderer) override; 176 void DrawVisualText(internal::SkiaTextRenderer* renderer) override;
178 177
179 private: 178 private:
180 friend class test::RenderTextTestApi; 179 friend class test::RenderTextTestApi;
181 180 friend class RenderTextHarfBuzzTest;
182 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest,
183 Multiline_HorizontalAlignment);
184 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, Multiline_NormalWidth);
185 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, Multiline_WordWrapBehavior);
186 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, HarfBuzz_RunDirection);
187 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest,
188 HarfBuzz_HorizontalPositions);
189 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest,
190 HarfBuzz_BreakRunsByUnicodeBlocks);
191 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, HarfBuzz_BreakRunsByEmoji);
192 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, HarfBuzz_BreakRunsByAscii);
193 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest,
194 HarfBuzz_SubglyphGraphemeCases);
195 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest,
196 HarfBuzz_SubglyphGraphemePartition);
197 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, HarfBuzz_NonExistentFont);
198 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, HarfBuzz_UniscribeFallback);
199 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, HarfBuzz_UnicodeFallback);
200 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest,
201 Multiline_LineBreakerBehavior);
202 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest,
203 Multiline_SurrogatePairsOrCombiningChars);
204 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, Multiline_ZeroWidthChars);
205 181
206 // Specify the width of a glyph for test. The width of glyphs is very 182 // Specify the width of a glyph for test. The width of glyphs is very
207 // platform-dependent and environment-dependent. Otherwise multiline test 183 // platform-dependent and environment-dependent. Otherwise multiline test
208 // will become really flaky. 184 // will become really flaky.
209 void set_glyph_width_for_test(float test_width) { 185 void set_glyph_width_for_test(float test_width) {
210 glyph_width_for_test_ = test_width; 186 glyph_width_for_test_ = test_width;
211 } 187 }
212 188
213 // Return the run index that contains the argument; or the length of the 189 // Return the run index that contains the argument; or the length of the
214 // |runs_| vector if argument exceeds the text length or width. 190 // |runs_| vector if argument exceeds the text length or width.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 259
284 // Fixed width of glyphs. This should only be set in test environments. 260 // Fixed width of glyphs. This should only be set in test environments.
285 float glyph_width_for_test_; 261 float glyph_width_for_test_;
286 262
287 DISALLOW_COPY_AND_ASSIGN(RenderTextHarfBuzz); 263 DISALLOW_COPY_AND_ASSIGN(RenderTextHarfBuzz);
288 }; 264 };
289 265
290 } // namespace gfx 266 } // namespace gfx
291 267
292 #endif // UI_GFX_RENDER_TEXT_HARFBUZZ_H_ 268 #endif // UI_GFX_RENDER_TEXT_HARFBUZZ_H_
OLDNEW
« no previous file with comments | « ui/gfx/render_text.h ('k') | ui/gfx/render_text_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698