]> granicus.if.org Git - taglib/commitdiff
Add a (failing) test for reading ALAC audio properties
authorLukáš Lalinský <lalinsky@gmail.com>
Wed, 8 Jun 2011 17:03:43 +0000 (19:03 +0200)
committerLukáš Lalinský <lalinsky@gmail.com>
Wed, 8 Jun 2011 17:03:43 +0000 (19:03 +0200)
tests/data/empty_alac.m4a [new file with mode: 0644]
tests/test_mp4.cpp

diff --git a/tests/data/empty_alac.m4a b/tests/data/empty_alac.m4a
new file mode 100644 (file)
index 0000000..35b0950
Binary files /dev/null and b/tests/data/empty_alac.m4a differ
index 1e7f8f5a87498160076fd3668d3e936ef921f415..bedf43ef0a733a8d0fb7ff4e75050af13098f586 100644 (file)
@@ -14,7 +14,8 @@ using namespace TagLib;
 class TestMP4 : public CppUnit::TestFixture
 {
   CPPUNIT_TEST_SUITE(TestMP4);
-  CPPUNIT_TEST(testProperties);
+  CPPUNIT_TEST(testPropertiesAAC);
+  CPPUNIT_TEST(testPropertiesALAC);
   CPPUNIT_TEST(testFreeForm);
   CPPUNIT_TEST(testCheckValid);
   CPPUNIT_TEST(testUpdateStco);
@@ -28,7 +29,7 @@ class TestMP4 : public CppUnit::TestFixture
 
 public:
 
-  void testProperties()
+  void testPropertiesAAC()
   {
     MP4::File f(TEST_FILE_PATH_C("has-tags.m4a"));
     CPPUNIT_ASSERT_EQUAL(3, f.audioProperties()->length());
@@ -38,6 +39,16 @@ public:
     CPPUNIT_ASSERT_EQUAL(16, ((MP4::Properties *)f.audioProperties())->bitsPerSample());
   }
 
+  void testPropertiesALAC()
+  {
+    MP4::File f(TEST_FILE_PATH_C("empty_alac.m4a"));
+    CPPUNIT_ASSERT_EQUAL(3, f.audioProperties()->length());
+    CPPUNIT_ASSERT_EQUAL(3, f.audioProperties()->bitrate());
+    CPPUNIT_ASSERT_EQUAL(2, f.audioProperties()->channels());
+    CPPUNIT_ASSERT_EQUAL(44100, f.audioProperties()->sampleRate());
+    CPPUNIT_ASSERT_EQUAL(16, ((MP4::Properties *)f.audioProperties())->bitsPerSample());
+  }
+
   void testCheckValid()
   {
     MP4::File f(TEST_FILE_PATH_C("empty.aiff"));