Files
OpenVulkano/tests/Host/Windows/SystemFontsSearchTests.cpp
2025-01-21 15:14:15 +02:00

34 lines
1.0 KiB
C++

/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include <catch2/catch_all.hpp>
#include "Base/Logger.hpp"
#include "Host/SystemFontResolver.hpp"
#include <filesystem>
#include "Scene/Text/FontAtlasFactory.hpp"
using namespace OpenVulkano;
TEST_CASE("Search system fonts")
{
Logger::SetupLogger("", "tests.log");
// assume these fonts are present since they are default
std::filesystem::path path = SystemFontResolver::GetSystemFontPath("Arial");
REQUIRE(path.filename() == "ARIAL.TTF");
// assume these fonts are present since they are default
path = SystemFontResolver::GetSystemFontPath("Times New Roman");
REQUIRE(path.filename() == "TIMES.TTF");
path = SystemFontResolver::GetSystemFontPath("Arial Bold Italic");
REQUIRE(path.filename() == "ARIALBI.TTF");
path = SystemFontResolver::GetSystemFontPath("NON-EXISTING Font");
REQUIRE(path.empty());
}