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

Side by Side Diff: ios/chrome/browser/ui/util/manual_text_framer_unittest.mm

Issue 2935723002: Fix ManualTextFramerTest.OriginRTLTest on iOS 11 (Closed)
Patch Set: Created 3 years, 6 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 | « base/ios/ios_util.mm ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ios/chrome/browser/ui/util/manual_text_framer.h" 5 #include "ios/chrome/browser/ui/util/manual_text_framer.h"
6 6
7 #include "base/ios/ios_util.h"
7 #include "base/mac/foundation_util.h" 8 #include "base/mac/foundation_util.h"
8 #include "base/time/time.h" 9 #include "base/time/time.h"
9 #import "ios/chrome/browser/ui/util/core_text_util.h" 10 #import "ios/chrome/browser/ui/util/core_text_util.h"
10 #import "ios/chrome/browser/ui/util/text_frame.h" 11 #import "ios/chrome/browser/ui/util/text_frame.h"
11 #import "ios/third_party/material_components_ios/src/components/Typography/src/M aterialTypography.h" 12 #import "ios/third_party/material_components_ios/src/components/Typography/src/M aterialTypography.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 #include "testing/gtest_mac.h" 14 #include "testing/gtest_mac.h"
14 #include "testing/platform_test.h" 15 #include "testing/platform_test.h"
15 #include "url/gurl.h" 16 #include "url/gurl.h"
16 17
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 @"\u0644\u064e\u0639\u064e\u0644\u064e\u0643\u0650\u0020\u062a\u064e" 192 @"\u0644\u064e\u0639\u064e\u0644\u064e\u0643\u0650\u0020\u062a\u064e"
192 @"\u062a\u064e\u0639\u064e\u0644\u0651\u064e\u0645\u064e\u0020\u0627" 193 @"\u062a\u064e\u0639\u064e\u0644\u0651\u064e\u0645\u064e\u0020\u0627"
193 @"\u0644\u062d\u0650\u0631\u0652\u0635\u064e\u0020\u0639\u064e\u0644" 194 @"\u0644\u062d\u0650\u0631\u0652\u0635\u064e\u0020\u0639\u064e\u0644"
194 @"\u064e\u0649\u0020\u0627\u0644\u0648\u064e\u0642\u0652\u062a\u0650" 195 @"\u064e\u0649\u0020\u0627\u0644\u0648\u064e\u0642\u0652\u062a\u0650"
195 @"\u0020\u002e\u0020\u0641\u064e\u0627\u0644\u062d\u064e\u064a\u064e" 196 @"\u0020\u002e\u0020\u0641\u064e\u0627\u0644\u062d\u064e\u064a\u064e"
196 @"\u0627\u0629\u064f"); 197 @"\u0627\u0629\u064f");
197 attributes()[NSFontAttributeName] = TypographyFontWithSize(14.0); 198 attributes()[NSFontAttributeName] = TypographyFontWithSize(14.0);
198 attributes()[NSParagraphStyleAttributeName] = CreateParagraphStyle( 199 attributes()[NSParagraphStyleAttributeName] = CreateParagraphStyle(
199 20.0, NSTextAlignmentNatural, NSLineBreakByWordWrapping); 200 20.0, NSTextAlignmentNatural, NSLineBreakByWordWrapping);
200 ApplyAttributesForRange(text_range()); 201 ApplyAttributesForRange(text_range());
201 CGRect bounds = CGRectMake(0, 0, 100.0, 60.0); 202 CGRect bounds = base::ios::IsRunningOnIOS11OrLater()
kkhorimoto 2017/06/12 19:42:03 Can we separate the width calculation out and add
lpromero 2017/06/13 08:10:25 Done.
203 ? CGRectMake(0, 0, 130.0, 60.0)
204 : CGRectMake(0, 0, 100.0, 60.0);
202 FrameTextInBounds(bounds); 205 FrameTextInBounds(bounds);
203 CheckForLineCountAndFramedRange(3, text_range()); 206 CheckForLineCountAndFramedRange(3, text_range());
204 for (FramedLine* line in text_frame().lines) { 207 for (FramedLine* line in text_frame().lines) {
205 ExpectNearPoint( 208 ExpectNearPoint(
206 CGRectGetMaxX(bounds), 209 CGRectGetMaxX(bounds),
207 line.origin.x + core_text_util::GetTrimmedLineWidth(line.line)); 210 line.origin.x + core_text_util::GetTrimmedLineWidth(line.line));
208 } 211 }
209 } 212 }
210 213
211 TEST_F(ManualTextFramerTest, CJKLineBreakTest) { 214 TEST_F(ManualTextFramerTest, CJKLineBreakTest) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 "\u062A\u0639\u0637\u064A\u0644\u0020\u0647\u0630\u0647\u0020\u0627" 283 "\u062A\u0639\u0637\u064A\u0644\u0020\u0647\u0630\u0647\u0020\u0627"
281 "\u0644\u062E\u062F\u0645\u0627\u062A\u002E"); 284 "\u0644\u062E\u062F\u0645\u0627\u062A\u002E");
282 attributes()[NSFontAttributeName] = [UIFont systemFontOfSize:20.0]; 285 attributes()[NSFontAttributeName] = [UIFont systemFontOfSize:20.0];
283 ApplyAttributesForRange(text_range()); 286 ApplyAttributesForRange(text_range());
284 CGRect bounds = CGRectMake(0, 0, 500, 100); 287 CGRect bounds = CGRectMake(0, 0, 500, 100);
285 FrameTextInBounds(bounds); 288 FrameTextInBounds(bounds);
286 CheckForLineCountAndFramedRange(2, text_range()); 289 CheckForLineCountAndFramedRange(2, text_range());
287 } 290 }
288 291
289 } // namespace 292 } // namespace
OLDNEW
« no previous file with comments | « base/ios/ios_util.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698