Skip to content

Commit

Permalink
Don't populate a file-backed experiment info on cloning.
Browse files Browse the repository at this point in the history
Refs #11350
  • Loading branch information
martyngigg committed Mar 13, 2015
1 parent cd3a37c commit 7c670e0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions Code/Mantid/Framework/API/src/FileBackedExperimentInfo.cpp
Expand Up @@ -28,11 +28,12 @@ FileBackedExperimentInfo::FileBackedExperimentInfo(const std::string &filename,
: ExperimentInfo(), m_loaded(false), m_filename(filename), m_nxpath(nxpath) {}

/**
* @return A clone of the object
* This clones the FileBackedExperimentInfo and will not cause a load
* of the information.
* @return A clone of the object.
*/
ExperimentInfo *FileBackedExperimentInfo::cloneExperimentInfo() const {
populateIfNotLoaded();
return ExperimentInfo::cloneExperimentInfo();
return new FileBackedExperimentInfo(*this);
}

/// @returns A human-readable description of the object
Expand Down
6 changes: 3 additions & 3 deletions Code/Mantid/Framework/API/test/FileBackedExperimentInfoTest.h
Expand Up @@ -45,12 +45,12 @@ class FileBackedExperimentInfoTest : public CxxTest::TestSuite {
TS_ASSERT_EQUALS(fileBacked->toString(), m_inMemoryExptInfo->toString());
}

void test_cloneExperimentInfo_populates_object() {
void test_cloneExperimentInfo_returns_new_file_backed_object_and_does_not_touch_file() {
auto fileBacked = createTestObject();
auto *clonedFileBacked = fileBacked->cloneExperimentInfo();

TS_ASSERT_EQUALS(clonedFileBacked->toString(),
m_inMemoryExptInfo->toString());
TS_ASSERT(dynamic_cast<FileBackedExperimentInfo*>(clonedFileBacked));

delete clonedFileBacked;
}

Expand Down

0 comments on commit 7c670e0

Please sign in to comment.