AutoTest: Fix handling of cpp files for Quick tests

Modifying C++ files of Quick tests had been ignored as they
normally have little impact.
But nevertheless this behavior is wrong and could lead to
unexpected behavior later on if no complete rescan had been
done and even with a rescan there could have been some
cached artifacts.
Fix this by tracking the paths of the C++ files that hold
the main() or the respective macro to be able to handle
changes of these files correctly as well.

Task-number: QTCREATORBUG-20746
Change-Id: Iec860aa63ffd167511efdbf63a6ffa369f094edf
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2018-07-10 14:47:40 +02:00
parent f18d2ded9b
commit f80aa2c6f7
4 changed files with 43 additions and 4 deletions

View File

@@ -51,11 +51,12 @@ public:
void release() override;
bool processDocument(QFutureInterface<TestParseResultPtr> futureInterface,
const QString &fileName) override;
QString projectFileForMainCppFile(const QString &fileName) const;
signals:
void updateWatchPaths(const QStringList &directories) const;
private:
bool handleQtQuickTest(QFutureInterface<TestParseResultPtr> futureInterface,
CPlusPlus::Document::Ptr document, const Core::Id &id) const;
CPlusPlus::Document::Ptr document, const Core::Id &id);
void handleDirectoryChanged(const QString &directory);
void doUpdateWatchPaths(const QStringList &directories);
QList<QmlJS::Document::Ptr> scanDirectoryForQuickTestQmlFiles(const QString &srcDir) const;
@@ -63,6 +64,7 @@ private:
QHash<QString, QString> m_proFilesForQmlFiles;
QFileSystemWatcher m_directoryWatcher;
QMap<QString, QMap<QString, QDateTime> > m_watchedFiles;
QMap<QString, QString> m_mainCppFiles;
};
} // namespace Internal