use both font filenames
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
|
||||
#include <catch2/catch_all.hpp>
|
||||
#include "Host/SystemFontResolver.hpp"
|
||||
#include "Host/SystemInfo.hpp"
|
||||
#include "Base/Logger.hpp"
|
||||
#include <filesystem>
|
||||
|
||||
@@ -16,31 +15,25 @@ TEST_CASE("Search system fonts")
|
||||
{
|
||||
Logger::SetupLogger("", "tests.log");
|
||||
|
||||
OsVersion version = SystemInfo::GetOsVersion();
|
||||
std::array<std::string, 2> fontFiles = { "/usr/share/fonts/truetype/ubuntu/", "/usr/share/fonts/truetype/ubuntu/" };
|
||||
if (version.major <= 22)
|
||||
{
|
||||
std::array<std::string, 4> fontFiles;
|
||||
fontFiles.fill("/usr/share/fonts/truetype/ubuntu/");
|
||||
fontFiles[0] += "Ubuntu-R.ttf";
|
||||
fontFiles[1] += "UbuntuMono-BI.ttf";
|
||||
}
|
||||
else
|
||||
{
|
||||
fontFiles[0] += "Ubuntu[wdth,wght].ttf";
|
||||
fontFiles[1] += "UbuntuMono-Italic[wght].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
|
||||
std::string path = SystemFontResolver::GetSystemFontPath("Ubuntu Regular");
|
||||
REQUIRE(path == fontFiles[0]);
|
||||
REQUIRE((path == fontFiles[0] || path == fontFiles[1]));
|
||||
|
||||
path = SystemFontResolver::GetSystemFontPath("ubuntu regular");
|
||||
REQUIRE(path == fontFiles[0]);
|
||||
REQUIRE((path == fontFiles[0] || path == fontFiles[1]));
|
||||
|
||||
path = SystemFontResolver::GetSystemFontPath("Ubuntu Mono Bold Italic");
|
||||
REQUIRE(path == fontFiles[1]);
|
||||
REQUIRE((path == fontFiles[2] || path == fontFiles[3]));
|
||||
|
||||
path = SystemFontResolver::GetSystemFontPath("ubuntu mono bold italic");
|
||||
REQUIRE(path == fontFiles[1]);
|
||||
REQUIRE((path == fontFiles[2] || path == fontFiles[3]));
|
||||
|
||||
path = SystemFontResolver::GetSystemFontPath("NON-EXISTING Font");
|
||||
REQUIRE(path.empty());
|
||||
|
||||
Reference in New Issue
Block a user