File indexing completed on 2025-01-05 04:27:29

0001 /****************************************************************************************
0002  * Copyright (c) 2012 Jasneet Singh Bhatti <jazneetbhatti@gmail.com>                    *
0003  * This program is free software; you can redistribute it and/or modify it under        *
0004  * the terms of the GNU General Public License as published by the Free Software        *
0005  * Foundation; either version 2 of the License, or (at your option) any later           *
0006  * version.                                                                             *
0007  *                                                                                      *
0008  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0009  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0010  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0011  *                                                                                      *
0012  * You should have received a copy of the GNU General Public License along with         *
0013  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0014  ****************************************************************************************/
0015 
0016 #ifndef TESTPRIVATEMETAREGISTRY_H
0017 #define TESTPRIVATEMETAREGISTRY_H
0018 
0019 #include "core/meta/forward_declarations.h"
0020 
0021 #include <QtTest>
0022 
0023 using namespace Meta;
0024 
0025 class TestPrivateMetaRegistry : public QObject
0026 {
0027     Q_OBJECT
0028 
0029     public:
0030         ~TestPrivateMetaRegistry() override;
0031 
0032     private Q_SLOTS:
0033         void initTestCase();
0034 
0035         /**
0036          * Data driven testing
0037          */
0038         void testInsertAlbum_data();
0039         void testInsertAlbum();
0040         void testInsertArtist_data();
0041         void testInsertArtist();
0042         void testInsertComposer_data();
0043         void testInsertComposer();
0044         void testInsertGenre_data();
0045         void testInsertGenre();
0046         void testInsertYear_data();
0047         void testInsertYear();
0048 
0049         /**
0050          * Test if the getters correctly return a pointer to null for a non-existing
0051          * combination of owner and key.
0052          * This is done in a separate method to avoid repetition of this verification
0053          * for each instance of the test data
0054          */
0055         void testNull();
0056 
0057     private:
0058         /**
0059          * For portability in fetching tracks from disk
0060          */
0061         QString datapath( const QString &relPath );
0062 
0063         /**
0064          * All _data() methods use this to create test data
0065          */
0066         void createTestData();
0067 
0068         /**
0069          * Test tracks required for generating test data
0070          */
0071         TrackPtr m_track1, m_track2, m_track3, m_track4, m_track5;
0072 };
0073 
0074 #endif // TESTPRIVATEMETAREGISTRY_H