forked from qt-creator/qt-creator
Clang: implement findUsages with existing index
Functionality is limited to the abilities of current index which is not updated and is generated only at project open. Search box temporarily doesn't allow to "Search again". Change-Id: Id1047f27ad0aafc901f06aa51ad38ceab95eaebb Reviewed-by: Marco Bubke <marco.bubke@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "mockfilepathcaching.h"
|
||||
#include "mockrefactoringserver.h"
|
||||
#include "mockrefactoringclient.h"
|
||||
#include "mocksymbolquery.h"
|
||||
|
||||
#include <refactoringengine.h>
|
||||
|
||||
@@ -61,9 +62,11 @@ protected:
|
||||
NiceMock<MockFilePathCaching> mockFilePathCaching;
|
||||
MockRefactoringServer mockRefactoringServer;
|
||||
MockRefactoringClient mockRefactoringClient;
|
||||
MockSymbolQuery mockSymbolQuery;
|
||||
ClangRefactoring::RefactoringEngine engine{mockRefactoringServer,
|
||||
mockRefactoringClient,
|
||||
mockFilePathCaching};
|
||||
mockFilePathCaching,
|
||||
mockSymbolQuery};
|
||||
QString fileContent{QStringLiteral("int x;\nint y;")};
|
||||
QTextDocument textDocument{fileContent};
|
||||
QTextCursor cursor{&textDocument};
|
||||
@@ -102,6 +105,16 @@ TEST_F(RefactoringEngine, AfterSendRequestSourceLocationsForRenamingMessageIsUnu
|
||||
ASSERT_FALSE(engine.isRefactoringEngineAvailable());
|
||||
}
|
||||
|
||||
TEST_F(RefactoringEngine, ExpectLocationsAtInFindUsages)
|
||||
{
|
||||
cursor.setPosition(11);
|
||||
|
||||
EXPECT_CALL(mockSymbolQuery, locationsAt(_, 2, 5));
|
||||
|
||||
engine.findUsages(CppTools::CursorInEditor{cursor, filePath},
|
||||
[](const CppTools::Usages &) {});
|
||||
}
|
||||
|
||||
TEST_F(RefactoringEngine, EngineIsNotUsableForUnusableServer)
|
||||
{
|
||||
ASSERT_FALSE(engine.isRefactoringEngineAvailable());
|
||||
|
||||
Reference in New Issue
Block a user