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: Marco Bubke <marco.bubke@theqtcompany.com>
This commit is contained in:
Nikolai Kosjar
2015-09-16 15:41:50 +02:00
parent 77270648e8
commit 7b631d484d
2 changed files with 25 additions and 0 deletions

View File

@@ -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"));

View File

@@ -65,6 +65,7 @@ private slots:
void testUnsavedFilesTrackingByModifyingIncludedFileInCurrentEditor();
void testUnsavedFilesTrackingByModifyingIncludedFileInNotCurrentEditor();
void testUnsavedFilesTrackingByModifyingIncludedFileExternally();
void testUnsavedFilesTrackingByModifyingIncludedFileExternally2();
void testUnsavedFilesTrackingByCompletingUiObject();
void testUpdateBackendAfterRestart();