diff --git a/testing/scenario_app/ios/Scenarios/ScenariosUITests/GoldenImage.m b/testing/scenario_app/ios/Scenarios/ScenariosUITests/GoldenImage.m index 909cac11c7eacc3a6ee3a3e14cbddc60ba4bc838..cc622d7df113965401d45374f4b1e6fdddf0d371 100644 --- a/testing/scenario_app/ios/Scenarios/ScenariosUITests/GoldenImage.m +++ b/testing/scenario_app/ios/Scenarios/ScenariosUITests/GoldenImage.m @@ -5,6 +5,7 @@ #import "GoldenImage.h" #import +#import #include static const double kRmseThreshold = 0.5; @@ -29,6 +30,7 @@ static const double kRmseThreshold = 0.5; - (BOOL)compareGoldenToImage:(UIImage*)image { if (!self.image || !image) { + os_log_error(OS_LOG_DEFAULT, "GOLDEN DIFF FAILED: image does not exists."); return NO; } CGImageRef imageRefA = [self.image CGImage]; @@ -40,6 +42,7 @@ static const double kRmseThreshold = 0.5; NSUInteger heightB = CGImageGetHeight(imageRefB); if (widthA != widthB || heightA != heightB) { + os_log_error(OS_LOG_DEFAULT, "GOLDEN DIFF FAILED: images sizes do not match."); return NO; } NSUInteger bytesPerPixel = 4; @@ -48,6 +51,7 @@ static const double kRmseThreshold = 0.5; NSMutableData* rawB = [NSMutableData dataWithLength:size]; if (!rawA || !rawB) { + os_log_error(OS_LOG_DEFAULT, "GOLDEN DIFF FAILED: image data length do not match."); return NO; } @@ -87,7 +91,14 @@ static const double kRmseThreshold = 0.5; } } double rmse = sqrt(sum / size); - return rmse <= kRmseThreshold; + if (rmse > kRmseThreshold) { + os_log_error( + OS_LOG_DEFAULT, + "GOLDEN DIFF FAILED: image diff greater than threshold. Current diff: %@, threshold: %@", + @(rmse), @(kRmseThreshold)); + return NO; + } + return YES; } NS_INLINE NSString* _platformName() {