diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/library/coverart.cpp | 4 | ||||
-rw-r--r-- | src/library/coverart.h | 4 | ||||
-rw-r--r-- | src/test/coverartutils_test.cpp | 4 |
3 files changed, 9 insertions, 3 deletions
diff --git a/src/library/coverart.cpp b/src/library/coverart.cpp index 459c77eca1..ed97363941 100644 --- a/src/library/coverart.cpp +++ b/src/library/coverart.cpp @@ -1,6 +1,7 @@ #include <QtDebug> #include "library/coverart.h" +#include "library/coverartutils.h" #include "util/debug.h" QString sourceToString(CoverInfo::Source source) { @@ -41,3 +42,6 @@ QDebug operator<<(QDebug dbg, const CoverArt& art) { .arg(toDebugString(art.image.size()), toDebugString(art.info)); } + +const quint16 CoverInfo::kNullImageHash = CoverArtUtils::calculateHash(QImage()); + diff --git a/src/library/coverart.h b/src/library/coverart.h index bdbb68d8fc..7510d496bd 100644 --- a/src/library/coverart.h +++ b/src/library/coverart.h @@ -28,12 +28,14 @@ struct CoverInfo { FILE = 2 }; + static const quint16 kNullImageHash; + CoverInfo() : source(UNKNOWN), type(NONE), coverLocation(QString()), trackLocation(QString()), // This default value is fine: qChecksum(NULL, 0) is 0. - hash(0) {} + hash(CoverInfo::kNullImageHash) {} bool operator==(const CoverInfo& other) const { return other.source == source && diff --git a/src/test/coverartutils_test.cpp b/src/test/coverartutils_test.cpp index 53278a4e42..2710f4fca4 100644 --- a/src/test/coverartutils_test.cpp +++ b/src/test/coverartutils_test.cpp @@ -135,7 +135,7 @@ TEST_F(CoverArtUtilTest, searchImage) { EXPECT_EQ(result.type, CoverInfo::METADATA); EXPECT_EQ(result.source, CoverInfo::GUESSED); EXPECT_EQ(result.coverLocation, QString()); - EXPECT_NE(result.hash, 0); + EXPECT_NE(result.hash, CoverInfo::kNullImageHash); const char* format("jpg"); const QString qFormat(format); @@ -246,7 +246,7 @@ TEST_F(CoverArtUtilTest, searchImage) { expected2.image = QImage(); expected2.info.type = CoverInfo::NONE; expected2.info.coverLocation = QString(); - expected2.info.hash = 0; + expected2.info.hash = CoverInfo::kNullImageHash; } else { expected2.image = QImage(cover.filePath()); expected2.info.type = CoverInfo::FILE; |