Warning, file /multimedia/amarok/tests/scanner/TestGenericScanManager.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /**************************************************************************************** 0002 * Copyright (c) 2009 Maximilian Kossick <maximilian.kossick@googlemail.com> * 0003 * Copyright (c) 2010-2013 Ralf Engels <ralf-engels@gmx.de> * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify it under * 0006 * the terms of the GNU General Public License as published by the Free Software * 0007 * Foundation; either version 2 of the License, or (at your option) any later * 0008 * version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0011 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0012 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0013 * * 0014 * You should have received a copy of the GNU General Public License along with * 0015 * this program. If not, see <http://www.gnu.org/licenses/>. * 0016 ****************************************************************************************/ 0017 0018 #ifndef TESTGENERICSCANMANAGER_H 0019 #define TESTGENERICSCANMANAGER_H 0020 0021 #include "scanner/GenericScanManager.h" 0022 #include "core/meta/support/MetaConstants.h" 0023 0024 #include <QSignalSpy> 0025 #include <QTemporaryDir> 0026 0027 #include <QTest> 0028 0029 /** Test the GenericScanManager and the scanner job 0030 */ 0031 class TestGenericScanManager : public QObject 0032 { 0033 Q_OBJECT 0034 0035 public: 0036 TestGenericScanManager(); 0037 0038 private Q_SLOTS: 0039 void initTestCase(); 0040 void cleanupTestCase(); 0041 0042 void init(); 0043 void cleanup(); 0044 0045 /** 0046 * Check that a single insert really inserts all the information 0047 */ 0048 void testScanSingle(); 0049 0050 /** 0051 * Check that fully scanning a directory works 0052 */ 0053 void testScanDirectory(); 0054 0055 /** 0056 * Check that the scanner continues if crashed 0057 */ 0058 void testRestartScanner(); 0059 0060 /** 0061 * Test images 0062 */ 0063 void testAlbumImage(); 0064 0065 0066 public Q_SLOTS: 0067 void slotStarted( GenericScanManager::ScanType type ); 0068 void slotDirectoryCount( int count ); 0069 void slotDirectoryScanned( QSharedPointer<CollectionScanner::Directory> dir ); 0070 void slotSucceeded(); 0071 void slotFailed( const QString& message ); 0072 0073 private: 0074 void fullScanAndWait(); 0075 void waitScannerFinished( QSignalSpy &spy ); 0076 0077 /** 0078 Creates a track in the m_tmpCollectionDir with the given values. 0079 Meta::valUrl gives the relative path to the target track. 0080 */ 0081 void createTrack( const Meta::FieldHash &values ); 0082 void createSingleTrack(); 0083 void createAlbum(); 0084 0085 bool m_started; 0086 bool m_finished; 0087 0088 int m_scannedDirsCount; 0089 int m_scannedTracksCount; 0090 int m_scannedCoversCount; 0091 0092 QTemporaryDir *m_tmpCollectionDir; 0093 QString m_sourcePath; // the path to the template .mp3 file 0094 0095 GenericScanManager *m_scanManager; 0096 }; 0097 0098 #endif // TESTGENERICSCANMANAGER_H