Compare commits

..

5 Commits

Author SHA1 Message Date
de41bbeb8d some other tests
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 20s
Create tag and build when new code gets to main / Export (push) Successful in 5m5s
2026-02-23 15:22:57 +01:00
a4873f183c back with more tests 2026-02-22 17:25:45 +01:00
d37ae8d26c remove tests from ci for now because the loading of the runtime is broken and 2dog might change that, but when it's available 2026-02-22 17:24:12 +01:00
5227fedf15 trying to fix CI
Some checks failed
Create tag and build when new code gets to main / BumpTag (push) Successful in 19s
Create tag and build when new code gets to main / Export (push) Successful in 6m2s
Create tag and build when new code gets to main / Test (push) Failing after 8m46s
2026-02-22 17:13:51 +01:00
c9738d9c61 bis
Some checks failed
Create tag and build when new code gets to main / BumpTag (push) Successful in 20s
Create tag and build when new code gets to main / Export (push) Successful in 6m8s
Create tag and build when new code gets to main / Test (push) Failing after 8m43s
2026-02-22 16:49:58 +01:00
8 changed files with 155 additions and 40 deletions

View File

@@ -9,6 +9,7 @@ on:
env:
GODOT_VERSION: 4.6
DOTNET_VERSION: 'net9.0'
GAME_NAME: MovementTests
ITCHIO_USERNAME: Minimata
ITCHIO_GAMEID: MovementTests
@@ -38,32 +39,47 @@ jobs:
INITIAL_VERSION: 0.1.0
DEFAULT_BUMP: patch
Test:
runs-on: godot
# env:
# RUNNER_TOOL_CACHE: /toolcache # Runner Tool Cache
steps:
- name: Checkout with LFS
uses: https://git.game-dev.space/minimata/checkout-with-lfs.git@main
- name: Run tests
uses: godot-gdunit-labs/gdUnit4-action@v1
with:
godot-version: ${GODOT_VERSION}
godot-net: true
godot-force-mono: true
dotnet-version: 'net9.0'
paths: |
res://tests/
publish-report: false
upload-report: false
arguments: "--verbose --headless --import"
- name: Upload test report
uses: actions/upload-artifact@v3-node20
with:
name: Test Report
path: ${{ github.workspace }}/reports/test-result.html
# Test:
# runs-on: godot
## env:
## RUNNER_TOOL_CACHE: /toolcache # Runner Tool Cache
# steps:
# - name: Checkout with LFS
# uses: https://git.game-dev.space/minimata/checkout-with-lfs.git@main
#
# - name: Setup Godot
# id: setup-godot
# uses: https://git.game-dev.space/minimata/setup-godot.git@main
# with:
# godot-version: ${GODOT_VERSION}
# dotnet-version: ${DOTNET_VERSION}
#
# - name: Run C# Tests
# env:
# GODOT_BIN: ${{ steps.setup-godot.outputs.godot_bin }}
# shell: bash
# run: |
# dotnet test --no-build --settings .runsettings --results-directory ./reports --logger "console;verbosity=normal" --logger "trx;LogFileName=results.xml" -- GdUnit4.Parameters="--verbose --headless --import"
#
## - name: Run tests
## uses: godot-gdunit-labs/gdUnit4-action@v1
## with:
## godot-version: ${GODOT_VERSION}
## godot-net: true
## godot-force-mono: true
## dotnet-version: ${DOTNET_VERSION}
## paths: |
## res://tests/
## publish-report: false
## upload-report: false
## console-verbosity: 'normal'
## arguments: "--verbose --headless --import"
#
# - name: Upload test report
# uses: actions/upload-artifact@v3-node20
# with:
# name: Test Report
# path: ${{ github.workspace }}/reports/test-result.html
Export:
runs-on: godot
@@ -78,8 +94,8 @@ jobs:
id: setup-godot
uses: https://git.game-dev.space/minimata/setup-godot.git@main
with:
godot-version: '4.6'
dotnet-version: 'net9.0'
godot-version: ${GODOT_VERSION}
dotnet-version: ${DOTNET_VERSION}
- name: Remove GDUnit addon
run: |

7
.gitignore vendored
View File

@@ -16,3 +16,10 @@
*.translation
.output.txt
*.suo
*.user
_ReSharper.*
bin
obj
packages

View File

@@ -125,6 +125,8 @@
</ItemGroup>
<ItemGroup>
<Folder Include="addons\" />
<Folder Include="tests\components\" />
<Folder Include="tests\enemies\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="RustyOptions" Version="0.10.1" />

