summaryrefslogtreecommitdiff
path: root/Tests/LibGfx/BenchmarkGfxPainter.cpp
diff options
context:
space:
mode:
authorAndrew Kaster <akaster@serenityos.org>2021-06-30 21:31:25 -0600
committerAndreas Kling <kling@serenityos.org>2021-07-06 17:22:45 +0200
commite4013f6cc68f271a8ecc5f2f79a473d182ee14ef (patch)
treeb6aea587117cb8efe5fef04507e0aaef643559bf /Tests/LibGfx/BenchmarkGfxPainter.cpp
parentad0b8b42eb95ed0c919bb444f6c81a5b5ac69d6d (diff)
downloadserenity-e4013f6cc68f271a8ecc5f2f79a473d182ee14ef.zip
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 :^(
Diffstat (limited to 'Tests/LibGfx/BenchmarkGfxPainter.cpp')
-rw-r--r--Tests/LibGfx/BenchmarkGfxPainter.cpp10
1 files changed, 10 insertions, 0 deletions
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 <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;