font: CodepointResolver test box glyph

This commit is contained in:
Mitchell Hashimoto
2024-04-02 20:39:51 -07:00
parent b2541d24f1
commit 88db80b7b0
2 changed files with 25 additions and 0 deletions

View File

@ -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);
}

View File

@ -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;