forked from qt-creator/qt-creator
QmlDesigner: Fix version scanning
Switch was missing. Change-Id: I5d87e624f698b9f59fe57cf49cafef4e6d08eca2 Reviewed-by: Marco Bubke <marco.bubke@qt.io> Reviewed-by: Aleksei German <aleksei.german@qt.io>
This commit is contained in:
@@ -70,8 +70,11 @@ void ModuleScanner::scan([[maybe_unused]] std::string_view modulePath)
|
|||||||
if (moduleName.isEmpty() || m_skip(moduleName))
|
if (moduleName.isEmpty() || m_skip(moduleName))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
m_modules.push_back(
|
QString version = m_versionScanning == VersionScanning::Yes
|
||||||
Import::createLibraryImport(moduleName, createVersion(parser.components())));
|
? createVersion(parser.components())
|
||||||
|
: QString{};
|
||||||
|
|
||||||
|
m_modules.push_back(Import::createLibraryImport(moduleName, version));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -79,6 +79,19 @@ TEST_F(ModuleScanner, Version)
|
|||||||
ASSERT_THAT(scanner.modules(), ElementsAre(AllOf(UrlProperty("Example"), VersionProperty("1.3"))));
|
ASSERT_THAT(scanner.modules(), ElementsAre(AllOf(UrlProperty("Example"), VersionProperty("1.3"))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(ModuleScanner, NoVersion)
|
||||||
|
{
|
||||||
|
QmlDesigner::ModuleScanner scanner{[](QStringView moduleName) {
|
||||||
|
return moduleName.endsWith(u"impl");
|
||||||
|
},
|
||||||
|
QmlDesigner::VersionScanning::No};
|
||||||
|
|
||||||
|
scanner.scan(QStringList{TESTDATA_DIR "/modulescanner"});
|
||||||
|
|
||||||
|
ASSERT_THAT(scanner.modules(),
|
||||||
|
ElementsAre(AllOf(UrlProperty("Example"), VersionProperty(QString{}))));
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(ModuleScanner, Duplicates)
|
TEST_F(ModuleScanner, Duplicates)
|
||||||
{
|
{
|
||||||
scanner.scan(QStringList{QT6_INSTALL_PREFIX});
|
scanner.scan(QStringList{QT6_INSTALL_PREFIX});
|
||||||
|
Reference in New Issue
Block a user