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

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

Issue 2814793003: Adds accessoryType property to CollectionViewItem (Closed)
Patch Set: 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 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/payments/cells/payment_method_item.h" 5 #import "ios/chrome/browser/payments/cells/payment_method_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 labels and image are set properly after a call to 17 // Tests that the labels and image are set properly after a call to
18 // |configureCell:|. 18 // |configureCell:|.
19 TEST(PaymentRequestPaymentMethodItemTest, TextLabels) { 19 TEST(PaymentRequestPaymentMethodItemTest, TextLabels) {
20 PaymentMethodItem* item = [[PaymentMethodItem alloc] initWithType:0]; 20 PaymentMethodItem* item = [[PaymentMethodItem alloc] initWithType:0];
21 21
22 NSString* methodID = @"BobPay - ****-6789"; 22 NSString* methodID = @"BobPay - ****-6789";
23 NSString* methodDetail = @"Bobs Your Uncle III, esq."; 23 NSString* methodDetail = @"Bobs Your Uncle III, esq.";
24 NSString* methodAddress = @"123 Bob St, Halifax, NS"; 24 NSString* methodAddress = @"123 Bob St, Halifax, NS";
25 NSString* notification = @"More information is required."; 25 NSString* notification = @"More information is required.";
26 UIImage* methodTypeIcon = ios_internal::CollectionViewTestImage(); 26 UIImage* methodTypeIcon = ios_internal::CollectionViewTestImage();
27 MDCCollectionViewCellAccessoryType accessoryType =
28 MDCCollectionViewCellAccessoryDisclosureIndicator;
29 27
30 item.methodID = methodID; 28 item.methodID = methodID;
31 item.methodDetail = methodDetail; 29 item.methodDetail = methodDetail;
32 item.methodAddress = methodAddress; 30 item.methodAddress = methodAddress;
33 item.notification = notification; 31 item.notification = notification;
34 item.methodTypeIcon = methodTypeIcon; 32 item.methodTypeIcon = methodTypeIcon;
35 item.accessoryType = accessoryType;
36 33
37 id cell = [[[item cellClass] alloc] init]; 34 id cell = [[[item cellClass] alloc] init];
38 ASSERT_TRUE([cell isMemberOfClass:[PaymentMethodCell class]]); 35 ASSERT_TRUE([cell isMemberOfClass:[PaymentMethodCell class]]);
39 36
40 PaymentMethodCell* paymentMethodCell = cell; 37 PaymentMethodCell* paymentMethodCell = cell;
41 EXPECT_FALSE(paymentMethodCell.methodIDLabel.text); 38 EXPECT_FALSE(paymentMethodCell.methodIDLabel.text);
42 EXPECT_FALSE(paymentMethodCell.methodDetailLabel.text); 39 EXPECT_FALSE(paymentMethodCell.methodDetailLabel.text);
43 EXPECT_FALSE(paymentMethodCell.methodAddressLabel.text); 40 EXPECT_FALSE(paymentMethodCell.methodAddressLabel.text);
44 EXPECT_FALSE(paymentMethodCell.notificationLabel.text); 41 EXPECT_FALSE(paymentMethodCell.notificationLabel.text);
45 EXPECT_EQ(nil, paymentMethodCell.methodTypeIconView.image); 42 EXPECT_EQ(nil, paymentMethodCell.methodTypeIconView.image);
46 EXPECT_EQ(paymentMethodCell.accessoryType,
47 MDCCollectionViewCellAccessoryNone);
48 43
49 [item configureCell:paymentMethodCell]; 44 [item configureCell:paymentMethodCell];
50 EXPECT_NSEQ(methodID, paymentMethodCell.methodIDLabel.text); 45 EXPECT_NSEQ(methodID, paymentMethodCell.methodIDLabel.text);
51 EXPECT_NSEQ(methodDetail, paymentMethodCell.methodDetailLabel.text); 46 EXPECT_NSEQ(methodDetail, paymentMethodCell.methodDetailLabel.text);
52 EXPECT_NSEQ(methodAddress, paymentMethodCell.methodAddressLabel.text); 47 EXPECT_NSEQ(methodAddress, paymentMethodCell.methodAddressLabel.text);
53 EXPECT_NSEQ(notification, paymentMethodCell.notificationLabel.text); 48 EXPECT_NSEQ(notification, paymentMethodCell.notificationLabel.text);
54 EXPECT_NSEQ(methodTypeIcon, paymentMethodCell.methodTypeIconView.image); 49 EXPECT_NSEQ(methodTypeIcon, paymentMethodCell.methodTypeIconView.image);
55 EXPECT_EQ(paymentMethodCell.accessoryType,
56 MDCCollectionViewCellAccessoryDisclosureIndicator);
57 } 50 }
58 51
59 } // namespace 52 } // namespace
OLDNEW
« no previous file with comments | « ios/chrome/browser/payments/cells/payment_method_item.mm ('k') | ios/chrome/browser/payments/cells/price_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698