OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/chrome/browser/ui/settings/cells/encryption_item.h" |
| 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "testing/gtest_mac.h" |
| 9 |
| 10 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 11 #error "This file requires ARC support." |
| 12 #endif |
| 13 |
| 14 namespace { |
| 15 |
| 16 // Tests that the text label, enabled status and accessory type are set properly |
| 17 // after a call to |configureCell:|. |
| 18 TEST(EncryptionItemTest, ConfigureCell) { |
| 19 EncryptionItem* item = [[EncryptionItem alloc] initWithType:0]; |
| 20 EncryptionCell* cell = [[[item cellClass] alloc] init]; |
| 21 EXPECT_TRUE([cell isMemberOfClass:[EncryptionCell class]]); |
| 22 EXPECT_NSEQ(nil, cell.textLabel.text); |
| 23 NSString* text = @"Test text"; |
| 24 UIColor* enabledColor = cell.textLabel.textColor; |
| 25 |
| 26 item.text = text; |
| 27 item.enabled = NO; |
| 28 item.accessoryType = MDCCollectionViewCellAccessoryCheckmark; |
| 29 [item configureCell:cell]; |
| 30 |
| 31 EXPECT_NSEQ(text, cell.textLabel.text); |
| 32 EXPECT_NE(enabledColor, cell.textLabel.textColor); |
| 33 EXPECT_EQ(MDCCollectionViewCellAccessoryCheckmark, cell.accessoryType); |
| 34 } |
| 35 |
| 36 } // namespace |
OLD | NEW |