| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/payments/cells/payments_text_item.h" | 5 #import "ios/chrome/browser/payments/cells/payments_text_item.h" |
| 6 | 6 |
| 7 #import "ios/chrome/browser/ui/collection_view/cells/test_utils.h" | 7 #import "ios/chrome/browser/ui/collection_view/cells/test_utils.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "testing/gtest_mac.h" | 9 #include "testing/gtest_mac.h" |
| 10 | 10 |
| 11 #if !defined(__has_feature) || !__has_feature(objc_arc) | 11 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 12 #error "This file requires ARC support." | 12 #error "This file requires ARC support." |
| 13 #endif | 13 #endif |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 // Tests that the text label and the image are set properly after a call to | 17 // Tests that the text label and the image are set properly after a call to |
| 18 // |configureCell:|. | 18 // |configureCell:|. |
| 19 TEST(PaymentRequestPaymentsTextItemTest, TextLabelAndImage) { | 19 TEST(PaymentRequestPaymentsTextItemTest, TextLabelAndImage) { |
| 20 PaymentsTextItem* item = [[PaymentsTextItem alloc] initWithType:0]; | 20 PaymentsTextItem* item = [[PaymentsTextItem alloc] initWithType:0]; |
| 21 | 21 |
| 22 NSString* text = @"Lorem ipsum dolor sit amet"; | 22 NSString* text = @"Lorem ipsum"; |
| 23 NSString* detailText = @"Dolor sit amet"; |
| 23 UIImage* image = ios_internal::CollectionViewTestImage(); | 24 UIImage* image = ios_internal::CollectionViewTestImage(); |
| 24 | 25 |
| 25 item.text = text; | 26 item.text = text; |
| 27 item.detailText = detailText; |
| 26 item.image = image; | 28 item.image = image; |
| 27 | 29 |
| 28 id cell = [[[item cellClass] alloc] init]; | 30 id cell = [[[item cellClass] alloc] init]; |
| 29 ASSERT_TRUE([cell isMemberOfClass:[PaymentsTextCell class]]); | 31 ASSERT_TRUE([cell isMemberOfClass:[PaymentsTextCell class]]); |
| 30 | 32 |
| 31 PaymentsTextCell* paymentsTextCell = cell; | 33 PaymentsTextCell* paymentsTextCell = cell; |
| 32 EXPECT_FALSE(paymentsTextCell.textLabel.text); | 34 EXPECT_FALSE(paymentsTextCell.textLabel.text); |
| 35 EXPECT_FALSE(paymentsTextCell.detailTextLabel.text); |
| 33 EXPECT_FALSE(paymentsTextCell.imageView.image); | 36 EXPECT_FALSE(paymentsTextCell.imageView.image); |
| 34 | 37 |
| 35 [item configureCell:paymentsTextCell]; | 38 [item configureCell:paymentsTextCell]; |
| 36 EXPECT_NSEQ(text, paymentsTextCell.textLabel.text); | 39 EXPECT_NSEQ(text, paymentsTextCell.textLabel.text); |
| 40 EXPECT_NSEQ(detailText, paymentsTextCell.detailTextLabel.text); |
| 37 EXPECT_NSEQ(image, paymentsTextCell.imageView.image); | 41 EXPECT_NSEQ(image, paymentsTextCell.imageView.image); |
| 38 } | 42 } |
| 39 | 43 |
| 40 } // namespace | 44 } // namespace |
| OLD | NEW |