File indexing completed on 2024-05-12 04:49:39

0001 /****************************************************************************************
0002  * Copyright (c) 2010 Maximilian Kossick <maximilian.kossick@googlemail.com>            *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 #include "TestArtistHelper.h"
0018 
0019 #include <core-impl/collections/support/ArtistHelper.h>
0020 
0021 
0022 QTEST_GUILESS_MAIN( TestArtistHelper )
0023 
0024 TestArtistHelper::TestArtistHelper() : QObject()
0025 {
0026 
0027 }
0028 
0029 void
0030 TestArtistHelper::testRealTrackArtist_data()
0031 {
0032     QTest::addColumn<QString>( "artistTag" );
0033     QTest::addColumn<QString>( "realArtist" );
0034 
0035     QTest::newRow( "no ft." ) << "Artist A" << "Artist A";
0036     QTest::newRow( "A ft. B") << "A ft. B" << "A";
0037     QTest::newRow( "A feat. B" ) << "A feat. B" << "A";
0038     QTest::newRow( "A featuring B" ) << "A featuring B" << "A";
0039     QTest::newRow( "A f. B" ) << "A f. B" << "A";
0040     //QTest::newRow( "artist including ft. string" ) << "Aft.B" << "Aft.B"; //not possible according to ML discussion
0041     QTest::newRow( "empty A, return original string" ) << "  featuring B" << "  featuring B";
0042     QTest::newRow( "A (feat. B)" ) << "A (feat. B )" << "A";
0043     QTest::newRow( "A [feat. B]" ) << "A [feat. B]" << "A";
0044 }
0045 
0046 void
0047 TestArtistHelper::testRealTrackArtist()
0048 {
0049     QFETCH( QString, artistTag );
0050     QFETCH( QString, realArtist );
0051 
0052     QCOMPARE( ArtistHelper::realTrackArtist( artistTag ), realArtist );
0053 }
0054