diff --git a/dolphin/src/panels/places/placespanel.h b/dolphin/src/panels/places/placespanel.h index 1ab64c45..2df015d3 100644 --- a/dolphin/src/panels/places/placespanel.h +++ b/dolphin/src/panels/places/placespanel.h @@ -21,6 +21,7 @@ #ifndef PLACESPANEL_H #define PLACESPANEL_H +#include #include #include @@ -29,7 +30,6 @@ class PlacesItemEditDialog; class PlacesItem; class PlacesItemModel; class PlacesView; -#include /** * @brief Combines bookmarks and mounted devices as list. diff --git a/drkonqi/tests/CMakeLists.txt b/drkonqi/tests/CMakeLists.txt index 22b6568a..8324e8c4 100644 --- a/drkonqi/tests/CMakeLists.txt +++ b/drkonqi/tests/CMakeLists.txt @@ -1,2 +1,23 @@ -add_subdirectory(crashtest) -add_subdirectory(backtraceparsertest) +set(backtraceparsertest_SRCS + fakebacktracegenerator.cpp + backtraceparsertest.cpp +) + +kde4_add_test(drkonqi-backtraceparsertest ${backtraceparsertest_SRCS}) +target_link_libraries(drkonqi-backtraceparsertest + ${QT_QTTEST_LIBRARY} + ${QT_QTCORE_LIBRARY} + drkonqi_backtrace_parser +) + +# create a link so that the data directory can be accessed from the build +# directory, where the test runs +if(NOT ${CMAKE_CURRENT_BINARY_DIR} EQUAL ${CMAKE_CURRENT_SOURCE_DIR}) + add_custom_command( + TARGET drkonqi-backtraceparsertest POST_BUILD + COMMAND ${CMAKE_COMMAND} -E create_symlink + ${CMAKE_CURRENT_SOURCE_DIR}/backtraceparsertest_data + backtraceparsertest_data + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) +endif() diff --git a/drkonqi/tests/backtraceparsertest/README b/drkonqi/tests/README similarity index 100% rename from drkonqi/tests/backtraceparsertest/README rename to drkonqi/tests/README diff --git a/drkonqi/tests/backtraceparsertest/backtraceparsertest.cpp b/drkonqi/tests/backtraceparsertest.cpp similarity index 100% rename from drkonqi/tests/backtraceparsertest/backtraceparsertest.cpp rename to drkonqi/tests/backtraceparsertest.cpp diff --git a/drkonqi/tests/backtraceparsertest/backtraceparsertest.h b/drkonqi/tests/backtraceparsertest.h similarity index 96% rename from drkonqi/tests/backtraceparsertest/backtraceparsertest.h rename to drkonqi/tests/backtraceparsertest.h index c03c12df..57dd9bf6 100644 --- a/drkonqi/tests/backtraceparsertest/backtraceparsertest.h +++ b/drkonqi/tests/backtraceparsertest.h @@ -21,7 +21,7 @@ #include #include "fakebacktracegenerator.h" -#include "../../parser/backtraceparser.h" +#include "../parser/backtraceparser.h" class BacktraceParserTest : public QObject { diff --git a/drkonqi/tests/backtraceparsertest/CMakeLists.txt b/drkonqi/tests/backtraceparsertest/CMakeLists.txt deleted file mode 100644 index 936cbac7..00000000 --- a/drkonqi/tests/backtraceparsertest/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -set(backtraceparsertest_SRCS - fakebacktracegenerator.cpp - backtraceparsertest.cpp -) - -kde4_add_test(drkonqi-backtraceparsertest ${backtraceparsertest_SRCS}) -target_link_libraries(drkonqi-backtraceparsertest - ${QT_QTTEST_LIBRARY} - ${QT_QTCORE_LIBRARY} - drkonqi_backtrace_parser -) - -set(backtraceparsertest_manual_SRCS - fakebacktracegenerator.cpp - backtraceparsertest_manual.cpp -) -kde4_add_manual_test(backtraceparsertest_manual ${backtraceparsertest_manual_SRCS}) -target_link_libraries(backtraceparsertest_manual drkonqi_backtrace_parser) - -# create a link so that the data directory can be accessed from the build -# directory, where the test runs -if(NOT ${CMAKE_CURRENT_BINARY_DIR} EQUAL ${CMAKE_CURRENT_SOURCE_DIR}) - add_custom_command( - TARGET drkonqi-backtraceparsertest POST_BUILD - COMMAND ${CMAKE_COMMAND} -E create_symlink - ${CMAKE_CURRENT_SOURCE_DIR}/backtraceparsertest_data - backtraceparsertest_data - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - ) -endif() diff --git a/drkonqi/tests/backtraceparsertest/backtraceparsertest_manual.cpp b/drkonqi/tests/backtraceparsertest/backtraceparsertest_manual.cpp deleted file mode 100644 index 9a01d9f7..00000000 --- a/drkonqi/tests/backtraceparsertest/backtraceparsertest_manual.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright (C) 2010 George Kiagiadakis - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ -#include "fakebacktracegenerator.h" -#include "../../parser/backtraceparser.h" -#include -#include -#include -#include -#include -#include -#include -#include - -int main(int argc, char **argv) -{ - KAboutData aboutData("backtraceparsertest_manual", 0, - ki18n("backtraceparsertest_manual"), "1.0"); - KCmdLineArgs::init(argc, argv, &aboutData); - - KCmdLineOptions options; - options.add("debugger ", ki18n("The debugger name passed to the parser factory"), "gdb"); - options.add("+file", ki18n("A file containing the backtrace.")); - KCmdLineArgs::addCmdLineOptions(options); - - QCoreApplication app(KCmdLineArgs::qtArgc(), KCmdLineArgs::qtArgv()); - QCoreApplication::setApplicationName(QLatin1String("backtraceparsertest_manual")); - - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - QString debugger = args->getOption("debugger"); - QString file = args->arg(0); - - if (!QFile::exists(file)) { - QTextStream(stderr) << "The specified file does not exist" << endl; - return 1; - } - - FakeBacktraceGenerator generator; - QSharedPointer parser(BacktraceParser::newParser(debugger)); - parser->connectToGenerator(&generator); - generator.sendData(file); - - QMetaEnum metaUsefulness = BacktraceParser::staticMetaObject.enumerator( - BacktraceParser::staticMetaObject.indexOfEnumerator("Usefulness")); - QTextStream(stdout) << "Usefulness: " << metaUsefulness.valueToKey(parser->backtraceUsefulness()) << endl; - QStringList l = static_cast(parser->librariesWithMissingDebugSymbols().toList()); - QTextStream(stdout) << "Missing dbgsym libs: " << l.join(" ") << endl; - - return 0; -} diff --git a/drkonqi/tests/backtraceparsertest/backtraceparsertest_data/data.ini b/drkonqi/tests/backtraceparsertest_data/data.ini similarity index 100% rename from drkonqi/tests/backtraceparsertest/backtraceparsertest_data/data.ini rename to drkonqi/tests/backtraceparsertest_data/data.ini diff --git a/drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_a b/drkonqi/tests/backtraceparsertest_data/test_a similarity index 100% rename from drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_a rename to drkonqi/tests/backtraceparsertest_data/test_a diff --git a/drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_anon_namespace b/drkonqi/tests/backtraceparsertest_data/test_anon_namespace similarity index 100% rename from drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_anon_namespace rename to drkonqi/tests/backtraceparsertest_data/test_anon_namespace diff --git a/drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_b b/drkonqi/tests/backtraceparsertest_data/test_b similarity index 100% rename from drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_b rename to drkonqi/tests/backtraceparsertest_data/test_b diff --git a/drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_bug168000 b/drkonqi/tests/backtraceparsertest_data/test_bug168000 similarity index 100% rename from drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_bug168000 rename to drkonqi/tests/backtraceparsertest_data/test_bug168000 diff --git a/drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_bug190882 b/drkonqi/tests/backtraceparsertest_data/test_bug190882 similarity index 100% rename from drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_bug190882 rename to drkonqi/tests/backtraceparsertest_data/test_bug190882 diff --git a/drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_bug192412_a b/drkonqi/tests/backtraceparsertest_data/test_bug192412_a similarity index 100% rename from drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_bug192412_a rename to drkonqi/tests/backtraceparsertest_data/test_bug192412_a diff --git a/drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_bug192412_b b/drkonqi/tests/backtraceparsertest_data/test_bug192412_b similarity index 100% rename from drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_bug192412_b rename to drkonqi/tests/backtraceparsertest_data/test_bug192412_b diff --git a/drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_bug200993 b/drkonqi/tests/backtraceparsertest_data/test_bug200993 similarity index 100% rename from drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_bug200993 rename to drkonqi/tests/backtraceparsertest_data/test_bug200993 diff --git a/drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_c b/drkonqi/tests/backtraceparsertest_data/test_c similarity index 100% rename from drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_c rename to drkonqi/tests/backtraceparsertest_data/test_c diff --git a/drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_d b/drkonqi/tests/backtraceparsertest_data/test_d similarity index 100% rename from drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_d rename to drkonqi/tests/backtraceparsertest_data/test_d diff --git a/drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_e b/drkonqi/tests/backtraceparsertest_data/test_e similarity index 100% rename from drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_e rename to drkonqi/tests/backtraceparsertest_data/test_e diff --git a/drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_f b/drkonqi/tests/backtraceparsertest_data/test_f similarity index 100% rename from drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_f rename to drkonqi/tests/backtraceparsertest_data/test_f diff --git a/drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_g b/drkonqi/tests/backtraceparsertest_data/test_g similarity index 100% rename from drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_g rename to drkonqi/tests/backtraceparsertest_data/test_g diff --git a/drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_h b/drkonqi/tests/backtraceparsertest_data/test_h similarity index 100% rename from drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_h rename to drkonqi/tests/backtraceparsertest_data/test_h diff --git a/drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_trailing_const b/drkonqi/tests/backtraceparsertest_data/test_trailing_const similarity index 100% rename from drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_trailing_const rename to drkonqi/tests/backtraceparsertest_data/test_trailing_const diff --git a/drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_usefulfunctions b/drkonqi/tests/backtraceparsertest_data/test_usefulfunctions similarity index 100% rename from drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_usefulfunctions rename to drkonqi/tests/backtraceparsertest_data/test_usefulfunctions diff --git a/drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_usefulfunctions2 b/drkonqi/tests/backtraceparsertest_data/test_usefulfunctions2 similarity index 100% rename from drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_usefulfunctions2 rename to drkonqi/tests/backtraceparsertest_data/test_usefulfunctions2 diff --git a/drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_usefulfunctions3 b/drkonqi/tests/backtraceparsertest_data/test_usefulfunctions3 similarity index 100% rename from drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_usefulfunctions3 rename to drkonqi/tests/backtraceparsertest_data/test_usefulfunctions3 diff --git a/drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_usefulfunctions4 b/drkonqi/tests/backtraceparsertest_data/test_usefulfunctions4 similarity index 100% rename from drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_usefulfunctions4 rename to drkonqi/tests/backtraceparsertest_data/test_usefulfunctions4 diff --git a/drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_usefulfunctions5 b/drkonqi/tests/backtraceparsertest_data/test_usefulfunctions5 similarity index 100% rename from drkonqi/tests/backtraceparsertest/backtraceparsertest_data/test_usefulfunctions5 rename to drkonqi/tests/backtraceparsertest_data/test_usefulfunctions5 diff --git a/drkonqi/tests/crashtest/CMakeLists.txt b/drkonqi/tests/crashtest/CMakeLists.txt deleted file mode 100644 index e2562a0a..00000000 --- a/drkonqi/tests/crashtest/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -set(crashtest_SRCS crashtest.cpp ) - -kde4_add_manual_test(crashtest ${crashtest_SRCS}) - -target_link_libraries(crashtest KDE4::kdeui) diff --git a/drkonqi/tests/crashtest/crashtest.cpp b/drkonqi/tests/crashtest/crashtest.cpp deleted file mode 100644 index e997d74a..00000000 --- a/drkonqi/tests/crashtest/crashtest.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/***************************************************************** - * drkonqi - The KDE Crash Handler - * - * Copyright (C) 2000-2002 David Faure - * Copyright (C) 2000-2002 Waldo Bastian - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************/ - -// Let's crash. -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -enum CrashType { Crash, Malloc, Div0, Assert, QAssert, Threads }; - -struct SomeStruct -{ - int foo() { return ret; } - int ret; -}; - -void do_crash() -{ - SomeStruct *obj = 0; - int ret = obj->foo(); - printf("result = %d\n", ret); -} - -void do_malloc() -{ - delete (char*)0xdead; -} - -void do_div0() -{ - volatile int a = 99; - volatile int b = 10; - volatile int c = a / ( b - 10 ); - printf("result = %d\n", c); -} - -void do_assert() -{ - assert(false); -} - -void do_qassert() -{ - Q_ASSERT(false); -} - -class FooRunnable : public QRunnable -{ -public: - FooRunnable(const QString &foostring); - - void run() final; - -private: - const QString m_foostring; -}; - -FooRunnable::FooRunnable(const QString &foostring) - : QRunnable(), - m_foostring(foostring) -{ -} - -void FooRunnable::run() -{ - while ( m_foostring != "thread 4" ) {} - do_crash(); -} - -void do_threads() -{ - QStringList foolist; - foolist << "thread 1" << "thread 2" << "thread 3" << "thread 4" << "thread 5"; - QThreadPool::globalInstance()->setMaxThreadCount(5); - foreach (const QString &foostring, foolist) { - QThreadPool::globalInstance()->start(new FooRunnable(foostring)); - } -} - -void level4(int t) -{ - if (t == Malloc) - do_malloc(); - else if (t == Div0) - do_div0(); - else if (t == Assert) - do_assert(); - else if (t == QAssert) - do_qassert(); - else if (t == Threads) - do_threads(); - else - do_crash(); -} - -void level3(int t) -{ - level4(t); -} - -void level2(int t) -{ - level3(t); -} - -void level1(int t) -{ - level2(t); -} - -int main(int argc, char *argv[]) -{ - KAboutData aboutData("crashtest", 0, ki18n("Crash Test for DrKonqi"), - "1.1", - ki18n("Crash Test for DrKonqi"), - KAboutData::License_GPL, - ki18n("(c) 2000-2002 David Faure, Waldo Bastian")); - - KCmdLineArgs::init(argc, argv, &aboutData); - - KCmdLineOptions options; - options.add("autorestart", ki18n("Automatically restart")); - options.add("+crash|malloc|div0|assert|threads", ki18n("Type of crash.")); - KCmdLineArgs::addCmdLineOptions(options); - - KApplication app; - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - - KCrash::CrashFlags flags; - if (args->isSet("autorestart")) - flags |= KCrash::AutoRestart; - KCrash::setFlags(flags); - kDebug() << flags; - - QByteArray type = args->count() ? args->arg(0).toUtf8() : ""; - int crashtype = Crash; - if (type == "malloc") - crashtype = Malloc; - else if (type == "div0") - crashtype = Div0; - else if (type == "assert") - crashtype = Assert; - else if (type == "qassert") - crashtype = QAssert; - else if (type == "threads") - crashtype = Threads; - level1(crashtype); - return app.exec(); -} diff --git a/drkonqi/tests/backtraceparsertest/fakebacktracegenerator.cpp b/drkonqi/tests/fakebacktracegenerator.cpp similarity index 100% rename from drkonqi/tests/backtraceparsertest/fakebacktracegenerator.cpp rename to drkonqi/tests/fakebacktracegenerator.cpp diff --git a/drkonqi/tests/backtraceparsertest/fakebacktracegenerator.h b/drkonqi/tests/fakebacktracegenerator.h similarity index 100% rename from drkonqi/tests/backtraceparsertest/fakebacktracegenerator.h rename to drkonqi/tests/fakebacktracegenerator.h diff --git a/kcontrol/icons/CMakeLists.txt b/kcontrol/icons/CMakeLists.txt index beea4ede..005ab794 100644 --- a/kcontrol/icons/CMakeLists.txt +++ b/kcontrol/icons/CMakeLists.txt @@ -1,7 +1,3 @@ -if(ENABLE_TESTING) - add_subdirectory(tests) -endif() - ########### next target ############### set(kcm_icons_PART_SRCS diff --git a/kcontrol/icons/tests/CMakeLists.txt b/kcontrol/icons/tests/CMakeLists.txt deleted file mode 100644 index e759d446..00000000 --- a/kcontrol/icons/tests/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) - -########### next target ############### - -set(testicons_SRCS - testicons.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/../icons.cpp -) - -kde4_add_manual_test(testicons ${testicons_SRCS}) - -target_link_libraries(testicons KDE4::kdeui) diff --git a/kcontrol/icons/tests/testicons.cpp b/kcontrol/icons/tests/testicons.cpp deleted file mode 100644 index d80f5159..00000000 --- a/kcontrol/icons/tests/testicons.cpp +++ /dev/null @@ -1,15 +0,0 @@ -/* Test program for icons setup module. */ - -#include -#include -#include "icons.h" - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - app.setApplicationName("testicons"); - KComponentData componentData("testicons"); - KIconConfig *w = new KIconConfig(componentData, 0L); - w->show(); - return app.exec(); -} diff --git a/konsole/src/tests/CMakeLists.txt b/konsole/src/tests/CMakeLists.txt index 71ae5d4a..72774e9c 100644 --- a/konsole/src/tests/CMakeLists.txt +++ b/konsole/src/tests/CMakeLists.txt @@ -11,11 +11,6 @@ set(KONSOLE_TEST_LIBS konsoleprivate ) -kde4_add_manual_test(PartManualTest PartManualTest.cpp) -target_link_libraries(PartManualTest - ${KONSOLE_TEST_LIBS} -) - kde4_add_test(konsole-CharacterColorTest CharacterColorTest.cpp) target_link_libraries(konsole-CharacterColorTest ${KONSOLE_TEST_LIBS}) diff --git a/konsole/src/tests/PartManualTest.cpp b/konsole/src/tests/PartManualTest.cpp deleted file mode 100644 index a41d6072..00000000 --- a/konsole/src/tests/PartManualTest.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* - Copyright 2008 by Robert Knight - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA. -*/ - -// Own -#include "PartManualTest.h" - -// Qt -#include -#include -#include -#include -#include -#include - -// System -#include -#include - -// KDE -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Konsole -#include "../Pty.h" -#include "../Session.h" -#include "../KeyboardTranslator.h" - -using namespace Konsole; - -void PartManualTest::testShortcutOverride() -{ - // FIXME: This test asks the user to press shortcut key sequences manually because - // the result is different than when sending the key press via QTest::keyClick() - // - // When the key presses are sent manually, Konsole::TerminalDisplay::event() is called - // and the overrideShortcut() signal is emitted by the part. - // When the key presses are sent automatically, the shortcut is triggered but - // Konsole::TerminalDisplay::event() is not called and the overrideShortcut() signal is - // not emitted by the part. - - // Create a main window with a menu and a test - // action with a shortcut set to Ctrl+S, which is also used by the terminal - KMainWindow* mainWindow = new KMainWindow(); - QMenu* fileMenu = mainWindow->menuBar()->addMenu("File"); - QAction* testAction = fileMenu->addAction("Test"); - testAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S)); - connect(testAction, SIGNAL(triggered()), this, SLOT(shortcutTriggered())); - - // Create terminal part and embed in into the main window - KParts::Part* terminalPart = createPart(); - QVERIFY(terminalPart); - mainWindow->setCentralWidget(terminalPart->widget()); - TerminalInterface* terminal = qobject_cast(terminalPart); - QVERIFY(terminal); - terminal->sendInput("Press Ctrl+S twice.\n"); - mainWindow->show(); - - // Test shortcut with override disabled, so the shortcut will be triggered - _shortcutTriggered = false; - _override = false; - _overrideCalled = false; - QVERIFY(connect(terminalPart, SIGNAL(overrideShortcut(QKeyEvent*,bool&)), - this, SLOT(overrideShortcut(QKeyEvent*,bool&)))); - - //QTest::keyClick(terminalPart->widget(),Qt::Key_S,Qt::ControlModifier); - _shortcutEventLoop = new QEventLoop(); - _shortcutEventLoop->exec(); - - QVERIFY(_overrideCalled); - QVERIFY(_shortcutTriggered); - QVERIFY(!_override); - - // Test shortcut with override enabled, so the shortcut will not be triggered - _override = true; - _overrideCalled = false; - _shortcutTriggered = false; - - //QTest::keyClick(terminalPart->widget(),Qt::Key_S,Qt::ControlModifier); - _shortcutEventLoop->exec(); - - QVERIFY(_overrideCalled); - QVERIFY(!_shortcutTriggered); - QVERIFY(_override); - - delete _shortcutEventLoop; - delete terminalPart; - delete mainWindow; -} -void PartManualTest::overrideShortcut(QKeyEvent* event, bool& override) -{ - QVERIFY(override == true); - if (event->modifiers() == Qt::ControlModifier && event->key() == Qt::Key_S) { - _overrideCalled = true; - override = _override; - _shortcutEventLoop->exit(); - } -} -void PartManualTest::shortcutTriggered() -{ - _shortcutTriggered = true; -} - -KParts::Part* PartManualTest::createPart() -{ - KPluginFactory* factory = KPluginLoader("konsolepart").factory(); - Q_ASSERT(factory); - - KParts::Part* terminalPart = factory->create(this); - - return terminalPart; -} - -QTEST_KDEMAIN(PartManualTest , GUI) - -#include "moc_PartManualTest.cpp" - diff --git a/konsole/src/tests/PartManualTest.h b/konsole/src/tests/PartManualTest.h deleted file mode 100644 index d501b062..00000000 --- a/konsole/src/tests/PartManualTest.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - Copyright 2008 by Robert Knight - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA. -*/ - -#ifndef PARTMANUALTEST_H -#define PARTMANUALTEST_H - -#include - -#include -#include - -#include -#include - -namespace Konsole -{ - -class PartManualTest : public QObject -{ - Q_OBJECT - -private slots: - void testShortcutOverride(); - -// marked as protected so they are not treated as test cases -protected slots: - void overrideShortcut(QKeyEvent* event, bool& override); - void shortcutTriggered(); - -private: - KParts::Part* createPart(); - - // variables for testShortcutOverride() - bool _shortcutTriggered; - bool _overrideCalled; - bool _override; - QEventLoop* _shortcutEventLoop; -}; - -} - -#endif // PARTMANUALTEST_H - diff --git a/ksmserver/CMakeLists.txt b/ksmserver/CMakeLists.txt index dea5ed28..aff4bab9 100644 --- a/ksmserver/CMakeLists.txt +++ b/ksmserver/CMakeLists.txt @@ -9,11 +9,7 @@ include_directories( ${CMAKE_BINARY_DIR}/libs/kworkspace ) -add_subdirectory( kcm ) - -if(ENABLE_TESTING) - add_subdirectory(tests) -endif() +add_subdirectory(kcm) check_library_exists(ICE _IceTransNoListen "" HAVE__ICETRANSNOLISTEN) configure_file(config-ksmserver.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-ksmserver.h) diff --git a/ksmserver/tests/CMakeLists.txt b/ksmserver/tests/CMakeLists.txt deleted file mode 100644 index bcd3b467..00000000 --- a/ksmserver/tests/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/..) - -set(testsh_SRCS - test.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/../shutdowndlg.cpp -) - -kde4_add_manual_test(testsh ${testsh_SRCS}) - -target_link_libraries(testsh - kworkspace - KDE4::kdeui - KDE4::solid - KDE4::kdeclarative - KDE4::plasma - ${X11_X11_LIB} - ${QT_QTDECLARATIVE_LIBRARY} -) diff --git a/ksmserver/tests/test.cpp b/ksmserver/tests/test.cpp deleted file mode 100644 index 1aefed2b..00000000 --- a/ksmserver/tests/test.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include "shutdowndlg.h" -#include -#include -#include -#include -#include -#include - -int main(int argc, char *argv[]) -{ - KAboutData about("kapptest", 0, ki18n("kapptest"), "version"); - KCmdLineArgs::init(argc, argv, &about); - - KCmdLineOptions options; - options.add("t"); - options.add("type ", ki18n("The type of shutdown to emulate: Default, None, Reboot, Halt or Logout"), "None"); - options.add("theme ", ki18n("Theme name. List with 'plasmoidviewer --list-themes'")); - KCmdLineArgs::addCmdLineOptions(options); - - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - - KApplication a; - KIconLoader::global()->addAppDir("ksmserver"); - qAddPostRoutine(KSMShutdownFeedback::stop); - - QString sdtypeOption = args->getOption("type").toLower(); - - if (args->isSet("theme")) { - Plasma::Theme::defaultTheme()->setUseGlobalSettings(false); //don't change every plasma theme! - Plasma::Theme::defaultTheme()->setThemeName(args->getOption("theme")); - } - - KWorkSpace::ShutdownType sdtype = KWorkSpace::ShutdownTypeDefault; - if (sdtypeOption == "reboot") { - sdtype = KWorkSpace::ShutdownTypeReboot; - } else if (sdtypeOption == "halt") { - sdtype = KWorkSpace::ShutdownTypeHalt; - } else if (sdtypeOption == "logout") { - sdtype = KWorkSpace::ShutdownTypeNone; - } - - (void)KSMShutdownDlg::confirmShutdown( true, true, sdtype, "default" ); -/* (void)KSMShutdownDlg::confirmShutdown( false, false, sdtype ); */ - - return a.exec(); -} diff --git a/kuiserver/CMakeLists.txt b/kuiserver/CMakeLists.txt index ef2f2050..7d86d33b 100644 --- a/kuiserver/CMakeLists.txt +++ b/kuiserver/CMakeLists.txt @@ -1,7 +1,3 @@ -if(ENABLE_TESTING) - add_subdirectory(tests) -endif() - set(kuiserver_SRCS main.cpp jobview.cpp diff --git a/kuiserver/tests/CMakeLists.txt b/kuiserver/tests/CMakeLists.txt deleted file mode 100644 index 68ed716b..00000000 --- a/kuiserver/tests/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -########### next target ############### - -set(kuiservertest_SRCS kuiservertest.cpp) - -kde4_add_manual_test(kuiservertest ${kuiservertest_SRCS}) - -target_link_libraries(kuiservertest KDE4::kio) - diff --git a/kuiserver/tests/kuiservertest.cpp b/kuiserver/tests/kuiservertest.cpp deleted file mode 100644 index b559ec59..00000000 --- a/kuiserver/tests/kuiservertest.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/** - * This file is part of the KDE libraries - * Copyright (C) 2007 Rafael Fernández López - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License version 2 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "kuiservertest.h" -#include -#include -#include -#include -#include -#include -#include - -KJobTest::KJobTest(int numberOfSeconds) - : KIO::Job(), timer(new QTimer(this)), clockTimer(new QTimer(this)), - seconds(numberOfSeconds), total(numberOfSeconds) -{ - setCapabilities(KJob::NoCapabilities); -} - -KJobTest::~KJobTest() -{ -} - -void KJobTest::start() -{ - connect(timer, SIGNAL(timeout()), this, - SLOT(timerTimeout())); - - connect(clockTimer, SIGNAL(timeout()), this, - SLOT(updateMessage())); - - timer->setSingleShot(true); - timer->start(seconds * 1000); - - updateMessage(); - - clockTimer->start(1000); -} - -void KJobTest::timerTimeout() -{ - clockTimer->stop(); - - emitResult(); - - QTimer::singleShot(0, QCoreApplication::instance(), SLOT(quit())); -} - -void KJobTest::updateMessage() -{ - emit infoMessage(this, i18n("Testing kuiserver (%1 seconds remaining)", seconds), i18n("Testing kuiserver (%1 seconds remaining)", seconds)); - emitPercent(total - seconds, total); - - seconds--; -} - -bool KJobTest::doSuspend() -{ - clockTimer->stop(); - - Job::doSuspend(); - - return true; -} - -#include "moc_kuiservertest.cpp" - -int main(int argc, char **argv) -{ - KCmdLineArgs::init(argc, argv, "kjobtest", 0, ki18n("KJobTest"), "0.01", ki18n("A KJob tester")); - - KApplication app; - - KJobTest *myJob = new KJobTest(10 /* 10 seconds before it gets removed */); - myJob->setUiDelegate(new KIO::JobUiDelegate()); - KIO::getJobTracker()->registerJob(myJob); - myJob->start(); - - return app.exec(); -} diff --git a/kuiserver/tests/kuiservertest.h b/kuiserver/tests/kuiservertest.h deleted file mode 100644 index da8975c7..00000000 --- a/kuiserver/tests/kuiservertest.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * This file is part of the KDE libraries - * Copyright (C) 2007 Rafael Fernández López - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License version 2 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef __KJOBTEST_H__ -#define __KJOBTEST_H__ - -#include -#include -#include - -#include - -class KJobTest - : public KIO::Job -{ - Q_OBJECT - -public: - KJobTest(int numberOfSeconds = 5); - ~KJobTest(); - - void start(); - -private Q_SLOTS: - void timerTimeout(); - void updateMessage(); - -protected: - bool doSuspend(); - -private: - QTimer *timer, *clockTimer; - int seconds, total; -}; - -#endif // __KJOBTEST_H__