Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mismatch name experimental features #1159

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
929d118
fix SIMULATE_WEB_RESPONSE not imported #449
wsdwsd0829 Jul 16, 2017
dd24d8f
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Sep 6, 2017
b8eaffa
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Oct 4, 2017
2918ea0
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Oct 11, 2017
9c42266
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Oct 12, 2017
329f35f
Fix to make rangeMode update in right time
wsdwsd0829 Feb 5, 2018
5f8b7ec
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Feb 7, 2018
d87bb11
merge master from upstream
wsdwsd0829 Feb 15, 2018
269c2ab
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Mar 10, 2018
24c1ce8
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Mar 12, 2018
233169e
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Mar 26, 2018
b19f90d
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Mar 28, 2018
b50cec4
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Apr 5, 2018
b75a5f3
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 May 3, 2018
64b46e0
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 May 16, 2018
5fabc1e
remove uncessary assert
wsdwsd0829 May 17, 2018
3d5b84b
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 May 21, 2018
098b978
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Jun 8, 2018
77eefd6
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Jun 13, 2018
0310ed7
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Jul 3, 2018
0b886de
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Jul 25, 2018
a63d438
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Aug 21, 2018
06e18a1
Fix collection cell editing bug for iOS 9 & 10
wsdwsd0829 Aug 22, 2018
918434d
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Aug 31, 2018
41d3680
Revert "Fix collection cell editing bug for iOS 9 & 10"
wsdwsd0829 Sep 10, 2018
34833a3
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Sep 19, 2018
8d82d21
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Sep 25, 2018
f02d47c
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Oct 3, 2018
6dbe79a
fix mismatch of name array and experimental features
wsdwsd0829 Oct 3, 2018
1714394
add more tests
wsdwsd0829 Oct 3, 2018
8148b62
remove nslog
wsdwsd0829 Oct 3, 2018
852101f
Merge branch 'master' of github.com:TextureGroup/Texture into mismatc…
wsdwsd0829 Oct 10, 2018
4c1c65e
add change log
wsdwsd0829 Oct 10, 2018
1d62611
fix tests
wsdwsd0829 Oct 10, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## master
* Add your own contributions to the next release on the line below this with your name.
- [ASExperimentalFeatures.m] Fix mismatch name in experimental features. [Max Wang](https://github.com/wsdwsd0829). [#1159](https://github.com/TextureGroup/Texture/pull/1159)
- [ASCollectionViewLayoutController] Set default tuning parameters before view is loaded. [Max Wang](https://github.com/wsdwsd0829). [#1158](https://github.com/TextureGroup/Texture/pull/1158)
- [ASPhotosFrameworkImageRequestTests] Guard photo library with macro for tests. [Max Wang](https://github.com/wsdwsd0829). [#1147](https://github.com/TextureGroup/Texture/pull/1147)
- [ASDisplayNode] Do not cancel display when in exit hierarchy but let interface state changing to handle it. [Max Wang](https://github.com/wsdwsd0829). [#1110](https://github.com/TextureGroup/Texture/pull/1110)
Expand Down
1 change: 0 additions & 1 deletion Source/ASExperimentalFeatures.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
@"exp_unfair_lock",
@"exp_infer_layer_defaults",
@"exp_network_image_queue",
@"exp_dealloc_queue_v2",
@"exp_collection_teardown",
@"exp_framesetter_cache",
@"exp_clear_data_during_deallocation"]));
Expand Down
63 changes: 57 additions & 6 deletions Tests/ASConfigurationTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@
#import "ASConfigurationDelegate.h"
#import "ASConfigurationInternal.h"

static ASExperimentalFeatures features[] = {
ASExperimentalGraphicsContexts,
ASExperimentalTextNode,
ASExperimentalInterfaceStateCoalescing,
ASExperimentalUnfairLock,
ASExperimentalLayerDefaults,
ASExperimentalNetworkImageQueue,
ASExperimentalCollectionTeardown,
ASExperimentalFramesetterCache,
ASExperimentalClearDataDuringDeallocation
};

@interface ASConfigurationTests : ASTestCase <ASConfigurationDelegate>

@end
Expand All @@ -20,6 +32,28 @@ @implementation ASConfigurationTests {
void (^onActivate)(ASConfigurationTests *self, ASExperimentalFeatures feature);
}

+ (NSArray *)names {
return @[
@"exp_graphics_contexts",
@"exp_text_node",
@"exp_interface_state_coalesce",
@"exp_unfair_lock",
@"exp_infer_layer_defaults",
@"exp_network_image_queue",
@"exp_collection_teardown",
@"exp_framesetter_cache",
@"exp_clear_data_during_deallocation"
];
}

- (ASExperimentalFeatures)allFeatures {
ASExperimentalFeatures allFeatures = 0;
for (int i = 0; i < sizeof(features)/sizeof(ASExperimentalFeatures); i++) {
allFeatures |= features[i];
}
return allFeatures;
}

- (void)testExperimentalFeatureConfig
{
// Set the config
Expand Down Expand Up @@ -55,17 +89,34 @@ - (void)textureDidActivateExperimentalFeatures:(ASExperimentalFeatures)feature
- (void)testMappingNamesToFlags
{
// Throw in a bad bit.
ASExperimentalFeatures features = ASExperimentalTextNode | ASExperimentalGraphicsContexts | (1 << 22);
NSArray *expectedNames = @[ @"exp_graphics_contexts", @"exp_text_node" ];
XCTAssertEqualObjects(expectedNames, ASExperimentalFeaturesGetNames(features));
ASExperimentalFeatures allFeatures = [self allFeatures];
ASExperimentalFeatures featuresWithBadBit = allFeatures | (1 << 22);
NSArray *expectedNames = [ASConfigurationTests names];
XCTAssertEqualObjects(expectedNames, ASExperimentalFeaturesGetNames(featuresWithBadBit));
}

- (void)testMappingFlagsFromNames
{
// Throw in a bad name.
NSArray *names = @[ @"exp_text_node", @"exp_graphics_contexts", @"__invalid_name" ];
ASExperimentalFeatures expected = ASExperimentalGraphicsContexts | ASExperimentalTextNode;
XCTAssertEqual(expected, ASExperimentalFeaturesFromArray(names));
NSMutableArray *allNames = [[NSMutableArray alloc] initWithArray:[ASConfigurationTests names]];
[allNames addObject:@"__invalid_name"];
ASExperimentalFeatures expected = [self allFeatures];
XCTAssertEqual(expected, ASExperimentalFeaturesFromArray(allNames));
}

- (void)testFlagMatchName
{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to cover shift number must comes with names update cases.

NSArray *names = [ASConfigurationTests names];
for (NSInteger i = 0; i < names.count; i++) {
XCTAssertEqual(features[i], ASExperimentalFeaturesFromArray(@[names[i]]));
}
}

- (void)testNameMatchFlag {
NSArray *names = [ASConfigurationTests names];
for (NSInteger i = 0; i < names.count; i++) {
XCTAssertEqualObjects(@[names[i]], ASExperimentalFeaturesGetNames(features[i]));
}
}

@end