GodotComponentTest/tests/StreamContainerTests.cs

49 lines
1.4 KiB
C#
Raw Normal View History

2023-08-28 14:48:54 +02:00
using Godot;
using GoDotTest;
namespace GodotComponentTest.tests;
2023-11-18 22:32:57 +01:00
public class StreamContainerTests : TestClass {
private readonly Node _testScene;
2023-08-28 14:48:54 +02:00
private TileWorld _tileWorld;
private StreamContainer _streamContainer;
2023-11-18 22:32:57 +01:00
private readonly PackedScene _tileWorldScene = GD.Load<PackedScene>("res://scenes/TileWorld.tscn");
private readonly PackedScene _streamContainerScene = GD.Load<PackedScene>("res://scenes/StreamContainer.tscn");
public StreamContainerTests(Node testScene) : base(testScene) {
2023-08-28 14:48:54 +02:00
_testScene = testScene;
}
[Setup]
2023-11-18 22:32:57 +01:00
public void Setup() {
_tileWorld = (TileWorld)_tileWorldScene.Instance();
2023-08-28 14:48:54 +02:00
_tileWorld.HexGrid = new HexGrid();
_testScene.AddChild(_tileWorld);
2023-11-18 22:32:57 +01:00
_streamContainer = (StreamContainer)_streamContainerScene.Instance();
2023-08-28 14:48:54 +02:00
2023-11-18 22:32:57 +01:00
foreach (Node node in _testScene.GetChildren()) {
if (node is TileWorld) {
2023-08-28 14:48:54 +02:00
_streamContainer.World = node.GetPath();
}
}
_testScene.AddChild(_streamContainer);
}
[Cleanup]
2023-11-18 22:32:57 +01:00
public void Cleanup() {
foreach (Node node in _testScene.GetChildren()) {
2023-08-28 14:48:54 +02:00
node.QueueFree();
}
2023-11-18 22:32:57 +01:00
2023-08-28 14:48:54 +02:00
_streamContainer.QueueFree();
_tileWorld.QueueFree();
}
[Test]
2023-11-18 22:32:57 +01:00
public void Plane2DDistSimple() {
2023-08-28 14:48:54 +02:00
// _streamContainer.UpdateRects(new Vector2(0, 0));
// _streamContainer.UpdateRects(new Vector2(1, 0));
}
}