reload test nodes
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
|
using SharpIDE.Application.Features.Build;
|
||||||
using SharpIDE.Application.Features.Testing;
|
using SharpIDE.Application.Features.Testing;
|
||||||
|
|
||||||
namespace SharpIDE.Godot.Features.TestExplorer;
|
namespace SharpIDE.Godot.Features.TestExplorer;
|
||||||
@@ -7,21 +8,39 @@ public partial class TestExplorerPanel : Control
|
|||||||
{
|
{
|
||||||
[Inject] private readonly SharpIdeSolutionAccessor _solutionAccessor = null!;
|
[Inject] private readonly SharpIdeSolutionAccessor _solutionAccessor = null!;
|
||||||
[Inject] private readonly TestRunnerService _testRunnerService = null!;
|
[Inject] private readonly TestRunnerService _testRunnerService = null!;
|
||||||
|
[Inject] private readonly BuildService _buildService = null!;
|
||||||
|
|
||||||
private readonly PackedScene _testNodeEntryScene = ResourceLoader.Load<PackedScene>("uid://dt50f2of66dlt");
|
private readonly PackedScene _testNodeEntryScene = ResourceLoader.Load<PackedScene>("uid://dt50f2of66dlt");
|
||||||
|
|
||||||
|
private Button _refreshButton = null!;
|
||||||
private VBoxContainer _testNodesVBoxContainer = null!;
|
private VBoxContainer _testNodesVBoxContainer = null!;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
|
_refreshButton = GetNode<Button>("%RefreshButton");
|
||||||
_testNodesVBoxContainer = GetNode<VBoxContainer>("%TestNodesVBoxContainer");
|
_testNodesVBoxContainer = GetNode<VBoxContainer>("%TestNodesVBoxContainer");
|
||||||
_ = Task.GodotRun(AsyncReady);
|
_ = Task.GodotRun(AsyncReady);
|
||||||
|
_refreshButton.Pressed += OnRefreshButtonPressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task AsyncReady()
|
private async Task AsyncReady()
|
||||||
|
{
|
||||||
|
await DiscoverTestNodesForSolution(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnRefreshButtonPressed()
|
||||||
|
{
|
||||||
|
_ = Task.GodotRun(() => DiscoverTestNodesForSolution(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task DiscoverTestNodesForSolution(bool withBuild)
|
||||||
{
|
{
|
||||||
await _solutionAccessor.SolutionReadyTcs.Task;
|
await _solutionAccessor.SolutionReadyTcs.Task;
|
||||||
var solution = _solutionAccessor.SolutionModel!;
|
var solution = _solutionAccessor.SolutionModel!;
|
||||||
|
if (withBuild)
|
||||||
|
{
|
||||||
|
await _buildService.MsBuildAsync(solution.FilePath);
|
||||||
|
}
|
||||||
var testNodes = await _testRunnerService.DiscoverTests(solution);
|
var testNodes = await _testRunnerService.DiscoverTests(solution);
|
||||||
testNodes.ForEach(s => GD.Print(s.DisplayName));
|
testNodes.ForEach(s => GD.Print(s.DisplayName));
|
||||||
var scenes = testNodes.Select(s =>
|
var scenes = testNodes.Select(s =>
|
||||||
|
|||||||
@@ -35,7 +35,8 @@ layout_mode = 2
|
|||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "Test Explorer"
|
text = "Test Explorer"
|
||||||
|
|
||||||
[node name="Button" type="Button" parent="VBoxContainer/MarginContainer/HBoxContainer"]
|
[node name="RefreshButton" type="Button" parent="VBoxContainer/MarginContainer/HBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_constants/icon_max_width = 15
|
theme_override_constants/icon_max_width = 15
|
||||||
icon = ExtResource("2_4bhqg")
|
icon = ExtResource("2_4bhqg")
|
||||||
|
|||||||
Reference in New Issue
Block a user