View File

@@ -20,7 +20,6 @@
[ext_resource type="PackedScene" uid="uid://b8aet6m4m2i83" path="res://scenes/tuto_trigger/TutoTrigger.tscn" id="16_qwuk2"]
[ext_resource type="Texture2D" uid="uid://com0lpfuol6vk" path="res://assets/ui/input-prompts/Xbox Series/Vector/xbox_stick_r.svg" id="17_rmfv1"]
[ext_resource type="PackedScene" uid="uid://kktuyhbd5xgc" path="res://menus/scenes/overlaid_menus/tuto_got_sword.tscn" id="17_t0d86"]
[ext_resource type="Texture2D" uid="uid://cjh5cnvdbq5ku" path="res://assets/ui/input-prompts/Xbox Series/Vector/xbox_button_b_outline.svg" id="19_efsse"]
[ext_resource type="Texture2D" uid="uid://nrhxjdpuje3f" path="res://assets/ui/input-prompts/Xbox Series/Vector/xbox_lt_outline.svg" id="20_crf87"]
[ext_resource type="Texture2D" uid="uid://dyjvbsvbriii4" path="res://assets/ui/input-prompts/Xbox Series/Vector/xbox_rb_outline.svg" id="23_p287n"]
[ext_resource type="PackedScene" uid="uid://c305mfrtumcyq" path="res://scenes/spawners/spawner.tscn" id="24_qwuk2"]
@@ -295,8 +294,6 @@ shape = SubResource("BoxShape3D_p287n")
[node name="TutoJump" parent="TutoTriggers" unique_id=1236312197 instance=ExtResource("16_qwuk2")]
transform = Transform3D(0.14133328, 0, 0.98996216, 0, 1, 0, -0.98996216, 0, 0.14133328, -0.32653046, 1.2493286, -50.374645)
first_input_texture = ExtResource("16_2k3fr")
second_input_texture = ExtResource("16_2k3fr")
tuto_text = "Double jump"
[node name="CollisionShape3D" type="CollisionShape3D" parent="TutoTriggers/TutoJump" unique_id=1841634666]
@@ -305,8 +302,6 @@ shape = SubResource("BoxShape3D_5hbxb")
[node name="TutoDash" parent="TutoTriggers" unique_id=1813720328 instance=ExtResource("16_qwuk2")]
transform = Transform3D(0.14133328, 0, 0.98996216, 0, 1, 0, -0.98996216, 0, 0.14133328, 19.967693, 1.2493286, -47.47731)
first_input_texture = ExtResource("16_crf87")
second_input_texture = ExtResource("19_efsse")
tuto_text = "Dash"
[node name="CollisionShape3D" type="CollisionShape3D" parent="TutoTriggers/TutoDash" unique_id=1004053358]
@@ -333,8 +328,6 @@ shape = SubResource("BoxShape3D_3wccx")
[node name="TutoDash2" parent="TutoTriggers" unique_id=1653612119 instance=ExtResource("16_qwuk2")]
transform = Transform3D(0.14133325, 0, 0.98996216, 0, 1, 0, -0.98996216, 0, 0.14133325, 28.885735, 27.749329, 25.360323)
first_input_texture = ExtResource("19_efsse")
complex_input_text = "against wall"
tuto_text = "Wall run"
[node name="CollisionShape3D" type="CollisionShape3D" parent="TutoTriggers/TutoDash2" unique_id=710186954]

View File

@@ -0,0 +1,50 @@
using System.Threading.Tasks;
using Godot;
using GodotStateCharts;
namespace Movementtests.tests;
using GdUnit4;
using static GdUnit4.Assertions;
[TestSuite, RequireGodotRuntime]
public class PlayerInteractionsTest
{
private ISceneRunner _runner;
private Node _scene;
private PlayerController _player;
private readonly float _tolerance = 0.01f;
private readonly Vector3 _vectorTolerance = new Vector3(0.01f, 0.01f, 0.01f);
[BeforeTest]
public void SetupTest()
{
_runner = ISceneRunner.Load("res://tests/player/interactions/player_interactions_scene.tscn");
_scene = _runner.Scene()!;
var player = _scene.FindChild("Player") as PlayerController;
_player = player!;
}
[AfterTest]
public void CleanupTest() {}
[TestCase("BaseLocation")]
public async Task PlayerMoveForward(string markerName)
{
var marker = _scene.FindChild(markerName) as Marker3D;
AssertObject(marker).IsNotNull();
_player.GlobalPosition = marker!.GlobalPosition;
await _runner.AwaitIdleFrame();
var startPos = _player.GlobalPosition;
_runner.SimulateKeyPress(Key.W);
await _runner.AwaitMillis(300);
_runner.SimulateKeyRelease(Key.W);
var endPos = _player.GlobalPosition;
var direction = startPos.DirectionTo(endPos);
AssertVector(direction).IsEqualApprox(Vector3.Forward, _vectorTolerance);
}
}

