forked from qt-creator/qt-creator
tst_QtcProcess: Get rid of lineCallbackIntern() test
This test introduced some additional private API to QtcProcess. This makes refactorings of QtcProcess harder, as we need to handle this artificial code working. We have a real lineCallback() test instead which doesn't employ this private API. Change-Id: Idbc314210cecc2044e1ccc298e5d3e0a9747e811 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -1240,23 +1240,6 @@ void QtcProcess::close()
|
||||
d->m_process->close();
|
||||
}
|
||||
|
||||
void QtcProcess::beginFeed()
|
||||
{
|
||||
d->clearForRun();
|
||||
}
|
||||
|
||||
void QtcProcess::endFeed()
|
||||
{
|
||||
d->handleFinished(0, QProcess::NormalExit);
|
||||
}
|
||||
|
||||
void QtcProcess::feedStdOut(const QByteArray &data)
|
||||
{
|
||||
d->m_stdOut.append(data);
|
||||
d->m_hangTimerCount = 0;
|
||||
emit readyReadStandardOutput();
|
||||
}
|
||||
|
||||
QString QtcProcess::locateBinary(const QString &binary)
|
||||
{
|
||||
const QByteArray path = qgetenv("PATH");
|
||||
|
@@ -210,11 +210,6 @@ private:
|
||||
|
||||
friend class Internal::QtcProcessPrivate;
|
||||
Internal::QtcProcessPrivate *d = nullptr;
|
||||
|
||||
friend tst_QtcProcess;
|
||||
void beginFeed();
|
||||
void feedStdOut(const QByteArray &data);
|
||||
void endFeed();
|
||||
};
|
||||
|
||||
class DeviceProcessHooks
|
||||
|
@@ -150,7 +150,6 @@ private slots:
|
||||
void runBlockingStdOut_data();
|
||||
void runBlockingStdOut();
|
||||
void lineCallback();
|
||||
void lineCallbackIntern();
|
||||
void waitForStartedAndFinished();
|
||||
void notRunningAfterStartingNonExistingProgram();
|
||||
void channelForwarding_data();
|
||||
@@ -964,27 +963,6 @@ void tst_QtcProcess::lineCallback()
|
||||
QCOMPARE(lineNumber, lines.size());
|
||||
}
|
||||
|
||||
void tst_QtcProcess::lineCallbackIntern()
|
||||
{
|
||||
TestProcess process;
|
||||
QStringList lines = QString(s_lineCallbackData).split('|');
|
||||
int lineNumber = 0;
|
||||
process.setStdOutLineCallback([lines, &lineNumber](const QString &actual) {
|
||||
QString expected = lines.at(lineNumber);
|
||||
expected.replace("\r\n", "\n");
|
||||
// Omit some initial lines generated by Qt, e.g.
|
||||
// Warning: Ignoring WAYLAND_DISPLAY on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
|
||||
if (lineNumber == 0 && actual != expected)
|
||||
return;
|
||||
++lineNumber;
|
||||
QCOMPARE(actual, expected);
|
||||
});
|
||||
process.beginFeed();
|
||||
process.feedStdOut(QByteArray(s_lineCallbackData).replace('|', ""));
|
||||
process.endFeed();
|
||||
QCOMPARE(lineNumber, lines.size());
|
||||
}
|
||||
|
||||
void tst_QtcProcess::waitForStartedAndFinished()
|
||||
{
|
||||
SubProcessConfig subConfig(ProcessTestApp::SimpleTest::envVar(), {});
|
||||
|
Reference in New Issue
Block a user