Commit 3a11d23b authored by Harriet Brown's avatar Harriet Brown
Browse files

Make the Indirect unit tests run on Qt5

parent e7b3af78
......@@ -32,7 +32,7 @@ set(CXXTEST_EXTRA_HEADER_INCLUDE
mtd_add_qt_tests(
TARGET_NAME MantidQtInterfacesIndirectTest
QT_VERSION 4
QT_VERSION 5
SRC ${TEST_FILES}
INCLUDE_DIRS
../../../../Framework/CurveFitting/inc
......@@ -53,11 +53,16 @@ mtd_add_qt_tests(
gmock
${POCO_LIBRARIES}
${Boost_LIBRARIES}
QT4_LINK_LIBS
Qwt5
PythonInterfaceCore
${PYTHON_LIBRARIES}
QT5_LINK_LIBS
Qt5::OpenGL
Qt5::Concurrent
MTD_QT_LINK_LIBS
MantidScientificInterfacesIndirect
MantidQtWidgetsCommon
MantidQtWidgetsPlotting
MantidQtWidgetsMplCpp
PARENT_DEPENDENCIES
GUITests)
......@@ -110,6 +110,8 @@ public:
IDA::WorkspaceIndex spectrum));
MOCK_METHOD2(setResolution,
void(const std::string &name, TableDatasetIndex index));
MOCK_METHOD2(setExcludeRegion,
void(const std::string &exclude, FitDomainIndex index));
MOCK_CONST_METHOD1(getWorkspace,
Mantid::API::MatrixWorkspace_sptr(FitDomainIndex index));
......
......@@ -16,6 +16,7 @@
#include "MantidAPI/MatrixWorkspace.h"
#include "MantidDataObjects/Workspace2D.h"
#include "MantidKernel/WarningSuppressions.h"
#include "MantidQtWidgets/MplCpp/BackendQt.h"
#include "MantidTestHelpers/WorkspaceCreationHelper.h"
using namespace Mantid::API;
......@@ -60,6 +61,7 @@ GNU_DIAG_ON_SUGGEST_OVERRIDE
class IndirectPlotterTest : public CxxTest::TestSuite {
public:
IndirectPlotterTest() : m_ads(AnalysisDataService::Instance()) {
MantidQt::Widgets::MplCpp::backendModule();
m_ads.clear();
}
......@@ -86,22 +88,18 @@ public:
TS_ASSERT(m_plotter);
}
void
test_that_plotSpectra_will_attempt_to_run_python_code_using_the_IPyRunner() {
void test_that_plotSpectra_will_not_throw() {
m_ads.addOrReplace(WORKSPACE_NAME, createMatrixWorkspace(5, 5));
EXPECT_CALL(*m_pyRunner, runPythonCode(_)).Times(1);
m_plotter->plotSpectra(WORKSPACE_NAME, WORKSPACE_INDICES);
TS_ASSERT_THROWS_NOTHING(
m_plotter->plotSpectra(WORKSPACE_NAME, WORKSPACE_INDICES));
}
void
test_that_plotBins_will_attempt_to_run_python_code_using_the_IPyRunner() {
void test_that_plotBins_will_not_throw() {
m_ads.addOrReplace(WORKSPACE_NAME, createMatrixWorkspace(5, 5));
EXPECT_CALL(*m_pyRunner, runPythonCode(_)).Times(1);
m_plotter->plotBins(WORKSPACE_NAME, WORKSPACE_INDICES);
TS_ASSERT_THROWS_NOTHING(
m_plotter->plotBins(WORKSPACE_NAME, WORKSPACE_INDICES));
}
void
......
......@@ -6,6 +6,7 @@
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
#include "MantidPythonInterface/core/Testing/PythonInterpreterGlobalFixture.h"
#include "MantidQtWidgets/Common/Testing/QApplicationGlobalFixture.h"
//------------------------------------------------------------------------------
......@@ -14,4 +15,5 @@
// We rely on cxxtest only including this file once so that the following
// statements do not cause multiple-definition errors.
//------------------------------------------------------------------------------
static PythonInterpreterGlobalFixture PYTHON_INTERPRETER;
static QApplicationGlobalFixture MAIN_QAPPLICATION;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment