diff --git a/src/autotests/CMakeLists.txt b/src/autotests/CMakeLists.txt index 2a566d25..0366504b 100644 --- a/src/autotests/CMakeLists.txt +++ b/src/autotests/CMakeLists.txt @@ -19,14 +19,13 @@ if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") add_executable(DBusTest DBusTest.cpp) ecm_mark_as_test(DBusTest) add_test(DBusTest DBusTest) - target_link_libraries(DBusTest ${KONSOLE_TEST_LIBS} Qt5::DBus KF5::KDELibs4Support) + target_link_libraries(DBusTest ${KONSOLE_TEST_LIBS} Qt5::DBus) endif() add_executable(HistoryTest HistoryTest.cpp) ecm_mark_as_test(HistoryTest) add_test(HistoryTest HistoryTest) -target_link_libraries(HistoryTest ${KONSOLE_TEST_LIBS} KF5::KDELibs4Support) - +target_link_libraries(HistoryTest ${KONSOLE_TEST_LIBS} KF5::Parts) add_executable(KeyboardTranslatorTest KeyboardTranslatorTest.cpp) ecm_mark_as_test(KeyboardTranslatorTest) @@ -37,7 +36,7 @@ if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") add_executable(PartTest PartTest.cpp) ecm_mark_as_test(PartTest) add_test(PartTest PartTest) - target_link_libraries(PartTest KF5::XmlGui KF5::Parts KF5::Pty KF5::KDELibs4Support + target_link_libraries(PartTest KF5::XmlGui KF5::Parts KF5::Pty ${KONSOLE_TEST_LIBS}) endif() @@ -54,7 +53,7 @@ target_link_libraries(PtyTest KF5::Pty ${KONSOLE_TEST_LIBS}) add_executable(SessionTest SessionTest.cpp) ecm_mark_as_test(SessionTest) add_test(SessionTest SessionTest) -target_link_libraries(SessionTest ${KONSOLE_TEST_LIBS} KF5::KDELibs4Support) +target_link_libraries(SessionTest ${KONSOLE_TEST_LIBS} KF5::Parts) add_executable(ShellCommandTest ShellCommandTest.cpp) ecm_mark_as_test(ShellCommandTest) @@ -70,7 +69,7 @@ target_link_libraries(TerminalCharacterDecoderTest ${KONSOLE_TEST_LIBS}) add_executable(TerminalTest TerminalTest.cpp) ecm_mark_as_test(TerminalTest) add_test(TerminalTest TerminalTest) -target_link_libraries(TerminalTest ${KONSOLE_TEST_LIBS} KF5::KDELibs4Support) +target_link_libraries(TerminalTest ${KONSOLE_TEST_LIBS} KF5::Parts) ##add_executable(TerminalInterfaceTest TerminalInterfaceTest.cpp) ##ecm_mark_as_test(TerminalInterface) diff --git a/src/autotests/DBusTest.cpp b/src/autotests/DBusTest.cpp index ac7b257c..0141622a 100644 --- a/src/autotests/DBusTest.cpp +++ b/src/autotests/DBusTest.cpp @@ -20,7 +20,7 @@ // Own #include "DBusTest.h" #include "../Session.h" -#include +#include #include using namespace Konsole; @@ -34,11 +34,10 @@ void DBusTest::initTestCase() if (!QDBusConnection::sessionBus().isConnected() || !(bus = QDBusConnection::sessionBus().interface())) - kFatal() << "Session bus not found"; + QFAIL("Session bus not found"); QDBusReply serviceReply = bus->registeredServiceNames(); - if (!serviceReply.isValid()) - kFatal() << "SessionBus interfaces not available"; + QVERIFY2(serviceReply.isValid(), "SessionBus interfaces not available"); // Find all current Konsoles' services running QStringList allServices = serviceReply; @@ -52,7 +51,7 @@ void DBusTest::initTestCase() // Create a new Konsole with a separate process id int result = KProcess::execute("konsole"); if (result) - kFatal() << "Unable to exec a new Konsole : " << result; + QFAIL(QString("Unable to exec a new Konsole: %1").arg(result).toLatin1().data()); // Wait for above Konsole to finish starting #if defined(HAVE_USLEEP) @@ -62,8 +61,7 @@ void DBusTest::initTestCase() #endif serviceReply = bus->registeredServiceNames(); - if (!serviceReply.isValid()) - kFatal() << "SessionBus interfaces not available"; + QVERIFY2(serviceReply.isValid(), "SessionBus interfaces not available"); // Find dbus service of above Konsole allServices = serviceReply; @@ -75,10 +73,8 @@ void DBusTest::initTestCase() _interfaceName = service; } - if (_interfaceName.isEmpty()) { - kFatal() << "This test will only work in a Konsole window with a new PID. A new Konsole PID can't be found."; - } - //kDebug()<< "Using service: " + _interfaceName.toLatin1(); + QVERIFY2(!_interfaceName.isEmpty(), + "This test will only work in a Konsole window with a new PID. A new Konsole PID can't be found."); QDBusInterface iface(_interfaceName, QLatin1String("/Konsole"), @@ -96,12 +92,11 @@ void DBusTest::cleanupTestCase() QDBusInterface iface(_interfaceName, QLatin1String("/konsole/MainWindow_1"), QLatin1String("org.qtproject.Qt.QWidget")); - if (!iface.isValid()) - kFatal() << "Unable to get a dbus interface to Konsole!"; + QVERIFY2(iface.isValid(), "Unable to get a dbus interface to Konsole!"); QDBusReply instanceReply = iface.call("close"); if (!instanceReply.isValid()) - kFatal() << "Unable to close Konsole :" << instanceReply.error(); + QFAIL(QString("Unable to close Konsole: %1").arg(instanceReply.error().message()).toLatin1().data()); } void DBusTest::testSessions() diff --git a/src/autotests/PartTest.cpp b/src/autotests/PartTest.cpp index 0c8e99d3..aeab7de5 100644 --- a/src/autotests/PartTest.cpp +++ b/src/autotests/PartTest.cpp @@ -25,6 +25,7 @@ #include #include #include +#include // KDE #include #include @@ -32,7 +33,6 @@ #include #include #include -#include #include #include @@ -84,9 +84,8 @@ void PartTest::testFd() // as soon as it becomes available and the terminal will not display any output ptyProcess.pty()->setSuspended(true); - QWeakPointer dialog = new KDialog(); - dialog.data()->setButtons(0); - QVBoxLayout* layout = new QVBoxLayout(dialog.data()->mainWidget()); + QWeakPointer dialog = new QDialog(); + QVBoxLayout* layout = new QVBoxLayout(dialog.data()); layout->addWidget(new QLabel("Output of 'ping localhost' should appear in a terminal below for 5 seconds")); layout->addWidget(terminalPart->widget()); QTimer::singleShot(5000, dialog.data(), SLOT(close()));