Utils: Add offset to search results

Offset are better to compute the length of a text range. The only problem
is that we get them for utf8 because that is the text representation of
source file. QTextDocument is Utf16 based, so it can not binary represent
the source file. Actually I do not see a simple performing workaround for
it.

Change-Id: Id615e1ee6a6e85c6ecc4f8044e275142409d9b46
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Tim Jenssen
2016-11-23 13:31:47 +01:00
parent 4aae6b730f
commit 6fe90532dc
10 changed files with 184 additions and 6 deletions

View File

@@ -232,6 +232,18 @@ TEST_F(RefactoringClient, ConvertFilePaths)
ASSERT_THAT(qstringFilePaths, Contains(Pair(42u, qStringFilePath)));
}
TEST_F(RefactoringClient, XXX)
{
const Core::Search::TextRange textRange{{1,0,1},{1,0,1}};
const ClangBackEnd::SourceRangeWithTextContainer sourceRange{1, 1, 1, 1, 1, 1, 1, "function"};
std::unordered_map<uint, QString> filePaths = {{1, "/path/to/file"}};
EXPECT_CALL(mockSearchHandle, addResult(QString("/path/to/file"), QString("function"), textRange))
.Times(1);
client.addSearchResult(sourceRange, filePaths);
}
void RefactoringClient::SetUp()
{
client.setRefactoringEngine(&engine);