From 100f409967cd5c17567e401826a0773c7e848ff3 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 24 Apr 2017 21:56:13 +0200 Subject: Dropped the now unused action framework --- framework/src/actions/tests/actiontest.cpp | 102 ----------------------------- 1 file changed, 102 deletions(-) delete mode 100644 framework/src/actions/tests/actiontest.cpp (limited to 'framework/src/actions/tests/actiontest.cpp') diff --git a/framework/src/actions/tests/actiontest.cpp b/framework/src/actions/tests/actiontest.cpp deleted file mode 100644 index a4ec4432..00000000 --- a/framework/src/actions/tests/actiontest.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include -#include -#include - -#include -#include -#include - -#include - -SINK_DEBUG_AREA("actiontest") - -class HandlerContext : public Kube::Context { - Q_OBJECT - KUBE_CONTEXT_PROPERTY(QString, Property1, property1) - KUBE_CONTEXT_PROPERTY(QString, Property2, property2) -}; - -class HandlerContextWrapper : public Kube::ContextWrapper { - using Kube::ContextWrapper::ContextWrapper; - KUBE_CONTEXTWRAPPER_PROPERTY(QString, Property1, property1) - KUBE_CONTEXTWRAPPER_PROPERTY(QString, Property2, property2) -}; - - - -class Handler : public Kube::ActionHandlerBase -{ -public: - Handler() : Kube::ActionHandlerBase{"org.kde.kube.test.action1"} - {} - - //TODO default implementation checks that all defined properties are available in the context - // bool isReady() override { - // auto accountId = context->property("accountId").value(); - // return !accountId.isEmpty(); - // } - - KAsync::Job execute(HandlerContextWrapper &context) - { - SinkLog() << "Executing action1"; - SinkLog() << context; - executions.append(context.context); - return KAsync::null(); - } - mutable QList executions; -}; - -class Context1 : public Kube::ContextWrapper { - using Kube::ContextWrapper::ContextWrapper; - KUBE_CONTEXTWRAPPER_PROPERTY(QString, Property1, property1) - KUBE_CONTEXTWRAPPER_PROPERTY(QByteArray, Property2, property2) -}; - -class Context2 : public Kube::ContextWrapper { - using Kube::ContextWrapper::ContextWrapper; - KUBE_CONTEXTWRAPPER_PROPERTY(QByteArray, Property2, property2) -}; - - -class ActionTest : public QObject -{ - Q_OBJECT -private slots: - - void initTestCase() - { - } - - void testActionExecution() - { - Handler actionHandler; - - HandlerContext context; - //Kube::Context context; - HandlerContextWrapper{context}.setProperty1(QString("property1")); - context.setProperty("property2", QVariant::fromValue(QString("property2"))); - auto future = Kube::Action("org.kde.kube.test.action1", context).executeWithResult(); - - QTRY_VERIFY(future.isDone()); - QVERIFY(!future.error()); - - QCOMPARE(actionHandler.executions.size(), 1); - QCOMPARE(actionHandler.executions.first().availableProperties().size(), 2); - } - - void testContextCasting() - { - Kube::Context c; - - Context1 context1{c}; - context1.setProperty1("property1"); - context1.setProperty2("property2"); - - auto context2 = Context2{c}; - QCOMPARE(context2.getProperty2(), QByteArray("property2")); - } - -}; - -QTEST_GUILESS_MAIN(ActionTest) -#include "actiontest.moc" -- cgit v1.2.3