Skip to content

Commit 2b61635

Browse files
myieyeclaude
andauthored
Generalize writing system font patch to include vernacular (#2141)
The font patch method was only handling Analysis writing systems, but Vernacular writing systems also use different fonts on Windows. Renamed and updated the method to patch all writing systems to ensure consistent snapshot verification across platforms. https://claude.ai/code/session_fx7MS Co-authored-by: Claude <noreply@anthropic.com>
1 parent 876e76b commit 2b61635

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

backend/FwLite/FwLiteProjectSync.Tests/Sena3SyncTests.cs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,10 @@ public async Task LiveSena3Sync()
218218
await using var liveScope = _project.Services.CreateAsyncScope();
219219
var liveCrdtApi = await liveScope.ServiceProvider.OpenCrdtProject(liveCrdtProject);
220220

221-
// The default font used for the Analysis writing systems in our Sena 3 project differs when opened on
221+
// The default fonts used for writing systems in our Sena 3 project differ when opened on
222222
// Windows versus Linux. So, we standardize them to Charis SIL (which is the default on Linux).
223223
// Otherwise, the snapshot verification isn't consistent.
224-
await PatchAnalysisWsFontsWithCharisSIL(_fwDataApi);
224+
await PatchAllWsFontsWithCharisSIL(_fwDataApi);
225225

226226
// act
227227
var result = await _syncService.Sync(liveCrdtApi, _fwDataApi);
@@ -259,15 +259,23 @@ await Verify(JsonSerializer.Serialize(fwHeadlessSnapshot, IndentedDefaultJsonOpt
259259
result.FwdataChanges.Should().Be(0);
260260
}
261261

262-
private async Task PatchAnalysisWsFontsWithCharisSIL(FwDataMiniLcmApi fwDataApi)
262+
private async Task PatchAllWsFontsWithCharisSIL(FwDataMiniLcmApi fwDataApi)
263263
{
264264
var writingSystems = await fwDataApi.GetWritingSystems();
265-
var analysisWs = writingSystems.Analysis;
266-
analysisWs.Length.Should().Be(2);
267-
await fwDataApi.UpdateWritingSystem(analysisWs[0].WsId, WritingSystemType.Analysis,
268-
new UpdateObjectInput<WritingSystem>().Set(ws => ws.Font, "Charis SIL"));
269-
await fwDataApi.UpdateWritingSystem(analysisWs[1].WsId, WritingSystemType.Analysis,
270-
new UpdateObjectInput<WritingSystem>().Set(ws => ws.Font, "Charis SIL"));
265+
266+
// Patch all Analysis writing systems
267+
foreach (var ws in writingSystems.Analysis)
268+
{
269+
await fwDataApi.UpdateWritingSystem(ws.WsId, WritingSystemType.Analysis,
270+
new UpdateObjectInput<WritingSystem>().Set(w => w.Font, "Charis SIL"));
271+
}
272+
273+
// Patch all Vernacular writing systems
274+
foreach (var ws in writingSystems.Vernacular)
275+
{
276+
await fwDataApi.UpdateWritingSystem(ws.WsId, WritingSystemType.Vernacular,
277+
new UpdateObjectInput<WritingSystem>().Set(w => w.Font, "Charis SIL"));
278+
}
271279
}
272280

273281
private static string RelativePath(string name, [CallerFilePath] string sourceFile = "")

0 commit comments

Comments
 (0)