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

Side by Side Diff: ios/chrome/browser/ui/collection_view/cells/collection_view_item_unittest.mm

Issue 2814273004: Makes -init and -setType: available in CollectionViewItem (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
« no previous file with comments | « ios/chrome/browser/ui/collection_view/cells/collection_view_item+collection_view_controller.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/ui/collection_view/cells/collection_view_item.h" 5 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h"
6 6
7 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item+collec tion_view_controller.h"
7 #import "ios/third_party/material_components_ios/src/components/CollectionCells/ src/MaterialCollectionCells.h" 8 #import "ios/third_party/material_components_ios/src/components/CollectionCells/ src/MaterialCollectionCells.h"
8 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
9 10
10 #if !defined(__has_feature) || !__has_feature(objc_arc) 11 #if !defined(__has_feature) || !__has_feature(objc_arc)
11 #error "This file requires ARC support." 12 #error "This file requires ARC support."
12 #endif 13 #endif
13 14
14 namespace { 15 namespace {
15 16
16 TEST(CollectionViewItemTest, Accessors) { 17 TEST(CollectionViewItemTest, Accessors) {
17 CollectionViewItem* five = [[CollectionViewItem alloc] initWithType:5]; 18 CollectionViewItem* five = [[CollectionViewItem alloc] initWithType:5];
18 CollectionViewItem* twelve = [[CollectionViewItem alloc] initWithType:12]; 19 CollectionViewItem* twelve = [[CollectionViewItem alloc] initWithType:12];
19 20
20 EXPECT_EQ(5, [five type]); 21 EXPECT_EQ(5, [five type]);
21 EXPECT_EQ(12, [twelve type]); 22 EXPECT_EQ(12, [twelve type]);
23
24 // Test setting the type property used in CollectionViewController.
25 [five setType:55];
26 EXPECT_EQ(55, [five type]);
27
28 [twelve setType:1212];
29 EXPECT_EQ(1212, [twelve type]);
22 } 30 }
23 31
24 TEST(CollectionViewItemTest, ConfigureCellPortsAccessibilityProperties) { 32 TEST(CollectionViewItemTest, ConfigureCellPortsAccessibilityProperties) {
25 CollectionViewItem* item = [[CollectionViewItem alloc] initWithType:0]; 33 CollectionViewItem* item = [[CollectionViewItem alloc] initWithType:0];
26 item.accessibilityIdentifier = @"test_identifier"; 34 item.accessibilityIdentifier = @"test_identifier";
27 item.accessibilityTraits = UIAccessibilityTraitButton; 35 item.accessibilityTraits = UIAccessibilityTraitButton;
28 MDCCollectionViewCell* cell = [[[item cellClass] alloc] init]; 36 MDCCollectionViewCell* cell = [[[item cellClass] alloc] init];
29 EXPECT_TRUE([cell isMemberOfClass:[MDCCollectionViewCell class]]); 37 EXPECT_TRUE([cell isMemberOfClass:[MDCCollectionViewCell class]]);
30 EXPECT_EQ(UIAccessibilityTraitNone, [cell accessibilityTraits]); 38 EXPECT_EQ(UIAccessibilityTraitNone, [cell accessibilityTraits]);
31 EXPECT_FALSE([cell accessibilityIdentifier]); 39 EXPECT_FALSE([cell accessibilityIdentifier]);
32 [item configureCell:cell]; 40 [item configureCell:cell];
33 EXPECT_EQ(UIAccessibilityTraitButton, [cell accessibilityTraits]); 41 EXPECT_EQ(UIAccessibilityTraitButton, [cell accessibilityTraits]);
34 EXPECT_EQ(@"test_identifier", [cell accessibilityIdentifier]); 42 EXPECT_EQ(@"test_identifier", [cell accessibilityIdentifier]);
35 } 43 }
36 44
37 } // namespace 45 } // namespace
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/collection_view/cells/collection_view_item+collection_view_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698