reenable two manual tests

This commit is contained in:
Marco Martin 2014-04-25 13:21:09 +02:00
parent 737b9b5eb3
commit a40e9d0dee
7 changed files with 28 additions and 42 deletions

View File

@ -1,2 +1,4 @@
add_subdirectory(kplugins) add_subdirectory(kplugins)
add_subdirectory(dpi) add_subdirectory(dpi)
add_subdirectory(testengine)
add_subdirectory(testcontainmentactionsplugin)

View File

@ -6,7 +6,7 @@ set(test_SRCS
qt5_wrap_ui(test_SRCS config.ui) qt5_wrap_ui(test_SRCS config.ui)
add_library(plasma_containmentactions_test MODULE ${test_SRCS}) 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(TARGETS plasma_containmentactions_test DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES plasma-containmentactions-test.desktop DESTINATION ${SERVICES_INSTALL_DIR}) install(FILES plasma-containmentactions-test.desktop DESTINATION ${SERVICES_INSTALL_DIR})

View File

@ -23,61 +23,38 @@
#include <QGraphicsSceneWheelEvent> #include <QGraphicsSceneWheelEvent>
#include <QDebug> #include <QDebug>
#include <QMenu> #include <KActionCollection>
#include <Plasma/Containment> #include <Plasma/Containment>
ContextTest::ContextTest(QObject *parent, const QVariantList &args) ContextTest::ContextTest(QObject *parent, const QVariantList &args)
: Plasma::ContainmentActions(parent, args) : Plasma::ContainmentActions(parent, args)
{ {
setConfigurationRequired(true);
} }
void ContextTest::contextEvent(QEvent *event) QList<QAction*> ContextTest::contextualActions()
{ {
switch (event->type()) {
case QEvent::GraphicsSceneMousePress:
contextEvent(static_cast<QGraphicsSceneMouseEvent*>(event));
break;
case QEvent::GraphicsSceneWheel:
wheelEvent(static_cast<QGraphicsSceneWheelEvent*>(event));
break;
default:
break;
}
}
void ContextTest::contextEvent(QGraphicsSceneMouseEvent *event)
{
// qDebug() << "test!!!!!!!!!!!!!!!!!!!!!!!" << event->pos();
// qDebug() << event->buttons() << event->modifiers();
Plasma::Containment *c = containment(); Plasma::Containment *c = containment();
if (c) { Q_ASSERT(c);
// qDebug() << c->name(); QList<QAction*> actions;
} else { actions << c->actions()->action("configure");
// qDebug() << "fail";
return;
}
QMenu desktopMenu;
desktopMenu.addTitle(m_text);
desktopMenu.addAction(c->action("configure"));
desktopMenu.exec(event->screenPos());
return actions;
} }
void ContextTest::wheelEvent(QGraphicsSceneWheelEvent *event) void ContextTest::performNextAction()
{ {
// qDebug() << "test!!!!!!!!!!!!!11111111!!"; qWarning() << "Next action requested";
// qDebug() << event->orientation() << event->delta(); }
// qDebug() << event->buttons() << event->modifiers();
void ContextTest::performPreviousAction()
{
qWarning() << "Previous action requested";
} }
void ContextTest::init(const KConfigGroup &config) void ContextTest::init(const KConfigGroup &config)
{ {
m_text = config.readEntry("test-text", QString()); m_text = config.readEntry("test-text", QString());
setConfigurationRequired(m_text.isEmpty());
} }
QWidget* ContextTest::createConfigurationInterface(QWidget* parent) QWidget* ContextTest::createConfigurationInterface(QWidget* parent)
@ -103,4 +80,6 @@ void ContextTest::save(KConfigGroup &config)
config.writeEntry("test-text", m_text); config.writeEntry("test-text", m_text);
} }
K_EXPORT_PLASMA_CONTAINMENTACTIONS_WITH_JSON(containmentactions_test, ContextTest, "plasma-containmentactions-test.desktop")
#include "test.moc"

View File

@ -31,10 +31,12 @@ class ContextTest : public Plasma::ContainmentActions
ContextTest(QObject* parent, const QVariantList& args); ContextTest(QObject* parent, const QVariantList& args);
void init(const KConfigGroup &config); void init(const KConfigGroup &config);
void contextEvent(QEvent *event);
void contextEvent(QGraphicsSceneMouseEvent *event);
void wheelEvent(QGraphicsSceneWheelEvent *event);
QList<QAction*> contextualActions();
void performNextAction();
void performPreviousAction();
QWidget* createConfigurationInterface(QWidget* parent); QWidget* createConfigurationInterface(QWidget* parent);
void configurationAccepted(); void configurationAccepted();
void save(KConfigGroup &config); void save(KConfigGroup &config);
@ -44,6 +46,5 @@ class ContextTest : public Plasma::ContainmentActions
QString m_text; QString m_text;
}; };
K_EXPORT_PLASMA_CONTAINMENTACTIONS(test, ContextTest)
#endif #endif

View File

@ -2,6 +2,9 @@ project(plasma_testengine_dataengine)
add_library(plasma_engine_testengine MODULE testengine.cpp) 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 target_link_libraries(plasma_engine_testengine
KF5::KIOWidgets KF5::Plasma) KF5::KIOWidgets KF5::Plasma)

View File

@ -174,4 +174,6 @@ bool TestEngine::sourceRequestEvent(const QString &source)
return true; return true;
} // sourceRequestEvent() } // sourceRequestEvent()
K_EXPORT_PLASMA_DATAENGINE_WITH_JSON(org.kde.examples.plasma_engine_testengine, TestEngine, "plasma-dataengine-testengine.desktop")
#include "testengine.moc"

View File

@ -47,7 +47,6 @@ protected:
}; };
K_EXPORT_PLASMA_DATAENGINE(testengine, TestEngine)
#endif // __TESTDATAENGINE_H__ #endif // __TESTDATAENGINE_H__