Changeset View
Changeset View
Standalone View
Standalone View
autotests/taglibextractortest.cpp
Show First 20 Lines • Show All 303 Lines • ▼ Show 20 Line(s) | 302 | { | |||
---|---|---|---|---|---|
304 | QTest::addColumn<QString>("mimeType"); | 304 | QTest::addColumn<QString>("mimeType"); | ||
305 | 305 | | |||
306 | QTest::addRow("mp4") | 306 | QTest::addRow("mp4") | ||
307 | << QStringLiteral("m4a") | 307 | << QStringLiteral("m4a") | ||
308 | << QStringLiteral("audio/mp4") | 308 | << QStringLiteral("audio/mp4") | ||
309 | ; | 309 | ; | ||
310 | } | 310 | } | ||
311 | 311 | | |||
312 | void TagLibExtractorTest::testAsf() | ||||
313 | { | ||||
314 | QFETCH(QString, fileType); | ||||
315 | QFETCH(QString, mimeType); | ||||
316 | | ||||
317 | QString fileName = QStringLiteral("test.") + fileType; | ||||
318 | | ||||
319 | TagLibExtractor plugin{this}; | ||||
320 | SimpleExtractionResult result(testFilePath(fileName), mimeType); | ||||
321 | plugin.extract(&result); | ||||
322 | | ||||
323 | QCOMPARE(result.properties().value(Property::AlbumArtist), QVariant(QStringLiteral("Album Artist"))); | ||||
324 | QCOMPARE(result.properties().value(Property::Rating).toInt(), 6); | ||||
325 | QCOMPARE(result.properties().value(Property::DiscNumber).toInt(), 1); | ||||
326 | QCOMPARE(result.properties().value(Property::Conductor), QVariant(QStringLiteral("Conductor"))); | ||||
327 | QCOMPARE(result.properties().value(Property::Composer), QVariant(QStringLiteral("Composer"))); | ||||
328 | QCOMPARE(result.properties().value(Property::Author), QVariant(QStringLiteral("Author"))); | ||||
329 | QCOMPARE(result.properties().value(Property::Lyricist), QVariant(QStringLiteral("Lyricist"))); | ||||
330 | QCOMPARE(result.properties().value(Property::Copyright), QVariant(QStringLiteral("Copyright"))); | ||||
331 | QCOMPARE(result.properties().value(Property::Publisher), QVariant(QStringLiteral("Publisher"))); | ||||
332 | } | ||||
333 | | ||||
334 | void TagLibExtractorTest::testAsf_data() | ||||
335 | { | ||||
336 | QTest::addColumn<QString>("fileType"); | ||||
337 | QTest::addColumn<QString>("mimeType"); | ||||
338 | | ||||
339 | QTest::addRow("asf") | ||||
340 | << QStringLiteral("wma") | ||||
341 | << QStringLiteral("audio/x-ms-wma") | ||||
342 | ; | ||||
343 | } | ||||
344 | | ||||
312 | void TagLibExtractorTest::testId3Rating_data() | 345 | void TagLibExtractorTest::testId3Rating_data() | ||
313 | { | 346 | { | ||
314 | QTest::addColumn<QString>("path"); | 347 | QTest::addColumn<QString>("path"); | ||
315 | QTest::addColumn<int>("expectedRating"); | 348 | QTest::addColumn<int>("expectedRating"); | ||
316 | 349 | | |||
317 | QTest::addRow("WMP") | 350 | QTest::addRow("WMP") | ||
318 | << QFINDTESTDATA("samplefiles/mp3_rating/testWMP.mp3") | 351 | << QFINDTESTDATA("samplefiles/mp3_rating/testWMP.mp3") | ||
319 | << 0 ; | 352 | << 0 ; | ||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Line(s) | 404 | { | |||
374 | 407 | | |||
375 | TagLibExtractor plugin{this}; | 408 | TagLibExtractor plugin{this}; | ||
376 | SimpleExtractionResult result(path, "audio/mpeg"); | 409 | SimpleExtractionResult result(path, "audio/mpeg"); | ||
377 | plugin.extract(&result); | 410 | plugin.extract(&result); | ||
378 | 411 | | |||
379 | QCOMPARE(result.properties().value(Property::Rating).toInt(), expectedRating); | 412 | QCOMPARE(result.properties().value(Property::Rating).toInt(), expectedRating); | ||
380 | } | 413 | } | ||
381 | 414 | | |||
415 | void TagLibExtractorTest::testWmaRating() | ||||
416 | { | ||||
417 | QFETCH(QString, path); | ||||
418 | QFETCH(int, expectedRating); | ||||
419 | | ||||
420 | TagLibExtractor plugin{this}; | ||||
421 | SimpleExtractionResult result(path, "audio/x-ms-wma"); | ||||
422 | plugin.extract(&result); | ||||
423 | | ||||
424 | QCOMPARE(result.properties().value(Property::Rating).toUInt(), expectedRating); | ||||
425 | } | ||||
426 | | ||||
427 | void TagLibExtractorTest::testWmaRating_data() | ||||
428 | { | ||||
429 | QTest::addColumn<QString>("path"); | ||||
430 | QTest::addColumn<int>("expectedRating"); | ||||
431 | | ||||
432 | QTest::addRow("WMP0") | ||||
433 | << QFINDTESTDATA("samplefiles/wma_rating/test0.wma") | ||||
434 | << 0 ; | ||||
435 | QTest::addRow("WMP1") | ||||
436 | << QFINDTESTDATA("samplefiles/wma_rating/test1.wma") | ||||
437 | << 2 ; | ||||
438 | QTest::addRow("WMP2") | ||||
439 | << QFINDTESTDATA("samplefiles/wma_rating/test2.wma") | ||||
440 | << 4 ; | ||||
441 | QTest::addRow("WMP3") | ||||
442 | << QFINDTESTDATA("samplefiles/wma_rating/test3.wma") | ||||
443 | << 6 ; | ||||
444 | QTest::addRow("WMP4") | ||||
445 | << QFINDTESTDATA("samplefiles/wma_rating/test4.wma") | ||||
446 | << 8 ; | ||||
447 | QTest::addRow("WMP5") | ||||
448 | << QFINDTESTDATA("samplefiles/wma_rating/test5.wma") | ||||
449 | << 10 ; | ||||
450 | } | ||||
451 | | ||||
382 | void TagLibExtractorTest::testNoMetadata_data() | 452 | void TagLibExtractorTest::testNoMetadata_data() | ||
383 | { | 453 | { | ||
384 | const auto expectedKeys = QList<Property::Property>{ | 454 | const auto expectedKeys = QList<Property::Property>{ | ||
385 | Property::BitRate, | 455 | Property::BitRate, | ||
386 | Property::Channels, | 456 | Property::Channels, | ||
387 | Property::Duration, | 457 | Property::Duration, | ||
388 | Property::SampleRate, | 458 | Property::SampleRate, | ||
389 | }; | 459 | }; | ||
▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines |