mirror of
https://github.com/taglib/taglib.git
synced 2025-06-04 01:28:21 -04:00
fixed tests
This commit is contained in:
parent
cfa5ac6569
commit
70c3264279
@ -4,6 +4,7 @@
|
||||
#include <tag.h>
|
||||
#include <tstringlist.h>
|
||||
#include <tbytevectorlist.h>
|
||||
#include <tpropertymap.h>
|
||||
#include <apetag.h>
|
||||
#include "utils.h"
|
||||
|
||||
@ -39,12 +40,12 @@ public:
|
||||
void testDict()
|
||||
{
|
||||
APE::Tag tag;
|
||||
TagDict dict = tag.toDict();
|
||||
PropertyMap dict = tag.properties();
|
||||
CPPUNIT_ASSERT(dict.isEmpty());
|
||||
dict["ARTIST"] = String("artist 1");
|
||||
dict["ARTIST"].append("artist 2");
|
||||
dict["TRACKNUMBER"].append("17");
|
||||
tag.fromDict(dict);
|
||||
tag.setProperties(dict);
|
||||
CPPUNIT_ASSERT_EQUAL(String("17"), tag.itemListMap()["TRACK"].values()[0]);
|
||||
CPPUNIT_ASSERT_EQUAL(2u, tag.itemListMap()["ARTIST"].values().size());
|
||||
CPPUNIT_ASSERT_EQUAL(String("artist 1"), tag.artist());
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <tag.h>
|
||||
#include <tstringlist.h>
|
||||
#include <tbytevectorlist.h>
|
||||
#include <tpropertymap.h>
|
||||
#include <flacfile.h>
|
||||
#include <xiphcomment.h>
|
||||
#include "utils.h"
|
||||
@ -216,15 +217,15 @@ public:
|
||||
string newname = copy.fileName();
|
||||
|
||||
FLAC::File *f = new FLAC::File(newname.c_str());
|
||||
TagDict dict;
|
||||
PropertyMap dict;
|
||||
dict["ARTIST"].append("artøst 1");
|
||||
dict["ARTIST"].append("artöst 2");
|
||||
f->fromDict(dict);
|
||||
f->setProperties(dict);
|
||||
f->save();
|
||||
delete f;
|
||||
|
||||
f = new FLAC::File(newname.c_str());
|
||||
dict = f->toDict();
|
||||
dict = f->properties();
|
||||
CPPUNIT_ASSERT_EQUAL(TagLib::uint(2), dict["ARTIST"].size());
|
||||
CPPUNIT_ASSERT_EQUAL(String("artøst 1"), dict["ARTIST"][0]);
|
||||
CPPUNIT_ASSERT_EQUAL(String("artöst 2"), dict["ARTIST"][1]);
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <popularimeterframe.h>
|
||||
#include <urllinkframe.h>
|
||||
#include <tdebug.h>
|
||||
#include <tpropertymap.h>
|
||||
#include "utils.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <tag.h>
|
||||
#include <tstringlist.h>
|
||||
#include <tbytevectorlist.h>
|
||||
#include <tpropertymap.h>
|
||||
#include <oggfile.h>
|
||||
#include <vorbisfile.h>
|
||||
#include <oggpageheader.h>
|
||||
@ -60,15 +61,15 @@ public:
|
||||
|
||||
Vorbis::File *f = new Vorbis::File(newname.c_str());
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(uint(0), f->tag()->toDict().size());
|
||||
CPPUNIT_ASSERT_EQUAL(uint(0), f->tag()->properties().size());
|
||||
|
||||
TagDict newTags;
|
||||
PropertyMap newTags;
|
||||
StringList values("value 1");
|
||||
values.append("value 2");
|
||||
newTags["ARTIST"] = values;
|
||||
f->tag()->fromDict(newTags);
|
||||
f->tag()->setProperties(newTags);
|
||||
|
||||
TagDict map = f->tag()->toDict();
|
||||
PropertyMap map = f->tag()->properties();
|
||||
CPPUNIT_ASSERT_EQUAL(uint(1), map.size());
|
||||
CPPUNIT_ASSERT_EQUAL(uint(2), map["ARTIST"].size());
|
||||
CPPUNIT_ASSERT_EQUAL(String("value 1"), map["ARTIST"][0]);
|
||||
@ -82,7 +83,7 @@ public:
|
||||
string newname = copy.fileName();
|
||||
|
||||
Vorbis::File *f = new Vorbis::File(newname.c_str());
|
||||
TagDict tags = f->tag()->toDict();
|
||||
PropertyMap tags = f->tag()->properties();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(uint(2), tags["UNUSUALTAG"].size());
|
||||
CPPUNIT_ASSERT_EQUAL(String("usual value"), tags["UNUSUALTAG"][0]);
|
||||
@ -91,9 +92,9 @@ public:
|
||||
|
||||
tags["UNICODETAG"][0] = L"νεω ναλυε";
|
||||
tags.erase("UNUSUALTAG");
|
||||
f->tag()->fromDict(tags);
|
||||
CPPUNIT_ASSERT_EQUAL(String(L"νεω ναλυε"), f->tag()->toDict()["UNICODETAG"][0]);
|
||||
CPPUNIT_ASSERT_EQUAL(false, f->tag()->toDict().contains("UNUSUALTAG"));
|
||||
f->tag()->setProperties(tags);
|
||||
CPPUNIT_ASSERT_EQUAL(String(L"νεω ναλυε"), f->tag()->properties()["UNICODETAG"][0]);
|
||||
CPPUNIT_ASSERT_EQUAL(false, f->tag()->properties().contains("UNUSUALTAG"));
|
||||
|
||||
delete f;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user