~ubuntu-branches/ubuntu/saucy/clementine/saucy

« back to all changes in this revision

Viewing changes to tests/asxparser_test.cpp

  • Committer: Package Import Robot
  • Author(s): Thomas PIERSON
  • Date: 2012-01-01 20:43:39 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120101204339-lsb6nndwhfy05sde
Tags: 1.0.1+dfsg-1
New upstream release. (Closes: #653926, #651611, #657391)

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#include "gmock/gmock-matchers.h"
20
20
#include "gtest/gtest.h"
21
21
 
 
22
#include "core/timeconstants.h"
22
23
#include "playlistparsers/asxparser.h"
23
24
 
24
25
#include <QBuffer>
 
26
#include <QUrl>
25
27
 
26
28
using ::testing::HasSubstr;
27
29
 
45
47
  const Song& song = songs[0];
46
48
  EXPECT_EQ("Foo", song.title());
47
49
  EXPECT_EQ("Bar", song.artist());
48
 
  EXPECT_EQ("http://example.com/foo.mp3", song.filename());
 
50
  EXPECT_EQ(QUrl("http://example.com/foo.mp3"), song.url());
49
51
  EXPECT_TRUE(song.is_valid());
50
52
}
51
53
 
64
66
  ASXParser parser(NULL);
65
67
  SongList songs = parser.Load(&buffer);
66
68
  ASSERT_EQ(2, songs.length());
67
 
  EXPECT_EQ("http://example.com/foo.mp3", songs[0].filename());
68
 
  EXPECT_EQ("http://example.com/bar.mp3", songs[1].filename());
 
69
  EXPECT_EQ(QUrl("http://example.com/foo.mp3"), songs[0].url());
 
70
  EXPECT_EQ(QUrl("http://example.com/bar.mp3"), songs[1].url());
69
71
  EXPECT_TRUE(songs[0].is_stream());
70
72
  EXPECT_TRUE(songs[1].is_stream());
71
73
}
90
92
  ASXParser parser(NULL);
91
93
  SongList songs = parser.Load(&buffer);
92
94
  ASSERT_EQ(1, songs.length());
93
 
  EXPECT_EQ("mms://72.26.204.105/classictrance128k?user=h&pass=xxxxxxxxxxxxxxx", songs[0].filename());
 
95
  EXPECT_EQ(QUrl("mms://72.26.204.105/classictrance128k?user=h&pass=xxxxxxxxxxxxxxx"), songs[0].url());
94
96
}
95
97
 
96
98
TEST_F(ASXParserTest, SavesSong) {
99
101
  buffer.open(QIODevice::WriteOnly);
100
102
  ASXParser parser(NULL);
101
103
  Song one;
102
 
  one.set_filename("http://www.example.com/foo.mp3");
 
104
  one.set_url(QUrl("http://www.example.com/foo.mp3"));
103
105
  one.set_filetype(Song::Type_Stream);
104
106
  one.set_title("foo");
105
107
  one.set_length_nanosec(123 * kNsecPerSec);
123
125
  ASSERT_EQ(4, songs.count());
124
126
  EXPECT_EQ("SomaFM: Secret Agent", songs[0].title());
125
127
  EXPECT_EQ("Keep us on the air! Click Support SomaFM above!", songs[0].artist());
126
 
  EXPECT_EQ("http://streamer-ntc-aa03.somafm.com:80/stream/1021", songs[0].filename());
 
128
  EXPECT_EQ(QUrl("http://streamer-ntc-aa03.somafm.com:80/stream/1021"), songs[0].url());
127
129
}