mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-06 04:32:06 +00:00
* [ASTraitCollection] Add missing properties to ASTraitCollection * ASTraitCollection now completely reflects UITraitCollection * Add ASContentSizeCategory enum that corresponds to UIContentSizeCategory and can be used inside a struct. * * Remove enum ASContentSizeCategory. * Use __unsafe_unretained UIContentSizeCategory instead of the enum. * Added ASPrimitiveTraitCollection lifetime test * Changes requested at code review: * Restore one of the ASTraitCollection constructors with a deprecation notice. * Clean up API by the separation of tvOS-specific interfaces. * Use [NSString -isEqualToString:] for ASPrimitiveContentSizeCategory equality tests for better readability. * Encapsulate fallback logic for UIContentSizeCategoryUnspecified. * Fix failing test
35 lines
1004 B
Objective-C
35 lines
1004 B
Objective-C
//
|
|
// ASTraitCollectionTests.m
|
|
// Texture
|
|
//
|
|
// Copyright (c) 2017-present, Pinterest, Inc. 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
|
|
//
|
|
|
|
#import <XCTest/XCTest.h>
|
|
#import <AsyncDisplayKit/ASTraitCollection.h>
|
|
|
|
@interface ASTraitCollectionTests : XCTestCase
|
|
|
|
@end
|
|
|
|
@implementation ASTraitCollectionTests
|
|
|
|
- (void)testPrimitiveContentSizeCategoryLifetime
|
|
{
|
|
ASPrimitiveContentSizeCategory primitiveContentSize;
|
|
@autoreleasepool {
|
|
// Make sure the compiler won't optimize string alloc/dealloc
|
|
NSString *contentSizeCategory = [NSString stringWithCString:"UICTContentSizeCategoryL" encoding:NSUTF8StringEncoding];
|
|
primitiveContentSize = ASPrimitiveContentSizeCategoryMake(contentSizeCategory);
|
|
}
|
|
|
|
XCTAssertEqual(primitiveContentSize, UIContentSizeCategoryLarge);
|
|
}
|
|
|
|
@end
|