#include "test_utils.h" #include "gtest/gtest.h" #include "xspfparser.h" #include class XSPFParserTest : public ::testing::Test { }; TEST_F(XSPFParserTest, ParsesOneTrackFromXML) { QByteArray data = "" "http://example.com/foo.mp3" "Foo" "Bar" "Baz" "60000" "http://example.com/albumcover.jpg" "http://example.com" ""; QBuffer buffer(&data); buffer.open(QIODevice::ReadOnly); XSPFParser parser(&buffer); const SongList& songs = parser.Parse(); ASSERT_EQ(1, songs.length()); const Song& song = songs[0]; EXPECT_EQ("Foo", song.title()); EXPECT_EQ("Bar", song.artist()); EXPECT_EQ("Baz", song.album()); EXPECT_EQ("http://example.com/foo.mp3", song.filename()); EXPECT_TRUE(song.is_valid()); }