From a40e9d0deef5590b327d3112ca9088e0ea5f16a8 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 25 Apr 2014 13:21:09 +0200 Subject: [PATCH] reenable two manual tests --- tests/CMakeLists.txt | 2 + .../CMakeLists.txt | 2 +- tests/testcontainmentactionsplugin/test.cpp | 51 ++++++------------- tests/testcontainmentactionsplugin/test.h | 9 ++-- tests/testengine/CMakeLists.txt | 3 ++ tests/testengine/testengine.cpp | 2 + tests/testengine/testengine.h | 1 - 7 files changed, 28 insertions(+), 42 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index df1dfb718..2eaec7f5d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,2 +1,4 @@ add_subdirectory(kplugins) add_subdirectory(dpi) +add_subdirectory(testengine) +add_subdirectory(testcontainmentactionsplugin) \ No newline at end of file diff --git a/tests/testcontainmentactionsplugin/CMakeLists.txt b/tests/testcontainmentactionsplugin/CMakeLists.txt index aba257565..1ec14dbaf 100644 --- a/tests/testcontainmentactionsplugin/CMakeLists.txt +++ b/tests/testcontainmentactionsplugin/CMakeLists.txt @@ -6,7 +6,7 @@ set(test_SRCS qt5_wrap_ui(test_SRCS config.ui) add_library(plasma_containmentactions_test MODULE ${test_SRCS}) -target_link_libraries(plasma_containmentactions_test KF5::Plasma KF5::KIOWidgets) +target_link_libraries(plasma_containmentactions_test KF5::Plasma KF5::KIOWidgets KF5::XmlGui) install(TARGETS plasma_containmentactions_test DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES plasma-containmentactions-test.desktop DESTINATION ${SERVICES_INSTALL_DIR}) diff --git a/tests/testcontainmentactionsplugin/test.cpp b/tests/testcontainmentactionsplugin/test.cpp index c8a5a4a8a..f6302a7ef 100644 --- a/tests/testcontainmentactionsplugin/test.cpp +++ b/tests/testcontainmentactionsplugin/test.cpp @@ -23,61 +23,38 @@ #include #include -#include +#include #include ContextTest::ContextTest(QObject *parent, const QVariantList &args) : Plasma::ContainmentActions(parent, args) { - setConfigurationRequired(true); } -void ContextTest::contextEvent(QEvent *event) +QList ContextTest::contextualActions() { - switch (event->type()) { - case QEvent::GraphicsSceneMousePress: - contextEvent(static_cast(event)); - break; - case QEvent::GraphicsSceneWheel: - wheelEvent(static_cast(event)); - break; - default: - break; - } -} - -void ContextTest::contextEvent(QGraphicsSceneMouseEvent *event) -{ - // qDebug() << "test!!!!!!!!!!!!!!!!!!!!!!!" << event->pos(); - // qDebug() << event->buttons() << event->modifiers(); - Plasma::Containment *c = containment(); - if (c) { - // qDebug() << c->name(); - } else { - // qDebug() << "fail"; - return; - } - - QMenu desktopMenu; - desktopMenu.addTitle(m_text); - desktopMenu.addAction(c->action("configure")); - desktopMenu.exec(event->screenPos()); + Q_ASSERT(c); + QList actions; + actions << c->actions()->action("configure"); + return actions; } -void ContextTest::wheelEvent(QGraphicsSceneWheelEvent *event) +void ContextTest::performNextAction() { - // qDebug() << "test!!!!!!!!!!!!!11111111!!"; - // qDebug() << event->orientation() << event->delta(); - // qDebug() << event->buttons() << event->modifiers(); + qWarning() << "Next action requested"; +} + +void ContextTest::performPreviousAction() +{ + qWarning() << "Previous action requested"; } void ContextTest::init(const KConfigGroup &config) { m_text = config.readEntry("test-text", QString()); - setConfigurationRequired(m_text.isEmpty()); } QWidget* ContextTest::createConfigurationInterface(QWidget* parent) @@ -103,4 +80,6 @@ void ContextTest::save(KConfigGroup &config) config.writeEntry("test-text", m_text); } +K_EXPORT_PLASMA_CONTAINMENTACTIONS_WITH_JSON(containmentactions_test, ContextTest, "plasma-containmentactions-test.desktop") +#include "test.moc" diff --git a/tests/testcontainmentactionsplugin/test.h b/tests/testcontainmentactionsplugin/test.h index 5cc5a6c07..c2e8761da 100644 --- a/tests/testcontainmentactionsplugin/test.h +++ b/tests/testcontainmentactionsplugin/test.h @@ -31,10 +31,12 @@ class ContextTest : public Plasma::ContainmentActions ContextTest(QObject* parent, const QVariantList& args); void init(const KConfigGroup &config); - void contextEvent(QEvent *event); - void contextEvent(QGraphicsSceneMouseEvent *event); - void wheelEvent(QGraphicsSceneWheelEvent *event); + QList contextualActions(); + + void performNextAction(); + void performPreviousAction(); + QWidget* createConfigurationInterface(QWidget* parent); void configurationAccepted(); void save(KConfigGroup &config); @@ -44,6 +46,5 @@ class ContextTest : public Plasma::ContainmentActions QString m_text; }; -K_EXPORT_PLASMA_CONTAINMENTACTIONS(test, ContextTest) #endif diff --git a/tests/testengine/CMakeLists.txt b/tests/testengine/CMakeLists.txt index dd906e867..2413157c5 100644 --- a/tests/testengine/CMakeLists.txt +++ b/tests/testengine/CMakeLists.txt @@ -2,6 +2,9 @@ project(plasma_testengine_dataengine) add_library(plasma_engine_testengine MODULE testengine.cpp) +kservice_desktop_to_json(plasma_engine_testengine plasma-dataengine-testengine.desktop) + + target_link_libraries(plasma_engine_testengine KF5::KIOWidgets KF5::Plasma) diff --git a/tests/testengine/testengine.cpp b/tests/testengine/testengine.cpp index b8e3a26f6..0a55c8bce 100644 --- a/tests/testengine/testengine.cpp +++ b/tests/testengine/testengine.cpp @@ -174,4 +174,6 @@ bool TestEngine::sourceRequestEvent(const QString &source) return true; } // sourceRequestEvent() +K_EXPORT_PLASMA_DATAENGINE_WITH_JSON(org.kde.examples.plasma_engine_testengine, TestEngine, "plasma-dataengine-testengine.desktop") +#include "testengine.moc" diff --git a/tests/testengine/testengine.h b/tests/testengine/testengine.h index e937ada4e..51f765989 100644 --- a/tests/testengine/testengine.h +++ b/tests/testengine/testengine.h @@ -47,7 +47,6 @@ protected: }; -K_EXPORT_PLASMA_DATAENGINE(testengine, TestEngine) #endif // __TESTDATAENGINE_H__