summaryrefslogtreecommitdiffstats
path: root/src/test/playlisttest.cpp
blob: 1b41ce28179693fa47f7c5e4fe9138a8a7d18aa6 (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
#include <gtest/gtest.h>

#include <QtGlobal>
#include <QDebug>
#include <QUrl>

#include "library/parserm3u.h"


class PlaylistTest : public testing::Test {};

TEST_F(PlaylistTest, Normalize) {
    ParserM3u parser;

    EXPECT_STREQ(parser.playlistEntrytoLocalFile("file:///foo/bar.mp3").toStdString().c_str(),
            "/foo/bar.mp3");
    EXPECT_STREQ(parser.playlistEntrytoLocalFile("file:foo/bar.mp3").toStdString().c_str(),
            "foo/bar.mp3");
#ifdef Q_OS_WIN
    EXPECT_STREQ(parser.playlistEntrytoLocalFile("file:///c:/foo/bar.mp3").toStdString().c_str(),
            "c:/foo/bar.mp3");
#else
    EXPECT_STREQ(parser.playlistEntrytoLocalFile("file:///c:/foo/bar.mp3").toStdString().c_str(),
            "/c:/foo/bar.mp3");
#endif
    EXPECT_STREQ(parser.playlistEntrytoLocalFile("file:///foo%20/bar.mp3").toStdString().c_str(),
            "/foo /bar.mp3");
    EXPECT_STREQ(parser.playlistEntrytoLocalFile("c:/foo/bar.mp3").toStdString().c_str(),
            "c:/foo/bar.mp3");
    EXPECT_STREQ(parser.playlistEntrytoLocalFile("c:\\foo\\bar.mp3").toStdString().c_str(),
            "c:/foo/bar.mp3");
}