forked from qt-creator/qt-creator
Clang: Tests: Remove invalid tests
Also, some use cases are already covered in unittests. Change-Id: I1b1351670509f1d004738a9c0dc8e858cfa6167b Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -697,126 +697,6 @@ void ClangCodeCompletionTest::testCompleteProjectDependingCodeInGeneratedUiFile(
|
||||
QVERIFY(hasItem(proposal, "setupUi"));
|
||||
}
|
||||
|
||||
void ClangCodeCompletionTest::testCompleteAfterModifyingIncludedHeaderInOtherEditor()
|
||||
{
|
||||
QSKIP("We don't reparse anymore before a code completion so we get wrong completion results.");
|
||||
|
||||
CppTools::Tests::TemporaryDir temporaryDir;
|
||||
const TestDocument sourceDocument("mysource.cpp", &temporaryDir);
|
||||
QVERIFY(sourceDocument.isCreatedAndHasValidCursorPosition());
|
||||
const TestDocument headerDocument("myheader.h", &temporaryDir);
|
||||
QVERIFY(headerDocument.isCreated());
|
||||
|
||||
// Test that declarations from header file are visible in source file
|
||||
OpenEditorAtCursorPosition openSource(sourceDocument);
|
||||
QVERIFY(openSource.succeeded());
|
||||
TextEditor::ProposalModelPtr proposal = completionResults(openSource.editor());
|
||||
QVERIFY(hasItem(proposal, "globalFromHeader"));
|
||||
|
||||
// Open header and insert a new declaration
|
||||
OpenEditorAtCursorPosition openHeader(headerDocument);
|
||||
QVERIFY(openHeader.succeeded());
|
||||
insertTextAtTopOfEditor(openHeader.editor(), "int globalFromHeaderUnsaved;\n");
|
||||
|
||||
// Switch back to source file and check if modified header is reflected in completions.
|
||||
Core::EditorManager::activateEditor(openSource.editor());
|
||||
QCoreApplication::processEvents(); // connections are queued
|
||||
proposal = completionResults(openSource.editor());
|
||||
QVERIFY(hasItem(proposal, "globalFromHeader"));
|
||||
QVERIFY(hasItem(proposal, "globalFromHeaderUnsaved"));
|
||||
}
|
||||
|
||||
void ClangCodeCompletionTest::testCompleteAfterModifyingIncludedHeaderByRefactoringActions()
|
||||
{
|
||||
QSKIP("We don't reparse anymore before a code completion so we get wrong completion results.");
|
||||
|
||||
CppTools::Tests::TemporaryDir temporaryDir;
|
||||
const TestDocument sourceDocument("mysource.cpp", &temporaryDir);
|
||||
QVERIFY(sourceDocument.isCreatedAndHasValidCursorPosition());
|
||||
const TestDocument headerDocument("myheader.h", &temporaryDir);
|
||||
QVERIFY(headerDocument.isCreated());
|
||||
|
||||
// Open header
|
||||
OpenEditorAtCursorPosition openHeader(headerDocument);
|
||||
QVERIFY(openHeader.succeeded());
|
||||
|
||||
// Open source and test that declaration from header file is visible in source file
|
||||
OpenEditorAtCursorPosition openSource(sourceDocument);
|
||||
QVERIFY(openSource.succeeded());
|
||||
TextEditor::ProposalModelPtr proposal = completionResults(openSource.editor());
|
||||
QVERIFY(hasItem(proposal, "globalFromHeader"));
|
||||
|
||||
// Modify header document without switching to its editor.
|
||||
// This simulates e.g. changes from refactoring actions.
|
||||
::Utils::ChangeSet cs;
|
||||
cs.insert(0, QLatin1String("int globalFromHeaderUnsaved;\n"));
|
||||
QTextCursor textCursor = openHeader.editor()->textCursor();
|
||||
cs.apply(&textCursor);
|
||||
|
||||
// Check whether modified header is reflected in the completions.
|
||||
proposal = completionResults(openSource.editor());
|
||||
QVERIFY(hasItem(proposal, "globalFromHeader"));
|
||||
QVERIFY(hasItem(proposal, "globalFromHeaderUnsaved"));
|
||||
}
|
||||
|
||||
void ClangCodeCompletionTest::testCompleteAfterChangingIncludedAndOpenHeaderExternally()
|
||||
{
|
||||
QSKIP("The file system watcher is doing it in backend process but we wait not long enough");
|
||||
|
||||
ChangeDocumentReloadSetting reloadSettingsChanger(Core::IDocument::ReloadUnmodified);
|
||||
|
||||
CppTools::Tests::TemporaryDir temporaryDir;
|
||||
const TestDocument sourceDocument("mysource.cpp", &temporaryDir);
|
||||
QVERIFY(sourceDocument.isCreatedAndHasValidCursorPosition());
|
||||
const TestDocument headerDocument("myheader.h", &temporaryDir);
|
||||
QVERIFY(headerDocument.isCreated());
|
||||
|
||||
// Open header
|
||||
OpenEditorAtCursorPosition openHeader(headerDocument);
|
||||
QVERIFY(openHeader.succeeded());
|
||||
|
||||
// Open source and test completions
|
||||
OpenEditorAtCursorPosition openSource(sourceDocument);
|
||||
QVERIFY(openSource.succeeded());
|
||||
TextEditor::ProposalModelPtr proposal = completionResults(openSource.editor());
|
||||
QVERIFY(hasItem(proposal, "globalFromHeader"));
|
||||
|
||||
// Simulate external modification and wait for reload
|
||||
WriteFileAndWaitForReloadedDocument waitForReloadedDocument(
|
||||
headerDocument.filePath,
|
||||
"int globalFromHeaderReloaded;\n",
|
||||
openHeader.editor()->document());
|
||||
QVERIFY(waitForReloadedDocument.wait());
|
||||
|
||||
// Retrigger completion and check if its updated
|
||||
proposal = completionResults(openSource.editor());
|
||||
QVERIFY(hasItem(proposal, "globalFromHeaderReloaded"));
|
||||
}
|
||||
|
||||
void ClangCodeCompletionTest::testCompleteAfterChangingIncludedAndNotOpenHeaderExternally()
|
||||
{
|
||||
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());
|
||||
TextEditor::ProposalModelPtr 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"));
|
||||
}
|
||||
|
||||
} // namespace Tests
|
||||
} // namespace Internal
|
||||
} // namespace ClangCodeModel
|
||||
|
@@ -54,11 +54,6 @@ private slots:
|
||||
void testCompleteProjectDependingCode();
|
||||
void testCompleteProjectDependingCodeAfterChangingProject();
|
||||
void testCompleteProjectDependingCodeInGeneratedUiFile();
|
||||
|
||||
void testCompleteAfterModifyingIncludedHeaderInOtherEditor();
|
||||
void testCompleteAfterModifyingIncludedHeaderByRefactoringActions();
|
||||
void testCompleteAfterChangingIncludedAndOpenHeaderExternally();
|
||||
void testCompleteAfterChangingIncludedAndNotOpenHeaderExternally();
|
||||
};
|
||||
|
||||
} // namespace Tests
|
||||
|
Reference in New Issue
Block a user