Debian Codegraph @

tests/test-taglist.cc

raw symbols SCIP
1 /*
2 * test-taglist.cc
3 *
4 * Created on: Jul 31, 2013
5 * Author: m.kolny
6 */
7
8 #include "mmtest.h"
9 #include <gstreamermm.h>
10
11 using namespace Gst;
12
13 class TagListTest : public ::testing::Test
14 {
15 protected:
16 TagList tag_list;
17
18 static Glib::ustring song_title;
19 static Glib::ustring song_artist;
20 static guint64 song_duration;
21 static Glib::Date song_date;
22
23 template<typename Ty>
24 Ty ValidateTag(Tag tag)
25 {
26 Ty output = {};
27
28 bool ok = tag_list.get(tag, output);
29
30 EXPECT_EQ(true, ok);
31
32 return output;
33 }
34 };
35
36 Glib::ustring TagListTest::song_title = "Funky Song";
37 Glib::ustring TagListTest::song_artist = "Marcin Kolny";
38 guint64 TagListTest::song_duration = 120;
39 Glib::Date TagListTest::song_date = Glib::Date(28, Glib::Date::DECEMBER, 1991);
40
41
42 TEST_F(TagListTest, GetTagTitleFromList)
43 {
44 tag_list.add(TAG_TITLE, song_title);
45
46 Glib::ustring out_title = ValidateTag<Glib::ustring>(TAG_TITLE);
47 ASSERT_STREQ(song_title.c_str(), out_title.c_str());
48 }
49
50 TEST_F(TagListTest, GetTagArtistFromList)
51 {
52 tag_list.add(TAG_ARTIST, song_artist);
53
54 Glib::ustring out_artist = ValidateTag<Glib::ustring>(TAG_ARTIST);
55 ASSERT_STREQ(song_artist.c_str(), out_artist.c_str());
56 }
57
58 TEST_F(TagListTest, DISABLED_GetTagDurationFromList)
59 {
60 tag_list.add(TAG_DURATION, song_duration);
61
62 guint64 out_duration = ValidateTag<guint64>(TAG_DURATION);
63 EXPECT_EQ(song_duration, out_duration);
64 }
65
66 TEST_F(TagListTest, DISABLED_GetTagDateFromList)
67 {
68 tag_list.add(TAG_DATE, song_date);
69
70 Glib::Date out_date = ValidateTag<Glib::Date>(TAG_DATE);
71
72 EXPECT_EQ(song_date.get_day(), out_date.get_day());
73 EXPECT_EQ(song_date.get_year(), out_date.get_year());
74 EXPECT_EQ(song_date.get_month(), out_date.get_month());
75 }
76
77 TEST_F(TagListTest, GetNonExistingTag)
78 {
79 Glib::ustring album;
80
81 bool album_exists = tag_list.get(TAG_ALBUM, album);
82
83 MM_ASSERT_FALSE(album_exists);
84 }