~aleteoryx/muditaos

ref: 9ae8d0f1566ef358cf29289a75825a1a4c4e8b8c muditaos/module-gui/test/test-catch-text/test-gui-Font.cpp -rw-r--r-- 970 bytes
9ae8d0f1 — Pawel.Paprocki [EGD-6313] Fix Display backlight settings are not presistent 4 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include <catch2/catch.hpp>
#include <FontManager.hpp>
#include <Font.hpp>
#include <Style.hpp>

TEST_CASE("Testo Font")
{
    using namespace gui;
    auto &fm = FontManager::getInstance();
    fm.init("assets");

    SECTION("medium font")
    {
        auto f        = Font(27);
        auto raw_font = fm.getFont(style::window::font::medium);
        REQUIRE(fm.getFont("gt_pressura_regular_27") == raw_font); /// check that style is ok
        REQUIRE(f.raw() == raw_font);                              /// check that Font() works ok
        f.setWeight(Font::Weight::Bold);
        REQUIRE(f.raw() == fm.getFont(style::window::font::mediumbold)); // check for changed weight
        f.setSize(30); // we are bold, now set size 30 which is bigbold
        REQUIRE(f.raw() == fm.getFont(style::window::font::bigbold));
    }
}