IGListKit/Tests/IGListContentInsetTests.m
Tim Oliver f92b9339ee Standarize the copyright notice in all source files
Summary:
The standardized Meta copyright notice is "Copyright (c) Meta Platforms, Inc. and affiliates." and not "Copyright (c) Meta Platforms, Inc. and its affiliates." (Dropping the "its")

This diff updates the copyright notice in each source file to the correct this.

Reviewed By: willbailey

Differential Revision: D44737667

fbshipit-source-id: 643bf36df76723e70d9d826c53cf8f29b8a0c8cc
2023-04-06 02:44:16 -07:00

83 lines
2.9 KiB
Objective-C

/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <XCTest/XCTest.h>
#import <IGListKit/IGListKit.h>
#import "IGListAdapterInternal.h"
#import "IGListTestHelpers.h"
#import "UIScrollView+IGListKit.h"
static const CGRect kStackTestFrame = (CGRect){{0.0, 0.0}, {320.0, 480.0}};
@interface IGListContentInsetTests : XCTestCase<IGListAdapterDataSource>
@property (nonatomic, strong) IGListAdapter *adapter;
@property (nonatomic, strong) UIWindow *window;
@property (nonatomic, strong) UIViewController *viewController;
@property (nonatomic, strong) UICollectionView *collectionView;
@end
@implementation IGListContentInsetTests
- (void)setUp {
[super setUp];
self.viewController = [UIViewController new];
IGListCollectionViewLayout *layout = [[IGListCollectionViewLayout alloc] initWithStickyHeaders:NO
topContentInset:0
stretchToEdge:YES];
self.collectionView = [[UICollectionView alloc] initWithFrame:kStackTestFrame
collectionViewLayout:layout];
self.collectionView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.viewController.view addSubview:self.collectionView];
self.adapter = [[IGListAdapter alloc] initWithUpdater:[IGListAdapterUpdater new]
viewController:self.viewController];
self.adapter.dataSource = self;
self.adapter.collectionView = self.collectionView;
self.window = [[UIWindow alloc] initWithFrame:kStackTestFrame];
self.window.rootViewController = self.viewController;
}
- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
self.adapter = nil;
self.viewController = nil;
self.collectionView = nil;
}
- (void) testCollectionViewContentInset {
const UIEdgeInsets inset = UIEdgeInsetsMake(10, 0, 10, 0);
self.collectionView.contentInset = inset;
IGAssertEqualInsets(self.collectionView.ig_contentInset, inset.top, inset.left, inset.bottom, inset.right);
id<IGListCollectionContext> context = self.adapter;
IGAssertEqualInsets(context.adjustedContainerInset, inset.top, inset.left, inset.bottom, inset.right);
}
#pragma mark - IGListAdapterDataSource
- (NSArray<id <IGListDiffable>> *)objectsForListAdapter:(IGListAdapter *)listAdapter {
return @[];
}
- (IGListSectionController *) listAdapter:(IGListAdapter *)listAdapter sectionControllerForObject:(id)object {
return nil;
}
- (UIView *) emptyViewForListAdapter:(IGListAdapter *)listAdapter {
return nil;
}
@end