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

Unified Diff: ios/chrome/browser/ui/collection_view/cells/collection_view_account_item_unittest.mm

Issue 2588713002: Upstream Chrome on iOS source code [4/11]. (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/collection_view/cells/collection_view_account_item_unittest.mm
diff --git a/ios/chrome/browser/ui/collection_view/cells/collection_view_account_item_unittest.mm b/ios/chrome/browser/ui/collection_view/cells/collection_view_account_item_unittest.mm
new file mode 100644
index 0000000000000000000000000000000000000000..b729393aa31d658e44debaf07bc51f12b65a95fd
--- /dev/null
+++ b/ios/chrome/browser/ui/collection_view/cells/collection_view_account_item_unittest.mm
@@ -0,0 +1,42 @@
+// Copyright 2016 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/ui/collection_view/cells/collection_view_account_item.h"
+
+#import <CoreGraphics/CoreGraphics.h>
+#import <UIKit/UIKit.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
+
+// Tests that the UIImageView and UILabels are set properly after a call to
+// |configureCell:|.
+TEST(AccountControlCollectionViewItemTest, ImageViewAndTextLabels) {
+ CollectionViewAccountItem* item =
+ [[CollectionViewAccountItem alloc] initWithType:0];
+ UIImage* image = [[UIImage alloc] init];
+ NSString* mainText = @"Main text";
+ NSString* detailText = @"Detail text";
+
+ item.image = image;
+ item.text = mainText;
+ item.detailText = detailText;
+
+ id cell = [[[item cellClass] alloc] init];
+ ASSERT_TRUE([cell isMemberOfClass:[CollectionViewAccountCell class]]);
+
+ CollectionViewAccountCell* accountCell = cell;
+ EXPECT_FALSE(accountCell.imageView.image);
+ EXPECT_FALSE(accountCell.textLabel.text);
+ EXPECT_FALSE(accountCell.detailTextLabel.text);
+
+ [item configureCell:cell];
+ EXPECT_NSEQ(image, accountCell.imageView.image);
+ EXPECT_NSEQ(mainText, accountCell.textLabel.text);
+ EXPECT_NSEQ(detailText, accountCell.detailTextLabel.text);
+}

Powered by Google App Engine
This is Rietveld 408576698