Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions framework/cloud/iauthorizationservice.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "modularity/imoduleinterface.h"
#include "cloudtypes.h"

#include "types/val.h"
#include "types/retval.h"

namespace muse::cloud {
Expand All @@ -40,8 +39,6 @@ class IAuthorizationService : MODULE_CONTEXT_INTERFACE
virtual void signIn() = 0;
virtual void signOut() = 0;

virtual RetVal<Val> ensureAuthorization(bool publishingScore, const std::string& text = {}) = 0;

virtual ValCh<bool> userAuthorized() const = 0;
virtual const AccountInfo& accountInfo() const = 0;

Expand Down
14 changes: 0 additions & 14 deletions framework/cloud/internal/abstractcloudservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@

#include "oauthhttpserverreplyhandler.h"

#include "defer.h"
#include "log.h"

using namespace muse;
Expand Down Expand Up @@ -311,19 +310,6 @@ void AbstractCloudService::signOut()
});
}

RetVal<Val> AbstractCloudService::ensureAuthorization(bool publishingScore, const std::string& text)
{
if (m_userAuthorized.val) {
return muse::make_ok();
}

UriQuery query("muse://cloud/requireauthorization");
query.addParam("text", Val(text));
query.addParam("cloudCode", Val(cloudInfo().code));
query.addParam("publishingScore", Val(publishingScore));
return interactive()->openSync(query);
}

ValCh<bool> AbstractCloudService::userAuthorized() const
{
return m_userAuthorized;
Expand Down
4 changes: 0 additions & 4 deletions framework/cloud/internal/abstractcloudservice.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "ui/iuiconfiguration.h"
#include "io/ifilesystem.h"
#include "network/inetworkmanagercreator.h"
#include "interactive/iinteractive.h"
#include "interactive/iplatforminteractive.h"
#include "multiwindows/imultiwindowsprovider.h"

Expand Down Expand Up @@ -63,7 +62,6 @@ class AbstractCloudService : public QObject, public IAuthorizationService, publi
muse::GlobalInject<network::INetworkManagerCreator> networkManagerCreator;
muse::GlobalInject<mi::IMultiWindowsProvider> multiwindowsProvider;
muse::GlobalInject<muse::IPlatformInteractive> platformInteractive;
muse::ContextInject<IInteractive> interactive = { this };

public:
explicit AbstractCloudService(const modularity::ContextPtr& iocCtx, QObject* parent = nullptr);
Expand All @@ -74,8 +72,6 @@ class AbstractCloudService : public QObject, public IAuthorizationService, publi
void signIn() override;
void signOut() override;

RetVal<Val> ensureAuthorization(bool publishingScore, const std::string& text = {}) override;

ValCh<bool> userAuthorized() const override;
const AccountInfo& accountInfo() const override;

Expand Down
42 changes: 42 additions & 0 deletions framework/cloud/tests/mocks/audiocomservicemock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2026 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

#pragma once

#include <gmock/gmock.h>

#include "cloud/audiocom/iaudiocomservice.h"

namespace muse::cloud {
class AudioComServiceMock : public IAudioComService
{
public:
MOCK_METHOD(IAuthorizationServicePtr, authorization, (), (override));
MOCK_METHOD(QUrl, projectManagerUrl, (), (const, override));

MOCK_METHOD(ProgressPtr, uploadAudio,
(DevicePtr audioData, const QString& audioFormat, const QString& title, const QUrl& existingUrl, Visibility visibility,
bool replaceExisting), (override));

MOCK_METHOD(CloudInfo, cloudInfo, (), (const, override));
};
}
41 changes: 41 additions & 0 deletions framework/cloud/tests/mocks/authorizationservicemock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2026 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

#pragma once

#include <gmock/gmock.h>

#include "cloud/iauthorizationservice.h"

namespace muse::cloud {
class AuthorizationServiceMock : public IAuthorizationService
{
public:
MOCK_METHOD(void, signUp, (), (override));
MOCK_METHOD(void, signIn, (), (override));
MOCK_METHOD(void, signOut, (), (override));
MOCK_METHOD(ValCh<bool>, userAuthorized, (), (const, override));
MOCK_METHOD(const AccountInfo&, accountInfo, (), (const, override));
MOCK_METHOD(CloudInfo, cloudInfo, (), (const, override));
MOCK_METHOD(Ret, checkCloudIsAvailable, (), (const, override));
};
}
46 changes: 46 additions & 0 deletions framework/cloud/tests/mocks/musescorecomservicemock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2026 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

#pragma once

#include <gmock/gmock.h>

#include "cloud/musescorecom/imusescorecomservice.h"

namespace muse::cloud {
class MuseScoreComServiceMock : public IMuseScoreComService
{
public:
MOCK_METHOD(IAuthorizationServicePtr, authorization, (), (override));
MOCK_METHOD(QUrl, scoreManagerUrl, (), (const, override));

MOCK_METHOD(ProgressPtr, uploadScore,
(DevicePtr scoreData, const QString& title, cloud::Visibility visibility, const QUrl& sourceUrl, int revisionId),
(override));
MOCK_METHOD(ProgressPtr, uploadAudio, (DevicePtr audioData, const QString& audioFormat, const QUrl& sourceUrl), (override));

MOCK_METHOD(RetVal<ScoreInfo>, downloadScoreInfo, (const QUrl& sourceUrl), (override));
MOCK_METHOD(RetVal<ScoreInfo>, downloadScoreInfo, (int scoreId), (override));
MOCK_METHOD(async::Promise<ScoresList>, downloadScoresList, (int scoresPerBatch, int batchNumber), (override));
MOCK_METHOD(ProgressPtr, downloadScore, (int scoreId, DevicePtr scoreData, const QString& hash, const QString& secret), (override));
};
}
42 changes: 42 additions & 0 deletions framework/interactive/tests/mocks/platforminteractivemock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2026 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

#pragma once

#include <gmock/gmock.h>

#include "interactive/iplatforminteractive.h"

namespace muse {
class PlatformInteractiveMock : public IPlatformInteractive
{
public:
MOCK_METHOD(Ret, openUrl, (const std::string& url), (const, override));
MOCK_METHOD(Ret, openUrl, (const QUrl& url), (const, override));

MOCK_METHOD(Ret, isAppExists, (const std::string& appIdentifier), (const, override));
MOCK_METHOD(Ret, canOpenApp, (const UriQuery& uri), (const, override));
MOCK_METHOD(async::Promise<Ret>, openApp, (const UriQuery& uri), (const, override));

MOCK_METHOD(Ret, revealInFileBrowser, (const io::path_t& filePath), (const, override));
};
}
5 changes: 0 additions & 5 deletions framework/stubs/cloud/authorizationservicestub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ void AuthorizationServiceStub::signOut()
{
}

RetVal<Val> AuthorizationServiceStub::ensureAuthorization(bool, const std::string&)
{
return muse::make_ret(Ret::Code::NotSupported);
}

ValCh<bool> AuthorizationServiceStub::userAuthorized() const
{
return ValCh<bool>();
Expand Down
2 changes: 0 additions & 2 deletions framework/stubs/cloud/authorizationservicestub.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ class AuthorizationServiceStub : public IAuthorizationService
void signIn() override;
void signOut() override;

RetVal<Val> ensureAuthorization(bool publishingScore, const std::string& text = {}) override;

ValCh<bool> userAuthorized() const override;
const AccountInfo& accountInfo() const override;

Expand Down