aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/coreplugin/locator/locator_test.cpp
diff options
context:
space:
mode:
authorAndre Hartmann <aha_1980@gmx.de>2017-12-29 07:57:01 +0100
committerAndré Hartmann <aha_1980@gmx.de>2018-01-03 10:39:30 +0000
commitadc8638de0bceafad65555e4f249e88883be01bb (patch)
tree423bf81b74146cac8f474c46258b0a6688ca80f9 /src/plugins/coreplugin/locator/locator_test.cpp
parent8e92c285737e3ac85e58186ec7c7efdf37b82268 (diff)
BaseFileFilter: Rate full matches higher than fuzzy matches
Searching for "qmap.h" should not have "qcore_mac_p.h" as first search result and "qmap.h" somewhere later in the list. This is only a partial solution for QTCREATORBUG-19531, as the filter might be called multiple times (for "All Included Files" and "Files in Any Project"). So the final result list may contain the best results in the middle. Task-number: QTCREATORBUG-19531 Change-Id: Ib5322824d3e0e8106c2f197169342f18923a894a Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins/coreplugin/locator/locator_test.cpp')
-rw-r--r--src/plugins/coreplugin/locator/locator_test.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/plugins/coreplugin/locator/locator_test.cpp b/src/plugins/coreplugin/locator/locator_test.cpp
index 270bc1d50a6..3e26ea92b4d 100644
--- a/src/plugins/coreplugin/locator/locator_test.cpp
+++ b/src/plugins/coreplugin/locator/locator_test.cpp
@@ -158,4 +158,26 @@ void Core::Internal::CorePlugin::test_basefilefilter_data()
<< ResultData("main.cpp", testFilesShort.at(1))
<< ResultData("main.cpp", testFilesShort.at(2))))
);
+
+ const QStringList priorityTestFiles({testDir.file("qmap.cpp"),
+ testDir.file("mid_qcore_mac_p.h"),
+ testDir.file("qcore_mac_p.h"),
+ testDir.file("foo_qmap.h"),
+ testDir.file("qmap.h"),
+ testDir.file("bar.h")});
+ QStringList priorityTestFilesShort;
+ for (const QString &file : priorityTestFiles)
+ priorityTestFilesShort << Utils::FileUtils::shortNativePath(Utils::FileName::fromString(file));
+
+ QTest::newRow("BaseFileFilter-InputPriorizeFullOverFuzzy")
+ << priorityTestFiles
+ << (QList<ReferenceData>()
+ << ReferenceData(
+ "qmap.h",
+ (QList<ResultData>()
+ << ResultData("qmap.h", priorityTestFilesShort.at(4))
+ << ResultData("foo_qmap.h", priorityTestFilesShort.at(3))
+ << ResultData("qcore_mac_p.h", priorityTestFilesShort.at(2))
+ << ResultData("mid_qcore_mac_p.h", priorityTestFilesShort.at(1))))
+ );
}