From 88db80b7b0359247185ab2f847532a853e012a50 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 2 Apr 2024 20:39:51 -0700 Subject: [PATCH] font: CodepointResolver test box glyph --- src/font/CodepointResolver.zig | 21 +++++++++++++++++++++ src/font/Group.zig | 4 ++++ 2 files changed, 25 insertions(+) diff --git a/src/font/CodepointResolver.zig b/src/font/CodepointResolver.zig index 7a03f0e5d..f902c2275 100644 --- a/src/font/CodepointResolver.zig +++ b/src/font/CodepointResolver.zig @@ -450,3 +450,24 @@ test "getIndex disabled font style" { try testing.expectEqual(@as(Collection.Index.IndexInt, 0), idx.idx); } } + +test "getIndex box glyph" { + const testing = std.testing; + const alloc = testing.allocator; + + var lib = try Library.init(); + defer lib.deinit(); + + const c = try Collection.init(alloc); + + var r: CodepointResolver = .{ + .collection = c, + .sprite = .{ .width = 18, .height = 36, .thickness = 2 }, + }; + defer r.deinit(alloc); + + // Should find a box glyph + const idx = r.getIndex(alloc, 0x2500, .regular, null).?; + try testing.expectEqual(Style.regular, idx.style); + try testing.expectEqual(@intFromEnum(Collection.Index.Special.sprite), idx.idx); +} diff --git a/src/font/Group.zig b/src/font/Group.zig index b9cfa2935..4637be3d9 100644 --- a/src/font/Group.zig +++ b/src/font/Group.zig @@ -769,6 +769,7 @@ pub const Wasm = struct { } }; +// X test { const testing = std.testing; const alloc = testing.allocator; @@ -847,6 +848,7 @@ test { } } +// X test "disabled font style" { const testing = std.testing; const alloc = testing.allocator; @@ -892,6 +894,7 @@ test "disabled font style" { } } +// X test "face count limit" { const testing = std.testing; const alloc = testing.allocator; @@ -917,6 +920,7 @@ test "face count limit" { )); } +// X test "box glyph" { const testing = std.testing; const alloc = testing.allocator;