summaryrefslogtreecommitdiffstats
path: root/xbmc/playlists/test/TestPlayListFactory.cpp
blob: 08b2b4b4461975d60136f5c6094e5f3867a28eac (plain)
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
36
37
38
/*
 *  Copyright (C) 2018 Tyler Szabo
 *  Copyright (C) 2018 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */

#include "URL.h"
#include "playlists/PlayList.h"
#include "playlists/PlayListFactory.h"
#include "playlists/PlayListXSPF.h"
#include "test/TestUtils.h"

#include <gtest/gtest.h>

using namespace PLAYLIST;


TEST(TestPlayListFactory, XSPF)
{
  std::string filename = XBMC_REF_FILE_PATH("/xbmc/playlists/test/newfile.xspf");
  CURL url("http://example.com/playlists/playlist.xspf");
  CPlayList* playlist = nullptr;

  EXPECT_TRUE(CPlayListFactory::IsPlaylist(url));
  EXPECT_TRUE(CPlayListFactory::IsPlaylist(filename));

  playlist = CPlayListFactory::Create(filename);
  EXPECT_NE(playlist, nullptr);

  if (playlist)
  {
    EXPECT_NE(dynamic_cast<CPlayListXSPF*>(playlist), nullptr);
    delete playlist;
  }
}