-
-
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.
GD-163: Collect the Godot log file into test report (#164)
# Why see #163 # What - Added `GodotProjectSettings` to load the current project settings - Copy finally the Godot log file into the results directory
- Loading branch information
1 parent
dda0203
commit ca23c88
Showing
11 changed files
with
488 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace GdUnit4.TestAdapter.Test; | ||
|
||
using System; | ||
using System.IO; | ||
|
||
public static class TestUtils | ||
{ | ||
public static string GetResourcePath(string resourcePath) | ||
{ | ||
var baseDir = AppDomain.CurrentDomain.BaseDirectory; | ||
var projectRoot = Path.GetFullPath(Path.Combine(baseDir, "..", "..", "..")); | ||
return Path.Combine(projectRoot, "test", "resources", resourcePath); | ||
} | ||
} |
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,19 @@ | ||
; Engine configuration file. | ||
; It's best edited using the editor UI and not directly, | ||
; since the parameters that go here are not all obvious. | ||
; | ||
; Format: | ||
; [section] ; section goes between [] | ||
; param=value ; assign values to parameters | ||
|
||
config_version=5 | ||
|
||
[application] | ||
|
||
config/name="gdUnit4Test" | ||
config/features=PackedStringArray("4.3", "C#", "Forward Plus") | ||
config/icon="res://icon.svg" | ||
|
||
[dotnet] | ||
|
||
project/assembly_name="gdUnit4Test" |
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,83 @@ | ||
; Engine configuration file. | ||
; It's best edited using the editor UI and not directly, | ||
; since the parameters that go here are not all obvious. | ||
; | ||
; Format: | ||
; [section] ; section goes between [] | ||
; param=value ; assign values to parameters | ||
|
||
config_version=5 | ||
|
||
[application] | ||
|
||
config/name="gdUnit4" | ||
config/tags=PackedStringArray("addon", "godot4", "testing") | ||
config/features=PackedStringArray("4.3", "C#") | ||
config/icon="res://icon.png" | ||
|
||
[audio] | ||
|
||
default_bus_layout="" | ||
|
||
[debug] | ||
|
||
file_logging/log_path="res://godot_session.log" | ||
gdscript/warnings/exclude_addons=false | ||
gdscript/warnings/untyped_declaration=2 | ||
gdscript/warnings/unsafe_property_access=1 | ||
gdscript/warnings/unsafe_method_access=1 | ||
gdscript/warnings/unsafe_cast=1 | ||
gdscript/warnings/unsafe_call_argument=1 | ||
|
||
[dotnet] | ||
|
||
project/assembly_name="gdUnit4" | ||
|
||
[editor_plugins] | ||
|
||
enabled=PackedStringArray("res://addons/gdUnit4/plugin.cfg") | ||
|
||
[gdunit4] | ||
|
||
ui/inspector/node_collapse=false | ||
ui/toolbar/run_overall=true | ||
ui/inspector/tree_sort_mode=1 | ||
report/godot/script_error=false | ||
settings/test/flaky_check_enable=true | ||
settings/common/update_notification_enabled=false | ||
|
||
[importer_defaults] | ||
|
||
texture={ | ||
"compress/channel_pack": 0, | ||
"compress/hdr_compression": 1, | ||
"compress/high_quality": false, | ||
"compress/lossy_quality": 0.7, | ||
"compress/mode": 0, | ||
"compress/normal_map": 0, | ||
"detect_3d/compress_to": 1, | ||
"editor/convert_colors_with_editor_theme": true, | ||
"editor/scale_with_editor_scale": true, | ||
"mipmaps/generate": false, | ||
"mipmaps/limit": -1, | ||
"process/fix_alpha_border": true, | ||
"process/hdr_as_srgb": false, | ||
"process/hdr_clamp_exposure": false, | ||
"process/normal_map_invert_y": false, | ||
"process/premult_alpha": false, | ||
"process/size_limit": 0, | ||
"roughness/mode": 0, | ||
"roughness/src_normal": "", | ||
"svg/scale": 1.0 | ||
} | ||
|
||
[network] | ||
|
||
limits/debugger_stdout/max_chars_per_second=60048 | ||
limits/debugger_stdout/max_messages_per_frame=100 | ||
limits/debugger_stdout/max_errors_per_second=1000 | ||
limits/debugger_stdout/max_warnings_per_second=1000 | ||
|
||
[rendering] | ||
|
||
environment/default_environment="res://default_env.tres" |
64 changes: 64 additions & 0 deletions
64
testadapter.test/test/settings/GodotProjectSettingsTest.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,64 @@ | ||
namespace GdUnit4.TestAdapter.Test.Settings; | ||
|
||
using System.IO; | ||
|
||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
using TestAdapter.Settings; | ||
|
||
using static TestUtils; | ||
|
||
using static TestAdapter.Utilities.Utils; | ||
|
||
[TestClass] | ||
public class GodotProjectSettingsTest | ||
{ | ||
[TestMethod] | ||
public void GlobalizeGodotPath() | ||
{ | ||
// user specific path | ||
Assert.AreEqual( | ||
Path.Combine(GetUserDataDirectory, "app_userdata", "gdUnit4Test", "logs", "godot.log"), | ||
GodotProjectSettings.GlobalizeGodotPath("user://logs/godot.log", "gdUnit4Test")); | ||
// project specific path | ||
Assert.AreEqual( | ||
Path.Combine(GetProjectDirectory, "logs", "godot.log"), | ||
GodotProjectSettings.GlobalizeGodotPath("res://logs/godot.log", "gdUnit4Test")); | ||
} | ||
|
||
[TestMethod] | ||
public void LoadGodotProjectSettingsWithoutDebugSection() | ||
{ | ||
var projectFile = GetResourcePath("project.godot"); | ||
var settings = GodotProjectSettings.LoadFromFile(projectFile); | ||
Assert.IsNotNull(settings); | ||
|
||
Assert.AreEqual("gdUnit4Test", settings.Application.Config.Name); | ||
CollectionAssert.Contains(settings.Application.Config.Features, "4.3"); | ||
CollectionAssert.Contains(settings.Application.Config.Features, "C#"); | ||
Assert.AreEqual("res://icon.svg", settings.Application.Config.Icon); | ||
|
||
// validate the log file path points to the default user dir | ||
Assert.IsNotNull(settings.Debug); | ||
var expectedLogFilePath = GodotProjectSettings.GlobalizeGodotPath("user://logs/godot.log", "gdUnit4Test"); | ||
Assert.AreEqual(expectedLogFilePath, settings.Debug.FileLogging.LogPath); | ||
} | ||
|
||
[TestMethod] | ||
public void LoadGodotProjectSettingsWithCustomLogPath() | ||
{ | ||
var projectFile = GetResourcePath("project.godot2"); | ||
var settings = GodotProjectSettings.LoadFromFile(projectFile); | ||
Assert.IsNotNull(settings); | ||
|
||
Assert.AreEqual("gdUnit4", settings.Application.Config.Name); | ||
CollectionAssert.Contains(settings.Application.Config.Features, "4.3"); | ||
CollectionAssert.Contains(settings.Application.Config.Features, "C#"); | ||
Assert.AreEqual("res://icon.png", settings.Application.Config.Icon); | ||
|
||
// validate the log file path points to project root | ||
Assert.IsNotNull(settings.Debug); | ||
var expectedLogFilePath = Path.Combine(GetProjectDirectory, "godot_session.log"); | ||
Assert.AreEqual(expectedLogFilePath, settings.Debug.FileLogging.LogPath); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
namespace GdUnit4.TestAdapter.Test.Utilities; | ||
|
||
using System; | ||
|
||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
using static TestAdapter.Utilities.Utils; | ||
|
||
[TestClass] | ||
public class UtilsTest | ||
{ | ||
[TestMethod] | ||
public void ProjectDirectory() | ||
=> Assert.IsTrue(GetProjectDirectory.EndsWith("testadapter.test")); | ||
|
||
[TestMethod] | ||
public void UserDataDirectory() | ||
{ | ||
switch (Environment.OSVersion.Platform) | ||
{ | ||
case PlatformID.Win32NT: | ||
Assert.IsTrue(GetUserDataDirectory.EndsWith("Godot")); break; | ||
case PlatformID.Unix: | ||
Assert.IsTrue(GetUserDataDirectory.EndsWith("godot")); break; | ||
case PlatformID.MacOSX: | ||
Assert.IsTrue(GetUserDataDirectory.EndsWith("Library/Application Support/Godot")); | ||
break; | ||
} | ||
} | ||
} |
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
Oops, something went wrong.