Add synced user notes

This commit is contained in:
hz
2026-07-18 22:22:29 -05:00
parent a232e18c46
commit d0bb271b14
22 changed files with 930 additions and 2 deletions
+37
View File
@@ -0,0 +1,37 @@
extends SceneTree
const NotesEditor := preload("res://scripts/ui/notes_editor.gd")
const NotesDialog := preload("res://scripts/ui/notes_dialog.gd")
const NavigationRoutes := preload("res://scripts/ui/navigation_routes.gd")
var failures := 0
func _initialize() -> void:
call_deferred("_run")
func _run() -> void:
var editor := NotesEditor.new()
root.add_child(editor)
await process_frame
_assert(editor.editor != null, "notes editor should create a text editor")
_assert(editor.editor.wrap_mode == TextEdit.LINE_WRAPPING_BOUNDARY, "notes should wrap plain text")
_assert(NavigationRoutes.key_for_screen("notes") == "notes", "notes should have a navigation route")
var dialog := NotesDialog.new()
root.add_child(dialog)
await process_frame
_assert(not dialog.visible, "notes dialog should start hidden")
_assert(dialog.notes_editor != null, "notes dialog should contain the shared editor")
editor.queue_free()
dialog.queue_free()
quit(1 if failures > 0 else 0)
func _assert(condition: bool, message: String) -> void:
if condition:
return
failures += 1
push_error(message)
+1
View File
@@ -0,0 +1 @@
uid://lo6a7h02ld0l
+9
View File
@@ -348,6 +348,7 @@ func _test_player_runtime_construction() -> void:
_assert(player.clear_highlight_button.icon != null, "clear highlights should use the supplied toolbar artwork")
_assert(player.report_button.icon != null, "report question should use the supplied toolbar artwork")
_assert(player.labs_button.icon != null, "lab results should use the supplied toolbar artwork")
_assert(player.notes_button != null and player.notes_button.icon != null, "practice questions should expose the notes tool")
for icon_button in [player.clear_highlight_button, player.report_button, player.labs_button]:
_assert(icon_button.alignment == HORIZONTAL_ALIGNMENT_CENTER and icon_button.icon_alignment == HORIZONTAL_ALIGNMENT_CENTER, "question toolbar artwork should be horizontally centered")
_assert(icon_button.vertical_icon_alignment == VERTICAL_ALIGNMENT_CENTER, "question toolbar artwork should be vertically centered")
@@ -362,6 +363,14 @@ func _test_player_runtime_construction() -> void:
_assert(player.theme_button.icon in [Brand.SUN_ICON, Brand.MOON_ICON], "question theme toggle should use the shared sun or moon icon")
_assert(player.choice_badges.size() == 5, "question player should construct an answer badge for every visible choice slot")
_assert(player.choice_followup_panels[2].get_parent() == player.choice_rows[2], "distractor remediation should remain nested inside its answer choice")
var prior_session_kind: String = root.get_node("BlockSessionService").session_kind
root.get_node("BlockSessionService").session_kind = "simulation"
player._refresh_toolbar_state()
_assert(not player.notes_button.visible, "timed simulations should hide the notes tool")
root.get_node("BlockSessionService").session_kind = "core"
player._refresh_toolbar_state()
_assert(player.notes_button.visible, "practice question runs should show the notes tool")
root.get_node("BlockSessionService").session_kind = prior_session_kind
player.choice_followup_panels[2].visible = true
player.locked_wrong_choice_ids = ["C"]
player.presented_choices = [{"id": "A", "text": "First"}, {"id": "B", "text": "Second"}, {"id": "C", "text": "Seek a court order"}]
+1
View File
@@ -16,6 +16,7 @@ func _initialize() -> void:
_assert(NavigationRoutes.key_for_screen("profile") == "performance", "profile should activate Performance")
_assert(NavigationRoutes.key_for_screen("map") == "study_plan", "study map should activate Study Plan")
_assert(NavigationRoutes.key_for_screen("settings") == "settings", "settings should activate Settings")
_assert(NavigationRoutes.key_for_screen("notes") == "notes", "notes should activate Notes")
quit(1 if failures > 0 else 0)