mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-02-05 00:35:39 +00:00
Add projectm_playlist_get_shuffle() method to playlist API
This commit is contained in:
@ -380,6 +380,13 @@ uint32_t projectm_playlist_remove_presets(projectm_playlist_handle instance, uin
|
||||
}
|
||||
|
||||
|
||||
bool projectm_playlist_get_shuffle(projectm_playlist_handle instance)
|
||||
{
|
||||
auto* playlist = playlist_handle_to_instance(instance);
|
||||
return playlist->Shuffle();
|
||||
}
|
||||
|
||||
|
||||
void projectm_playlist_set_shuffle(projectm_playlist_handle instance, bool shuffle)
|
||||
{
|
||||
auto* playlist = playlist_handle_to_instance(instance);
|
||||
|
||||
@ -331,6 +331,13 @@ bool projectm_playlist_remove_preset(projectm_playlist_handle instance, uint32_t
|
||||
uint32_t projectm_playlist_remove_presets(projectm_playlist_handle instance, uint32_t index,
|
||||
uint32_t count);
|
||||
|
||||
/**
|
||||
* @brief Retrieves the current state of shuffle mode.
|
||||
* @param instance The playlist manager instance.
|
||||
* @return True if shuffle mode is enabled, false otherwise.
|
||||
*/
|
||||
bool projectm_playlist_get_shuffle(projectm_playlist_handle instance);
|
||||
|
||||
/**
|
||||
* @brief Enable or disable shuffle mode.
|
||||
* @param instance The playlist manager instance.
|
||||
|
||||
@ -270,6 +270,18 @@ TEST(projectMPlaylistAPI, RemovePresets)
|
||||
}
|
||||
|
||||
|
||||
TEST(projectMPlaylistAPI, GetShuffle)
|
||||
{
|
||||
PlaylistCWrapperMock mockPlaylist;
|
||||
|
||||
EXPECT_CALL(mockPlaylist, Shuffle())
|
||||
.Times(1)
|
||||
.WillOnce(Return(true));
|
||||
|
||||
EXPECT_TRUE(projectm_playlist_get_shuffle(reinterpret_cast<projectm_playlist_handle>(&mockPlaylist)));
|
||||
}
|
||||
|
||||
|
||||
TEST(projectMPlaylistAPI, SetShuffle)
|
||||
{
|
||||
PlaylistCWrapperMock mockPlaylist;
|
||||
|
||||
@ -21,6 +21,7 @@ public:
|
||||
MOCK_METHOD(bool, AddItem, (const std::string&, uint32_t, bool) );
|
||||
MOCK_METHOD(uint32_t, AddPath, (const std::string&, uint32_t, bool, bool) );
|
||||
MOCK_METHOD(bool, RemoveItem, (uint32_t));
|
||||
MOCK_METHOD(bool, Shuffle, (), (const));
|
||||
MOCK_METHOD(void, SetShuffle, (bool) );
|
||||
MOCK_METHOD(void, Sort, (uint32_t, uint32_t, SortPredicate, SortOrder));
|
||||
MOCK_METHOD(uint32_t, RetryCount, ());
|
||||
|
||||
Reference in New Issue
Block a user