[gstreamermm: 104/167] added taglist tests, and first fails;)



commit 2fdc0e6cde32d70ec7556a47bec9b3fdc1b5cf81
Author: Marcin Kolny at Flytronic <marcin kolny flytronic pl>
Date:   Wed Jul 31 17:48:35 2013 +0200

    added taglist tests, and first fails;)

 tests/test-buffer.cc  |   10 +-----
 tests/test-taglist.cc |   76 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 78 insertions(+), 8 deletions(-)
---
diff --git a/tests/test-buffer.cc b/tests/test-buffer.cc
index efab5e1..2ce3ede 100644
--- a/tests/test-buffer.cc
+++ b/tests/test-buffer.cc
@@ -27,14 +27,8 @@ TEST(BufferTest, CheckBufferFlags)
 {
     guint buff_flags = 1;
     Glib::RefPtr<Buffer> buf = Buffer::create();
-    buf->set_flags(buff_flags);
-    Glib::RefPtr<MapInfo> map_info(new MapInfo());
-
-    buf->map(map_info, MAP_READ);
 
-    buf->get_flags();
-
-    EXPECT_EQ(buff_flags, map_info->get_flags());
+    buf->set_flags(buff_flags);
 
-    buf->unmap(map_info);
+    EXPECT_EQ(buff_flags, buf->get_flags());
 }
diff --git a/tests/test-taglist.cc b/tests/test-taglist.cc
new file mode 100644
index 0000000..89d0d4d
--- /dev/null
+++ b/tests/test-taglist.cc
@@ -0,0 +1,76 @@
+/*
+ * test-taglist.cc
+ *
+ *  Created on: Jul 31, 2013
+ *      Author: m.kolny
+ */
+
+#include <gtest/gtest.h>
+#include <gstreamermm.h>
+
+using namespace Gst;
+
+
+class TagListTest : public ::testing::Test
+{
+protected:
+    TagList tag_list;
+
+    static Glib::ustring song_title;
+    static Glib::ustring song_artist;
+    static guint64 song_duration;
+    static Glib::Date song_date;
+
+    virtual void SetUp()
+    {
+        tag_list.add(TAG_TITLE, song_title);
+        tag_list.add(TAG_ARTIST, song_artist);
+        tag_list.add(TAG_DURATION, song_duration);
+        tag_list.add(TAG_DATE, song_date);
+    }
+
+    template<typename Ty>
+    Ty ValidateTag(Tag tag)
+    {
+        Ty output;
+
+        bool ok = tag_list.get(tag, output);
+
+        EXPECT_EQ(true, ok);
+
+        return output;
+    }
+};
+
+Glib::ustring TagListTest::song_title = "Funky Song";
+Glib::ustring TagListTest::song_artist = "Marcin Kolny";
+guint64 TagListTest::song_duration = 120;
+Glib::Date TagListTest::song_date = Glib::Date(28, Glib::Date::DECEMBER, 1991);
+
+
+TEST_F(TagListTest, GetTagTitleFromList)
+{
+    Glib::ustring out_title = ValidateTag<Glib::ustring>(TAG_TITLE);
+    ASSERT_STREQ(song_title.c_str(), out_title.c_str());
+}
+
+TEST_F(TagListTest, GetTagArtistFromList)
+{
+    Glib::ustring out_artist = ValidateTag<Glib::ustring>(TAG_ARTIST);
+    ASSERT_STREQ(song_artist.c_str(), out_artist.c_str());
+}
+
+TEST_F(TagListTest, GetTagDurationFromList)
+{
+    guint64 out_duration = ValidateTag<guint64>(TAG_DURATION);
+    EXPECT_EQ(song_duration, out_duration);
+}
+
+TEST_F(TagListTest, GetTagDateFromList)
+{
+    Glib::Date out_date = ValidateTag<Glib::Date>(TAG_DATE);
+
+    EXPECT_EQ(song_date.get_day(), out_date.get_day());
+    EXPECT_EQ(song_date.get_year(), out_date.get_year());
+    EXPECT_EQ(song_date.get_month(), out_date.get_month());
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]