Merge remote-tracking branch 'origin/12.0'

Conflicts:
	src/plugins/python/pyside.cpp

Change-Id: I1f84ed56d38355cef6076797c72693fff4c1aa78
This commit is contained in:
Eike Ziller
2023-09-28 11:02:38 +02:00
45 changed files with 1741 additions and 747 deletions

View File

@@ -261,7 +261,10 @@ bool QuickTestParser::handleQtQuickTest(QPromise<TestParseResultPtr> &promise,
return false;
const FilePath cppFileName = document->filePath();
const FilePath proFile = FilePath::fromString(ppList.at(0)->projectFile);
m_mainCppFiles.insert(cppFileName, proFile);
{
QWriteLocker lock(&m_parseLock);
m_mainCppFiles.insert(cppFileName, proFile);
}
const FilePath srcDir = FilePath::fromString(quickTestSrcDir(cppFileName));
if (srcDir.isEmpty())
return false;
@@ -340,13 +343,13 @@ QuickTestParser::QuickTestParser(ITestFramework *framework)
void QuickTestParser::init(const QSet<FilePath> &filesToParse, bool fullParse)
{
m_qmlSnapshot = QmlJSTools::Internal::ModelManager::instance()->snapshot();
QWriteLocker lock(&m_parseLock); // should not be necessary
if (!fullParse) {
// in a full parse we get the correct entry points by the respective main
m_proFilesForQmlFiles = QuickTestUtils::proFilesForQmlFiles(framework(), filesToParse);
// get rid of cached main cpp files that are going to get processed anyhow
for (const FilePath &file : filesToParse) {
if (m_mainCppFiles.contains(file)) {
m_mainCppFiles.remove(file);
if (m_mainCppFiles.remove(file) == 1) {
if (m_mainCppFiles.isEmpty())
break;
}
@@ -355,6 +358,7 @@ void QuickTestParser::init(const QSet<FilePath> &filesToParse, bool fullParse)
// get rid of all cached main cpp files
m_mainCppFiles.clear();
}
lock.unlock();
m_checkForDerivedTests = theQtTestFramework().quickCheckForDerivedTests();
@@ -399,9 +403,10 @@ bool QuickTestParser::processDocument(QPromise<TestParseResultPtr> &promise,
return handleQtQuickTest(promise, cppdoc, framework());
}
FilePath QuickTestParser::projectFileForMainCppFile(const FilePath &fileName) const
FilePath QuickTestParser::projectFileForMainCppFile(const FilePath &fileName)
{
return m_mainCppFiles.contains(fileName) ? m_mainCppFiles.value(fileName) : FilePath();
QReadLocker lock(&m_parseLock);
return m_mainCppFiles.value(fileName);
}
} // namespace Autotest::Internal

View File

@@ -8,6 +8,7 @@
#include <qmljs/qmljsdocument.h>
#include <QFileSystemWatcher>
#include <QReadWriteLock>
namespace Autotest {
namespace Internal {
@@ -28,7 +29,7 @@ public:
void release() override;
bool processDocument(QPromise<TestParseResultPtr> &promise,
const Utils::FilePath &fileName) override;
Utils::FilePath projectFileForMainCppFile(const Utils::FilePath &fileName) const;
Utils::FilePath projectFileForMainCppFile(const Utils::FilePath &fileName);
QStringList supportedExtensions() const override { return {"qml"}; };
private:
@@ -45,6 +46,7 @@ private:
QMap<QString, QMap<QString, QDateTime> > m_watchedFiles;
QMap<Utils::FilePath, Utils::FilePath> m_mainCppFiles;
QSet<Utils::FilePath> m_prefilteredFiles;
QReadWriteLock m_parseLock; // guard for m_mainCppFiles
bool m_checkForDerivedTests = false;
};

View File

@@ -611,7 +611,8 @@ void TestTreeModel::insertItemInParent(TestTreeItem *item, TestTreeItem *root, b
delete item;
} else {
// restore former check state if available
std::optional<Qt::CheckState> cached = m_checkStateCache->get(item);
std::optional<Qt::CheckState> cached = m_checkStateCache ? m_checkStateCache->get(item)
: std::optional<Qt::CheckState>{};
if (cached.has_value())
item->setData(0, cached.value(), Qt::CheckStateRole);
else