Merge pull request 'Fix test for different ubuntu versions' (#194) from misc2 into master

Reviewed-on: https://git.madvoxel.net/OpenVulkano/OpenVulkano/pulls/194
Reviewed-by: Georg Hagen <georg.hagen@madvoxel.com>
This commit is contained in:
Oleksii_Hyzha
2025-01-27 12:31:30 +01:00

View File

@@ -15,18 +15,25 @@ TEST_CASE("Search system fonts")
{ {
Logger::SetupLogger("", "tests.log"); Logger::SetupLogger("", "tests.log");
std::array<std::string, 4> fontFiles;
fontFiles.fill("/usr/share/fonts/truetype/ubuntu/");
fontFiles[0] += "Ubuntu-R.ttf";
fontFiles[1] += "Ubuntu[wdth,wght].ttf";
fontFiles[2] += "UbuntuMono-BI.ttf";
fontFiles[3] += "UbuntuMono-Italic[wght].ttf";
// assume these fonts are present since they are default // assume these fonts are present since they are default
std::string path = SystemFontResolver::GetSystemFontPath("Ubuntu Regular"); std::string path = SystemFontResolver::GetSystemFontPath("Ubuntu Regular");
REQUIRE(path == "/usr/share/fonts/truetype/ubuntu/Ubuntu-R.ttf"); REQUIRE((path == fontFiles[0] || path == fontFiles[1]));
path = SystemFontResolver::GetSystemFontPath("ubuntu regular"); path = SystemFontResolver::GetSystemFontPath("ubuntu regular");
REQUIRE(path == "/usr/share/fonts/truetype/ubuntu/Ubuntu-R.ttf"); REQUIRE((path == fontFiles[0] || path == fontFiles[1]));
path = SystemFontResolver::GetSystemFontPath("Ubuntu Mono Bold Italic"); path = SystemFontResolver::GetSystemFontPath("Ubuntu Mono Bold Italic");
REQUIRE(path == "/usr/share/fonts/truetype/ubuntu/UbuntuMono-BI.ttf"); REQUIRE((path == fontFiles[2] || path == fontFiles[3]));
path = SystemFontResolver::GetSystemFontPath("ubuntu mono bold italic"); path = SystemFontResolver::GetSystemFontPath("ubuntu mono bold italic");
REQUIRE(path == "/usr/share/fonts/truetype/ubuntu/UbuntuMono-BI.ttf"); REQUIRE((path == fontFiles[2] || path == fontFiles[3]));
path = SystemFontResolver::GetSystemFontPath("NON-EXISTING Font"); path = SystemFontResolver::GetSystemFontPath("NON-EXISTING Font");
REQUIRE(path.empty()); REQUIRE(path.empty());