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

Commit 27cb4d1

Browse files
committed
Change code formatting
1 parent 75f3640 commit 27cb4d1

File tree

2 files changed

+154
-63
lines changed

2 files changed

+154
-63
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -823,18 +823,22 @@ - (void)performOrientationUpdate:(UIInterfaceOrientationMask)new_preferences {
823823
if (new_preferences != _orientationPreferences) {
824824
_orientationPreferences = new_preferences;
825825
[UIViewController attemptRotationToDeviceOrientation];
826-
827-
UIInterfaceOrientationMask currentInterfaceOrientation = 1 << [[UIApplication sharedApplication] statusBarOrientation];
826+
827+
UIInterfaceOrientationMask currentInterfaceOrientation =
828+
1 << [[UIApplication sharedApplication] statusBarOrientation];
828829
if (!(_orientationPreferences & currentInterfaceOrientation)) {
829830
// Force orientation switch if the current orientation is not allowed
830831
if (_orientationPreferences & UIInterfaceOrientationMaskPortrait) {
831832
[[UIDevice currentDevice] setValue:@(UIInterfaceOrientationPortrait) forKey:@"orientation"];
832833
} else if (_orientationPreferences & UIInterfaceOrientationMaskPortraitUpsideDown) {
833-
[[UIDevice currentDevice] setValue:@(UIInterfaceOrientationPortraitUpsideDown) forKey:@"orientation"];
834+
[[UIDevice currentDevice] setValue:@(UIInterfaceOrientationPortraitUpsideDown)
835+
forKey:@"orientation"];
834836
} else if (_orientationPreferences & UIInterfaceOrientationMaskLandscapeLeft) {
835-
[[UIDevice currentDevice] setValue:@(UIInterfaceOrientationLandscapeLeft) forKey:@"orientation"];
837+
[[UIDevice currentDevice] setValue:@(UIInterfaceOrientationLandscapeLeft)
838+
forKey:@"orientation"];
836839
} else if (_orientationPreferences & UIInterfaceOrientationMaskLandscapeRight) {
837-
[[UIDevice currentDevice] setValue:@(UIInterfaceOrientationLandscapeRight) forKey:@"orientation"];
840+
[[UIDevice currentDevice] setValue:@(UIInterfaceOrientationLandscapeRight)
841+
forKey:@"orientation"];
838842
}
839843
}
840844
}

shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m

Lines changed: 145 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -241,82 +241,169 @@ - (void)testItReportsHighContrastWhenTraitCollectionRequestsIt {
241241
}
242242

243243
- (void)testPerformOrientationUpdateForcesOrientationChange {
244-
[self orientationTestWithMask:UIInterfaceOrientationMaskPortrait current:UIInterfaceOrientationLandscapeLeft force:YES to:UIInterfaceOrientationPortrait];
245-
246-
[self orientationTestWithMask:UIInterfaceOrientationMaskPortrait current:UIInterfaceOrientationLandscapeRight force:YES to:UIInterfaceOrientationPortrait];
247-
248-
[self orientationTestWithMask:UIInterfaceOrientationMaskPortrait current:UIInterfaceOrientationPortraitUpsideDown force:YES to:UIInterfaceOrientationPortrait];
249-
250-
[self orientationTestWithMask:UIInterfaceOrientationMaskPortraitUpsideDown current:UIInterfaceOrientationLandscapeLeft force:YES to:UIInterfaceOrientationPortraitUpsideDown];
251-
252-
[self orientationTestWithMask:UIInterfaceOrientationMaskPortraitUpsideDown current:UIInterfaceOrientationLandscapeRight force:YES to:UIInterfaceOrientationPortraitUpsideDown];
253-
254-
[self orientationTestWithMask:UIInterfaceOrientationMaskPortraitUpsideDown current:UIInterfaceOrientationPortrait force:YES to:UIInterfaceOrientationPortraitUpsideDown];
255-
256-
[self orientationTestWithMask:UIInterfaceOrientationMaskLandscape current:UIInterfaceOrientationPortrait force:YES to:UIInterfaceOrientationLandscapeLeft];
257-
258-
[self orientationTestWithMask:UIInterfaceOrientationMaskLandscape current:UIInterfaceOrientationPortraitUpsideDown force:YES to:UIInterfaceOrientationLandscapeLeft];
259-
260-
[self orientationTestWithMask:UIInterfaceOrientationMaskLandscapeLeft current:UIInterfaceOrientationPortrait force:YES to:UIInterfaceOrientationLandscapeLeft];
261-
262-
[self orientationTestWithMask:UIInterfaceOrientationMaskLandscapeLeft current:UIInterfaceOrientationLandscapeRight force:YES to:UIInterfaceOrientationLandscapeLeft];
263-
264-
[self orientationTestWithMask:UIInterfaceOrientationMaskLandscapeLeft current:UIInterfaceOrientationPortraitUpsideDown force:YES to:UIInterfaceOrientationLandscapeLeft];
265-
266-
[self orientationTestWithMask:UIInterfaceOrientationMaskLandscapeRight current:UIInterfaceOrientationPortrait force:YES to:UIInterfaceOrientationLandscapeRight];
267-
268-
[self orientationTestWithMask:UIInterfaceOrientationMaskLandscapeRight current:UIInterfaceOrientationLandscapeLeft force:YES to:UIInterfaceOrientationLandscapeRight];
269-
270-
[self orientationTestWithMask:UIInterfaceOrientationMaskLandscapeRight current:UIInterfaceOrientationPortraitUpsideDown force:YES to:UIInterfaceOrientationLandscapeRight];
271-
272-
[self orientationTestWithMask:UIInterfaceOrientationMaskAllButUpsideDown current:UIInterfaceOrientationPortraitUpsideDown force:YES to:UIInterfaceOrientationPortrait];
244+
[self orientationTestWithMask:UIInterfaceOrientationMaskPortrait
245+
current:UIInterfaceOrientationLandscapeLeft
246+
force:YES
247+
to:UIInterfaceOrientationPortrait];
248+
249+
[self orientationTestWithMask:UIInterfaceOrientationMaskPortrait
250+
current:UIInterfaceOrientationLandscapeRight
251+
force:YES
252+
to:UIInterfaceOrientationPortrait];
253+
254+
[self orientationTestWithMask:UIInterfaceOrientationMaskPortrait
255+
current:UIInterfaceOrientationPortraitUpsideDown
256+
force:YES
257+
to:UIInterfaceOrientationPortrait];
258+
259+
[self orientationTestWithMask:UIInterfaceOrientationMaskPortraitUpsideDown
260+
current:UIInterfaceOrientationLandscapeLeft
261+
force:YES
262+
to:UIInterfaceOrientationPortraitUpsideDown];
263+
264+
[self orientationTestWithMask:UIInterfaceOrientationMaskPortraitUpsideDown
265+
current:UIInterfaceOrientationLandscapeRight
266+
force:YES
267+
to:UIInterfaceOrientationPortraitUpsideDown];
268+
269+
[self orientationTestWithMask:UIInterfaceOrientationMaskPortraitUpsideDown
270+
current:UIInterfaceOrientationPortrait
271+
force:YES
272+
to:UIInterfaceOrientationPortraitUpsideDown];
273+
274+
[self orientationTestWithMask:UIInterfaceOrientationMaskLandscape
275+
current:UIInterfaceOrientationPortrait
276+
force:YES
277+
to:UIInterfaceOrientationLandscapeLeft];
278+
279+
[self orientationTestWithMask:UIInterfaceOrientationMaskLandscape
280+
current:UIInterfaceOrientationPortraitUpsideDown
281+
force:YES
282+
to:UIInterfaceOrientationLandscapeLeft];
283+
284+
[self orientationTestWithMask:UIInterfaceOrientationMaskLandscapeLeft
285+
current:UIInterfaceOrientationPortrait
286+
force:YES
287+
to:UIInterfaceOrientationLandscapeLeft];
288+
289+
[self orientationTestWithMask:UIInterfaceOrientationMaskLandscapeLeft
290+
current:UIInterfaceOrientationLandscapeRight
291+
force:YES
292+
to:UIInterfaceOrientationLandscapeLeft];
293+
294+
[self orientationTestWithMask:UIInterfaceOrientationMaskLandscapeLeft
295+
current:UIInterfaceOrientationPortraitUpsideDown
296+
force:YES
297+
to:UIInterfaceOrientationLandscapeLeft];
298+
299+
[self orientationTestWithMask:UIInterfaceOrientationMaskLandscapeRight
300+
current:UIInterfaceOrientationPortrait
301+
force:YES
302+
to:UIInterfaceOrientationLandscapeRight];
303+
304+
[self orientationTestWithMask:UIInterfaceOrientationMaskLandscapeRight
305+
current:UIInterfaceOrientationLandscapeLeft
306+
force:YES
307+
to:UIInterfaceOrientationLandscapeRight];
308+
309+
[self orientationTestWithMask:UIInterfaceOrientationMaskLandscapeRight
310+
current:UIInterfaceOrientationPortraitUpsideDown
311+
force:YES
312+
to:UIInterfaceOrientationLandscapeRight];
313+
314+
[self orientationTestWithMask:UIInterfaceOrientationMaskAllButUpsideDown
315+
current:UIInterfaceOrientationPortraitUpsideDown
316+
force:YES
317+
to:UIInterfaceOrientationPortrait];
273318
}
274319

275320
- (void)testPerformOrientationUpdateDoesNotForceOrientationChange {
276-
[self orientationTestWithMask:UIInterfaceOrientationMaskAll current:UIInterfaceOrientationPortrait force:NO to:0];
277-
278-
[self orientationTestWithMask:UIInterfaceOrientationMaskAll current:UIInterfaceOrientationPortraitUpsideDown force:NO to:0];
279-
280-
[self orientationTestWithMask:UIInterfaceOrientationMaskAll current:UIInterfaceOrientationLandscapeLeft force:NO to:0];
281-
282-
[self orientationTestWithMask:UIInterfaceOrientationMaskAll current:UIInterfaceOrientationLandscapeRight force:NO to:0];
283-
284-
[self orientationTestWithMask:UIInterfaceOrientationMaskAllButUpsideDown current:UIInterfaceOrientationPortrait force:NO to:0];
285-
286-
[self orientationTestWithMask:UIInterfaceOrientationMaskAllButUpsideDown current:UIInterfaceOrientationLandscapeLeft force:NO to:0];
287-
288-
[self orientationTestWithMask:UIInterfaceOrientationMaskAllButUpsideDown current:UIInterfaceOrientationLandscapeRight force:NO to:0];
289-
290-
[self orientationTestWithMask:UIInterfaceOrientationMaskPortrait current:UIInterfaceOrientationPortrait force:NO to:0];
291-
292-
[self orientationTestWithMask:UIInterfaceOrientationMaskPortraitUpsideDown current:UIInterfaceOrientationPortraitUpsideDown force:NO to:0];
293-
294-
[self orientationTestWithMask:UIInterfaceOrientationMaskLandscape current:UIInterfaceOrientationLandscapeLeft force:NO to:0];
295-
296-
[self orientationTestWithMask:UIInterfaceOrientationMaskLandscape current:UIInterfaceOrientationLandscapeRight force:NO to:0];
297-
298-
[self orientationTestWithMask:UIInterfaceOrientationMaskLandscapeLeft current:UIInterfaceOrientationLandscapeLeft force:NO to:0];
299-
300-
[self orientationTestWithMask:UIInterfaceOrientationMaskLandscapeRight current:UIInterfaceOrientationLandscapeRight force:NO to:0];
321+
[self orientationTestWithMask:UIInterfaceOrientationMaskAll
322+
current:UIInterfaceOrientationPortrait
323+
force:NO
324+
to:0];
325+
326+
[self orientationTestWithMask:UIInterfaceOrientationMaskAll
327+
current:UIInterfaceOrientationPortraitUpsideDown
328+
force:NO
329+
to:0];
330+
331+
[self orientationTestWithMask:UIInterfaceOrientationMaskAll
332+
current:UIInterfaceOrientationLandscapeLeft
333+
force:NO
334+
to:0];
335+
336+
[self orientationTestWithMask:UIInterfaceOrientationMaskAll
337+
current:UIInterfaceOrientationLandscapeRight
338+
force:NO
339+
to:0];
340+
341+
[self orientationTestWithMask:UIInterfaceOrientationMaskAllButUpsideDown
342+
current:UIInterfaceOrientationPortrait
343+
force:NO
344+
to:0];
345+
346+
[self orientationTestWithMask:UIInterfaceOrientationMaskAllButUpsideDown
347+
current:UIInterfaceOrientationLandscapeLeft
348+
force:NO
349+
to:0];
350+
351+
[self orientationTestWithMask:UIInterfaceOrientationMaskAllButUpsideDown
352+
current:UIInterfaceOrientationLandscapeRight
353+
force:NO
354+
to:0];
355+
356+
[self orientationTestWithMask:UIInterfaceOrientationMaskPortrait
357+
current:UIInterfaceOrientationPortrait
358+
force:NO
359+
to:0];
360+
361+
[self orientationTestWithMask:UIInterfaceOrientationMaskPortraitUpsideDown
362+
current:UIInterfaceOrientationPortraitUpsideDown
363+
force:NO
364+
to:0];
365+
366+
[self orientationTestWithMask:UIInterfaceOrientationMaskLandscape
367+
current:UIInterfaceOrientationLandscapeLeft
368+
force:NO
369+
to:0];
370+
371+
[self orientationTestWithMask:UIInterfaceOrientationMaskLandscape
372+
current:UIInterfaceOrientationLandscapeRight
373+
force:NO
374+
to:0];
375+
376+
[self orientationTestWithMask:UIInterfaceOrientationMaskLandscapeLeft
377+
current:UIInterfaceOrientationLandscapeLeft
378+
force:NO
379+
to:0];
380+
381+
[self orientationTestWithMask:UIInterfaceOrientationMaskLandscapeRight
382+
current:UIInterfaceOrientationLandscapeRight
383+
force:NO
384+
to:0];
301385
}
302386

303-
- (void)orientationTestWithMask:(UIInterfaceOrientationMask)mask current:(UIInterfaceOrientation) currentOrientation force:(BOOL)forceChange to:(UIInterfaceOrientation)forcedOrientation {
387+
- (void)orientationTestWithMask:(UIInterfaceOrientationMask)mask
388+
current:(UIInterfaceOrientation)currentOrientation
389+
force:(BOOL)forceChange
390+
to:(UIInterfaceOrientation)forcedOrientation {
304391
id engine = OCMClassMock([FlutterEngine class]);
305-
392+
306393
id deviceMock = OCMPartialMock([UIDevice currentDevice]);
307394
if (!forceChange) {
308395
OCMReject([deviceMock setValue:[OCMArg any] forKey:@"orientation"]);
309396
} else {
310397
OCMExpect([deviceMock setValue:@(forcedOrientation) forKey:@"orientation"]);
311398
}
312-
399+
313400
FlutterViewController* realVC = [[FlutterViewController alloc] initWithEngine:engine
314401
nibName:nil
315402
bundle:nil];
316403
id mockApplication = OCMClassMock([UIApplication class]);
317404
OCMStub([mockApplication sharedApplication]).andReturn(mockApplication);
318405
OCMStub([mockApplication statusBarOrientation]).andReturn(currentOrientation);
319-
406+
320407
[realVC performOrientationUpdate:mask];
321408
OCMVerifyAll(deviceMock);
322409
[engine stopMocking];

0 commit comments

Comments
 (0)