forked from qt-creator/qt-creator
CppEditor: Proliferate FilePath use
This includes one functional change: It drops some cleaning of the path used to create the CppDocument, which is now assumed to be done on the caller side. Change-Id: I5e2a182028e4d5b56282ad85f4a5c665f081754f Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
add_qtc_test(tst_cplusplus_cppselectionchangertest
|
||||
DEPENDS CppEditor
|
||||
DEPENDS CppEditor Utils
|
||||
SOURCES tst_cppselectionchangertest.cpp
|
||||
)
|
||||
|
||||
@@ -9,11 +9,14 @@
|
||||
#include <cplusplus/TranslationUnit.h>
|
||||
#include <cplusplus/pp-engine.h>
|
||||
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <QtTest>
|
||||
#include <QTextDocument>
|
||||
|
||||
using namespace CPlusPlus;
|
||||
using namespace CppEditor;
|
||||
using namespace Utils;
|
||||
|
||||
//TESTED_COMPONENT=src/plugins/cppeditor
|
||||
|
||||
@@ -175,7 +178,7 @@ inline void tst_CppSelectionChanger::doShrink(QTextCursor& cursor, const QString
|
||||
QByteArray tst_CppSelectionChanger::preprocess(const QByteArray &source, const QString &fileName)
|
||||
{
|
||||
Client *client = 0; // no client.
|
||||
Environment env;
|
||||
CPlusPlus::Environment env;
|
||||
Preprocessor preprocess(client, &env);
|
||||
preprocess.setKeepComments(true);
|
||||
return preprocess.run(fileName, source);
|
||||
@@ -193,7 +196,7 @@ void tst_CppSelectionChanger::initTestCase()
|
||||
textDocument.setPlainText(cppFileString);
|
||||
|
||||
// Create the CPP document and preprocess the source, just like how the CppEditor does it.
|
||||
cppDocument = Document::create(fileName);
|
||||
cppDocument = Document::create(FilePath::fromString(fileName));
|
||||
const QByteArray preprocessedSource = preprocess(cppFileString.toUtf8(), fileName);
|
||||
cppDocument->setUtf8Source(preprocessedSource);
|
||||
cppDocument->parse();
|
||||
|
||||
Reference in New Issue
Block a user