Commit 3cacd14b authored by Kurt Hindenburg's avatar Kurt Hindenburg
Browse files

For PartTest, exit cleanly if konsolepart not found

(cherry picked from commit 16be1f4e)
parent ab61a94a
......@@ -59,6 +59,11 @@ void PartTest::testFd()
return;
}
// create a Konsole part and attempt to connect to it
KParts::Part* terminalPart = createPart();
if (!terminalPart) // not found
QSKIP("konsolepart not found.", SkipSingle);
// start a pty process
KPtyProcess ptyProcess;
ptyProcess.setProgram(pingExe, QStringList() << "localhost");
......@@ -68,8 +73,6 @@ void PartTest::testFd()
int fd = ptyProcess.pty()->masterFd();
// create a Konsole part and attempt to connect to it
KParts::Part* terminalPart = createPart();
bool result = QMetaObject::invokeMethod(terminalPart, "openTeletype",
Qt::DirectConnection, Q_ARG(int, fd));
QVERIFY(result);
......@@ -96,9 +99,11 @@ void PartTest::testFd()
KParts::Part* PartTest::createPart()
{
KService::Ptr service = KService::serviceByDesktopName("konsolepart");
Q_ASSERT(service);
if (!service) // not found
return 0;
KPluginFactory* factory = KPluginLoader(service->library()).factory();
Q_ASSERT(factory);
if (!factory) // not found
return 0;
KParts::Part* terminalPart = factory->create<KParts::Part>(this);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment