~aleteoryx/muditaos

ref: 706a25df1d30ed69e073711c65d15071f547c436 muditaos/module-apps/application-music-player/tests/unittest_songsmodel.cpp -rw-r--r-- 918 bytes
706a25df — Maciej Janicki [BH-1125] Add file indexer 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
27
28
29
30
31
32
33
34
35
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include <gtest/gtest.h>

#include "MockSongsRepository.hpp"

#include <models/SongsModel.hpp>

#include <memory>
#include <optional>

using ::app::music::SongsModel;
using ::testing::Return;
using ::testing::app::music::MockSongsRepository;

TEST(SongsModel, Init)
{
    auto mockRepo = std::make_shared<MockSongsRepository>();
    auto model    = SongsModel(nullptr, mockRepo);

    EXPECT_FALSE(model.isSongPlaying());
}

TEST(SongsModel, EmptyContext)
{
    auto mockRepo = std::make_shared<MockSongsRepository>();
    auto model    = SongsModel(nullptr, mockRepo);

    auto ctx = model.getCurrentSongContext();

    EXPECT_EQ(ctx.currentFileToken, std::nullopt);
    EXPECT_TRUE(ctx.filePath.empty());
    EXPECT_EQ(ctx.currentSongState, app::music::SongState::NotPlaying);
}