| 1 |
/* |
| 2 |
* Copyright (C) 2018 Tyler Szabo |
| 3 |
* Copyright (C) 2018 Team Kodi |
| 4 |
* This file is part of Kodi - https://kodi.tv |
| 5 |
* |
| 6 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 7 |
* See LICENSES/README.md for more information. |
| 8 |
*/ |
| 9 |
|
| 10 |
#include "URL.h" |
| 11 |
#include "playlists/PlayList.h" |
| 12 |
#include "playlists/PlayListFactory.h" |
| 13 |
#include "playlists/PlayListXSPF.h" |
| 14 |
#include "test/TestUtils.h" |
| 15 |
|
| 16 |
#include <gtest/gtest.h> |
| 17 |
|
| 18 |
using namespace PLAYLIST; |
| 19 |
|
| 20 |
|
| 21 |
TEST(TestPlayListFactory, XSPF) |
| 22 |
{ |
| 23 |
std::string filename = XBMC_REF_FILE_PATH("/xbmc/playlists/test/newfile.xspf"); |
| 24 |
CURL url("http://example.com/playlists/playlist.xspf"); |
| 25 |
CPlayList* playlist = nullptr; |
| 26 |
|
| 27 |
EXPECT_TRUE(CPlayListFactory::IsPlaylist(url)); |
| 28 |
EXPECT_TRUE(CPlayListFactory::IsPlaylist(filename)); |
| 29 |
|
| 30 |
playlist = CPlayListFactory::Create(filename); |
| 31 |
EXPECT_NE(playlist, nullptr); |
| 32 |
|
| 33 |
if (playlist) |
| 34 |
{ |
| 35 |
EXPECT_NE(dynamic_cast<CPlayListXSPF*>(playlist), nullptr); |
| 36 |
delete playlist; |
| 37 |
} |
| 38 |
} |