refactor(core): streamline FEN and PGN export/import methods in ChessBoardView

This commit is contained in:
2026-04-05 17:01:34 +02:00
parent 17fa13c82a
commit a1b7cc7f4a
4 changed files with 28 additions and 70 deletions
@@ -217,8 +217,12 @@ class GameEngine(
if ruleSet.isCheckmate(currentContext) then
val winner = currentContext.turn.opposite
notifyObservers(CheckmateEvent(currentContext, winner))
invoker.clear()
currentContext = GameContext.initial
else if ruleSet.isStalemate(currentContext) then
notifyObservers(StalemateEvent(currentContext))
invoker.clear()
currentContext = GameContext.initial
else if ruleSet.isCheck(currentContext) then
notifyObservers(CheckDetectedEvent(currentContext))
@@ -73,7 +73,7 @@ class GameEngineNotationTest extends AnyFunSuite with Matchers:
// Verify the captured pawn was found (computeCaptured EnPassant branch)
val moveEvt = events.collect { case e: MoveExecutedEvent => e }.head
moveEvt.capturedPiece shouldBe defined
moveEvt.capturedPiece.get should include ("black")
moveEvt.capturedPiece.get should include ("Black")
events.clear()
engine.undo()