mirror of
https://git.tonybark.com/tonytins/CyberBits.git
synced 2026-05-12 05:23:34 -04:00
Initial migration to the new 2dog project project structure
This commit is contained in:
parent
55044ae4b8
commit
1f2032dcf8
34 changed files with 830 additions and 96 deletions
52
CyberBits.Tests/BasicTests.cs
Normal file
52
CyberBits.Tests/BasicTests.cs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
using Godot;
|
||||
using twodog.xunit;
|
||||
|
||||
namespace CyberBits.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();
|
||||
}
|
||||
}
|
||||
59
CyberBits.Tests/CyberBits.Tests.csproj
Normal file
59
CyberBits.Tests/CyberBits.Tests.csproj
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- 2dog packages -->
|
||||
<ItemGroup>
|
||||
<PackageReference Include="2dog" Version="0.1.23-pre"/>
|
||||
<PackageReference Include="2dog.xunit" Version="0.1.23-pre"/>
|
||||
<PackageReference Include="GodotSharp" Version="4.6.2"/>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Platform-specific native library packages -->
|
||||
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
|
||||
<PackageReference Include="2dog.win-x64" Version="4.6.2.0"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Linux'))">
|
||||
<PackageReference Include="2dog.linux-x64" Version="4.6.2.0"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('OSX'))">
|
||||
<PackageReference Include="2dog.osx-arm64" Version="4.6.2.0"/>
|
||||
</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>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../CyberBits.Godot/CyberBits.Godot.csproj"/>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Godot project location -->
|
||||
<PropertyGroup>
|
||||
<GodotProjectDir>../CyberBits.Godot</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>
|
||||
7
CyberBits.Tests/GodotHeadlessCollection.cs
Normal file
7
CyberBits.Tests/GodotHeadlessCollection.cs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
using twodog.xunit;
|
||||
using Xunit;
|
||||
|
||||
namespace CyberBits.Tests;
|
||||
|
||||
[CollectionDefinition("GodotHeadless", DisableParallelization = true)]
|
||||
public class GodotHeadlessCollection : ICollectionFixture<GodotHeadlessFixture>;
|
||||
4
CyberBits.Tests/xunit.runner.json
Normal file
4
CyberBits.Tests/xunit.runner.json
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"$schema": "https://xunit.net/schema/current/xunit.runner.schema.json",
|
||||
"parallelizeTestCollections": false
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue