From 9968128da9e50e5cd6a27e4bc306f90b09280f31 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 1 Jul 2023 15:15:53 -0700 Subject: [PATCH] fix failing test on non-Mac --- src/font/Group.zig | 9 ++++----- src/font/shaper/harfbuzz.zig | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/font/Group.zig b/src/font/Group.zig index 91c3978ab..02e9ef4a6 100644 --- a/src/font/Group.zig +++ b/src/font/Group.zig @@ -411,12 +411,12 @@ test { 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, testEmojiText, .{ .points = 12 }))); if (font.options.backend != .coretext) { // 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, testEmojiText, .{ .points = 12 }))); // Should find all visible ASCII var i: u32 = 32; @@ -441,16 +441,15 @@ test { { const idx = group.indexForCodepoint('🥸', .regular, null).?; try testing.expectEqual(Style.regular, idx.style); - - const expected: FontIndex.IndexInt = if (font.options.backend == .coretext) 1 else 2; - try testing.expectEqual(expected, idx.idx); + try testing.expectEqual(@as(FontIndex.IndexInt, 1), idx.idx); } // Try text emoji { const idx = group.indexForCodepoint(0x270C, .regular, .text).?; 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).?; diff --git a/src/font/shaper/harfbuzz.zig b/src/font/shaper/harfbuzz.zig index 8c16344df..1f4cbc817 100644 --- a/src/font/shaper/harfbuzz.zig +++ b/src/font/shaper/harfbuzz.zig @@ -648,11 +648,11 @@ fn testShaper(alloc: Allocator) !TestShaper { // 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, testEmojiText, .{ .points = 12 }))); if (font.options.backend != .coretext) { // 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, testEmojiText, .{ .points = 12 }))); var cell_buf = try alloc.alloc(font.shape.Cell, 80); errdefer alloc.free(cell_buf);