diff options
author | Nikolai Kosjar <nikolai.kosjar@digia.com> | 2013-12-16 16:02:45 +0100 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@digia.com> | 2014-01-07 14:19:13 +0100 |
commit | 5c8df5fa4ec4a8f30261dc4d53a810f7be65df51 (patch) | |
tree | 2abcbc02f94c15f4d26a5399c1ea31b4183923e7 /src/plugins/cpptools/cppmodelmanager_test.cpp | |
parent | 5aa8a63f90934619072242ac0f6f5fca128edd39 (diff) | |
download | qt-creator-5c8df5fa4ec4a8f30261dc4d53a810f7be65df51.tar.gz |
CppEditor/CppTools: Introduce Test{Case,Document}
Move common functionality of the 12 test classes into base classes.
Change-Id: If64d3cec876807ac6f991151189860a99b8ff4ca
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/plugins/cpptools/cppmodelmanager_test.cpp')
-rw-r--r-- | src/plugins/cpptools/cppmodelmanager_test.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/plugins/cpptools/cppmodelmanager_test.cpp b/src/plugins/cpptools/cppmodelmanager_test.cpp index 9e33466a06..235d4e5c56 100644 --- a/src/plugins/cpptools/cppmodelmanager_test.cpp +++ b/src/plugins/cpptools/cppmodelmanager_test.cpp @@ -27,9 +27,10 @@ ** ****************************************************************************/ -#include "cpptoolsplugin.h" #include "cpppreprocessor.h" #include "cpptoolseditorsupport.h" +#include "cpptoolsplugin.h" +#include "cpptoolstestcase.h" #include "modelmanagertesthelper.h" #include <coreplugin/editormanager/editormanager.h> @@ -181,19 +182,15 @@ public: return isFetchOk; } - void writeContents(const QByteArray &contents) const + bool writeContents(const QByteArray &contents) const { - Utils::FileSaver fileSaver(m_filePath); - fileSaver.write(contents); - fileSaver.finalize(); + return CppTools::Tests::TestCase::writeFile(m_filePath, contents); } private: void restoreContents() const { - Utils::FileSaver fileSaver(m_filePath); - fileSaver.write(m_originalFileContents); - fileSaver.finalize(); + CppTools::Tests::TestCase::writeFile(m_filePath, m_originalFileContents); } QByteArray m_originalFileContents; @@ -554,7 +551,7 @@ void CppToolsPlugin::test_modelmanager_refresh_timeStampModified_if_sourcefiles_ QByteArray originalContents; QVERIFY(fileChangerAndRestorer.readContents(&originalContents)); const QByteArray newFileContentes = originalContents + "\nint addedOtherGlobal;"; - fileChangerAndRestorer.writeContents(newFileContentes); + QVERIFY(fileChangerAndRestorer.writeContents(newFileContentes)); // Add or remove source file. The configuration stays the same. part->files.clear(); |