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 AMAROK_MOCKLOGGER_H 0018 #define AMAROK_MOCKLOGGER_H 0019 0020 #include <gmock/gmock.h> 0021 0022 #include "core/logger/Logger.h" 0023 0024 using ::testing::Return; 0025 using ::testing::An; 0026 using ::testing::_; 0027 0028 namespace Amarok 0029 { 0030 class MockLogger : public Amarok::Logger 0031 { 0032 public: 0033 MockLogger() : Amarok::Logger() 0034 { 0035 ON_CALL( *this, shortMessageImpl( _ ) ).WillByDefault( Return() ); 0036 ON_CALL( *this, longMessageImpl( _, _ ) ).WillByDefault( Return() ); 0037 ON_CALL( *this, newProgressOperationImpl( An<KJob*>(), _, _, _, _ ) ).WillByDefault( Return() ); 0038 ON_CALL( *this, newProgressOperationImpl( An<QNetworkReply*>(), _, _, _, _ ) ).WillByDefault( Return() ); 0039 ON_CALL( *this, newProgressOperationImpl( An<QObject *>(), _, _, _, _, _, _, _ ) ).WillByDefault( Return() ); 0040 } 0041 0042 MOCK_METHOD1( shortMessageImpl, void( const QString& ) ); 0043 MOCK_METHOD2( longMessageImpl, void( const QString&, Amarok::Logger::MessageType ) ); 0044 MOCK_METHOD5( newProgressOperationImpl, void( KJob*, const QString&, QObject*, const std::function<void ()>&, 0045 Qt::ConnectionType ) ); 0046 MOCK_METHOD5( newProgressOperationImpl, void( QNetworkReply*, const QString&, QObject*, 0047 const std::function<void ()>&, Qt::ConnectionType ) ); 0048 MOCK_METHOD8( newProgressOperationImpl, void( QObject *, const QMetaMethod &, const QMetaMethod &, const QString&, 0049 int, QObject*, const std::function<void ()>&, Qt::ConnectionType ) ); 0050 }; 0051 } 0052 0053 #endif 0054