~mediascanner-team/mediascanner2/trunk

« back to all changes in this revision

Viewing changes to test/test_metadataextractor.cc

  • Committer: CI Train Bot
  • Author(s): Jussi Pakkanen
  • Date: 2015-01-22 10:17:50 UTC
  • mfrom: (286.3.2 mediascanner)
  • Revision ID: ci-train-bot@canonical.com-20150122101750-2v7esq537i3ama66
Add blacklist functionality and use it to block music playlists. Fixes: #1384295
Approved by: James Henstridge, PS Jenkins bot

Show diffs side-by-side

added added

removed removed

Lines of Context:
133
133
    EXPECT_DOUBLE_EQ(153.1727346, file.getLongitude());
134
134
}
135
135
 
136
 
// PNG files don't have exif entries, so test we work with those, too.
 
136
TEST_F(MetadataExtractorTest, blacklist) {
 
137
    MetadataExtractor e;
 
138
    string testfile = SOURCE_DIR "/media/playlist.m3u";
 
139
    try {
 
140
        e.detect(testfile);
 
141
    } catch(const std::runtime_error &e) {
 
142
        std::string error_message(e.what());
 
143
        ASSERT_NE(error_message.find("blacklist"), std::string::npos);
 
144
        return;
 
145
    }
 
146
    ASSERT_TRUE(false) << "Blacklist exception was not thrown.\n";
 
147
}
 
148
 
137
149
TEST_F(MetadataExtractorTest, png_file) {
 
150
    // PNG files don't have exif entries, so test we work with those, too.
138
151
    MetadataExtractor e;
139
152
    MediaFile file = e.extract(e.detect(SOURCE_DIR "/media/image3.png"));
140
153
 
156
169
 
157
170
    EXPECT_DOUBLE_EQ(0, file.getLatitude());
158
171
    EXPECT_DOUBLE_EQ(0, file.getLongitude());
159
 
 
160
172
}
161
173
 
162
174
int main(int argc, char **argv) {