Skip to content

Commit

Permalink
Run iOS scenario apps on iPhone 11 and iOS 14 (flutter#30104)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmagman authored Dec 7, 2021
1 parent 6551934 commit 9b74c21
Show file tree
Hide file tree
Showing 41 changed files with 91 additions and 118 deletions.
140 changes: 65 additions & 75 deletions testing/scenario_app/ios/Scenarios/Scenarios.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,14 @@ - (BOOL)compareGoldenToImage:(UIImage*)image {
os_log_error(OS_LOG_DEFAULT, "GOLDEN DIFF FAILED: image does not exists.");
return NO;
}
CGImageRef imageRefA = [self.image CGImage];
CGImageRef imageRefB = [image CGImage];

// The home bar at the bottom of the screen can be different shades of gray
// depending on how long ago it animated in. This differences causes golden flakes.
// Adjust the height by 25 to crop put the home bar. This value may need to be adjusted
// depending on SDK and device type captured in the goldens.
CGRect imageRect = {CGPointZero, CGSizeMake(image.size.width, image.size.height - 25)};
CGImageRef imageRefA = CGImageCreateWithImageInRect(self.image.CGImage, imageRect);
CGImageRef imageRefB = CGImageCreateWithImageInRect(image.CGImage, imageRect);

NSUInteger widthA = CGImageGetWidth(imageRefA);
NSUInteger heightA = CGImageGetHeight(imageRefA);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ - (instancetype)initWithLaunchArg:(NSString*)launchArg {
@"--non-full-screen-flutter-view-platform-view" :
@"non_full_screen_flutter_view_platform_view",
@"--bogus-font-text" : @"bogus_font_text",
@"--spawn-engine-works" : @"spawn_engine_works",
};
});
_identifier = launchArgsMap[launchArg];
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,26 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "SpawnEngineTest.h"
#import "GoldenImage.h"
#import "GoldenPlatformViewTests.h"

@interface SpawnEngineTest : XCTestCase
@end

@implementation SpawnEngineTest

- (void)setUp {
[super setUp];
- (void)testSpawnEngineWorks {
self.continueAfterFailure = NO;

self.application = [[XCUIApplication alloc] init];
self.application.launchArguments = @[ @"--spawn-engine-works", @"--enable-software-rendering" ];
[self.application launch];
}
XCUIApplication* application = [[XCUIApplication alloc] init];
application.launchArguments = @[ @"--spawn-engine-works", @"--enable-software-rendering" ];
[application launch];

- (void)testSpawnEngineWorks {
NSString* prefix = @"golden_spawn_engine_works_";
GoldenImage* golden = [[GoldenImage alloc] initWithGoldenNamePrefix:prefix];
if (!golden.image) {
XCTFail(@"unable to find golden image for: %@", prefix);
}
XCUIScreenshot* screenshot = [[XCUIScreen mainScreen] screenshot];
if (![golden compareGoldenToImage:screenshot.image]) {
XCTAttachment* screenshotAttachment = [XCTAttachment attachmentWithImage:screenshot.image];
screenshotAttachment.name = [golden.goldenName stringByAppendingString:@"_actual"];
screenshotAttachment.lifetime = XCTAttachmentLifetimeKeepAlways;
[self addAttachment:screenshotAttachment];

XCTFail(@"Goldens do not match. Follow the steps in the "
@"README to update golden named %@ if needed.",
golden.goldenName);
}
XCUIElement* addTextField = application.textFields[@"ready"];
XCTAssertTrue([addTextField waitForExistenceWithTimeout:30]);

GoldenTestManager* manager =
[[GoldenTestManager alloc] initWithLaunchArg:@"--spawn-engine-works"];
[manager checkGoldenForTest:self];
}

@end
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ - (void)testPointerHover {
XCTAssertNotEqual(lastHoverSequenceNumber, -1,
@"PointerChange.hover event did not occur for a hover");
NSString* removeMessage = [NSString
stringWithFormat:@"%d,PointerChange.remove,device=0,buttons=0", lastHoverSequenceNumber + 1];
stringWithFormat:@"%ld,PointerChange.remove,device=0,buttons=0", lastHoverSequenceNumber + 1];
XCTAssertTrue([app.textFields[removeMessage] waitForExistenceWithTimeout:1],
@"PointerChange.remove event did not occur for a hover");
}
Expand Down
2 changes: 1 addition & 1 deletion testing/scenario_app/run_ios_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ defaults write com.apple.iphonesimulator RotateWindowWhenSignaledByGuest -int 1
cd $SRC_DIR/out/$FLUTTER_ENGINE/scenario_app/Scenarios
set -o pipefail && xcodebuild -sdk iphonesimulator \
-scheme Scenarios \
-destination 'platform=iOS Simulator,OS=13.0,name=iPhone 8' \
-destination 'platform=iOS Simulator,OS=14.0,name=iPhone 11' \
clean test \
FLUTTER_ENGINE="$FLUTTER_ENGINE"

0 comments on commit 9b74c21

Please sign in to comment.