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

« back to all changes in this revision

Viewing changes to tests/xspfparser_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/xspfparser.h"
23
24
 
24
25
#include <QBuffer>
 
26
#include <QUrl>
25
27
 
26
28
using ::testing::HasSubstr;
27
29
 
49
51
  EXPECT_EQ("Foo", song.title());
50
52
  EXPECT_EQ("Bar", song.artist());
51
53
  EXPECT_EQ("Baz", song.album());
52
 
  EXPECT_EQ("http://example.com/foo.mp3", song.filename());
 
54
  EXPECT_EQ(QUrl("http://example.com/foo.mp3"), song.url());
53
55
  EXPECT_EQ(60 * kNsecPerSec, song.length_nanosec());
54
56
  EXPECT_TRUE(song.is_valid());
55
57
}
69
71
  XSPFParser parser(NULL);
70
72
  SongList songs = parser.Load(&buffer);
71
73
  ASSERT_EQ(2, songs.length());
72
 
  EXPECT_EQ("http://example.com/foo.mp3", songs[0].filename());
73
 
  EXPECT_EQ("http://example.com/bar.mp3", songs[1].filename());
 
74
  EXPECT_EQ(QUrl("http://example.com/foo.mp3"), songs[0].url());
 
75
  EXPECT_EQ(QUrl("http://example.com/bar.mp3"), songs[1].url());
74
76
  EXPECT_TRUE(songs[0].is_stream());
75
77
  EXPECT_TRUE(songs[1].is_stream());
76
78
}
100
102
  buffer.open(QIODevice::WriteOnly);
101
103
  XSPFParser parser(NULL);
102
104
  Song one;
103
 
  one.set_filename("http://www.example.com/foo.mp3");
 
105
  one.set_url(QUrl("http://www.example.com/foo.mp3"));
104
106
  one.set_filetype(Song::Type_Stream);
105
107
  one.set_title("foo");
106
108
  one.set_length_nanosec(123 * kNsecPerSec);
121
123
  buffer.open(QIODevice::WriteOnly);
122
124
  XSPFParser parser(NULL);
123
125
  Song one;
124
 
  one.set_filename("/bar/foo.mp3");
 
126
  one.set_url(QUrl("file:///bar/foo.mp3"));
125
127
  one.set_filetype(Song::Type_Mpeg);
126
128
  one.set_title("foo");
127
129
  one.set_length_nanosec(123 * kNsecPerSec);