Skip to content

Commit

Permalink
Re #11663 Add unit test for PeakFitting model
Browse files Browse the repository at this point in the history
  • Loading branch information
raquelalvarezbanos committed Apr 30, 2015
1 parent 29b419b commit f914fe2
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
1 change: 1 addition & 0 deletions Code/Mantid/MantidQt/CustomInterfaces/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ set ( TEST_FILES
ALCBaselineModellingModelTest.h
ALCBaselineModellingPresenterTest.h
ALCDataLoadingPresenterTest.h
ALCPeakFittingModelTest.h
ALCPeakFittingPresenterTest.h
IO_MuonGroupingTest.h
MuonAnalysisHelperTest.h
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#ifndef MANTID_CUSTOMINTERFACES_ALCPEAKFITTINGMODELTEST_H_
#define MANTID_CUSTOMINTERFACES_ALCPEAKFITTINGMODELTEST_H_

#include <cxxtest/TestSuite.h>

#include <boost/assign.hpp>

#include "MantidAPI/MatrixWorkspace.h"
#include "MantidAPI/WorkspaceFactory.h"
#include "MantidAPI/FunctionFactory.h"
#include "MantidAPI/FrameworkManager.h"

#include "MantidQtCustomInterfaces/Muon/ALCPeakFittingModel.h"

#include <QtTest/QSignalSpy>

using namespace Mantid::API;
using namespace MantidQt::CustomInterfaces;

class ALCPeakFittingModelTest : public CxxTest::TestSuite
{
ALCPeakFittingModel* m_model;

public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static ALCPeakFittingModelTest *createSuite() { return new ALCPeakFittingModelTest(); }
static void destroySuite( ALCPeakFittingModelTest *suite ) { delete suite; }

ALCPeakFittingModelTest()
{
FrameworkManager::Instance(); // To make sure everything is initialized
}

void setUp()
{
m_model = new ALCPeakFittingModel();
}

void tearDown()
{
delete m_model;
}

void test_setData()
{
MatrixWorkspace_sptr data = WorkspaceFactory::Instance().create("Workspace2D", 1, 1, 1);

QSignalSpy spy(m_model, SIGNAL(dataChanged()));

TS_ASSERT_THROWS_NOTHING(m_model->setData(data));

TS_ASSERT_EQUALS(spy.size(), 1);
TS_ASSERT_EQUALS(m_model->data(), data);
}

void test_fit()
{
}

};


#endif /* MANTID_CUSTOMINTERFACES_ALCPEAKFITTINGMODELTEST_H_ */

0 comments on commit f914fe2

Please sign in to comment.