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

Side by Side Diff: ios/chrome/browser/payments/cells/price_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/price_item.h" 5 #import "ios/chrome/browser/payments/cells/price_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 are set properly after a call to |configureCell:|. 17 // Tests that the labels are set properly after a call to |configureCell:|.
18 TEST(PaymentRequestPriceItemTest, TextLabels) { 18 TEST(PaymentRequestPriceItemTest, TextLabels) {
19 PriceItem* priceItem = [[PriceItem alloc] initWithType:0]; 19 PriceItem* priceItem = [[PriceItem alloc] init];
20 20
21 NSString* item = @"Total"; 21 NSString* item = @"Total";
22 NSString* notification = @"Updated"; 22 NSString* notification = @"Updated";
23 NSString* price = @"USD $60.0"; 23 NSString* price = @"USD $60.0";
24 24
25 priceItem.item = item; 25 priceItem.item = item;
26 priceItem.notification = notification; 26 priceItem.notification = notification;
27 priceItem.price = price; 27 priceItem.price = price;
28 28
29 id cell = [[[priceItem cellClass] alloc] init]; 29 id cell = [[[priceItem cellClass] alloc] init];
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // width, in which case, it gets clipped too. 166 // width, in which case, it gets clipped too.
167 itemLabelRect.size.width = 90; 167 itemLabelRect.size.width = 90;
168 priceLabelRect.size.width = 60; 168 priceLabelRect.size.width = 60;
169 cell.itemLabel.frame = itemLabelRect; 169 cell.itemLabel.frame = itemLabelRect;
170 cell.priceLabel.frame = priceLabelRect; 170 cell.priceLabel.frame = priceLabelRect;
171 EXPECT_EQ(50, [cell itemLabelTargetWidth]); 171 EXPECT_EQ(50, [cell itemLabelTargetWidth]);
172 EXPECT_EQ(50, [cell priceLabelTargetWidth]); 172 EXPECT_EQ(50, [cell priceLabelTargetWidth]);
173 } 173 }
174 174
175 } // namespace 175 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698