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 :^(
This commit is contained in:
Andrew Kaster 2021-06-30 21:31:25 -06:00 committed by Andreas Kling
parent ad0b8b42eb
commit e4013f6cc6
Notes: sideshowbarker 2024-07-18 10:17:50 +09:00

View file

@ -7,9 +7,19 @@
#include <LibTest/TestCase.h>
#include <LibGfx/Bitmap.h>
#include <LibGfx/FontDatabase.h>
#include <LibGfx/Painter.h>
#include <stdio.h>
// 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;