Flutter Engine
GoldenPlatformViewTests Class Reference

#import <GoldenPlatformViewTests.h>

Inheritance diagram for GoldenPlatformViewTests:
MultiplePlatformViewsBackgroundForegroundTest MultiplePlatformViewsTest PlatformViewMutationClipPathTests PlatformViewMutationClipRectTests PlatformViewMutationClipRRectTests PlatformViewMutationOpacityTests PlatformViewMutationTransformTests PlatformViewRotation PlatformViewUITests

Instance Methods

(instancetype) - initWithManager:invocation:
 
(void) - checkGolden
 

Properties

XCUIApplication * application
 

Detailed Description

Definition at line 18 of file GoldenPlatformViewTests.h.

Method Documentation

◆ checkGolden()

- (void) checkGolden

Definition at line 40 of file GoldenPlatformViewTests.m.

References GoldenImage::goldenName, GoldenImage::image, and kSecondsToWaitForPlatformView.

40  {
41  XCUIElement* element = self.application.textViews.firstMatch;
42  BOOL exists = [element waitForExistenceWithTimeout:kSecondsToWaitForPlatformView];
43  if (!exists) {
44  XCTFail(@"It took longer than %@ second to find the platform view."
45  @"There might be issues with the platform view's construction,"
46  @"or with how the scenario is built.",
48  }
49 
50  GoldenImage* golden = self.manager.goldenImage;
51 
52  XCUIScreenshot* screenshot = [[XCUIScreen mainScreen] screenshot];
53  if (!golden.image) {
54  XCTAttachment* attachment = [XCTAttachment attachmentWithScreenshot:screenshot];
55  attachment.name = @"new_golden";
56  attachment.lifetime = XCTAttachmentLifetimeKeepAlways;
57  [self addAttachment:attachment];
58  XCTFail(@"This test will fail - no golden named %@ found. Follow the steps in the "
59  @"README to add a new golden.",
60  golden.goldenName);
61  }
62 
63  if (![golden compareGoldenToImage:screenshot.image]) {
64  XCTAttachment* screenshotAttachment;
65  screenshotAttachment = [XCTAttachment attachmentWithImage:screenshot.image];
66  screenshotAttachment.name = golden.goldenName;
67  screenshotAttachment.lifetime = XCTAttachmentLifetimeKeepAlways;
68  [self addAttachment:screenshotAttachment];
69 
70  XCTFail(@"Goldens to not match. Follow the steps in the "
71  @"README to update golden named %@ if needed.",
72  golden.goldenName);
73  }
74 }
static const NSInteger kSecondsToWaitForPlatformView
NSString * goldenName
Definition: GoldenImage.h:11
UIImage * image
Definition: GoldenImage.h:12

◆ initWithManager:invocation:()

- (instancetype) initWithManager: (PlatformViewGoldenTestManager*)  manager
invocation: (NSInvocation*)  invocation 

Definition at line 23 of file GoldenPlatformViewTests.m.

24  invocation:(NSInvocation*)invocation {
25  self = [super initWithInvocation:invocation];
26  _manager = manager;
27  return self;
28 }

Property Documentation

◆ application

- (XCUIApplication*) application
readwritenonatomicstrong

Definition at line 20 of file GoldenPlatformViewTests.h.


The documentation for this class was generated from the following files: