Skip to content

Commit

Permalink
Use the global counter
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuniwak committed Nov 8, 2023
1 parent 50dc5e4 commit 3fc9fb4
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions Runtime/Agents/UGUIMonkeyAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -66,15 +67,23 @@ public class UGUIMonkeyAgent : AbstractAgent
/// </summary>
public bool defaultScreenshotDirectory = true;

/// <inheritdoc cref="ScreenshotOptions.Directory" />
/// <summary>
/// Directory path for screenshot images. Create a new directory if directory not exists.
/// If the value is null or empty,
/// <c>Path.Combine(Application.persistentDataPath, "TestHelper.Monkey", "Screenshots")</c> will be used
/// </summary>
public string screenshotDirectory;

/// <summary>
/// Whether using a default file name prefix or specifying manually
/// </summary>
public bool defaultScreenshotFilenamePrefix = true;

/// <inheritdoc cref="ScreenshotOptions.FilenamePrefix" />
/// <summary>
/// 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
/// </summary>
public string screenshotFilenamePrefix;

/// <inheritdoc cref="ScreenshotOptions.SuperSize" />
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -150,6 +162,7 @@ public struct RandomStringParametersEntry
/// <inheritdoc cref="RandomStringParameters.CharactersKind" />
public CharactersKind CharactersKind;


/// <summary>
/// Returns a <c cref="RandomStringParameters" />
/// </summary>
Expand Down

0 comments on commit 3fc9fb4

Please sign in to comment.