blob: 24419a649910bc777a9f8b6f1bae96d98d5218a4 [file] [log] [blame]
// Copyright 2013 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 "GoldenPlatformViewTests.h"
static const NSInteger kSecondsToWaitForPlatformView = 30;
@interface PlatformViewUITests : GoldenPlatformViewTests
@end
@implementation PlatformViewUITests
- (instancetype)initWithInvocation:(NSInvocation*)invocation {
PlatformViewGoldenTestManager* manager =
[[PlatformViewGoldenTestManager alloc] initWithLaunchArg:@"--platform-view"];
return [super initWithManager:manager invocation:invocation];
}
- (void)testPlatformView {
[self checkGolden];
}
@end
@interface MultiplePlatformViewsTest : GoldenPlatformViewTests
@end
@implementation MultiplePlatformViewsTest
- (instancetype)initWithInvocation:(NSInvocation*)invocation {
PlatformViewGoldenTestManager* manager =
[[PlatformViewGoldenTestManager alloc] initWithLaunchArg:@"--platform-view-multiple"];
return [super initWithManager:manager invocation:invocation];
}
- (void)testPlatformView {
[self checkGolden];
}
@end
@interface MultiplePlatformViewsBackgroundForegroundTest : GoldenPlatformViewTests
@end
@implementation MultiplePlatformViewsBackgroundForegroundTest
- (instancetype)initWithInvocation:(NSInvocation*)invocation {
PlatformViewGoldenTestManager* manager = [[PlatformViewGoldenTestManager alloc]
initWithLaunchArg:@"--platform-view-multiple-background-foreground"];
return [super initWithManager:manager invocation:invocation];
}
- (void)testPlatformView {
[[XCUIDevice sharedDevice] pressButton:XCUIDeviceButtonHome];
[self.application activate];
[self checkGolden];
}
@end
// Clip Rect Tests
@interface PlatformViewMutationClipRectTests : GoldenPlatformViewTests
@end
@implementation PlatformViewMutationClipRectTests
- (instancetype)initWithInvocation:(NSInvocation*)invocation {
PlatformViewGoldenTestManager* manager =
[[PlatformViewGoldenTestManager alloc] initWithLaunchArg:@"--platform-view-cliprect"];
return [super initWithManager:manager invocation:invocation];
}
- (void)testPlatformView {
[self checkGolden];
}
@end
@interface PlatformViewMutationClipRRectTests : GoldenPlatformViewTests
@end
@implementation PlatformViewMutationClipRRectTests
- (instancetype)initWithInvocation:(NSInvocation*)invocation {
PlatformViewGoldenTestManager* manager =
[[PlatformViewGoldenTestManager alloc] initWithLaunchArg:@"--platform-view-cliprrect"];
return [super initWithManager:manager invocation:invocation];
}
- (void)testPlatformView {
[self checkGolden];
}
@end
@interface PlatformViewMutationClipPathTests : GoldenPlatformViewTests
@end
@implementation PlatformViewMutationClipPathTests
- (instancetype)initWithInvocation:(NSInvocation*)invocation {
PlatformViewGoldenTestManager* manager =
[[PlatformViewGoldenTestManager alloc] initWithLaunchArg:@"--platform-view-clippath"];
return [super initWithManager:manager invocation:invocation];
}
- (void)testPlatformView {
[self checkGolden];
}
@end
@interface PlatformViewMutationTransformTests : GoldenPlatformViewTests
@end
@implementation PlatformViewMutationTransformTests
- (instancetype)initWithInvocation:(NSInvocation*)invocation {
PlatformViewGoldenTestManager* manager =
[[PlatformViewGoldenTestManager alloc] initWithLaunchArg:@"--platform-view-transform"];
return [super initWithManager:manager invocation:invocation];
}
- (void)testPlatformView {
[self checkGolden];
}
@end
@interface PlatformViewMutationOpacityTests : GoldenPlatformViewTests
@end
@implementation PlatformViewMutationOpacityTests
- (instancetype)initWithInvocation:(NSInvocation*)invocation {
PlatformViewGoldenTestManager* manager =
[[PlatformViewGoldenTestManager alloc] initWithLaunchArg:@"--platform-view-opacity"];
return [super initWithManager:manager invocation:invocation];
}
- (void)testPlatformView {
[self checkGolden];
}
@end
@interface PlatformViewRotation : GoldenPlatformViewTests
@end
@implementation PlatformViewRotation
- (instancetype)initWithInvocation:(NSInvocation*)invocation {
PlatformViewGoldenTestManager* manager =
[[PlatformViewGoldenTestManager alloc] initWithLaunchArg:@"--platform-view-rotate"];
return [super initWithManager:manager invocation:invocation];
}
- (void)tearDown {
XCUIDevice.sharedDevice.orientation = UIDeviceOrientationPortrait;
[super tearDown];
}
- (void)testPlatformView {
XCUIDevice.sharedDevice.orientation = UIDeviceOrientationLandscapeLeft;
[self checkGolden];
}
@end
@interface PlatformViewWithContinuousTexture : XCTestCase
@end
@implementation PlatformViewWithContinuousTexture
- (void)setUp {
self.continueAfterFailure = NO;
}
- (void)testPlatformViewWithContinuousTexture {
XCUIApplication* app = [[XCUIApplication alloc] init];
app.launchArguments =
@[ @"--platform-view-with-continuous-texture", @"--with-continuous-texture" ];
[app launch];
XCUIElement* platformView = app.textViews.firstMatch;
BOOL exists = [platformView waitForExistenceWithTimeout:kSecondsToWaitForPlatformView];
if (!exists) {
XCTFail(@"It took longer than %@ second to find the platform view."
@"There might be issues with the platform view's construction,"
@"or with how the scenario is built.",
@(kSecondsToWaitForPlatformView));
}
XCTAssertNotNil(platformView);
}
@end