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

Side by Side Diff: ios/chrome/browser/payments/cells/payments_text_item_unittest.mm

Issue 2825143002: [Payment Request] Accepted credit card type icons in the credit card editor (Closed)
Patch Set: Addressed comments Created 3 years, 8 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
OLDNEW
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] init];
21 21
22 NSString* text = @"Lorem ipsum"; 22 NSString* text = @"Lorem ipsum";
23 NSString* detailText = @"Dolor sit amet"; 23 NSString* detailText = @"Dolor sit amet";
24 UIImage* image = ios_internal::CollectionViewTestImage(); 24 UIImage* image = ios_internal::CollectionViewTestImage();
25 25
26 item.text = text; 26 item.text = text;
27 item.detailText = detailText; 27 item.detailText = detailText;
28 item.image = image; 28 item.image = image;
29 29
30 id cell = [[[item cellClass] alloc] init]; 30 id cell = [[[item cellClass] alloc] init];
31 ASSERT_TRUE([cell isMemberOfClass:[PaymentsTextCell class]]); 31 ASSERT_TRUE([cell isMemberOfClass:[PaymentsTextCell class]]);
32 32
33 PaymentsTextCell* paymentsTextCell = cell; 33 PaymentsTextCell* paymentsTextCell = cell;
34 EXPECT_FALSE(paymentsTextCell.textLabel.text); 34 EXPECT_FALSE(paymentsTextCell.textLabel.text);
35 EXPECT_FALSE(paymentsTextCell.detailTextLabel.text); 35 EXPECT_FALSE(paymentsTextCell.detailTextLabel.text);
36 EXPECT_FALSE(paymentsTextCell.imageView.image); 36 EXPECT_FALSE(paymentsTextCell.imageView.image);
37 37
38 [item configureCell:paymentsTextCell]; 38 [item configureCell:paymentsTextCell];
39 EXPECT_NSEQ(text, paymentsTextCell.textLabel.text); 39 EXPECT_NSEQ(text, paymentsTextCell.textLabel.text);
40 EXPECT_NSEQ(detailText, paymentsTextCell.detailTextLabel.text); 40 EXPECT_NSEQ(detailText, paymentsTextCell.detailTextLabel.text);
41 EXPECT_NSEQ(image, paymentsTextCell.imageView.image); 41 EXPECT_NSEQ(image, paymentsTextCell.imageView.image);
42 } 42 }
43 43
44 } // namespace 44 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698