File indexing completed on 2024-12-08 10:14:49

0001 /*
0002     SPDX-FileCopyrightText: 2014 Vishesh Handa <me@vhanda.in>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-or-later
0005 */
0006 
0007 #include "extractortest.h"
0008 #include "ondemandextractor.h"
0009 
0010 #include <QDataStream>
0011 #include <QDebug>
0012 #include <QProcess>
0013 #include <QStandardPaths>
0014 #include <QTest>
0015 
0016 void ExtractorTest::test()
0017 {
0018     using namespace KFileMetaData::Property;
0019     QString fileUrl = QFINDTESTDATA("samplefiles/test.mp3");
0020 
0021     Baloo::Private::OnDemandExtractor extractor;
0022     extractor.process(fileUrl);
0023     QVERIFY(extractor.waitFinished());
0024 
0025     auto data = extractor.properties();
0026 
0027     QCOMPARE(data.value(Property::Channels).toInt(), 2);
0028     QCOMPARE(data.value(Property::SampleRate).toInt(), 44100);
0029     if (data.size() == 3) {
0030         QCOMPARE(data.value(Property::BitRate).toInt(), 255000);
0031     } else {
0032         QCOMPARE(data.size(), 2);
0033     }
0034 }
0035 
0036 QTEST_MAIN(ExtractorTest)
0037 
0038 #include "moc_extractortest.cpp"