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

Commit 301eba3

Browse files
committed
review and fix broken test
1 parent 9a8d741 commit 301eba3

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

testing/scenario_app/ios/Scenarios/Scenarios.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
/* Begin PBXBuildFile section */
1010
0A02E8F724EFAD27002D54E5 /* BogusFontTextTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A02E8F624EFAD27002D54E5 /* BogusFontTextTest.m */; };
11-
0A02E8F924EFB1F5002D54E5 /* golden_bogus_font_text_iPhone 8_simulator.png in Resources */ = {isa = PBXBuildFile; fileRef = 0A02E8F824EFB1F5002D54E5 /* golden_bogus_font_text_iPhone 8_simulator.png */; };
11+
0A19E18D2540B6AF00D34505 /* golden_bogus_font_text_iPhone 8_simulator.png in Resources */ = {isa = PBXBuildFile; fileRef = 0A19E18C2540B6AE00D34505 /* golden_bogus_font_text_iPhone 8_simulator.png */; };
1212
0A42BFB42447E179007E212E /* TextSemanticsFocusTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A42BFB32447E179007E212E /* TextSemanticsFocusTest.m */; };
1313
0A57B3BD2323C4BD00DD9521 /* ScreenBeforeFlutter.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A57B3BC2323C4BD00DD9521 /* ScreenBeforeFlutter.m */; };
1414
0A57B3BF2323C74200DD9521 /* FlutterEngine+ScenariosTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A57B3BE2323C74200DD9521 /* FlutterEngine+ScenariosTest.m */; };
@@ -110,7 +110,7 @@
110110

111111
/* Begin PBXFileReference section */
112112
0A02E8F624EFAD27002D54E5 /* BogusFontTextTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BogusFontTextTest.m; sourceTree = "<group>"; };
113-
0A02E8F824EFB1F5002D54E5 /* golden_bogus_font_text_iPhone 8_simulator.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "golden_bogus_font_text_iPhone 8_simulator.png"; sourceTree = "<group>"; };
113+
0A19E18C2540B6AE00D34505 /* golden_bogus_font_text_iPhone 8_simulator.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "golden_bogus_font_text_iPhone 8_simulator.png"; sourceTree = "<group>"; };
114114
0A42BFB32447E179007E212E /* TextSemanticsFocusTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TextSemanticsFocusTest.m; sourceTree = "<group>"; };
115115
0A42BFB52447E19F007E212E /* TextSemanticsFocusTest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TextSemanticsFocusTest.h; sourceTree = "<group>"; };
116116
0A57B3BB2323C4BD00DD9521 /* ScreenBeforeFlutter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScreenBeforeFlutter.h; sourceTree = "<group>"; };
@@ -249,7 +249,7 @@
249249
children = (
250250
4F06F1B124731F66000AF246 /* LocalizationInitializationTest.m */,
251251
6402EBD024147BDA00987DCB /* UnobstructedPlatformViewTests.m */,
252-
0A02E8F824EFB1F5002D54E5 /* golden_bogus_font_text_iPhone 8_simulator.png */,
252+
0A19E18C2540B6AE00D34505 /* golden_bogus_font_text_iPhone 8_simulator.png */,
253253
0D14A3FD239743190013D873 /* golden_platform_view_rotate_iPhone SE_simulator.png */,
254254
3DE09E8B23C010BC006C9851 /* golden_platform_view_clippath_iPhone 8_simulator.png */,
255255
3DE09E9223C010BD006C9851 /* golden_platform_view_cliprect_iPhone 8_simulator.png */,
@@ -417,11 +417,11 @@
417417
buildActionMask = 2147483647;
418418
files = (
419419
3DEF491623C3BE6500184216 /* golden_platform_view_multiple_background_foreground_iPhone 8_simulator.png in Resources */,
420-
0A02E8F924EFB1F5002D54E5 /* golden_bogus_font_text_iPhone 8_simulator.png in Resources */,
421420
3DEF491323C3BE6500184216 /* golden_platform_view_cliprect_iPhone 8_simulator.png in Resources */,
422421
3DEF491523C3BE6500184216 /* golden_platform_view_iPhone 8_simulator.png in Resources */,
423422
0D14A3FE239743190013D873 /* golden_platform_view_rotate_iPhone SE_simulator.png in Resources */,
424423
3DEF491823C3BE6500184216 /* golden_platform_view_opacity_iPhone 8_simulator.png in Resources */,
424+
0A19E18D2540B6AF00D34505 /* golden_bogus_font_text_iPhone 8_simulator.png in Resources */,
425425
3DEF491723C3BE6500184216 /* golden_platform_view_multiple_iPhone 8_simulator.png in Resources */,
426426
3DEF491223C3BE6500184216 /* golden_platform_view_clippath_iPhone 8_simulator.png in Resources */,
427427
3DEF491423C3BE6500184216 /* golden_platform_view_cliprrect_iPhone 8_simulator.png in Resources */,

testing/scenario_app/ios/Scenarios/Scenarios.xcodeproj/xcshareddata/xcschemes/Scenarios.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
</CommandLineArgument>
8181
<CommandLineArgument
8282
argument = "--bogus-font-text"
83-
isEnabled = "YES">
83+
isEnabled = "NO">
8484
</CommandLineArgument>
8585
<CommandLineArgument
8686
argument = "--text-semantics-focus"

testing/scenario_app/ios/Scenarios/ScenariosUITests/GoldenTestManager.m

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,23 @@ - (void)checkGoldenForTest:(XCTestCase*)test {
4848
XCUIScreenshot* screenshot = [[XCUIScreen mainScreen] screenshot];
4949
if (!_goldenImage.image) {
5050
XCTAttachment* attachment = [XCTAttachment attachmentWithScreenshot:screenshot];
51-
attachment.name = @"new_golden";
51+
attachment.name = [_goldenImage.goldenName stringByAppendingString:@"_new"];
5252
attachment.lifetime = XCTAttachmentLifetimeKeepAlways;
5353
[test addAttachment:attachment];
54-
XCTFail(@"This test will fail - no golden named %@ found. Follow the steps in the "
55-
@"README to add a new golden.",
54+
// Instead of XCTFail because that definition changed between Xcode 11 and 12 whereas this impl
55+
// is stable.
56+
_XCTPrimitiveFail(test, @"This test will fail - no golden named %@ found. "
57+
@"Follow the steps in the README to add a new golden.",
5658
_goldenImage.goldenName);
5759
}
5860

5961
if (![_goldenImage compareGoldenToImage:screenshot.image]) {
60-
XCTAttachment* screenshotAttachment;
61-
screenshotAttachment = [XCTAttachment attachmentWithImage:screenshot.image];
62-
screenshotAttachment.name = _goldenImage.goldenName;
62+
XCTAttachment* screenshotAttachment = [XCTAttachment attachmentWithImage:screenshot.image];
63+
screenshotAttachment.name = [_goldenImage.goldenName stringByAppendingString:@"_actual"];
6364
screenshotAttachment.lifetime = XCTAttachmentLifetimeKeepAlways;
6465
[test addAttachment:screenshotAttachment];
6566

66-
XCTFail(@"Goldens to not match. Follow the steps in the "
67+
_XCTPrimitiveFail(test, @"Goldens do not match. Follow the steps in the "
6768
@"README to update golden named %@ if needed.",
6869
_goldenImage.goldenName);
6970
}
528 Bytes
Loading

0 commit comments

Comments
 (0)