diff options
author | Lukáš Lalinský <lalinsky@gmail.com> | 2010-07-03 11:32:27 +0000 |
---|---|---|
committer | Lukáš Lalinský <lalinsky@gmail.com> | 2010-07-03 11:32:27 +0000 |
commit | ab1bc0617211586351e30bac10fd3e41e363b3ab (patch) | |
tree | 643a6bf9c4c9692c5f0481c1a633cb1c3bf2eb07 /tests | |
parent | 8792f8df82b6cd7929853ea5c47ca28d2fd1e66b (diff) |
Support for reading/writing tags from Monkey's Audio files
Patch by Alex Novichkov, slightly modified by me (code formatting + tests).
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1145554 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tests/Makefile.am | 2 | ||||
-rw-r--r-- | tests/data/mac-390-hdr.ape | bin | 0 -> 128 bytes | |||
-rw-r--r-- | tests/data/mac-396.ape | bin | 0 -> 104 bytes | |||
-rw-r--r-- | tests/data/mac-399.ape | bin | 0 -> 172 bytes | |||
-rw-r--r-- | tests/test_ape.cpp | 52 | ||||
-rw-r--r-- | tests/test_fileref.cpp | 5 |
7 files changed, 61 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 005b7a5a..21820d75 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -3,6 +3,7 @@ if(BUILD_TESTS) INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/../taglib ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/toolkit + ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/ape ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/asf ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpeg/id3v1 ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpeg/id3v2 @@ -37,6 +38,7 @@ SET(test_runner_SRCS test_ogg.cpp test_oggflac.cpp test_flac.cpp + test_ape.cpp ) IF(WITH_MP4) SET(test_runner_SRCS ${test_runner_SRCS} diff --git a/tests/Makefile.am b/tests/Makefile.am index 9f99683b..94131821 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -2,6 +2,7 @@ INCLUDES = \ -I$(top_srcdir)/taglib\ -I$(top_srcdir)/taglib/toolkit \ -I$(top_srcdir)/taglib/trueaudio \ + -I$(top_srcdir)/taglib/ape \ -I$(top_srcdir)/taglib/mpeg \ -I$(top_srcdir)/taglib/mpeg/id3v1 \ -I$(top_srcdir)/taglib/mpeg/id3v2 \ @@ -19,6 +20,7 @@ test_runner_SOURCES = \ test_map.cpp \ test_mpeg.cpp \ test_synchdata.cpp \ + test_ape.cpp \ test_trueaudio.cpp \ test_bytevector.cpp \ test_string.cpp \ diff --git a/tests/data/mac-390-hdr.ape b/tests/data/mac-390-hdr.ape Binary files differnew file mode 100644 index 00000000..c703e2e2 --- /dev/null +++ b/tests/data/mac-390-hdr.ape diff --git a/tests/data/mac-396.ape b/tests/data/mac-396.ape Binary files differnew file mode 100644 index 00000000..fa7ae414 --- /dev/null +++ b/tests/data/mac-396.ape diff --git a/tests/data/mac-399.ape b/tests/data/mac-399.ape Binary files differnew file mode 100644 index 00000000..ae895ba2 --- /dev/null +++ b/tests/data/mac-399.ape diff --git a/tests/test_ape.cpp b/tests/test_ape.cpp new file mode 100644 index 00000000..10010932 --- /dev/null +++ b/tests/test_ape.cpp @@ -0,0 +1,52 @@ +#include <cppunit/extensions/HelperMacros.h> +#include <string> +#include <stdio.h> +#include <tag.h> +#include <tstringlist.h> +#include <tbytevectorlist.h> +#include <apefile.h> +#include "utils.h" + +using namespace std; +using namespace TagLib; + +class TestAPE : public CppUnit::TestFixture +{ + CPPUNIT_TEST_SUITE(TestAPE); + CPPUNIT_TEST(testProperties399); + CPPUNIT_TEST(testProperties396); + CPPUNIT_TEST(testProperties390); + CPPUNIT_TEST_SUITE_END(); + +public: + + void testProperties399() + { + APE::File f("data/mac-399.ape"); + CPPUNIT_ASSERT_EQUAL(3, f.audioProperties()->length()); + CPPUNIT_ASSERT_EQUAL(0, f.audioProperties()->bitrate()); + CPPUNIT_ASSERT_EQUAL(2, f.audioProperties()->channels()); + CPPUNIT_ASSERT_EQUAL(44100, f.audioProperties()->sampleRate()); + } + + void testProperties396() + { + APE::File f("data/mac-396.ape"); + CPPUNIT_ASSERT_EQUAL(3, f.audioProperties()->length()); + CPPUNIT_ASSERT_EQUAL(0, f.audioProperties()->bitrate()); + CPPUNIT_ASSERT_EQUAL(2, f.audioProperties()->channels()); + CPPUNIT_ASSERT_EQUAL(44100, f.audioProperties()->sampleRate()); + } + + void testProperties390() + { + APE::File f("data/mac-390-hdr.ape"); + CPPUNIT_ASSERT_EQUAL(15, f.audioProperties()->length()); + CPPUNIT_ASSERT_EQUAL(0, f.audioProperties()->bitrate()); + CPPUNIT_ASSERT_EQUAL(2, f.audioProperties()->channels()); + CPPUNIT_ASSERT_EQUAL(44100, f.audioProperties()->sampleRate()); + } + +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(TestAPE); diff --git a/tests/test_fileref.cpp b/tests/test_fileref.cpp index bc0c5fe1..965afa9a 100644 --- a/tests/test_fileref.cpp +++ b/tests/test_fileref.cpp @@ -32,6 +32,7 @@ class TestFileRef : public CppUnit::TestFixture CPPUNIT_TEST(testMP4_3); #endif CPPUNIT_TEST(testTrueAudio); + CPPUNIT_TEST(testAPE); CPPUNIT_TEST_SUITE_END(); public: @@ -148,6 +149,10 @@ public: CPPUNIT_ASSERT(dynamic_cast<Ogg::FLAC::File *>(f->file()) == NULL); } + void testAPE() + { + fileRefSave("mac-399.ape", ".ape"); + } }; CPPUNIT_TEST_SUITE_REGISTRATION(TestFileRef); |