OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/chrome/browser/ui/settings/cells/card_multiline_item.h" |
| 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "testing/gtest_mac.h" |
| 9 |
| 10 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 11 #error "This file requires ARC support." |
| 12 #endif |
| 13 |
| 14 namespace { |
| 15 |
| 16 // Tests that the text is honoured after a call to |configureCell:|. |
| 17 TEST(CardMultilineItemTest, ConfigureCell) { |
| 18 CardMultilineItem* item = [[CardMultilineItem alloc] initWithType:0]; |
| 19 NSString* text = @"Test Disclaimer"; |
| 20 |
| 21 item.text = text; |
| 22 |
| 23 id cell = [[[item cellClass] alloc] init]; |
| 24 ASSERT_TRUE([cell isMemberOfClass:[CardMultilineCell class]]); |
| 25 |
| 26 CardMultilineCell* disclaimerCell = static_cast<CardMultilineCell*>(cell); |
| 27 EXPECT_FALSE(disclaimerCell.textLabel.text); |
| 28 |
| 29 [item configureCell:cell]; |
| 30 EXPECT_NSEQ(text, disclaimerCell.textLabel.text); |
| 31 } |
| 32 |
| 33 // Tests that the text label of an CardMultilineCell spans multiple |
| 34 // lines. |
| 35 TEST(CardMultilineItemTest, MultipleLines) { |
| 36 CardMultilineCell* cell = [[CardMultilineCell alloc] init]; |
| 37 EXPECT_EQ(0, cell.textLabel.numberOfLines); |
| 38 } |
| 39 |
| 40 } // namespace |
OLD | NEW |