mirror of
https://git.tonybark.com/tonytins/Longhorn.git
synced 2026-02-10 08:14:51 -05:00
Initial source commit 🎉
This commit is contained in:
commit
7d823aa78b
12 changed files with 305 additions and 0 deletions
52
Longhorn.Tests/BasicTests.cs
Normal file
52
Longhorn.Tests/BasicTests.cs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
using Godot;
|
||||
using twodog.xunit;
|
||||
|
||||
namespace Longhorn.Tests;
|
||||
|
||||
[Collection("GodotHeadless")]
|
||||
public class BasicTests(GodotHeadlessFixture godot)
|
||||
{
|
||||
[Fact]
|
||||
public void LoadMainScene_Succeeds()
|
||||
{
|
||||
// Arrange
|
||||
var scene = GD.Load<PackedScene>("res://main.tscn");
|
||||
|
||||
// Act
|
||||
var instance = scene.Instantiate();
|
||||
godot.Tree.Root.AddChild(instance);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(instance);
|
||||
Assert.NotNull(instance.GetParent());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PhysicsIteration_Succeeds()
|
||||
{
|
||||
// Arrange & Act
|
||||
godot.Tree.Root.PhysicsInterpolationMode = Node.PhysicsInterpolationModeEnum.Off;
|
||||
godot.GodotInstance.Iteration();
|
||||
|
||||
// Assert - if we get here without crashing, test passes
|
||||
Assert.True(true);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CreateNode_AddsToTree()
|
||||
{
|
||||
// Arrange
|
||||
var node = new Node();
|
||||
node.Name = "TestNode";
|
||||
|
||||
// Act
|
||||
godot.Tree.Root.AddChild(node);
|
||||
|
||||
// Assert
|
||||
Assert.True(godot.Tree.Root.HasNode("TestNode"));
|
||||
Assert.Equal("TestNode", (string)godot.Tree.Root.GetNode("TestNode").Name);
|
||||
|
||||
// Cleanup
|
||||
node.QueueFree();
|
||||
}
|
||||
}
|
||||
7
Longhorn.Tests/GodotHeadlessCollection.cs
Normal file
7
Longhorn.Tests/GodotHeadlessCollection.cs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
using twodog.xunit;
|
||||
using Xunit;
|
||||
|
||||
namespace Longhorn.Tests;
|
||||
|
||||
[CollectionDefinition("GodotHeadless", DisableParallelization = true)]
|
||||
public class GodotHeadlessCollection : ICollectionFixture<GodotHeadlessFixture>;
|
||||
51
Longhorn.Tests/Longhorn.Tests.csproj
Normal file
51
Longhorn.Tests/Longhorn.Tests.csproj
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- 2dog packages -->
|
||||
<ItemGroup>
|
||||
<PackageReference Include="2dog" Version="0.1.10-pre"/>
|
||||
<PackageReference Include="2dog.xunit" Version="0.1.10-pre"/>
|
||||
<PackageReference Include="GodotSharp" Version="4.6.0"/>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Platform-specific native library packages -->
|
||||
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
|
||||
<PackageReference Include="2dog.win-x64" Version="0.1.10-pre"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Linux'))">
|
||||
<PackageReference Include="2dog.linux-x64" Version="0.1.10-pre"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('OSX'))">
|
||||
<PackageReference Include="2dog.osx-arm64" Version="0.1.10-pre"/>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Test framework packages -->
|
||||
<ItemGroup>
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.2"/>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0"/>
|
||||
<PackageReference Include="xunit" Version="2.9.2"/>
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="Xunit"/>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Godot project location -->
|
||||
<PropertyGroup>
|
||||
<GodotProjectDir>../Longhorn/project</GodotProjectDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Remove duplicate Godot.SourceGenerators that come from GodotSharp package
|
||||
(2dog package already embeds them) -->
|
||||
<Target Name="RemoveDuplicateGodotAnalyzers" BeforeTargets="CoreCompile">
|
||||
<ItemGroup>
|
||||
<Analyzer Remove="@(Analyzer)" Condition="$([System.String]::Copy('%(Analyzer.Identity)').Contains('Godot.SourceGenerators'))" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
</Project>
|
||||
Loading…
Add table
Add a link
Reference in a new issue