fix failing test on non-Mac

This commit is contained in:
Mitchell Hashimoto
2023-07-01 15:15:53 -07:00
parent f537d7aab1
commit 9968128da9
2 changed files with 5 additions and 6 deletions

View File

@ -411,12 +411,12 @@ test {
defer group.deinit(); defer group.deinit();
try group.addFace(alloc, .regular, DeferredFace.initLoaded(try Face.init(lib, testFont, .{ .points = 12 }))); try group.addFace(alloc, .regular, DeferredFace.initLoaded(try Face.init(lib, testFont, .{ .points = 12 })));
try group.addFace(alloc, .regular, DeferredFace.initLoaded(try Face.init(lib, testEmojiText, .{ .points = 12 })));
if (font.options.backend != .coretext) { if (font.options.backend != .coretext) {
// Coretext doesn't support Noto's format // Coretext doesn't support Noto's format
try group.addFace(alloc, .regular, DeferredFace.initLoaded(try Face.init(lib, testEmoji, .{ .points = 12 }))); try group.addFace(alloc, .regular, DeferredFace.initLoaded(try Face.init(lib, testEmoji, .{ .points = 12 })));
} }
try group.addFace(alloc, .regular, DeferredFace.initLoaded(try Face.init(lib, testEmojiText, .{ .points = 12 })));
// Should find all visible ASCII // Should find all visible ASCII
var i: u32 = 32; var i: u32 = 32;
@ -441,16 +441,15 @@ test {
{ {
const idx = group.indexForCodepoint('🥸', .regular, null).?; const idx = group.indexForCodepoint('🥸', .regular, null).?;
try testing.expectEqual(Style.regular, idx.style); try testing.expectEqual(Style.regular, idx.style);
try testing.expectEqual(@as(FontIndex.IndexInt, 1), idx.idx);
const expected: FontIndex.IndexInt = if (font.options.backend == .coretext) 1 else 2;
try testing.expectEqual(expected, idx.idx);
} }
// Try text emoji // Try text emoji
{ {
const idx = group.indexForCodepoint(0x270C, .regular, .text).?; const idx = group.indexForCodepoint(0x270C, .regular, .text).?;
try testing.expectEqual(Style.regular, idx.style); try testing.expectEqual(Style.regular, idx.style);
try testing.expectEqual(@as(FontIndex.IndexInt, 1), idx.idx); const text_idx = if (font.options.backend == .coretext) 1 else 2;
try testing.expectEqual(@as(FontIndex.IndexInt, text_idx), idx.idx);
} }
{ {
const idx = group.indexForCodepoint(0x270C, .regular, .emoji).?; const idx = group.indexForCodepoint(0x270C, .regular, .emoji).?;

View File

@ -648,11 +648,11 @@ fn testShaper(alloc: Allocator) !TestShaper {
// Setup group // Setup group
try cache_ptr.group.addFace(alloc, .regular, DeferredFace.initLoaded(try Face.init(lib, testFont, .{ .points = 12 }))); try cache_ptr.group.addFace(alloc, .regular, DeferredFace.initLoaded(try Face.init(lib, testFont, .{ .points = 12 })));
try cache_ptr.group.addFace(alloc, .regular, DeferredFace.initLoaded(try Face.init(lib, testEmojiText, .{ .points = 12 })));
if (font.options.backend != .coretext) { if (font.options.backend != .coretext) {
// Coretext doesn't support Noto's format // Coretext doesn't support Noto's format
try cache_ptr.group.addFace(alloc, .regular, DeferredFace.initLoaded(try Face.init(lib, testEmoji, .{ .points = 12 }))); try cache_ptr.group.addFace(alloc, .regular, DeferredFace.initLoaded(try Face.init(lib, testEmoji, .{ .points = 12 })));
} }
try cache_ptr.group.addFace(alloc, .regular, DeferredFace.initLoaded(try Face.init(lib, testEmojiText, .{ .points = 12 })));
var cell_buf = try alloc.alloc(font.shape.Cell, 80); var cell_buf = try alloc.alloc(font.shape.Cell, 80);
errdefer alloc.free(cell_buf); errdefer alloc.free(cell_buf);