Implement native text face selection

This commit is contained in:
gamer147
2026-07-28 14:16:24 -04:00
parent a991d5699c
commit f885ac4189
12 changed files with 270 additions and 33 deletions

View File

@@ -9,6 +9,32 @@ using Xunit;
public class AdvTextOpsTests
{
[Fact]
public void SetFontFaceFlowsIntoLiveAndRetainedTextStyles()
{
var table = OpcodeTableJson.Load(Paths.OpcodesJson);
static Operand I(long value) => new(0, value);
static Operand S(int index) => new(2, index);
var script = ScriptAssembler.Assemble(table, "ADV_FONT_FACE",
new List<(int, Operand[])>
{
(0x1a5, new[] { S(0) }),
(0x6e, new[] { I(0), S(2) }),
(0x1a5, new[] { S(1) }),
(0x6e, new[] { I(0), S(3) }),
(0x2, Array.Empty<Operand>()),
}, new[] { " 明朝", " ゴシック", "mincho", "gothic" });
var host = new RecordingHost();
var vm = new VirtualMachine(script, table, host);
vm.Run();
Assert.Equal(new[] { " 明朝", " ゴシック" },
host.LiveTextRuns.Select(run => run.Run.Style.FontFace));
Assert.Equal(new[] { " 明朝", " ゴシック" },
vm.TextHistory.Records.Select(record => record.Style.FontFace));
}
[Fact]
public void TextCursorAndDrawStringReachHostWithLocalStringPointer()
{