Commit 7b631d48 authored by Nikolai Kosjar's avatar Nikolai Kosjar

Clang: Add testUnsavedFilesTrackingByModifyingIncludedFileExternally2

Same test as the first version, but without having the header open in
the editor. This one is also skipped since we can't make it reliable
without adding extra messages.

Follow up changes will improve the names of both tests and will make
them both reliable so that the can be activated again.

Change-Id: Ie3ca52e01aedd612bc07e7429dd64d92eb1a23b5
Reviewed-by: default avatarMarco Bubke <marco.bubke@theqtcompany.com>
parent 77270648
......@@ -1116,6 +1116,30 @@ void ClangCodeCompletionTest::testUnsavedFilesTrackingByModifyingIncludedFileExt
QVERIFY(hasItem(proposal, "globalFromHeaderReloaded"));
}
void ClangCodeCompletionTest::testUnsavedFilesTrackingByModifyingIncludedFileExternally2()
{
QSKIP("The file system watcher is doing it in backend process but we wait not long enough");
CppTools::Tests::TemporaryDir temporaryDir;
const TestDocument sourceDocument("mysource.cpp", &temporaryDir);
QVERIFY(sourceDocument.isCreatedAndHasValidCursorPosition());
const TestDocument headerDocument("myheader.h", &temporaryDir);
QVERIFY(headerDocument.isCreated());
// Open source and test completions
OpenEditorAtCursorPosition openSource(sourceDocument);
QVERIFY(openSource.succeeded());
ProposalModel proposal = completionResults(openSource.editor());
QVERIFY(hasItem(proposal, "globalFromHeader"));
// Simulate external modification, e.g version control checkout
QVERIFY(writeFile(headerDocument.filePath, "int globalFromHeaderReloaded;\n"));
// Retrigger completion and check if its updated
proposal = completionResults(openSource.editor());
QVERIFY(hasItem(proposal, "globalFromHeaderReloaded"));
}
void ClangCodeCompletionTest::testUnsavedFilesTrackingByCompletingUiObject()
{
CppTools::Tests::TemporaryCopiedDir testDir(qrcPath("qt-widgets-app"));
......
......@@ -65,6 +65,7 @@ private slots:
void testUnsavedFilesTrackingByModifyingIncludedFileInCurrentEditor();
void testUnsavedFilesTrackingByModifyingIncludedFileInNotCurrentEditor();
void testUnsavedFilesTrackingByModifyingIncludedFileExternally();
void testUnsavedFilesTrackingByModifyingIncludedFileExternally2();
void testUnsavedFilesTrackingByCompletingUiObject();
void testUpdateBackendAfterRestart();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment