summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2023-03-29 21:15:47 +0200
committerChristian Stenger <christian.stenger@qt.io>2023-05-17 06:07:17 +0000
commit0672199de83042fa160f0abbb5c6077642b0d261 (patch)
treec6e044d7b882cdfbc69792542c4974429a3c6d65 /src
parenta21b96f4b6bc252c20824c0d807583df4b905f49 (diff)
downloadqt-creator-0672199de83042fa160f0abbb5c6077642b0d261.tar.gz
Squish: Provide object picker
Provide the object picker. Currently only partial functionality and limited for a debug run of a squish test. Change-Id: Ic6f765d3c76b29c732684879c2459f1e0f732978 Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/squish/squishperspective.cpp161
-rw-r--r--src/plugins/squish/squishperspective.h36
-rw-r--r--src/plugins/squish/squishrunnerprocess.cpp93
-rw-r--r--src/plugins/squish/squishrunnerprocess.h16
-rw-r--r--src/plugins/squish/squishtools.cpp78
-rw-r--r--src/plugins/squish/squishtools.h8
6 files changed, 378 insertions, 14 deletions
diff --git a/src/plugins/squish/squishperspective.cpp b/src/plugins/squish/squishperspective.cpp
index b229541842..5120ec6ea9 100644
--- a/src/plugins/squish/squishperspective.cpp
+++ b/src/plugins/squish/squishperspective.cpp
@@ -96,6 +96,79 @@ QVariant LocalsItem::data(int column, int role) const
return TreeItem::data(column, role);
}
+QVariant InspectedObjectItem::data(int column, int role) const
+{
+ if (role == Qt::DisplayRole || role == Qt::ToolTipRole) {
+ switch (column) {
+ case 0: return value;
+ case 1: return type;
+ }
+ }
+ return TreeItem::data(column, role);
+}
+
+QVariant InspectedPropertyItem::data(int column, int role) const
+{
+ if (role ==Qt::DisplayRole || role == Qt::ToolTipRole) {
+ switch (column) {
+ case 0: return name;
+ case 1: return value;
+ }
+ }
+ return TreeItem::data(column, role);
+}
+
+void InspectedPropertyItem::parseAndUpdateChildren()
+{
+ const char open = '{';
+ const char close = '}';
+ const char delimiter =',';
+ const char eq = '=';
+
+ if (!value.startsWith(open) || !value.endsWith(close)) // only parse multi-property content
+ return;
+
+ int start = 1;
+ int end = value.size() - 1;
+ do {
+ int endOfName = value.indexOf(eq, start);
+ QTC_ASSERT(endOfName != -1, return);
+ int innerStart = endOfName + 2;
+ QTC_ASSERT(innerStart < end, return);
+ const QString name = value.mid(start, endOfName - start).trimmed();
+ if (value.at(innerStart) != open) {
+ int endOfItemValue = value.indexOf(delimiter, innerStart);
+ if (endOfItemValue == -1)
+ endOfItemValue = end;
+ const QString content = value.mid(innerStart, endOfItemValue - innerStart).trimmed();
+ appendChild(new InspectedPropertyItem(name, content));
+ start = endOfItemValue + 1;
+ } else {
+ int openedBraces = 1;
+ // advance until item's content is complete
+ int pos = innerStart;
+ do {
+ if (++pos > end)
+ break;
+ if (value.at(pos) == open) {
+ ++openedBraces;
+ continue;
+ }
+ if (value.at(pos) == close) {
+ --openedBraces;
+ if (openedBraces == 0)
+ break;
+ }
+ } while (pos < end);
+ ++pos;
+ QTC_ASSERT(pos < end, return);
+ const QString content = value.mid(innerStart, pos - innerStart).trimmed();
+ appendChild(new InspectedPropertyItem(name, content));
+ start = pos + 1;
+ }
+ } while (start < end);
+}
+
class SquishControlBar : public QDialog
{
public:
@@ -240,12 +313,12 @@ void SquishPerspective::initPerspective()
objectsMainLayout->setSpacing(1);
m_objectsModel.setHeader({Tr::tr("Object"), Tr::tr("Type")});
- auto objectsView = new Utils::TreeView;
- objectsView->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
- objectsView->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
- objectsView->setModel(&m_objectsModel);
- objectsView->setRootIsDecorated(true);
- objectsMainLayout->addWidget(objectsView);
+ m_objectsView = new Utils::TreeView;
+ m_objectsView->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+ m_objectsView->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+ m_objectsView->setModel(&m_objectsModel);
+ m_objectsView->setRootIsDecorated(true);
+ objectsMainLayout->addWidget(m_objectsView);
QWidget *objectWidget = new QWidget;
objectWidget->setObjectName("SquishObjectsView");
@@ -313,6 +386,33 @@ void SquishPerspective::initPerspective()
SquishTools::instance()->requestExpansion(item->name);
}
});
+
+ connect(SquishTools::instance(), &SquishTools::objectPicked,
+ this, &SquishPerspective::onObjectPicked);
+ connect(SquishTools::instance(), &SquishTools::propertiesFetched,
+ this, &SquishPerspective::onPropertiesFetched);
+ connect(SquishTools::instance(), &SquishTools::autIdRetrieved,
+ this, [this]{
+ m_autIdKnown = true;
+ m_inspectAction->setEnabled(true);
+ });
+ connect(m_objectsView, &QTreeView::expanded, this, [this](const QModelIndex &idx) {
+ InspectedObjectItem *item = m_objectsModel.itemForIndex(idx);
+ if (QTC_GUARD(item)) {
+ if (item->expanded)
+ return;
+ item->expanded = true;
+ SquishTools::instance()->requestExpansionForObject(item->value);
+ }
+ });
+ connect(m_objectsView->selectionModel(), &QItemSelectionModel::currentChanged,
+ this, [this](const QModelIndex &current){
+ m_propertiesModel.clear();
+ InspectedObjectItem *item = m_objectsModel.itemForIndex(current);
+ if (!item)
+ return;
+ SquishTools::instance()->requestPropertiesForObject(item->value);
+ });
}
void SquishPerspective::onStopTriggered()
@@ -321,6 +421,7 @@ void SquishPerspective::onStopTriggered()
m_pausePlayAction->setEnabled(false);
m_stopAction->setEnabled(false);
m_inspectAction->setEnabled(false);
+ m_autIdKnown = false;
emit stopRequested();
}
@@ -330,6 +431,7 @@ void SquishPerspective::onStopRecordTriggered()
m_pausePlayAction->setEnabled(false);
m_stopAction->setEnabled(false);
m_inspectAction->setEnabled(false);
+ m_autIdKnown = false;
emit stopRecordRequested();
}
@@ -379,6 +481,44 @@ void SquishPerspective::onLocalsUpdated(const QString &output)
}
}
+void SquishPerspective::onObjectPicked(const QString &output)
+{
+ // "+{container=':o_QQuickView' text='2' type='Text' unnamed='1' visible='true'}\tQQuickText_QML_1"
+ static const QRegularExpression regex("^(?<exp>[-+])(?<content>\\{.*\\})\t(?<type>.+)$");
+ const QRegularExpressionMatch match = regex.match(output);
+ if (!match.hasMatch())
+ return;
+ InspectedObjectItem *parent = nullptr;
+ const QString content = match.captured("content");
+ parent = m_objectsModel.findNonRootItem([content](InspectedObjectItem *it) {
+ return it->value == content;
+ });
+ if (!parent) {
+ m_objectsModel.clear();
+ parent = m_objectsModel.rootItem();
+ }
+ InspectedObjectItem *obj = new InspectedObjectItem(content, match.captured("type"));
+ if (match.captured("exp") == "+")
+ obj->appendChild(new InspectedObjectItem); // add pseudo child
+ parent->appendChild(obj);
+ m_inspectAction->setEnabled(true);
+ const QModelIndex idx = m_objectsModel.indexForItem(obj);
+ if (idx.isValid())
+ m_objectsView->setCurrentIndex(idx);
+}
+
+void SquishPerspective::onPropertiesFetched(const QStringList &properties)
+{
+ static const QRegularExpression regex("(?<name>.+)=(?<exp>[-+])(?<content>.*)");
+
+ for (const QString &line : properties) {
+ const QRegularExpressionMatch match = regex.match(line);
+ QTC_ASSERT(match.hasMatch(), continue);
+ auto item = new InspectedPropertyItem(match.captured("name"), match.captured("content"));
+ m_propertiesModel.rootItem()->appendChild(item);
+ }
+}
+
void SquishPerspective::updateStatus(const QString &status)
{
m_status->setText(status);
@@ -413,6 +553,12 @@ void SquishPerspective::destroyControlBar()
m_controlBar = nullptr;
}
+void SquishPerspective::resetAutId()
+{
+ m_autIdKnown = false;
+ m_inspectAction->setEnabled(false);
+}
+
void SquishPerspective::setPerspectiveMode(PerspectiveMode mode)
{
if (m_mode == mode) // ignore
@@ -450,7 +596,7 @@ void SquishPerspective::setPerspectiveMode(PerspectiveMode mode)
m_stepOverAction->setEnabled(true);
m_stepOutAction->setEnabled(true);
m_stopAction->setEnabled(true);
- m_inspectAction->setEnabled(true);
+ m_inspectAction->setEnabled(m_autIdKnown);
break;
case Configuring:
case Querying:
@@ -465,6 +611,7 @@ void SquishPerspective::setPerspectiveMode(PerspectiveMode mode)
m_stopAction->setEnabled(false);
m_inspectAction->setEnabled(false);
m_localsModel.clear();
+ m_objectsModel.clear();
break;
default:
break;
diff --git a/src/plugins/squish/squishperspective.h b/src/plugins/squish/squishperspective.h
index 3a69247c33..1ab6b59be2 100644
--- a/src/plugins/squish/squishperspective.h
+++ b/src/plugins/squish/squishperspective.h
@@ -9,6 +9,8 @@
#include <utils/treemodel.h>
+namespace Utils { class TreeView; }
+
namespace Squish {
namespace Internal {
@@ -26,6 +28,31 @@ public:
bool expanded = false;
};
+class InspectedObjectItem : public Utils::TreeItem
+{
+public:
+ InspectedObjectItem() = default;
+ InspectedObjectItem(const QString &v, const QString &t) : value(v), type(t) {}
+ QVariant data(int column, int role) const override;
+ QString value;
+ QString type;
+ bool expanded = false;
+};
+
+class InspectedPropertyItem : public Utils::TreeItem
+{
+public:
+ InspectedPropertyItem() = default;
+ InspectedPropertyItem(const QString &n, const QString &v)
+ : name(n), value(v) { parseAndUpdateChildren(); }
+ QVariant data(int column, int role) const override;
+ QString name;
+ QString value;
+ bool expanded = false;
+private:
+ void parseAndUpdateChildren();
+};
+
class SquishPerspective : public Utils::Perspective
{
Q_OBJECT
@@ -41,6 +68,7 @@ public:
void showControlBar(SquishXmlOutputHandler *xmlOutputHandler);
void destroyControlBar();
+ void resetAutId();
signals:
void stopRequested();
@@ -54,6 +82,8 @@ private:
void onStopRecordTriggered();
void onPausePlayTriggered();
void onLocalsUpdated(const QString &output);
+ void onObjectPicked(const QString &output);
+ void onPropertiesFetched(const QStringList &properties);
QAction *m_stopRecordAction = nullptr;
QAction *m_pausePlayAction = nullptr;
@@ -65,9 +95,11 @@ private:
QLabel *m_status = nullptr;
class SquishControlBar *m_controlBar = nullptr;
Utils::TreeModel<LocalsItem> m_localsModel;
- Utils::TreeModel<> m_objectsModel;
- Utils::TreeModel<> m_propertiesModel;
+ Utils::TreeModel<InspectedObjectItem> m_objectsModel;
+ Utils::TreeModel<InspectedPropertyItem> m_propertiesModel;
+ Utils::TreeView *m_objectsView = nullptr;
PerspectiveMode m_mode = NoMode;
+ bool m_autIdKnown = false;
friend class SquishControlBar;
};
diff --git a/src/plugins/squish/squishrunnerprocess.cpp b/src/plugins/squish/squishrunnerprocess.cpp
index 3fa6474e26..4c6991a207 100644
--- a/src/plugins/squish/squishrunnerprocess.cpp
+++ b/src/plugins/squish/squishrunnerprocess.cpp
@@ -6,6 +6,7 @@
#include "squishtr.h"
#include <debugger/breakhandler.h>
+#include <utils/executeondestruction.h>
#include <QLoggingCategory>
@@ -13,6 +14,14 @@ Q_LOGGING_CATEGORY(runnerLOG, "qtc.squish.squishrunner", QtWarningMsg)
namespace Squish::Internal {
+static QString maskedArgument(const QString &originalArg)
+{
+ QString masked = originalArg;
+ masked.replace('\\', "\\\\");
+ masked.replace(' ', "\\x20");
+ return masked;
+}
+
SquishRunnerProcess::SquishRunnerProcess(QObject *parent)
: SquishProcessBase{parent}
{
@@ -36,6 +45,10 @@ void SquishRunnerProcess::setupProcess(RunnerMode mode)
case Record:
m_process.setProcessMode(Utils::ProcessMode::Writer);
break;
+ case Inspect:
+ m_process.setProcessMode(Utils::ProcessMode::Writer);
+ m_process.setStdOutLineCallback([this](const QString &line) { onInspectorOutput(line); });
+ break;
}
}
@@ -44,6 +57,8 @@ void SquishRunnerProcess::start(const Utils::CommandLine &cmdline, const Utils::
QTC_ASSERT(m_process.state() == QProcess::NotRunning, return);
m_licenseIssues = false;
m_autId = 0;
+ m_outputMode = SingleLine;
+ m_multiLineContent.clear();
SquishProcessBase::start(cmdline, env);
}
@@ -130,11 +145,75 @@ void SquishRunnerProcess::onStdOutput(const QString &lineIn)
isPrompt = true;
m_autId = line.mid(7).toInt();
qCInfo(runnerLOG) << "AUT ID set" << m_autId << "(" << line << ")";
+ emit autIdRetrieved();
}
if (isPrompt)
emit interrupted(fileName, fileLine, fileColumn);
}
+void SquishRunnerProcess::handleMultiLineOutput(OutputMode mode)
+{
+ Utils::ExecuteOnDestruction atExit([this]{
+ m_multiLineContent.clear();
+ m_context.clear();
+ });
+
+ if (mode == MultiLineProperties) {
+ emit propertiesFetched(m_multiLineContent);
+ } else if (mode == MultiLineChildren) {
+ // TODO
+ }
+}
+
+void SquishRunnerProcess::onInspectorOutput(const QString &lineIn)
+{
+ QString line = lineIn;
+ line.chop(1); // line has a newline
+ if (line.startsWith("SSPY:"))
+ line = line.mid(5);
+ if (line.isEmpty()) // we have a prompt, that's fine
+ return;
+
+ if (m_outputMode != SingleLine) {
+ const OutputMode originalMode = m_outputMode;
+ if (line.startsWith("@end")) {
+ m_outputMode = SingleLine;
+ if (!QTC_GUARD(line.mid(6).chopped(1) == m_context)) { // messed up output
+ m_multiLineContent.clear();
+ m_context.clear();
+ return;
+ }
+ } else {
+ m_multiLineContent.append(line);
+ }
+ if (m_outputMode == SingleLine) // we reached the @end
+ handleMultiLineOutput(originalMode);
+ return;
+ }
+ if (line == "@ready")
+ return;
+ if (line.startsWith("@picked: ")) {
+ const QString value = line.mid(9);
+ emit objectPicked(value);
+ return;
+ }
+ if (line.startsWith("@startprop")) {
+ m_outputMode = MultiLineProperties;
+ m_context = line.mid(12).chopped(1);
+ return;
+ }
+ if (line.startsWith("@startobj")) {
+ m_outputMode = MultiLineChildren;
+ m_context = line.mid(11).chopped(1);
+ return;
+ }
+ if (line.contains("license acquisition")) {
+ emit logOutputReceived("Inspect: " + line);
+ return;
+ }
+// qDebug() << "unhandled" << line;
+}
+
static QString cmdToString(SquishRunnerProcess::RunnerCommand cmd)
{
switch (cmd) {
@@ -142,6 +221,7 @@ static QString cmdToString(SquishRunnerProcess::RunnerCommand cmd)
case SquishRunnerProcess::EndRecord: return "endrecord\n";
case SquishRunnerProcess::Exit: return "exit\n";
case SquishRunnerProcess::Next: return "next\n";
+ case SquishRunnerProcess::Pick: return "pick\n";
case SquishRunnerProcess::PrintVariables: return "print variables\n";
case SquishRunnerProcess::Return: return "return\n";
case SquishRunnerProcess::Step: return "step\n";
@@ -161,6 +241,16 @@ void SquishRunnerProcess::requestExpanded(const QString &variableName)
m_process.write("print variables +" + variableName + "\n");
}
+void SquishRunnerProcess::requestListObject(const QString &value)
+{
+ m_process.write("list objects " + maskedArgument(value) + "\n");
+}
+
+void SquishRunnerProcess::requestListProperties(const QString &value)
+{
+ m_process.write("list properties " + maskedArgument(value) + "\n");
+}
+
// FIXME: add/removal of breakpoints while debugging not handled yet
// FIXME: enabled state of breakpoints
Utils::Links SquishRunnerProcess::setBreakpoints(const QString &scriptExtension)
@@ -180,8 +270,7 @@ Utils::Links SquishRunnerProcess::setBreakpoints(const QString &scriptExtension)
continue;
// mask backslashes and spaces
- fileName.replace('\\', "\\\\");
- fileName.replace(' ', "\\x20");
+ fileName = maskedArgument(fileName);
auto line = gb->data(BreakpointLineColumn, Qt::DisplayRole).toInt();
QString cmd = "break ";
cmd.append(fileName);
diff --git a/src/plugins/squish/squishrunnerprocess.h b/src/plugins/squish/squishrunnerprocess.h
index b1c98220c1..624b986c6d 100644
--- a/src/plugins/squish/squishrunnerprocess.h
+++ b/src/plugins/squish/squishrunnerprocess.h
@@ -15,8 +15,8 @@ class SquishRunnerProcess : public SquishProcessBase
{
Q_OBJECT
public:
- enum RunnerCommand { Continue, EndRecord, Exit, Next, PrintVariables, Return, Step };
- enum RunnerMode { Run, StartAut, QueryServer, Record };
+ enum RunnerCommand { Continue, EndRecord, Exit, Next, Pick, PrintVariables, Return, Step };
+ enum RunnerMode { Run, StartAut, QueryServer, Record, Inspect };
enum RunnerError { InvalidSocket, MappedAutMissing };
explicit SquishRunnerProcess(QObject *parent = nullptr);
@@ -33,6 +33,8 @@ public:
void writeCommand(RunnerCommand cmd);
void requestExpanded(const QString &variableName);
+ void requestListObject(const QString &value);
+ void requestListProperties(const QString &value);
Utils::Links setBreakpoints(const QString &scriptExtension);
bool lastRunHadLicenseIssues() const { return m_licenseIssues; }
@@ -43,16 +45,26 @@ signals:
void runnerFinished();
void interrupted(const QString &fileName, int line, int column);
void localsUpdated(const QString &output);
+ void propertiesFetched(const QStringList &properties);
+ void objectPicked(const QString &output);
void runnerError(RunnerError error);
+ void autIdRetrieved();
protected:
void onDone() override;
void onErrorOutput() override;
private:
+ enum OutputMode { SingleLine, MultiLineChildren, MultiLineProperties };
+
void onStdOutput(const QString &line);
+ void handleMultiLineOutput(OutputMode mode);
+ void onInspectorOutput(const QString &line);
Utils::FilePath m_currentTestCasePath;
+ QStringList m_multiLineContent;
+ QString m_context;
+ OutputMode m_outputMode = SingleLine;
int m_autId = 0;
bool m_licenseIssues = false;
std::optional<RunnerMode> m_mode;
diff --git a/src/plugins/squish/squishtools.cpp b/src/plugins/squish/squishtools.cpp
index c31109fab3..64cc98f780 100644
--- a/src/plugins/squish/squishtools.cpp
+++ b/src/plugins/squish/squishtools.cpp
@@ -133,6 +133,8 @@ SquishTools::SquishTools(QObject *parent)
this, &SquishTools::stopRecorder);
connect(&m_perspective, &SquishPerspective::runRequested,
this, &SquishTools::onRunnerRunRequested);
+ connect(&m_perspective, &SquishPerspective::inspectTriggered,
+ this, &SquishTools::onInspectTriggered);
}
SquishTools::~SquishTools()
@@ -440,6 +442,7 @@ void SquishTools::onRunnerStopped()
m_request = ServerStopRequested;
qCInfo(LOG) << "Stopping server from RunnerStopped (query)";
stopSquishServer();
+ return;
} else if (m_request == RecordTestRequested) {
if (m_secondaryRunner && m_secondaryRunner->isRunning()) {
stopRecorder();
@@ -448,7 +451,12 @@ void SquishTools::onRunnerStopped()
qCInfo(LOG) << "Stopping server from RunnerStopped (startaut)";
stopSquishServer();
}
- } else if (m_testCases.isEmpty() || (m_squishRunnerState == RunnerState::Canceled)) {
+ return;
+ }
+ // below only normal run of test case(s)
+ exitAndResetSecondaryRunner();
+
+ if (m_testCases.isEmpty() || (m_squishRunnerState == RunnerState::Canceled)) {
m_request = ServerStopRequested;
qCInfo(LOG) << "Stopping server from RunnerStopped";
stopSquishServer();
@@ -613,6 +621,50 @@ void SquishTools::setupAndStartRecorder()
m_secondaryRunner->start(cmd, squishEnvironment());
}
+void SquishTools::setupAndStartInspector()
+{
+ QTC_ASSERT(m_primaryRunner && m_primaryRunner->autId() != 0, return);
+ QTC_ASSERT(!m_secondaryRunner, return);
+
+ QStringList args;
+ if (!toolsSettings.isLocalServer)
+ args << "--host" << toolsSettings.serverHost;
+ args << "--port" << QString::number(m_serverProcess.port());
+ args << "--debugLog" << "alpw"; // TODO make this configurable?
+ args << "--inspect";
+ args << "--suitedir" << m_suitePath.toUserOutput();
+ args << "--autid" << QString::number(m_primaryRunner->autId());
+
+ m_secondaryRunner = new SquishRunnerProcess(this);
+ m_secondaryRunner->setupProcess(SquishRunnerProcess::Inspect);
+ const CommandLine cmd = {toolsSettings.runnerPath, args};
+ connect(m_secondaryRunner, &SquishRunnerProcess::logOutputReceived,
+ this, &SquishTools::logOutputReceived);
+ connect(m_secondaryRunner, &SquishRunnerProcess::objectPicked,
+ this, &SquishTools::objectPicked);
+ connect(m_secondaryRunner, &SquishRunnerProcess::propertiesFetched,
+ this, &SquishTools::propertiesFetched);
+ qCDebug(LOG) << "Inspector starting:" << cmd.toUserOutput();
+ m_secondaryRunner->start(cmd, squishEnvironment());
+}
+
+void SquishTools::exitAndResetSecondaryRunner()
+{
+ m_perspective.resetAutId();
+ if (m_secondaryRunner) {
+ m_secondaryRunner->writeCommand(SquishRunnerProcess::Exit);
+ m_secondaryRunner->deleteLater();
+ m_secondaryRunner = nullptr;
+ }
+}
+
+void SquishTools::onInspectTriggered()
+{
+ QTC_ASSERT(m_primaryRunner, return);
+ QTC_ASSERT(m_secondaryRunner, return);
+ m_secondaryRunner->writeCommand(SquishRunnerProcess::Pick);
+}
+
void SquishTools::stopRecorder()
{
QTC_ASSERT(m_secondaryRunner && m_secondaryRunner->isRunning(), return);
@@ -865,6 +917,7 @@ void SquishTools::handlePrompt(const QString &fileName, int line, int column)
case RunnerState::CancelRequested:
case RunnerState::CancelRequestedWhileInterrupted:
logAndChangeRunnerState(RunnerState::Canceled);
+ exitAndResetSecondaryRunner();
m_primaryRunner->writeCommand(SquishRunnerProcess::Exit);
clearLocationMarker();
break;
@@ -885,6 +938,9 @@ void SquishTools::handlePrompt(const QString &fileName, int line, int column)
const FilePath filePath = FilePath::fromUserInput(fileName);
Core::EditorManager::openEditorAt({filePath, line, column});
updateLocationMarker(filePath, line);
+ // looks like we need to start inspector while being interrupted?
+ if (!m_secondaryRunner && m_primaryRunner->autId() !=0)
+ setupAndStartInspector();
}
} else { // it's just some output coming from the server
if (m_squishRunnerState == RunnerState::Interrupted && !m_requestVarsTimer) {
@@ -909,6 +965,24 @@ void SquishTools::requestExpansion(const QString &name)
m_primaryRunner->requestExpanded(name);
}
+void SquishTools::requestExpansionForObject(const QString &value)
+{
+ QTC_ASSERT(m_primaryRunner, return);
+ if (m_squishRunnerState != RunnerState::Interrupted)
+ return;
+ QTC_ASSERT(m_secondaryRunner, return);
+ m_secondaryRunner->requestListObject(value);
+}
+
+void SquishTools::requestPropertiesForObject(const QString &value)
+{
+ QTC_ASSERT(m_primaryRunner, return);
+ if (m_squishRunnerState != RunnerState::Interrupted)
+ return;
+ QTC_ASSERT(m_secondaryRunner, return);
+ m_secondaryRunner->requestListProperties(value);
+}
+
bool SquishTools::shutdown()
{
QTC_ASSERT(!m_shutdownInitiated, return true);
@@ -1202,6 +1276,8 @@ void SquishTools::setupAndStartSquishRunnerProcess(const Utils::CommandLine &cmd
m_primaryRunner->closeProcess();
if (m_request == RunTestRequested) {
+ connect(m_primaryRunner, &SquishRunnerProcess::autIdRetrieved,
+ this, &SquishTools::autIdRetrieved);
// set up the file system watcher for being able to read the results.xml file
m_resultsFileWatcher = new QFileSystemWatcher;
// on 2nd run this directory exists and won't emit changes, so use the current subdirectory
diff --git a/src/plugins/squish/squishtools.h b/src/plugins/squish/squishtools.h
index 8d3cf61cfc..11bb9d3096 100644
--- a/src/plugins/squish/squishtools.h
+++ b/src/plugins/squish/squishtools.h
@@ -60,10 +60,13 @@ public:
void requestSetSharedFolders(const Utils::FilePaths &sharedFolders);
void writeServerSettingsChanges(const QList<QStringList> &changes);
void requestExpansion(const QString &name);
+ void requestExpansionForObject(const QString &value);
+ void requestPropertiesForObject(const QString &value);
bool shutdown();
signals:
+ void autIdRetrieved();
void logOutputReceived(const QString &output);
void squishTestRunStarted();
void squishTestRunFinished();
@@ -71,6 +74,8 @@ signals:
void configChangesFailed(QProcess::ProcessError error);
void configChangesWritten();
void localsUpdated(const QString &output);
+ void objectPicked(const QString &output);
+ void propertiesFetched(const QStringList &properties);
void shutdownFinished();
private:
@@ -103,6 +108,9 @@ private:
void stopSquishServer();
void startSquishRunner();
void setupAndStartRecorder();
+ void setupAndStartInspector();
+ void exitAndResetSecondaryRunner();
+ void onInspectTriggered();
void stopRecorder();
void queryServer(RunnerQuery query);
void executeRunnerQuery();