From 3fc9fb42a072e0a40f48512cc12bdf69b969c28d Mon Sep 17 00:00:00 2001 From: Kuniwak Date: Wed, 8 Nov 2023 17:49:51 +0900 Subject: [PATCH] Use the global counter --- Runtime/Agents/UGUIMonkeyAgent.cs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/Runtime/Agents/UGUIMonkeyAgent.cs b/Runtime/Agents/UGUIMonkeyAgent.cs index 61242e3..857e6c9 100644 --- a/Runtime/Agents/UGUIMonkeyAgent.cs +++ b/Runtime/Agents/UGUIMonkeyAgent.cs @@ -9,6 +9,7 @@ using TestHelper.Monkey; using TestHelper.Monkey.Annotations.Enums; using TestHelper.Monkey.Random; +using TestHelper.Monkey.ScreenshotFilenameStrategies; using TestHelper.Random; using UnityEngine; @@ -66,7 +67,11 @@ public class UGUIMonkeyAgent : AbstractAgent /// public bool defaultScreenshotDirectory = true; - /// + /// + /// Directory path for screenshot images. Create a new directory if directory not exists. + /// If the value is null or empty, + /// Path.Combine(Application.persistentDataPath, "TestHelper.Monkey", "Screenshots") will be used + /// public string screenshotDirectory; /// @@ -74,7 +79,11 @@ public class UGUIMonkeyAgent : AbstractAgent /// public bool defaultScreenshotFilenamePrefix = true; - /// + /// + /// File name prefix for screenshot images. If the value is null or empty, a default value will be used. + /// The default value is the current test name if the agent is running on tests. Otherwise, be a caller method + /// name + /// public string screenshotFilenamePrefix; /// @@ -103,8 +112,11 @@ public override async UniTask Run(CancellationToken token) Screenshots = screenshotEnabled ? new ScreenshotOptions { - Directory = defaultScreenshotDirectory ? null : screenshotDirectory, - FilenamePrefix = defaultScreenshotFilenamePrefix ? null : screenshotFilenamePrefix, + FilePathStrategy = CounterBasedStrategy.Create( + Counter.Global, + defaultScreenshotDirectory ? null : screenshotDirectory, + defaultScreenshotFilenamePrefix ? null : screenshotFilenamePrefix + ), SuperSize = screenshotSuperSize, StereoCaptureMode = screenshotStereoCaptureMode } @@ -150,6 +162,7 @@ public struct RandomStringParametersEntry /// public CharactersKind CharactersKind; + /// /// Returns a ///