File indexing completed on 2024-09-22 04:23:32
0001 /**************************************************************************************** 0002 * Copyright (c) 2009 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 TESTSQLQUERYMAKER_H 0018 #define TESTSQLQUERYMAKER_H 0019 0020 #include <QSharedPointer> 0021 #include <QTest> 0022 #include <core/collections/QueryMaker.h> 0023 0024 #include <QTemporaryDir> 0025 0026 class MySqlEmbeddedStorage; 0027 class SqlMountPointManagerMock; 0028 0029 namespace Collections { 0030 class SqlCollection; 0031 class SqlQueryMaker; 0032 } 0033 0034 class TestSqlQueryMaker : public QObject 0035 { 0036 Q_OBJECT 0037 public: 0038 TestSqlQueryMaker(); 0039 0040 private Q_SLOTS: 0041 void initTestCase(); 0042 void cleanupTestCase(); 0043 0044 void cleanup(); 0045 0046 void testQueryTracks(); 0047 void testQueryAlbums(); 0048 void testQueryGenres(); 0049 void testQueryYears(); 0050 void testQueryComposers(); 0051 void testQueryArtists(); 0052 void testAlbumQueryMode(); 0053 0054 void testDeleteQueryMakerWithRunningQuery(); 0055 0056 void testAsyncTrackQuery(); 0057 void testAsyncArtistQuery(); 0058 void testAsyncGenreQuery(); 0059 void testAsyncComposerQuery(); 0060 void testAsyncAlbumQuery(); 0061 void testAsyncYearQuery(); 0062 void testAsyncCustomQuery(); 0063 0064 void testFilter(); 0065 void testFilter_data(); 0066 0067 void testDynamicCollection(); 0068 0069 void testSpecialCharacters_data(); 0070 void testSpecialCharacters(); 0071 0072 void testNumberFilter(); 0073 void testNumberFilter_data(); 0074 0075 void testReturnFunctions_data(); 0076 void testReturnFunctions(); 0077 0078 void testLabelMatch(); 0079 void testMultipleLabelMatches(); 0080 0081 void testQueryTypesWithLabelMatching_data(); 0082 void testQueryTypesWithLabelMatching(); 0083 0084 void testFilterOnLabelsAndCombination(); 0085 void testFilterOnLabelsOrCombination(); 0086 void testFilterOnLabelsNegationAndCombination(); 0087 void testFilterOnLabelsNegationOrCombination(); 0088 void testComplexLabelsFilter(); 0089 0090 void testLabelQueryMode_data(); 0091 void testLabelQueryMode(); 0092 0093 private: 0094 void checkResultCount( Collections::SqlQueryMaker* qm, 0095 Collections::QueryMaker::QueryType type, int count ); 0096 0097 Collections::SqlCollection *m_collection; 0098 SqlMountPointManagerMock *m_mpm; 0099 QSharedPointer<MySqlEmbeddedStorage> m_storage; 0100 QTemporaryDir *m_tmpDir; 0101 }; 0102 0103 #endif // TESTSQLQUERYMAKER_H