File indexing completed on 2024-09-22 04:23:34

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 #ifndef TESTSQLTRACK_H
0018 #define TESTSQLTRACK_H
0019 
0020 #include <QSharedPointer>
0021 #include <QtTest>
0022 
0023 #include <QTemporaryDir>
0024 
0025 class MySqlEmbeddedStorage;
0026 class SqlRegistry;
0027 
0028 namespace Collections {
0029     class SqlCollection;
0030 }
0031 namespace Meta {
0032     class SqlTrack;
0033 }
0034 
0035 class TestSqlTrack : public QObject
0036 {
0037     Q_OBJECT
0038 
0039 public:
0040     TestSqlTrack();
0041 
0042 private Q_SLOTS:
0043     void initTestCase();
0044     void cleanupTestCase();
0045 
0046     void init();
0047     void cleanup();
0048 
0049     void testGetTrack();
0050 
0051     void testSetAllValuesSingleNotExisting();
0052     void testSetAllValuesSingleExisting();
0053     void testSetAllValuesBatch();
0054 
0055     void testUnsetValues();
0056 
0057     void testFinishedPlaying();
0058 
0059     void testAlbumRemainsCompilationAfterChangingAlbumName();
0060     void testAlbumRemaingsNonCompilationAfterChangingAlbumName();
0061     void testRemoveLabelFromTrack();
0062     void testRemoveLabelFromTrackWhenNotInCache();
0063 
0064 private:
0065     void setAllValues( Meta::SqlTrack *track );
0066     void getAllValues( Meta::SqlTrack *track );
0067 
0068     Collections::SqlCollection *m_collection;
0069     QSharedPointer<MySqlEmbeddedStorage> m_storage;
0070     QTemporaryDir *m_tmpDir;
0071 };
0072 
0073 #endif // TESTSQLTRACK_H