Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
5bef2440
Commit
5bef2440
authored
4 years ago
by
Nick Draper
Browse files
Options
Downloads
Patches
Plain Diff
Add a unit test to prevent regression
parent
0cd88b58
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
qt/widgets/common/CMakeLists.txt
+3
-0
3 additions, 0 deletions
qt/widgets/common/CMakeLists.txt
qt/widgets/common/test/FitPropertyBrowserTest.h
+57
-0
57 additions, 0 deletions
qt/widgets/common/test/FitPropertyBrowserTest.h
with
60 additions
and
0 deletions
qt/widgets/common/CMakeLists.txt
+
3
−
0
View file @
5bef2440
...
...
@@ -931,6 +931,7 @@ set(TEST_FILES
test/FileDialogHandlerTest.h
test/FindFilesThreadPoolManagerTest.h
test/FindFilesWorkerTest.h
test/FitPropertyBrowserTest.h
test/FunctionModelTest.h
test/FunctionMultiDomainPresenterTest.h
test/FunctionBrowserUtilsTest.h
...
...
@@ -976,6 +977,7 @@ set(
test/FileDialogHandlerTest.h
test/FindFilesThreadPoolManagerTest.h
test/FindFilesWorkerTest.h
test/FitPropertyBrowserTest.h
test/FunctionModelTest.h
test/FunctionMultiDomainPresenterTest.h
test/FunctionBrowserUtilsTest.h
...
...
@@ -1047,6 +1049,7 @@ set(
test/FileDialogHandlerTest.h
test/FindFilesThreadPoolManagerTest.h
test/FindFilesWorkerTest.h
test/FitPropertyBrowserTest.h
test/InterfaceManagerTest.h
test/QtJSONUtilsTest.h
test/RepoModelTest.h
...
...
This diff is collapsed.
Click to expand it.
qt/widgets/common/test/FitPropertyBrowserTest.h
0 → 100644
+
57
−
0
View file @
5bef2440
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
#include
"MantidQtWidgets/Common/FitPropertyBrowser.h"
#include
"MantidAPI/IFunction1D.h"
#include
"MantidAPI/ParamFunction.h"
#include
"MantidAPI/FunctionFactory.h"
#include
<cxxtest/TestSuite.h>
using
namespace
Mantid
::
API
;
class
FitPropertyBrowserTest_Funct
:
public
ParamFunction
,
public
IFunction1D
{
public:
FitPropertyBrowserTest_Funct
()
{
declareParameter
(
"b0"
);
declareParameter
(
"b1"
);
}
std
::
string
name
()
const
override
{
return
"FitPropertyBrowserTest_Funct"
;
}
void
function1D
(
double
*
out
,
const
double
*
xValues
,
const
size_t
nData
)
const
override
{
UNUSED_ARG
(
out
);
UNUSED_ARG
(
xValues
);
UNUSED_ARG
(
nData
);
}
void
functionDeriv1D
(
Jacobian
*
out
,
const
double
*
xValues
,
const
size_t
nData
)
override
{
UNUSED_ARG
(
out
);
UNUSED_ARG
(
xValues
);
UNUSED_ARG
(
nData
);
}
};
DECLARE_FUNCTION
(
FitPropertyBrowserTest_Funct
)
class
FitPropertyBrowserTest
:
public
CxxTest
::
TestSuite
{
public:
//This is a very specific test for a bug that is now fixed to prevent regression
void
test_FunctionFactory_notification_is_released
()
{
//create a FunctionBrowser
auto
fpBrowser
=
std
::
make_unique
<
MantidQt
::
MantidWidgets
::
FitPropertyBrowser
>
();
//initialise it - this adds an observer on the function factory update message
fpBrowser
->
init
();
//delete the FunctionBrowser
fpBrowser
.
reset
();
//Make sure the FunctionFactory does not have a dead link as an observer
TS_ASSERT_THROWS_NOTHING
(
FunctionFactory
::
Instance
().
unsubscribe
(
"FitPropertyBrowserTest_Funct"
);)
}
};
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment