Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[List] Add basic snapshot tests for MDCSelfSizingStereoCell. (#7439)
- Loading branch information
1 parent
f266736
commit 32d8d4d
Showing
4 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
81 changes: 81 additions & 0 deletions
81
components/List/tests/snapshot/MDCSelfSizingStereoCellSnapshotTests.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// Copyright 2019-present the Material Components for iOS authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#import "MaterialSnapshot.h" | ||
|
||
#import "MaterialList.h" | ||
|
||
/** Snapshot tests for MDCBaseCell. */ | ||
@interface MDCSelfSizingStereoCellSnapshotTests : MDCSnapshotTestCase | ||
|
||
/** The view being tested. */ | ||
@property(nonatomic, strong) MDCSelfSizingStereoCell *cell; | ||
|
||
@end | ||
|
||
@implementation MDCSelfSizingStereoCellSnapshotTests | ||
|
||
- (void)setUp { | ||
[super setUp]; | ||
|
||
// Uncomment below to recreate all the goldens (or add the following line to the specific | ||
// test you wish to recreate the golden for). | ||
// self.recordMode = YES; | ||
|
||
self.cell = [[MDCSelfSizingStereoCell alloc] initWithFrame:CGRectMake(0, 0, 240, 60)]; | ||
} | ||
|
||
- (void)tearDown { | ||
self.cell = nil; | ||
|
||
[super tearDown]; | ||
} | ||
|
||
- (void)generateSnapshotAndVerifyForView:(UIView *)view { | ||
UIView *snapshotView = [view mdc_addToBackgroundView]; | ||
[self snapshotVerifyView:snapshotView]; | ||
} | ||
|
||
#pragma mark - Tests | ||
|
||
- (void)testDefaultCell { | ||
// Then | ||
[self generateSnapshotAndVerifyForView:self.cell]; | ||
} | ||
|
||
- (void)testCellWithTitleAndDetail { | ||
// When | ||
self.cell.titleLabel.text = @"Title"; | ||
self.cell.detailLabel.text = @"Detail"; | ||
|
||
// Then | ||
[self generateSnapshotAndVerifyForView:self.cell]; | ||
} | ||
|
||
- (void)testCellWithTitleAndDetailAndImage { | ||
// When | ||
self.cell.titleLabel.text = @"Title"; | ||
self.cell.detailLabel.text = @"Detail"; | ||
self.cell.leadingImageView.image = | ||
[UIImage mdc_testImageOfSize:CGSizeMake(24, 24) | ||
withStyle:MDCSnapshotTestImageStyleCheckerboard]; | ||
self.cell.trailingImageView.image = | ||
[UIImage mdc_testImageOfSize:CGSizeMake(24, 24) | ||
withStyle:MDCSnapshotTestImageStyleRectangles]; | ||
|
||
// Then | ||
[self generateSnapshotAndVerifyForView:self.cell]; | ||
} | ||
|
||
@end |
Binary file added
BIN
+5.82 KB
...elfSizingStereoCellSnapshotTests/testCellWithTitleAndDetailAndImage_11_2@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.77 KB
..._64/MDCSelfSizingStereoCellSnapshotTests/testCellWithTitleAndDetail_11_2@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.2 KB
...ens/goldens_64/MDCSelfSizingStereoCellSnapshotTests/testDefaultCell_11_2@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.