File indexing completed on 2024-04-28 04:48:14

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 META_MOCKTRACK_H
0018 #define META_MOCKTRACK_H
0019 
0020 #undef kWarning  // WORKAROUND: Prevent symbols clash with KDE's kWarning macro
0021 #include <gmock/gmock.h>
0022 
0023 #include "core/meta/Meta.h"
0024 
0025 using ::testing::Return;
0026 
0027 namespace Meta
0028 {
0029 class MockTrack : public Meta::Track
0030 {
0031     public:
0032     MockTrack() : Meta::Track()
0033     {
0034         ON_CALL( *this, name() ).WillByDefault( Return( "" ) );
0035         ON_CALL( *this, notPlayableReason() ).WillByDefault( Return( QString() ) );
0036         ON_CALL( *this, artist() ).WillByDefault( Return( Meta::ArtistPtr() ) );
0037         ON_CALL( *this, album() ).WillByDefault( Return( Meta::AlbumPtr() ) );
0038         ON_CALL( *this, genre() ).WillByDefault( Return( Meta::GenrePtr() ) );
0039         ON_CALL( *this, year() ).WillByDefault( Return( Meta::YearPtr() ) );
0040         ON_CALL( *this, composer() ).WillByDefault( Return( Meta::ComposerPtr() ) );
0041     }
0042 
0043     MOCK_CONST_METHOD0( name, QString() );
0044     MOCK_CONST_METHOD0( prettyName, QString() );
0045     MOCK_CONST_METHOD0( playableUrl, QUrl() );
0046     MOCK_CONST_METHOD0( prettyUrl, QString() );
0047     MOCK_CONST_METHOD0( uidUrl, QString() );
0048     MOCK_CONST_METHOD0( notPlayableReason, QString() );
0049     MOCK_CONST_METHOD0( album, Meta::AlbumPtr() );
0050     MOCK_CONST_METHOD0( artist, Meta::ArtistPtr() );
0051     MOCK_CONST_METHOD0( composer, Meta::ComposerPtr() );
0052     MOCK_CONST_METHOD0( genre, Meta::GenrePtr() );
0053     MOCK_CONST_METHOD0( year, Meta::YearPtr() );
0054     MOCK_CONST_METHOD0( bpm, qreal() );
0055     MOCK_CONST_METHOD0( comment, QString() );
0056     MOCK_CONST_METHOD0( score, double() );
0057     MOCK_METHOD1( setScore, void(double score) );
0058     MOCK_CONST_METHOD0( rating, int() );
0059     MOCK_METHOD1( setRating, void(int rating) );
0060     MOCK_CONST_METHOD0( length, qint64() );
0061     MOCK_CONST_METHOD0( filesize, int() );
0062     MOCK_CONST_METHOD0( sampleRate, int() );
0063     MOCK_CONST_METHOD0( bitrate, int() );
0064     MOCK_CONST_METHOD0( createDate, QDateTime() );
0065     MOCK_CONST_METHOD0( trackNumber, int() );
0066     MOCK_CONST_METHOD0( discNumber, int() );
0067     MOCK_CONST_METHOD0( lastPlayed, QDateTime() );
0068     MOCK_CONST_METHOD0( firstPlayed, QDateTime() );
0069     MOCK_CONST_METHOD0( playCount, int() );
0070     MOCK_CONST_METHOD1( replayGain, qreal(Meta::ReplayGainTag mode) );
0071     MOCK_CONST_METHOD0( type, QString() );
0072     MOCK_METHOD0( prepareToPlay, void() );
0073     MOCK_METHOD1( finishedPlaying, void( double playedFraction ) );
0074     MOCK_CONST_METHOD0( inCollection, bool() );
0075     MOCK_CONST_METHOD0( collection, Collections::Collection*() );
0076     MOCK_CONST_METHOD0( cachedLyrics, QString() );
0077 };
0078 }
0079 
0080 #endif