-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit test for the presenter and the model
- Loading branch information
1 parent
941c3c8
commit 746f8a1
Showing
13 changed files
with
484 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
qt/scientific_interfaces/Inelastic/test/BayesFitting/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
get_filename_component(SUB_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}" NAME) | ||
|
||
set(TEST_FILES StretchModelTest.h StretchPresenterTest.h) | ||
|
||
set(TEST_HELPERS MockObjects.h) | ||
|
||
list(TRANSFORM TEST_FILES PREPEND ${SUB_DIRECTORY}/) | ||
list(TRANSFORM TEST_HELPERS PREPEND ${SUB_DIRECTORY}/) | ||
|
||
set(ALL_TEST_FILES | ||
${ALL_TEST_FILES} ${TEST_FILES} | ||
PARENT_SCOPE | ||
) | ||
|
||
set(ALL_TEST_HELPERS | ||
${ALL_TEST_HELPERS} ${TEST_HELPERS} | ||
PARENT_SCOPE | ||
) |
71 changes: 71 additions & 0 deletions
71
qt/scientific_interfaces/Inelastic/test/BayesFitting/MockObjects.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Mantid Repository : https://github.com/mantidproject/mantid | ||
// | ||
// Copyright © 2024 ISIS Rutherford Appleton Laboratory UKRI, | ||
// NScD Oak Ridge National Laboratory, European Spallation Source | ||
// & Institut Laue - Langevin | ||
// SPDX - License - Identifier: GPL - 3.0 + | ||
#pragma once | ||
|
||
#include <cxxtest/TestSuite.h> | ||
#include <gmock/gmock.h> | ||
|
||
#include "BayesFitting/StretchModel.h" | ||
#include "BayesFitting/StretchView.h" | ||
|
||
#include "MantidKernel/WarningSuppressions.h" | ||
#include "MantidQtWidgets/Common/IConfiguredAlgorithm.h" | ||
|
||
#include <string> | ||
|
||
using namespace MantidQt; | ||
using namespace MantidQt::CustomInterfaces; | ||
|
||
GNU_DIAG_OFF_SUGGEST_OVERRIDE | ||
|
||
class MockStretchView : public IStretchView { | ||
public: | ||
virtual ~MockStretchView() = default; | ||
|
||
MOCK_METHOD(void, subscribePresenter, (IStretchViewSubscriber * presenter), (override)); | ||
MOCK_METHOD(void, loadSettings, (const QSettings &settings), (override)); | ||
MOCK_METHOD(void, applySettings, ((std::map<std::string, QVariant> const &settings)), (override)); | ||
MOCK_METHOD(void, validateUserInput, (IUserInputValidator * validator), (const, override)); | ||
|
||
MOCK_METHOD(StretchRunData, getRunData, (), (const, override)); | ||
MOCK_METHOD(CurrentPreviewData, getCurrentPreviewData, (), (const, override)); | ||
MOCK_METHOD(std::string, getPlotType, (), (const, override)); | ||
MOCK_METHOD(std::string, getPlotContour, (), (const, override)); | ||
MOCK_METHOD(IRunView *, getRunWidget, (), (const, override)); | ||
|
||
MOCK_METHOD(void, setupFitOptions, (), (override)); | ||
MOCK_METHOD(void, setupPropertyBrowser, (), (override)); | ||
MOCK_METHOD(void, setupPlotOptions, (), (override)); | ||
|
||
MOCK_METHOD(void, setFileExtensionsByName, (bool filter), (override)); | ||
MOCK_METHOD(void, setLoadHistory, (bool doLoadHistory), (override)); | ||
|
||
MOCK_METHOD(void, resetPlotContourOptions, ((const std::vector<std::string> &contourNames)), (override)); | ||
MOCK_METHOD(bool, displaySaveDirectoryMessage, (), (override)); | ||
|
||
MOCK_METHOD(void, setPlotADSEnabled, (bool enabled), (override)); | ||
MOCK_METHOD(void, setPlotResultEnabled, (bool enabled), (override)); | ||
MOCK_METHOD(void, setPlotContourEnabled, (bool enabled), (override)); | ||
MOCK_METHOD(void, setSaveResultEnabled, (bool enabled), (override)); | ||
MOCK_METHOD(void, setButtonsEnabled, (bool enabled), (override)); | ||
MOCK_METHOD(void, setPlotResultIsPlotting, (bool plotting), (override)); | ||
MOCK_METHOD(void, setPlotContourIsPlotting, (bool plotting), (override)); | ||
}; | ||
|
||
class MockStretchModel : public IStretchModel { | ||
public: | ||
virtual ~MockStretchModel() = default; | ||
|
||
MOCK_METHOD(MantidQt::API::IConfiguredAlgorithm_sptr, stretchAlgorithm, | ||
((const StretchRunData &algParams), const std::string &fitWorkspaceName, | ||
const std::string &contourWorkspaceName, const bool useQuickBayes), | ||
(const, override)); | ||
|
||
MOCK_METHOD(API::IConfiguredAlgorithm_sptr, setupSaveAlgorithm, (const std::string &wsName), (const, override)); | ||
}; | ||
|
||
GNU_DIAG_ON_SUGGEST_OVERRIDE |
Oops, something went wrong.