Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrom e.h" | 5 #import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrom e.h" |
| 6 | 6 |
| 7 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_footer_item .h" | 7 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_footer_item .h" |
| 8 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" | 8 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 | 45 |
| 46 TEST(MDCCollectionViewCellChrome, PreferredHeight) { | 46 TEST(MDCCollectionViewCellChrome, PreferredHeight) { |
| 47 CollectionViewFooterItem* footerItem = | 47 CollectionViewFooterItem* footerItem = |
| 48 [[CollectionViewFooterItem alloc] initWithType:0]; | 48 [[CollectionViewFooterItem alloc] initWithType:0]; |
| 49 footerItem.text = @"This is a pretty lengthy sentence."; | 49 footerItem.text = @"This is a pretty lengthy sentence."; |
| 50 CGFloat (^heightForWidth)(CGFloat width) = ^(CGFloat width) { | 50 CGFloat (^heightForWidth)(CGFloat width) = ^(CGFloat width) { |
| 51 return [MDCCollectionViewCell cr_preferredHeightForWidth:width | 51 return [MDCCollectionViewCell cr_preferredHeightForWidth:width |
| 52 forItem:footerItem]; | 52 forItem:footerItem]; |
| 53 }; | 53 }; |
| 54 EXPECT_NEAR(heightForWidth(300), 50, 5); | 54 EXPECT_NEAR(heightForWidth(300), 50, 5); |
| 55 EXPECT_NEAR(heightForWidth(100), 110, 5); | 55 EXPECT_NEAR(heightForWidth(100), 115, 5); |
|
lpromero
2017/05/31 15:14:48
With Roboto, heightForWidth(100) returns 114.5. Wi
| |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace | 58 } // namespace |
| OLD | NEW |