From a0ab67db259434d063beb426cfe955734816d104 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Sun, 22 Jun 2014 18:30:52 +0200 Subject: [PATCH] Wait for background parser to become idle. This way, we also wait for dependent parse jobs to finish, which is neccessary for imported modules. --- codecompletion/tests/qmlcompletiontest.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/codecompletion/tests/qmlcompletiontest.cpp b/codecompletion/tests/qmlcompletiontest.cpp index 04b12c8828..f504dc5b47 100644 --- a/codecompletion/tests/qmlcompletiontest.cpp +++ b/codecompletion/tests/qmlcompletiontest.cpp @@ -23,6 +23,9 @@ #include #include #include +#include + +#include #include #include @@ -77,7 +80,12 @@ CompletionParameters prepareCompletion(const QString& initCode, const QString& i qml ? "qml" : "js")); completion_data.file->parse(); - if (!completion_data.file->waitForParsed(2000)) { + // wait for this fail and all dependencies, like modules and such + while (!ICore::self()->languageController()->backgroundParser()->isIdle()) { + QTest::qWait(500); + } + + if (!completion_data.file->topContext()) { qWarning() << "file contents are: " << completion_data.file->fileContents(); Q_ASSERT_X(false, Q_FUNC_INFO, "Failed to parse initCode."); } -- GitLab