-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from chickensoft-games/fix/multiple-deps-per-pr…
…ovider fix: correct dependency resolution for dependents that rely on more than one dependency from the same provider
- Loading branch information
Showing
10 changed files
with
117 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
Chickensoft.AutoInject.Tests/test/fixtures/MultiProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
namespace Chickensoft.AutoInject.Tests.Fixtures; | ||
|
||
using Chickensoft.AutoInject; | ||
using Chickensoft.AutoInject.Tests.Subjects; | ||
using Godot; | ||
using SuperNodes.Types; | ||
|
||
[SuperNode(typeof(Provider))] | ||
public partial class MultiProvider : Node2D, IProvide<int>, IProvide<string> { | ||
public override partial void _Notification(int what); | ||
|
||
int IProvide<int>.Value() => IntValue; | ||
string IProvide<string>.Value() => StringValue; | ||
|
||
public MultiDependent Child { get; private set; } = default!; | ||
|
||
public override void _Ready() { | ||
Child = new MultiDependent(); | ||
AddChild(Child); | ||
|
||
Provide(); | ||
} | ||
|
||
public bool OnProvidedCalled { get; private set; } | ||
public int IntValue { get; set; } | ||
public string StringValue { get; set; } = ""; | ||
|
||
public void OnProvided() => OnProvidedCalled = true; | ||
} |
6 changes: 6 additions & 0 deletions
6
Chickensoft.AutoInject.Tests/test/fixtures/MultiProvider.tscn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[gd_scene load_steps=2 format=3 uid="uid://bby7an0ngn7l6"] | ||
|
||
[ext_resource type="Script" path="res://test/fixtures/MultiProvider.cs" id="1_gn2k1"] | ||
|
||
[node name="MultiProvider" type="Node2D"] | ||
script = ExtResource("1_gn2k1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
Chickensoft.AutoInject.Tests/test/src/MultiResolutionTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
namespace Chickensoft.GodotGame; | ||
|
||
using System.Threading.Tasks; | ||
using Chickensoft.AutoInject.Tests.Fixtures; | ||
using Chickensoft.GoDotTest; | ||
using Godot; | ||
using GodotTestDriver; | ||
using GodotTestDriver.Util; | ||
using Shouldly; | ||
|
||
#pragma warning disable CA1001 | ||
public class MultiResolutionTest : TestClass { | ||
private Fixture _fixture = default!; | ||
private MultiProvider _provider = default!; | ||
|
||
public MultiResolutionTest(Node testScene) : base(testScene) { } | ||
|
||
[Setup] | ||
public async Task Setup() { | ||
_fixture = new Fixture(TestScene.GetTree()); | ||
_provider = await _fixture.LoadAndAddScene<MultiProvider>( | ||
"res://test/fixtures/MultiProvider.tscn" | ||
); | ||
} | ||
|
||
[Cleanup] | ||
public void Cleanup() => _fixture.Cleanup(); | ||
|
||
[Test] | ||
public async Task MultiDependentSubscribesToMultiProviderCorrectly() { | ||
_provider.Child.ReadyCalled.ShouldBeTrue(); | ||
await TestScene.ProcessFrame(2); | ||
_provider.Child.OnResolvedCalled.ShouldBeTrue(); | ||
} | ||
} | ||
#pragma warning restore CA1001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,6 @@ | |
"rollForward": "latestMinor" | ||
}, | ||
"msbuild-sdks": { | ||
"Godot.NET.Sdk": "4.0.2" | ||
"Godot.NET.Sdk": "4.0.4" | ||
} | ||
} |