Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 1d6e39c

Browse files
committed
Read the FLTEnableImpeller flag from the right bundle
1 parent 2d6803c commit 1d6e39c

File tree

3 files changed

+42
-7
lines changed

3 files changed

+42
-7
lines changed

shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@
207207
settings.enable_wide_gamut = enableWideGamut;
208208

209209
// Whether to enable Impeller.
210-
NSNumber* enableImpeller = [mainBundle objectForInfoDictionaryKey:@"FLTEnableImpeller"];
210+
NSNumber* enableImpeller = [bundle objectForInfoDictionaryKey:@"FLTEnableImpeller"];
211211
// Change the default only if the option is present.
212212
if (enableImpeller != nil) {
213213
settings.enable_impeller = enableImpeller.boolValue;

shell/platform/darwin/ios/framework/Source/FlutterDartProjectTest.mm

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,52 @@ - (void)testFLTFrameworkBundleInternalWhenBundleIsPresent {
7373
XCTAssertNotNil(found);
7474
}
7575

76+
- (void)testDisableImpellerSettingIsCorrectlyParsed {
77+
id mockMainBundle = OCMPartialMock([NSBundle mainBundle]);
78+
OCMStub([mockMainBundle objectForInfoDictionaryKey:@"FLTEnableImpeller"]).andReturn(@"NO");
79+
80+
auto settings = FLTDefaultSettingsForBundle();
81+
// Check settings.enable_impeller value is same as the value defined in Info.plist.
82+
XCTAssertEqual(settings.enable_impeller, NO);
83+
}
84+
7685
- (void)testEnableImpellerSettingIsCorrectlyParsed {
77-
// The FLTEnableImpeller's value is defined in Info.plist
78-
NSBundle* mainBundle = [NSBundle mainBundle];
79-
NSNumber* enableImpeller = [mainBundle objectForInfoDictionaryKey:@"FLTEnableImpeller"];
80-
XCTAssertEqual(enableImpeller.boolValue, NO);
86+
id mockMainBundle = OCMPartialMock([NSBundle mainBundle]);
87+
OCMStub([mockMainBundle objectForInfoDictionaryKey:@"FLTEnableImpeller"]).andReturn(@"YES");
88+
89+
auto settings = FLTDefaultSettingsForBundle();
90+
// Check settings.enable_impeller value is same as the value defined in Info.plist.
91+
XCTAssertEqual(settings.enable_impeller, YES);
92+
}
93+
94+
- (void)testDisableImpellerAppBundleSettingIsCorrectlyParsed {
95+
NSString* bundleId = [FlutterDartProject defaultBundleIdentifier];
96+
id mockAppBundle = OCMClassMock([NSBundle class]);
97+
OCMStub([mockAppBundle objectForInfoDictionaryKey:@"FLTEnableImpeller"]).andReturn(@"NO");
98+
99+
id nsBundleMock = OCMClassMock([NSBundle class]);
100+
OCMStub([nsBundleMock bundleWithIdentifier:bundleId]).andReturn(mockAppBundle);
81101

82102
auto settings = FLTDefaultSettingsForBundle();
83103
// Check settings.enable_impeller value is same as the value defined in Info.plist.
84104
XCTAssertEqual(settings.enable_impeller, NO);
105+
106+
[nsBundleMock stopMocking];
107+
}
108+
109+
- (void)testEnableImpellerAppBundleSettingIsCorrectlyParsed {
110+
NSString* bundleId = [FlutterDartProject defaultBundleIdentifier];
111+
id mockAppBundle = OCMClassMock([NSBundle class]);
112+
OCMStub([mockAppBundle objectForInfoDictionaryKey:@"FLTEnableImpeller"]).andReturn(@"YES");
113+
114+
id nsBundleMock = OCMClassMock([NSBundle class]);
115+
OCMStub([nsBundleMock bundleWithIdentifier:bundleId]).andReturn(mockAppBundle);
116+
117+
auto settings = FLTDefaultSettingsForBundle();
118+
// Check settings.enable_impeller value is same as the value defined in Info.plist.
119+
XCTAssertEqual(settings.enable_impeller, YES);
120+
121+
[nsBundleMock stopMocking];
85122
}
86123

87124
- (void)testEnableTraceSystraceSettingIsCorrectlyParsed {

testing/ios/IosUnitTests/App/Info.plist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@
4646
</dict>
4747
<key>FLTLeakDartVM</key>
4848
<false/>
49-
<key>FLTEnableImpeller</key>
50-
<false/>
5149
<key>FLTTraceSystrace</key>
5250
<false/>
5351
<key>FLTEnableDartProfiling</key>

0 commit comments

Comments
 (0)