Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #import "ios/chrome/browser/payments/cells/accepted_payment_methods_item.h" | |
| 6 | |
| 7 #import "ios/chrome/browser/ui/collection_view/cells/test_utils.h" | |
| 8 #include "testing/gtest/include/gtest/gtest.h" | |
| 9 #include "testing/gtest_mac.h" | |
| 10 | |
| 11 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
| 12 #error "This file requires ARC support." | |
| 13 #endif | |
| 14 | |
| 15 namespace { | |
| 16 | |
| 17 // Tests that the label and the images are set properly after a call to | |
| 18 // |configureCell:|. | |
| 19 TEST(AccepedPaymentMethodsItemTest, TextLabelsAndImages) { | |
|
lpromero
2017/04/20 16:59:52
*Accepted
Moe
2017/04/21 14:14:14
Done.
| |
| 20 AcceptedPaymentMethodsItem* item = | |
| 21 [[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
| |
| 22 | |
| 23 NSString* message = @"Lorem ipsum dolor sit amet"; | |
| 24 NSArray* methodTypeIcons = @[ | |
| 25 ios_internal::CollectionViewTestImage(), | |
| 26 ios_internal::CollectionViewTestImage() | |
| 27 ]; | |
| 28 | |
| 29 item.message = message; | |
| 30 item.methodTypeIcons = methodTypeIcons; | |
| 31 | |
| 32 id cell = [[[item cellClass] alloc] init]; | |
| 33 ASSERT_TRUE([cell isMemberOfClass:[AcceptedPaymentMethodsCell class]]); | |
| 34 | |
| 35 AcceptedPaymentMethodsCell* acceptedPaymentMethodsCell = cell; | |
| 36 EXPECT_FALSE(acceptedPaymentMethodsCell.messageLabel.text); | |
| 37 EXPECT_EQ(nil, acceptedPaymentMethodsCell.methodTypeIconViews); | |
| 38 | |
| 39 [item configureCell:acceptedPaymentMethodsCell]; | |
| 40 EXPECT_NSEQ(message, acceptedPaymentMethodsCell.messageLabel.text); | |
| 41 ASSERT_EQ(2UL, acceptedPaymentMethodsCell.methodTypeIconViews.count); | |
| 42 EXPECT_NSEQ(methodTypeIcons[0], | |
| 43 acceptedPaymentMethodsCell.methodTypeIconViews[0].image); | |
| 44 EXPECT_NSEQ(methodTypeIcons[1], | |
| 45 acceptedPaymentMethodsCell.methodTypeIconViews[1].image); | |
| 46 } | |
| 47 | |
| 48 } // namespace | |
| OLD | NEW |