From e4013f6cc68f271a8ecc5f2f79a473d182ee14ef Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Wed, 30 Jun 2021 21:31:25 -0600 Subject: [PATCH] Tests: Set a default font in BenchmarkGfxPainter to prevent crashes After the changes to LibGfx to make default font management handled in WindowServer instead of each GUI application to allow for global font broadcasts, the two LibGfx tests broke. The non-benchmark was fixed in 8f96d2, but the benchmark was left in the dust because nobody really runs it manually :^( --- Tests/LibGfx/BenchmarkGfxPainter.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Tests/LibGfx/BenchmarkGfxPainter.cpp b/Tests/LibGfx/BenchmarkGfxPainter.cpp index ca4fef41cf..5e763403ed 100644 --- a/Tests/LibGfx/BenchmarkGfxPainter.cpp +++ b/Tests/LibGfx/BenchmarkGfxPainter.cpp @@ -7,9 +7,19 @@ #include #include +#include #include #include +// Make sure that no matter what order tests are run in, we've got some +// default fonts for the application to use without talking to WindowServer +static struct FontDatabaseSpoofer { + FontDatabaseSpoofer() + { + Gfx::FontDatabase::the().set_default_font_query("Katica 10 400"sv); + } +} g_spoof; + BENCHMARK_CASE(diagonal_lines) { const int run_count = 50;