CppEditor: Fix race condition in test

Opening an editor starts a new parser, so we must do that before we wait
for the parsing to finish.

Change-Id: Iee9da8da1fb60bf496a093d8efd878101d91f53f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2021-08-24 09:42:13 +02:00
parent ca885ee87a
commit 5c6ebf7434

View File

@@ -92,15 +92,15 @@ public:
filePaths << absoluteFilePath;
}
// Update Code Model
QVERIFY(parseFiles(filePaths));
// Open Editor
const QString fileName = temporaryDir.path() + QLatin1String("/file1.h");
CppEditor *editor;
QVERIFY(openCppEditor(fileName, &editor));
closeEditorAtEndOfTestCase(editor);
// Update Code Model
QVERIFY(parseFiles(filePaths));
// Test model
CppIncludeHierarchyModel model;
model.buildHierarchy(editor->document()->filePath().toString());