diff options
author | dknn <yoann.blein@free.fr> | 2012-08-17 15:32:43 (GMT) |
---|---|---|
committer | dknn <yoann.blein@free.fr> | 2012-09-22 09:34:49 (GMT) |
commit | 6247ed394302ff2cf1f33a71df808bebf7241242 (patch) | |
tree | d4d61fb5e66611ecdc75cf1149b64e23fef2b077 | |
parent | c8ced8597ab28b928862d21554c0a68c238b1165 (diff) | |
download | swift-contrib-6247ed394302ff2cf1f33a71df808bebf7241242.zip swift-contrib-6247ed394302ff2cf1f33a71df808bebf7241242.tar.bz2 |
Fix test suite compliance
-rw-r--r-- | Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp | 7 | ||||
-rw-r--r-- | Swift/Controllers/MainController.cpp | 4 | ||||
-rw-r--r-- | Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp | 9 | ||||
-rw-r--r-- | Swift/Controllers/SConscript | 2 | ||||
-rw-r--r-- | Swift/Controllers/ScreenSharing/ScreenSharingController.cpp | 4 | ||||
-rw-r--r-- | Swift/Controllers/ScreenSharing/ScreenSharingOverview.h | 25 | ||||
-rw-r--r-- | Swift/Controllers/ScreenSharing/ScreenSharingOverviewImpl.cpp (renamed from Swift/Controllers/ScreenSharing/ScreenSharingOverview.cpp) | 17 | ||||
-rw-r--r-- | Swift/Controllers/ScreenSharing/ScreenSharingOverviewImpl.h | 40 | ||||
-rw-r--r-- | Swift/Controllers/ScreenSharing/UnitTest/DummyScreenSharingOverview.h | 18 | ||||
-rw-r--r-- | Swift/Controllers/UnitTest/MockChatWindow.h | 6 |
10 files changed, 93 insertions, 39 deletions
diff --git a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp index 482b19c..2bf0ba0 100644 --- a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp +++ b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp @@ -52,6 +52,7 @@ #include <Swift/Controllers/SettingConstants.h> #include <Swift/Controllers/WhiteboardManager.h> #include <Swiften/Whiteboard/WhiteboardSessionManager.h> +#include <Swift/Controllers/ScreenSharing/UnitTest/DummyScreenSharingOverview.h> using namespace Swift; @@ -103,13 +104,15 @@ public: chatListWindow_ = new MockChatListWindow(); ftManager_ = new DummyFileTransferManager(); ftOverview_ = new FileTransferOverview(ftManager_); + ssOverview_ = new DummyScreenSharingOverview; avatarManager_ = new NullAvatarManager(); wbSessionManager_ = new WhiteboardSessionManager(iqRouter_, stanzaChannel_, presenceOracle_, entityCapsManager_); wbManager_ = new WhiteboardManager(whiteboardWindowFactory_, uiEventStream_, nickResolver_, wbSessionManager_); mocks_->ExpectCall(chatListWindowFactory_, ChatListWindowFactory::createChatListWindow).With(uiEventStream_).Return(chatListWindow_); - manager_ = new ChatsManager(jid_, stanzaChannel_, iqRouter_, eventController_, chatWindowFactory_, joinMUCWindowFactory_, nickResolver_, presenceOracle_, directedPresenceSender_, uiEventStream_, chatListWindowFactory_, true, NULL, mucRegistry_, entityCapsManager_, mucManager_, mucSearchWindowFactory_, profileSettings_, ftOverview_, xmppRoster_, false, settings_, NULL, wbManager_); + manager_ = new ChatsManager(jid_, stanzaChannel_, iqRouter_, eventController_, chatWindowFactory_, joinMUCWindowFactory_, nickResolver_, presenceOracle_, directedPresenceSender_, uiEventStream_, chatListWindowFactory_, true, NULL, mucRegistry_, entityCapsManager_, mucManager_, mucSearchWindowFactory_, profileSettings_, ftOverview_, ssOverview_, xmppRoster_, false, settings_, NULL, wbManager_); + avatarManager_ = new NullAvatarManager(); manager_->setAvatarManager(avatarManager_); }; @@ -118,6 +121,7 @@ public: delete profileSettings_; delete avatarManager_; delete manager_; + delete ssOverview_; delete ftOverview_; delete ftManager_; delete wbSessionManager_; @@ -479,6 +483,7 @@ private: ChatListWindow* chatListWindow_; FileTransferOverview* ftOverview_; FileTransferManager* ftManager_; + ScreenSharingOverview* ssOverview_; WhiteboardSessionManager* wbSessionManager_; WhiteboardManager* wbManager_; }; diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index 5774ea6..c678dc8 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -78,7 +78,7 @@ #include <Swiften/Client/ClientXMLTracer.h> #include <Swift/Controllers/SettingConstants.h> #include <Swiften/Client/StanzaChannel.h> -#include "Swift/Controllers/ScreenSharing/ScreenSharingOverview.h" +#include "Swift/Controllers/ScreenSharing/ScreenSharingOverviewImpl.h" namespace Swift { @@ -306,7 +306,7 @@ void MainController::handleConnected() { client_->getFileTransferManager()->startListeningOnPort(randomPort); ftOverview_ = new FileTransferOverview(client_->getFileTransferManager()); fileTransferListController_->setFileTransferOverview(ftOverview_); - ssOverview_ = new ScreenSharingOverview(client_->getScreenSharingManager(), uiFactory_, networkFactories_->getTimerFactory()); + ssOverview_ = new ScreenSharingOverviewImpl(client_->getScreenSharingManager(), uiFactory_, networkFactories_->getTimerFactory()); rosterController_ = new RosterController(jid_, client_->getRoster(), client_->getAvatarManager(), uiFactory_, client_->getNickManager(), client_->getNickResolver(), client_->getPresenceOracle(), client_->getSubscriptionManager(), eventController_, uiEventStream_, client_->getIQRouter(), settings_, client_->getEntityCapsProvider(), ftOverview_, ssOverview_); rosterController_->onChangeStatusRequest.connect(boost::bind(&MainController::handleChangeStatusRequest, this, _1, _2)); rosterController_->onSignOutRequest.connect(boost::bind(&MainController::signOut, this)); diff --git a/Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp b/Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp index fbee894..5009c0c 100644 --- a/Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp +++ b/Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp @@ -37,6 +37,7 @@ #include <Swiften/FileTransfer/UnitTest/DummyFileTransferManager.h> #include <Swiften/Base/Algorithm.h> #include <Swiften/EventLoop/DummyEventLoop.h> +#include "Swift/Controllers/ScreenSharing/UnitTest/DummyScreenSharingOverview.h" using namespace Swift; @@ -82,12 +83,17 @@ class RosterControllerTest : public CppUnit::TestFixture { ftManager_ = new DummyFileTransferManager(); ftOverview_ = new FileTransferOverview(ftManager_); - rosterController_ = new RosterController(jid_, xmppRoster_, avatarManager_, mainWindowFactory_, nickManager_, nickResolver_, presenceOracle_, subscriptionManager_, eventController_, uiEventStream_, router_, settings_, entityCapsManager_, ftOverview_); + ssOverview_ = new DummyScreenSharingOverview; + + rosterController_ = new RosterController(jid_, xmppRoster_, avatarManager_, mainWindowFactory_, nickManager_, nickResolver_, presenceOracle_, subscriptionManager_, eventController_, uiEventStream_, router_, settings_, entityCapsManager_, ftOverview_, ssOverview_); mainWindow_ = mainWindowFactory_->last; }; void tearDown() { delete rosterController_; + + delete ssOverview_; + delete ftOverview_; delete ftManager_; delete jingleSessionManager_; @@ -337,6 +343,7 @@ class RosterControllerTest : public CppUnit::TestFixture { JingleSessionManager* jingleSessionManager_; FileTransferManager* ftManager_; FileTransferOverview* ftOverview_; + ScreenSharingOverview* ssOverview_; }; CPPUNIT_TEST_SUITE_REGISTRATION(RosterControllerTest); diff --git a/Swift/Controllers/SConscript b/Swift/Controllers/SConscript index d884baa..6463854 100644 --- a/Swift/Controllers/SConscript +++ b/Swift/Controllers/SConscript @@ -76,7 +76,7 @@ if env["SCONS_STAGE"] == "build" : "SettingConstants.cpp", "WhiteboardManager.cpp", "ScreenSharing/ScreenSharingController.cpp", - "ScreenSharing/ScreenSharingOverview.cpp", + "ScreenSharing/ScreenSharingOverviewImpl.cpp", ]) env.Append(UNITTEST_SOURCES = [ diff --git a/Swift/Controllers/ScreenSharing/ScreenSharingController.cpp b/Swift/Controllers/ScreenSharing/ScreenSharingController.cpp index 2e9a75d..a42e9bb 100644 --- a/Swift/Controllers/ScreenSharing/ScreenSharingController.cpp +++ b/Swift/Controllers/ScreenSharing/ScreenSharingController.cpp @@ -23,7 +23,7 @@ namespace Swift { ScreenSharingController::ScreenSharingController(ScreenSharingManager* screenSharingManager, TimerFactory* timerFactory, DesktopScreenGrabber* desktopScreenGrabber, const JID& to) - : screenGrabber(desktopScreenGrabber), grabTimer(timerFactory->createTimer(500)), remoteScreenWindowFactory(0), + : screenGrabber(desktopScreenGrabber), grabTimer(timerFactory->createTimer(1000/0.5)), remoteScreenWindowFactory(0), remoteScreenWindow(0), otherParty(to), incoming(false), chatWindow(0) { OutgoingScreenSharing::ref oss = screenSharingManager->createOutgoingScreenSharing(to); @@ -108,7 +108,7 @@ void ScreenSharingController::handleReady() void ScreenSharingController::handleFinished() { - screenSharing->onFinished.disconnect(boost::bind(&ScreenSharingController::handleFinished, this)); +// screenSharing->onFinished.disconnect(boost::bind(&ScreenSharingController::handleFinished, this)); screenSharing.reset(); delete remoteScreenWindow; remoteScreenWindow = 0; diff --git a/Swift/Controllers/ScreenSharing/ScreenSharingOverview.h b/Swift/Controllers/ScreenSharing/ScreenSharingOverview.h index b43a665..86f81df 100644 --- a/Swift/Controllers/ScreenSharing/ScreenSharingOverview.h +++ b/Swift/Controllers/ScreenSharing/ScreenSharingOverview.h @@ -8,38 +8,17 @@ #include <Swiften/Base/boost_bsignals.h> -#include <boost/shared_ptr.hpp> - -#include <vector> - namespace Swift { - class ScreenSharingManager; class ScreenSharingController; - class IncomingScreenSharing; - class TimerFactory; - class DesktopScreenGrabber; - class RemoteScreenWindowFactory; class JID; class ScreenSharingOverview { public: - ScreenSharingOverview(ScreenSharingManager* screenSharingManager, RemoteScreenWindowFactory* remoteScreenWindowFactory, TimerFactory* timerFactory); - ~ScreenSharingOverview(); + virtual ~ScreenSharingOverview() {} - void createOugoingScreenSharing(const JID& to); + virtual void createOugoingScreenSharing(const JID& to) = 0; public: boost::signal<void (ScreenSharingController*)> onNewScreenSharingController; - - private: - void handleIncomingScreenSharing(boost::shared_ptr<IncomingScreenSharing> incomingScreenSharing); - - private: - ScreenSharingManager* screenSharingManager; - RemoteScreenWindowFactory* remoteScreenWindowFactory; - TimerFactory* timerFactory; - - DesktopScreenGrabber* screenGrabber; - std::vector<ScreenSharingController*> controllers; }; } diff --git a/Swift/Controllers/ScreenSharing/ScreenSharingOverview.cpp b/Swift/Controllers/ScreenSharing/ScreenSharingOverviewImpl.cpp index 91f75b9..1f5cdec 100644 --- a/Swift/Controllers/ScreenSharing/ScreenSharingOverview.cpp +++ b/Swift/Controllers/ScreenSharing/ScreenSharingOverviewImpl.cpp @@ -4,7 +4,7 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ -#include "ScreenSharingOverview.h" +#include "ScreenSharingOverviewImpl.h" #include "Swift/QtUI/ScreenSharing/QtDesktopScreenGrabber.h" #include "Swift/Controllers/ScreenSharing/ScreenSharingController.h" @@ -14,26 +14,27 @@ namespace Swift { -ScreenSharingOverview::ScreenSharingOverview(ScreenSharingManager *screenSharingManager, RemoteScreenWindowFactory* remoteScreenViewerFactory, TimerFactory* timerFactory) - : screenSharingManager(screenSharingManager), remoteScreenWindowFactory(remoteScreenViewerFactory), timerFactory(timerFactory), +ScreenSharingOverviewImpl::ScreenSharingOverviewImpl(ScreenSharingManager *screenSharingManager, RemoteScreenWindowFactory* remoteScreenViewerFactory, TimerFactory* timerFactory) + : ScreenSharingOverview(), + screenSharingManager(screenSharingManager), remoteScreenWindowFactory(remoteScreenViewerFactory), timerFactory(timerFactory), screenGrabber(new QtDesktopScreenGrabber) { - screenSharingManager->onIncomingScreenSharing.connect(boost::bind(&ScreenSharingOverview::handleIncomingScreenSharing, this, _1)); + screenSharingManager->onIncomingScreenSharing.connect(boost::bind(&ScreenSharingOverviewImpl::handleIncomingScreenSharing, this, _1)); } -ScreenSharingOverview::~ScreenSharingOverview() +ScreenSharingOverviewImpl::~ScreenSharingOverviewImpl() { - screenSharingManager->onIncomingScreenSharing.disconnect(boost::bind(&ScreenSharingOverview::handleIncomingScreenSharing, this, _1)); + screenSharingManager->onIncomingScreenSharing.disconnect(boost::bind(&ScreenSharingOverviewImpl::handleIncomingScreenSharing, this, _1)); } -void ScreenSharingOverview::createOugoingScreenSharing(const JID& to) +void ScreenSharingOverviewImpl::createOugoingScreenSharing(const JID& to) { ScreenSharingController* ssc = new ScreenSharingController(screenSharingManager, timerFactory, screenGrabber, to); controllers.push_back(ssc); onNewScreenSharingController(ssc); } -void ScreenSharingOverview::handleIncomingScreenSharing(boost::shared_ptr<IncomingScreenSharing> incomingScreenSharing) +void ScreenSharingOverviewImpl::handleIncomingScreenSharing(boost::shared_ptr<IncomingScreenSharing> incomingScreenSharing) { ScreenSharingController* ssc = new ScreenSharingController(incomingScreenSharing, remoteScreenWindowFactory); controllers.push_back(ssc); diff --git a/Swift/Controllers/ScreenSharing/ScreenSharingOverviewImpl.h b/Swift/Controllers/ScreenSharing/ScreenSharingOverviewImpl.h new file mode 100644 index 0000000..ad5871d --- /dev/null +++ b/Swift/Controllers/ScreenSharing/ScreenSharingOverviewImpl.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2012 Yoann Blein + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <boost/shared_ptr.hpp> + +#include <vector> + +#include "ScreenSharingOverview.h" + +namespace Swift { + class ScreenSharingManager; + class IncomingScreenSharing; + class TimerFactory; + class DesktopScreenGrabber; + class RemoteScreenWindowFactory; + + class ScreenSharingOverviewImpl : public ScreenSharingOverview { + public: + ScreenSharingOverviewImpl(ScreenSharingManager* screenSharingManager, RemoteScreenWindowFactory* remoteScreenWindowFactory, TimerFactory* timerFactory); + virtual ~ScreenSharingOverviewImpl(); + + virtual void createOugoingScreenSharing(const JID& to); + + private: + void handleIncomingScreenSharing(boost::shared_ptr<IncomingScreenSharing> incomingScreenSharing); + + private: + ScreenSharingManager* screenSharingManager; + RemoteScreenWindowFactory* remoteScreenWindowFactory; + TimerFactory* timerFactory; + + DesktopScreenGrabber* screenGrabber; + std::vector<ScreenSharingController*> controllers; + }; +} diff --git a/Swift/Controllers/ScreenSharing/UnitTest/DummyScreenSharingOverview.h b/Swift/Controllers/ScreenSharing/UnitTest/DummyScreenSharingOverview.h new file mode 100644 index 0000000..8ea4d68 --- /dev/null +++ b/Swift/Controllers/ScreenSharing/UnitTest/DummyScreenSharingOverview.h @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2012 Yoann Blein + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include "Swift/Controllers/ScreenSharing/ScreenSharingOverview.h" + +namespace Swift { + class DummyScreenSharingOverview : public ScreenSharingOverview { + public: + virtual ~DummyScreenSharingOverview() {} + + virtual void createOugoingScreenSharing(const JID& /*to*/) {} + }; +} diff --git a/Swift/Controllers/UnitTest/MockChatWindow.h b/Swift/Controllers/UnitTest/MockChatWindow.h index 998a4eb..4bb3cd3 100644 --- a/Swift/Controllers/UnitTest/MockChatWindow.h +++ b/Swift/Controllers/UnitTest/MockChatWindow.h @@ -24,7 +24,11 @@ namespace Swift { virtual std::string addFileTransfer(const std::string& /*senderName*/, bool /*senderIsSelf*/,const std::string& /*filename*/, const boost::uintmax_t /*sizeInBytes*/) { return 0; }; virtual void setFileTransferProgress(std::string /*id*/, const int /*alreadyTransferedBytes*/) { }; virtual void setFileTransferStatus(std::string /*id*/, const FileTransferState /*state*/, const std::string& /*msg*/) { }; - + + // Screen sharing related stuff + virtual std::string addScreenSharing(const std::string& /*senderName*/, bool /*incoming*/) { return ""; } + virtual void setScreenSharingStatus(std::string, const ScreenSharing::SCState /*state*/, const std::string& /*msg*/) {} + virtual void setMessageReceiptState(const std::string &/* id */, ReceiptState /* state */) { } virtual void setContactChatState(ChatState::ChatStateType /*state*/) {}; |