| 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..13f144b3047a6c312e48c15824d586a813874368
|
| --- /dev/null
|
| +++ b/ios/chrome/browser/payments/cells/accepted_payment_methods_item_unittest.mm
|
| @@ -0,0 +1,47 @@
|
| +// 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(PaymentRequestAcceptedPaymentMethodsItemTest, TextLabelsAndImages) {
|
| + AcceptedPaymentMethodsItem* item = [[AcceptedPaymentMethodsItem alloc] init];
|
| +
|
| + 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
|
|
|