Index: ios/chrome/browser/payments/cells/accepted_payment_methods_item_unittest.mm |
diff --git a/ios/chrome/browser/payments/cells/accepted_payment_methods_item_unittest.mm b/ios/chrome/browser/payments/cells/accepted_payment_methods_item_unittest.mm |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1a1b3b5cb883613a23a807f3a74ab6d9cf7d50cc |
--- /dev/null |
+++ b/ios/chrome/browser/payments/cells/accepted_payment_methods_item_unittest.mm |
@@ -0,0 +1,48 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#import "ios/chrome/browser/payments/cells/accepted_payment_methods_item.h" |
+ |
+#import "ios/chrome/browser/ui/collection_view/cells/test_utils.h" |
+#include "testing/gtest/include/gtest/gtest.h" |
+#include "testing/gtest_mac.h" |
+ |
+#if !defined(__has_feature) || !__has_feature(objc_arc) |
+#error "This file requires ARC support." |
+#endif |
+ |
+namespace { |
+ |
+// Tests that the label and the images are set properly after a call to |
+// |configureCell:|. |
+TEST(AccepedPaymentMethodsItemTest, TextLabelsAndImages) { |
lpromero
2017/04/20 16:59:52
*Accepted
Moe
2017/04/21 14:14:14
Done.
|
+ AcceptedPaymentMethodsItem* item = |
+ [[AcceptedPaymentMethodsItem alloc] initWithType:0]; |
lpromero
2017/04/20 16:59:52
Nit: alloc] init] :p
Moe
2017/04/21 14:14:14
good riddance! :D as you can see this CL has been
|
+ |
+ NSString* message = @"Lorem ipsum dolor sit amet"; |
+ NSArray* methodTypeIcons = @[ |
+ ios_internal::CollectionViewTestImage(), |
+ ios_internal::CollectionViewTestImage() |
+ ]; |
+ |
+ item.message = message; |
+ item.methodTypeIcons = methodTypeIcons; |
+ |
+ id cell = [[[item cellClass] alloc] init]; |
+ ASSERT_TRUE([cell isMemberOfClass:[AcceptedPaymentMethodsCell class]]); |
+ |
+ AcceptedPaymentMethodsCell* acceptedPaymentMethodsCell = cell; |
+ EXPECT_FALSE(acceptedPaymentMethodsCell.messageLabel.text); |
+ EXPECT_EQ(nil, acceptedPaymentMethodsCell.methodTypeIconViews); |
+ |
+ [item configureCell:acceptedPaymentMethodsCell]; |
+ EXPECT_NSEQ(message, acceptedPaymentMethodsCell.messageLabel.text); |
+ ASSERT_EQ(2UL, acceptedPaymentMethodsCell.methodTypeIconViews.count); |
+ EXPECT_NSEQ(methodTypeIcons[0], |
+ acceptedPaymentMethodsCell.methodTypeIconViews[0].image); |
+ EXPECT_NSEQ(methodTypeIcons[1], |
+ acceptedPaymentMethodsCell.methodTypeIconViews[1].image); |
+} |
+ |
+} // namespace |