~aleteoryx/muditaos

ref: d967f86934ae512978dff095b1a91b9b279b4b23 muditaos/module-gui/test/mock/InitializedFontManager.cpp -rw-r--r-- 621 bytes
d967f869 — Radoslaw Wicik [EGD-4763] Add VFS to gui fontmanager mock 5 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
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "InitializedFontManager.hpp"
#include <mutex>
#include <vfs.hpp>

extern class vfs vfs;

namespace mockup
{
    auto guard = std::mutex();

    auto fontManager() -> gui::FontManager &
    {
        vfs.Init();
        std::lock_guard<std::mutex> scoped(guard);
        auto &fontmanager = gui::FontManager::getInstance();
        if (!fontmanager.isInitialized()) {
            fontmanager.init("assets");
        }
        return fontmanager;
    }
} // namespace mockup