mirror of
https://github.com/taglib/taglib.git
synced 2025-07-18 21:14:23 -04:00
Support for writing structuraly correct ID3v2.3 tags
We don't use the tag footer, extended header or unsynchronization, so we only need to change the frame size format. Note that this doesn't write correct ID3v2.3 tags, just tags that have the correct structure. The content is sill incorrect, unless you add the right frames manually to the tag instance.
This commit is contained in:
@ -2,6 +2,8 @@
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
#include <mpegfile.h>
|
||||
#include <id3v2tag.h>
|
||||
#include "utils.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace TagLib;
|
||||
@ -10,6 +12,8 @@ class TestMPEG : public CppUnit::TestFixture
|
||||
{
|
||||
CPPUNIT_TEST_SUITE(TestMPEG);
|
||||
CPPUNIT_TEST(testVersion2DurationWithXingHeader);
|
||||
CPPUNIT_TEST(testSaveID3v24);
|
||||
CPPUNIT_TEST(testSaveID3v23);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
@ -20,6 +24,38 @@ public:
|
||||
CPPUNIT_ASSERT_EQUAL(5387, f.audioProperties()->length());
|
||||
}
|
||||
|
||||
void testSaveID3v24()
|
||||
{
|
||||
ScopedFileCopy copy("xing", ".mp3", false);
|
||||
string newname = copy.fileName();
|
||||
|
||||
String xxx = ByteVector(254, 'X');
|
||||
MPEG::File f(newname.c_str());
|
||||
f.tag()->setTitle(xxx);
|
||||
f.tag()->setArtist("Artist A");
|
||||
f.save(MPEG::File::AllTags, true, 4);
|
||||
|
||||
MPEG::File f2(newname.c_str());
|
||||
CPPUNIT_ASSERT_EQUAL(String("Artist A"), f2.tag()->artist());
|
||||
CPPUNIT_ASSERT_EQUAL(xxx, f2.tag()->title());
|
||||
}
|
||||
|
||||
void testSaveID3v23()
|
||||
{
|
||||
ScopedFileCopy copy("xing", ".mp3", false);
|
||||
string newname = copy.fileName();
|
||||
|
||||
String xxx = ByteVector(254, 'X');
|
||||
MPEG::File f(newname.c_str());
|
||||
f.tag()->setTitle(xxx);
|
||||
f.tag()->setArtist("Artist A");
|
||||
f.save(MPEG::File::AllTags, true, 3);
|
||||
|
||||
MPEG::File f2(newname.c_str());
|
||||
CPPUNIT_ASSERT_EQUAL(String("Artist A"), f2.tag()->artist());
|
||||
CPPUNIT_ASSERT_EQUAL(xxx, f2.tag()->title());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(TestMPEG);
|
||||
|
Reference in New Issue
Block a user