Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
140 changes: 75 additions & 65 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 = "1300"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,8 @@ - (BOOL)compareGoldenToImage:(UIImage*)image {
os_log_error(OS_LOG_DEFAULT, "GOLDEN DIFF FAILED: image does not exists.");
return NO;
}

// 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);
CGImageRef imageRefA = [self.image CGImage];
CGImageRef imageRefB = [image CGImage];

NSUInteger widthA = CGImageGetWidth(imageRefA);
NSUInteger heightA = CGImageGetHeight(imageRefA);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ - (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
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright 2020 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import <XCTest/XCTest.h>

NS_ASSUME_NONNULL_BEGIN

@interface SpawnEngineTest : XCTestCase
@property(nonatomic, strong) XCUIApplication* application;
@end

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

#import "GoldenPlatformViewTests.h"

@interface SpawnEngineTest : XCTestCase
@end
#import "SpawnEngineTest.h"
#import "GoldenImage.h"

@implementation SpawnEngineTest

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

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

XCUIElement* addTextField = application.textFields[@"ready"];
XCTAssertTrue([addTextField waitForExistenceWithTimeout:30]);
self.application = [[XCUIApplication alloc] init];
self.application.launchArguments = @[ @"--spawn-engine-works", @"--enable-software-rendering" ];
[self.application launch];
}

GoldenTestManager* manager =
[[GoldenTestManager alloc] initWithLaunchArg:@"--spawn-engine-works"];
[manager checkGoldenForTest:self];
- (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);
}
}

@end
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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:@"%ld,PointerChange.remove,device=0,buttons=0", lastHoverSequenceNumber + 1];
stringWithFormat:@"%d,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=14.0,name=iPhone 11' \
-destination 'platform=iOS Simulator,OS=13.0,name=iPhone 8' \
clean test \
FLUTTER_ENGINE="$FLUTTER_ENGINE"