Files
MusicPlayer/addons/gdUnit4/src/ui/GdUnitFonts.gd
T
Sansan c985a6ce5b Replace the broken test suite with working GdUnit4 tests
The previous tests never compiled: they used GUT's assert functions,
Godot 3 APIs and reassigned autoload functions, so no test ran.

- 90 tests: unit tests for the playlist, songs, player scoring, time
  formatting, search and the server client, plus integration tests
  that run MainWindow and SyncWindow against a fake server
- Keybind tests check that Alt+<number> and Ctrl+Alt+<number> keep
  following the player rows while players are added and removed
- run_tests.sh finds Godot and runs the suite headless (~10 seconds)
- CI runs the tests before the build job in gitea-build.yaml; the
  separate test.yml used a GitHub action that does not exist
- GdUnit4 is committed instead of ignored, since the project enables
  it, and .gitea/ is no longer ignored
- Exported builds leave out tests/ and addons/gdUnit4/
2026-10-06 08:32:56 +02:00

37 lines
1.9 KiB
GDScript

@tool
class_name GdUnitFonts
extends RefCounted
static func init_fonts(item: CanvasItem) -> float:
# set default size
item.set("theme_override_font_sizes/font_size", 16)
if Engine.is_editor_hint():
var base_control := EditorInterface.get_base_control()
# source modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs
# https://github.com/godotengine/godot/blob/9ee1873ae1e09c217ac24a5800007f63cb895615/editor/editor_log.cpp#L65
var output_source_mono := base_control.get_theme_font("output_source_mono", "EditorFonts")
var output_source_bold_italic := base_control.get_theme_font("output_source_bold_italic", "EditorFonts")
var output_source_italic := base_control.get_theme_font("output_source_italic", "EditorFonts")
var output_source_bold := base_control.get_theme_font("output_source_bold", "EditorFonts")
#var output_source := base_control.get_theme_font("output_source", "EditorFonts")
var settings := EditorInterface.get_editor_settings()
var scale_factor := EditorInterface.get_editor_scale()
var font_size: float = settings.get_setting("interface/editor/main_font_size")
font_size *= scale_factor
#item.set("theme_override_fonts/normal_font", output_source)
item.set("theme_override_fonts/bold_font", output_source_bold)
item.set("theme_override_fonts/italics_font", output_source_italic)
item.set("theme_override_fonts/bold_italics_font", output_source_bold_italic)
item.set("theme_override_fonts/mono_font", output_source_mono)
item.set("theme_override_font_sizes/font_size", font_size)
item.set("theme_override_font_sizes/normal_font_size", font_size)
item.set("theme_override_font_sizes/bold_font_size", font_size)
item.set("theme_override_font_sizes/italics_font_size", font_size)
item.set("theme_override_font_sizes/bold_italics_font_size", font_size)
item.set("theme_override_font_sizes/mono_font_size", font_size)
return font_size
return 16.0