View File

@@ -0,0 +1 @@
uid://denedm5b8rmhh

View File

@@ -0,0 +1,35 @@
[gd_scene format=3 uid="uid://l0lflvsjbyvs"]
[ext_resource type="Material" uid="uid://31aulub2nqov" path="res://assets/materials/greybox/m_greybox.tres" id="1_dv0re"]
[ext_resource type="PackedScene" uid="uid://bei4nhkf8lwdo" path="res://scenes/player_controller/PlayerController.tscn" id="2_52d52"]
[node name="PlayerMovementScene" type="Node3D" unique_id=231040688]
[node name="CSGCombiner3D" type="CSGCombiner3D" parent="." unique_id=241909240]
use_collision = true
collision_layer = 256
collision_mask = 65553
[node name="Ground" type="CSGBox3D" parent="CSGCombiner3D" unique_id=432200143]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, -0.5, -3.25)
use_collision = true
collision_layer = 256
collision_mask = 65553
size = Vector3(1000, 1, 1000)
material = ExtResource("1_dv0re")
[node name="Ground2" type="CSGBox3D" parent="CSGCombiner3D" unique_id=854660236]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.75, 0.5, -1.75)
use_collision = true
collision_layer = 256
collision_mask = 65553
size = Vector3(1.5, 1, 1.5)
material = ExtResource("1_dv0re")
[node name="Player" parent="." unique_id=709076448 instance=ExtResource("2_52d52")]
TutorialDone = true
[node name="BaseLocation" type="Marker3D" parent="." unique_id=1793710692]
[node name="MantleLocation1" type="Marker3D" parent="." unique_id=550080845]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.75, 0, 0)

View File

@@ -1,5 +1,6 @@
using System.Threading.Tasks;
using Godot;
using GodotStateCharts;
namespace Movementtests.tests;
@@ -44,7 +45,7 @@ public class PlayerMovementTest
var startPos = _player.GlobalPosition;
_runner.SimulateKeyPress(Key.W);
await _runner.AwaitMillis(300);
await _runner.AwaitMillis(100);
_runner.SimulateKeyRelease(Key.W);
var endPos = _player.GlobalPosition;
@@ -63,17 +64,24 @@ public class PlayerMovementTest
var startPos = _player.GlobalPosition;
_runner.SimulateKeyPress(Key.Space);
await _runner.AwaitMillis(100);
_runner.SimulateKeyRelease(Key.Space);
await _runner.AwaitIdleFrame();
var jumping = StateChartState.Of(_player.GetNode("StateChart/Root/Movement/Jump"));
AssertBool(jumping.Active).IsTrue();
_runner.SimulateKeyRelease(Key.Space);
await _runner.AwaitIdleFrame();
var endPos = _player.GlobalPosition;
var direction = startPos.DirectionTo(endPos);
AssertVector(direction).IsEqualApprox(Vector3.Up, _vectorTolerance);
AssertVector(_player.Velocity.Normalized()).IsEqualApprox(Vector3.Up, _vectorTolerance);
await _runner.AwaitMillis(500);
await _runner.AwaitMillis(600);
endPos = _player.GlobalPosition;
AssertVector(endPos - startPos).IsEqualApprox(Vector3.Zero, _vectorTolerance);
var grounded = StateChartState.Of(_player.GetNode("StateChart/Root/Movement/Grounded"));
AssertBool(grounded.Active).IsTrue();
}
[TestCase("MantleLocation1")]
@@ -88,6 +96,9 @@ public class PlayerMovementTest
_runner.SimulateKeyPress(Key.Space);
await _runner.AwaitMillis(100);
var mantling = StateChartState.Of(_player.GetNode("StateChart/Root/Movement/Mantling"));
AssertBool(mantling.Active).IsTrue();
_runner.SimulateKeyRelease(Key.Space);
await _runner.AwaitMillis(500);