mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-03-15 07:43:20 +08:00
6.0鱼定义和测试用例 (#2201)
This commit is contained in:
@@ -3,6 +3,7 @@ using BetterGenshinImpact.GameTask.AutoFishing;
|
||||
using BetterGenshinImpact.GameTask.AutoFishing.Model;
|
||||
using BetterGenshinImpact.GameTask.Model.Area;
|
||||
using BetterGenshinImpact.GameTask.Model.Area.Converter;
|
||||
using BetterGenshinImpact.Helpers.Extensions;
|
||||
using Microsoft.Extensions.Time.Testing;
|
||||
using OpenCvSharp;
|
||||
using System;
|
||||
@@ -15,10 +16,36 @@ namespace BetterGenshinImpact.UnitTest.GameTaskTests.AutoFishingTests
|
||||
{
|
||||
public partial class BehavioursTests
|
||||
{
|
||||
[Fact]
|
||||
/// <summary>
|
||||
/// 测试识别数量不足的鱼饵,由于图标变灰,识别应失败
|
||||
/// </summary>
|
||||
public void FindBaitTest_RecognitionShouldFail()
|
||||
{
|
||||
//
|
||||
Mat mat = new Mat(@$"..\..\..\Assets\AutoFishing\202509141339218213_ChooseBait.png");
|
||||
var imageRegion = new ImageRegion(mat, 0, 0, new DesktopRegion(new FakeMouseSimulator()), converter: new ScaleConverter(1d));
|
||||
|
||||
FakeSystemInfo systemInfo = new FakeSystemInfo(new Vanara.PInvoke.RECT(0, 0, mat.Width, mat.Height), 1);
|
||||
var blackboard = new Blackboard();
|
||||
|
||||
//
|
||||
ChooseBait sut = new ChooseBait("-", blackboard, new FakeLogger(), false, systemInfo, new FakeInputSimulator(), this.session, this.prototypes);
|
||||
var result = sut.FindBait(imageRegion).OrderBy(r => r.Item1.X).ToArray();
|
||||
|
||||
//
|
||||
Assert.Equal(3, result.Length);
|
||||
Assert.Equal(BaitType.FruitPasteBait.GetDescription(), result[0].Item2);
|
||||
Assert.Equal(BaitType.BerryBait.GetDescription(), result[1].Item2);
|
||||
Assert.Null(result[2].Item2);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(@"20250225101300361_ChooseBait_Succeeded.png", new string[] { "medaka", "butterflyfish", "butterflyfish", "pufferfish" })]
|
||||
[InlineData(@"20250226161354285_ChooseBait_Succeeded.png", new string[] { "medaka", "medaka" })] // todo 更新用例
|
||||
[InlineData(@"20250226161354285_ChooseBait_Succeeded.png", new string[] { "medaka" })] // 不稳定的测试用例,因未学习被照亮的场景
|
||||
[InlineData(@"202503160917566615@900p.png", new string[] { "pufferfish" })]
|
||||
[InlineData(@"202509141339218213_ChooseBait.png", new string[] { "axehead fish" })]
|
||||
[InlineData(@"202509141339218213_ChooseBait.png", new string[] { "mauler shark", "crystal eye", "medaka", "medaka", "medaka" })]
|
||||
/// <summary>
|
||||
/// 测试各种选取鱼饵,结果为成功
|
||||
/// </summary>
|
||||
@@ -50,6 +77,7 @@ namespace BetterGenshinImpact.UnitTest.GameTaskTests.AutoFishingTests
|
||||
|
||||
[Theory]
|
||||
[InlineData(@"20250226161354285_ChooseBait_Succeeded.png", new string[] { "koi" })]
|
||||
[InlineData(@"202509141339218213_ChooseBait.png", new string[] { "mauler shark", "crystal eye" })]
|
||||
/// <summary>
|
||||
/// 测试各种选取鱼饵,结果为失败
|
||||
/// </summary>
|
||||
|
||||
@@ -14,7 +14,6 @@ namespace BetterGenshinImpact.UnitTest.GameTaskTests.AutoFishingTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(@"20250225101304534_ThrowRod_Succeeded.png", BaitType.FalseWormBait)]
|
||||
[InlineData(@"20250226162217468_ThrowRod_Succeeded.png", BaitType.FruitPasteBait)]
|
||||
/// <summary>
|
||||
/// 测试各种抛竿,结果为成功
|
||||
/// </summary>
|
||||
@@ -43,6 +42,7 @@ namespace BetterGenshinImpact.UnitTest.GameTaskTests.AutoFishingTests
|
||||
[Theory]
|
||||
[InlineData(@"20250225101304534_ThrowRod_Succeeded.png", BaitType.RedrotBait)]
|
||||
[InlineData(@"20250225101304534_ThrowRod_Succeeded.png", BaitType.FakeFlyBait)]
|
||||
[InlineData(@"20250226162217468_ThrowRod_Succeeded.png", BaitType.FruitPasteBait)]
|
||||
/// <summary>
|
||||
/// 测试各种抛竿,未满足HutaoFisher判定,结果为运行中
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user