[Ktutorial-commits] SF.net SVN: ktutorial:[317] trunk/ktutorial/ktutorial-editor
Status: Alpha
Brought to you by:
danxuliu
|
From: <dan...@us...> - 2011-06-08 13:23:46
|
Revision: 317
http://ktutorial.svn.sourceforge.net/ktutorial/?rev=317&view=rev
Author: danxuliu
Date: 2011-06-08 12:48:46 +0000 (Wed, 08 Jun 2011)
Log Message:
-----------
Add support for testing a tutorial from the currently selected step instead of just from the start.
Modified Paths:
--------------
trunk/ktutorial/ktutorial-editor/src/CMakeLists.txt
trunk/ktutorial/ktutorial-editor/src/EditActions.cpp
trunk/ktutorial/ktutorial-editor/src/EditActions.h
trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp
trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h
trunk/ktutorial/ktutorial-editor/src/TutorialTester.cpp
trunk/ktutorial/ktutorial-editor/src/TutorialTester.h
trunk/ktutorial/ktutorial-editor/src/ktutorial-editorui.rc
trunk/ktutorial/ktutorial-editor/src/targetapplication/RemoteEditorSupport.cpp
trunk/ktutorial/ktutorial-editor/src/targetapplication/RemoteEditorSupport.h
trunk/ktutorial/ktutorial-editor/tests/unit/targetapplication/RemoteClassStubs.h
trunk/ktutorial/ktutorial-editor/tests/unit/targetapplication/RemoteEditorSupportTest.cpp
Added Paths:
-----------
trunk/ktutorial/ktutorial-editor/src/TestTutorialActions.cpp
trunk/ktutorial/ktutorial-editor/src/TestTutorialActions.h
Modified: trunk/ktutorial/ktutorial-editor/src/CMakeLists.txt
===================================================================
--- trunk/ktutorial/ktutorial-editor/src/CMakeLists.txt 2011-06-08 12:46:04 UTC (rev 316)
+++ trunk/ktutorial/ktutorial-editor/src/CMakeLists.txt 2011-06-08 12:48:46 UTC (rev 317)
@@ -41,6 +41,7 @@
if (QT_QTDBUS_FOUND)
set(ktutorial_editor_SRCS
${ktutorial_editor_SRCS}
+ TestTutorialActions.cpp
TutorialTester.cpp
)
endif (QT_QTDBUS_FOUND)
Modified: trunk/ktutorial/ktutorial-editor/src/EditActions.cpp
===================================================================
--- trunk/ktutorial/ktutorial-editor/src/EditActions.cpp 2011-06-08 12:46:04 UTC (rev 316)
+++ trunk/ktutorial/ktutorial-editor/src/EditActions.cpp 2011-06-08 12:48:46 UTC (rev 317)
@@ -37,10 +37,6 @@
#include "view/TutorialCustomCodeWidget.h"
#include "view/TutorialInformationWidget.h"
-#ifdef QT_QTDBUS_FOUND
-#include "TutorialTester.h"
-#endif
-
//public:
EditActions::EditActions(KTutorialEditor* tutorialEditor):
@@ -211,18 +207,6 @@
action->setEnabled(false);
actionCollection->addAction("removeReaction", action);
connect(action, SIGNAL(triggered(bool)), this, SLOT(removeReaction()));
-
-#ifdef QT_QTDBUS_FOUND
- action = new KAction(this);
- action->setText(i18nc("@action", "Test tutorial"));
- action->setStatusTip(i18nc("@info:status", "Starts the tutorial in the "
-"target application."));
- action->setIcon(KIcon("document-preview"));
- action->setEnabled(true);
- actionCollection->addAction("testTutorial", action);
- connect(action, SIGNAL(triggered(bool)),
- new TutorialTester(mTutorialEditor), SLOT(testTutorial()));
-#endif
}
int EditActions::showEditionDialog(CommandWidget* commandWidget) {
Modified: trunk/ktutorial/ktutorial-editor/src/EditActions.h
===================================================================
--- trunk/ktutorial/ktutorial-editor/src/EditActions.h 2011-06-08 12:46:04 UTC (rev 316)
+++ trunk/ktutorial/ktutorial-editor/src/EditActions.h 2011-06-08 12:48:46 UTC (rev 317)
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2010 by Daniel Calviño Sánchez *
+ * Copyright (C) 2010-2011 by Daniel Calviño Sánchez *
* dan...@gm... *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -30,8 +30,7 @@
/**
* Edition related actions.
* EditActions provide the actions to edit a tutorial (set the setup code, add a
- * step...), actions to undo and redo the edition, and also an action to test
- * the current tutorial in the target application.
+ * step...), and actions to undo and redo the edition.
*
* KTutorialEditor notifies EditActions when a step or reaction is selected, so
* it can know which step or reaction have to be edited. EditActions provides
Modified: trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp
===================================================================
--- trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp 2011-06-08 12:46:04 UTC (rev 316)
+++ trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp 2011-06-08 12:48:46 UTC (rev 317)
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2010 by Daniel Calviño Sánchez *
+ * Copyright (C) 2010-2011 by Daniel Calviño Sánchez *
* dan...@gm... *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -38,6 +38,7 @@
#include "view/TutorialTreeSelectionManager.h"
#ifdef QT_QTDBUS_FOUND
+#include "TestTutorialActions.h"
#include "targetapplication/TargetApplication.h"
#endif
@@ -145,6 +146,10 @@
mEditActions, SLOT(selectStep(Step*)));
connect(selectionManager, SIGNAL(reactionSelected(Reaction*)),
mEditActions, SLOT(selectReaction(Reaction*)));
+#ifdef QT_QTDBUS_FOUND
+ connect(selectionManager, SIGNAL(stepSelected(Step*)),
+ mTestTutorialActions, SLOT(selectStep(Step*)));
+#endif
mEditActions->clearCommands();
@@ -179,6 +184,10 @@
mEditActions = new EditActions(this);
+#ifdef QT_QTDBUS_FOUND
+ mTestTutorialActions = new TestTutorialActions(this);
+#endif
+
actionCollection()->addAction("showEditTutorialDock",
mTutorialActionDock->toggleViewAction());
actionCollection()->addAction("showEditStepDock",
Modified: trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h
===================================================================
--- trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h 2011-06-08 12:46:04 UTC (rev 316)
+++ trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h 2011-06-08 12:48:46 UTC (rev 317)
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2010 by Daniel Calviño Sánchez *
+ * Copyright (C) 2010-2011 by Daniel Calviño Sánchez *
* dan...@gm... *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -27,6 +27,10 @@
class QTreeView;
class Tutorial;
+#ifdef QT_QTDBUS_FOUND
+class TestTutorialActions;
+#endif
+
/**
* KTutorial editor main window.
* It wires up all the components in the application.
@@ -152,7 +156,14 @@
*/
EditActions* mEditActions;
+#ifdef QT_QTDBUS_FOUND
/**
+ * The test tutorial related actions and data.
+ */
+ TestTutorialActions* mTestTutorialActions;
+#endif
+
+ /**
* The tutorial being edited.
*/
Tutorial* mTutorial;
Added: trunk/ktutorial/ktutorial-editor/src/TestTutorialActions.cpp
===================================================================
--- trunk/ktutorial/ktutorial-editor/src/TestTutorialActions.cpp (rev 0)
+++ trunk/ktutorial/ktutorial-editor/src/TestTutorialActions.cpp 2011-06-08 12:48:46 UTC (rev 317)
@@ -0,0 +1,108 @@
+/***************************************************************************
+ * Copyright (C) 2011 by Daniel Calviño Sánchez *
+ * dan...@gm... *
+ * *
+ * 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 3 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 <http://www.gnu.org/licenses/>. *
+ ***************************************************************************/
+
+#include "TestTutorialActions.h"
+
+#include <KAction>
+#include <KActionCollection>
+#include <KLocalizedString>
+
+#include "KTutorialEditor.h"
+#include "TutorialTester.h"
+#include "data/Step.h"
+
+//public:
+
+TestTutorialActions::TestTutorialActions(KTutorialEditor* tutorialEditor):
+ QObject(tutorialEditor),
+ mTutorialEditor(tutorialEditor),
+ mCurrentStep(0) {
+
+ setupActions();
+}
+
+//public slots:
+
+void TestTutorialActions::selectStep(Step* step) {
+ if (mCurrentStep) {
+ disconnect(mCurrentStep, SIGNAL(dataChanged(Step*)),
+ this, SLOT(updateTestTutorialFromCurrentStepActionState()));
+ }
+
+ mCurrentStep = step;
+
+ if (mCurrentStep) {
+ connect(mCurrentStep, SIGNAL(dataChanged(Step*)),
+ this, SLOT(updateTestTutorialFromCurrentStepActionState()));
+ }
+
+ updateTestTutorialFromCurrentStepActionState();
+}
+
+//private:
+
+void TestTutorialActions::setupActions() {
+ KActionCollection* actionCollection = mTutorialEditor->actionCollection();
+
+ KAction* action = new KAction(this);
+ action = new KAction(this);
+ action->setText(i18nc("@action", "Test tutorial"));
+ action->setStatusTip(i18nc("@info:status", "Starts the tutorial in the "
+"target application."));
+ action->setIcon(KIcon("document-preview"));
+ action->setEnabled(true);
+ actionCollection->addAction("testTutorial", action);
+ connect(action, SIGNAL(triggered(bool)),
+ this, SLOT(testTutorial()));
+
+ action = new KAction(this);
+ action->setText(i18nc("@action", "Test tutorial from current step"));
+ action->setStatusTip(i18nc("@info:status", "Starts the tutorial in the "
+"target application from the current step."));
+ action->setIcon(KIcon("document-preview"));
+ action->setEnabled(false);
+ actionCollection->addAction("testTutorialFromCurrentStep", action);
+ connect(action, SIGNAL(triggered(bool)),
+ this, SLOT(testTutorialFromCurrentStep()));
+}
+
+//private slots:
+
+void TestTutorialActions::updateTestTutorialFromCurrentStepActionState() {
+ KActionCollection* actionCollection = mTutorialEditor->actionCollection();
+ QAction* action = actionCollection->action("testTutorialFromCurrentStep");
+
+ if (mCurrentStep && !mCurrentStep->id().isEmpty()) {
+ action->setEnabled(true);
+ } else {
+ action->setEnabled(false);
+ }
+}
+
+void TestTutorialActions::testTutorial() {
+ TutorialTester* tutorialTester = new TutorialTester(mTutorialEditor);
+ tutorialTester->testTutorial();
+}
+
+void TestTutorialActions::testTutorialFromCurrentStep() {
+ Q_ASSERT(mCurrentStep);
+
+ TutorialTester* tutorialTester = new TutorialTester(mTutorialEditor);
+ tutorialTester->setStepToTestFrom(mCurrentStep->id());
+ tutorialTester->testTutorial();
+}
Property changes on: trunk/ktutorial/ktutorial-editor/src/TestTutorialActions.cpp
___________________________________________________________________
Added: svn:eol-style
+ native
Added: trunk/ktutorial/ktutorial-editor/src/TestTutorialActions.h
===================================================================
--- trunk/ktutorial/ktutorial-editor/src/TestTutorialActions.h (rev 0)
+++ trunk/ktutorial/ktutorial-editor/src/TestTutorialActions.h 2011-06-08 12:48:46 UTC (rev 317)
@@ -0,0 +1,95 @@
+/***************************************************************************
+ * Copyright (C) 2011 by Daniel Calviño Sánchez *
+ * dan...@gm... *
+ * *
+ * 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 3 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 <http://www.gnu.org/licenses/>. *
+ ***************************************************************************/
+
+#ifndef TESTTUTORIALACTIONS_H
+#define TESTTUTORIALACTIONS_H
+
+#include <QObject>
+
+class KTutorialEditor;
+class Step;
+
+/**
+ * Test tutorial related actions.
+ * TestTutorialActions provide the actions to test the current tutorial in the
+ * target application (from the start or from the selected step).
+ *
+ * KTutorialEditor notifies TestTutorialActions when a step is selected, so it
+ * can know from which step test the tutorial.
+ */
+class TestTutorialActions: public QObject {
+Q_OBJECT
+public:
+
+ /**
+ * Creates a new TestTutorialActions for the given KTutorialEditor.
+ * All the actions are set up and added to the KTutorialEditor.
+ *
+ * @param tutorialEditor The KTutorialEditor to work with.
+ */
+ explicit TestTutorialActions(KTutorialEditor* tutorialEditor);
+
+public Q_SLOTS:
+
+ /**
+ * Sets the current step and enables or disables the actions that depend on
+ * a step as needed.
+ *
+ * @param step The step to select, or null to deselect the current one.
+ */
+ void selectStep(Step* step);
+
+private:
+
+ /**
+ * The KTutorialEditor to work with.
+ */
+ KTutorialEditor* mTutorialEditor;
+
+ /**
+ * The currently selected step.
+ */
+ Step* mCurrentStep;
+
+ /**
+ * Sets up all the edit related actions.
+ */
+ void setupActions();
+
+private Q_SLOTS:
+
+ /**
+ * Enables or disables the "test tutorial from current step" action based on
+ * the current step.
+ */
+ void updateTestTutorialFromCurrentStepActionState();
+
+ /**
+ * Tests the current tutorial in the target application.
+ */
+ void testTutorial();
+
+ /**
+ * Tests the current tutorial from the current step in the target
+ * application.
+ */
+ void testTutorialFromCurrentStep();
+
+};
+
+#endif
Property changes on: trunk/ktutorial/ktutorial-editor/src/TestTutorialActions.h
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/ktutorial/ktutorial-editor/src/TutorialTester.cpp
===================================================================
--- trunk/ktutorial/ktutorial-editor/src/TutorialTester.cpp 2011-06-08 12:46:04 UTC (rev 316)
+++ trunk/ktutorial/ktutorial-editor/src/TutorialTester.cpp 2011-06-08 12:48:46 UTC (rev 317)
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2010 by Daniel Calviño Sánchez *
+ * Copyright (C) 2010-2011 by Daniel Calviño Sánchez *
* dan...@gm... *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -33,21 +33,26 @@
TutorialTester::TutorialTester(KTutorialEditor* tutorialEditor):
QObject(tutorialEditor),
mTutorialEditor(tutorialEditor) {
+}
- mTargetApplicationView =
- new TargetApplicationView(TargetApplication::self(), mTutorialEditor);
+void TutorialTester::setStepToTestFrom(const QString& stepId) {
+ mStepId = stepId;
}
-//public slots:
-
void TutorialTester::testTutorial() {
if (TargetApplication::self()->remoteEditorSupport()) {
sendTutorialToTargetApplication();
} else {
connect(TargetApplication::self(), SIGNAL(started()),
this, SLOT(sendTutorialToTargetApplication()));
+ connect(TargetApplication::self(),
+ SIGNAL(startFailed(TargetApplication::Error)),
+ this, SLOT(deleteLater()));
- mTargetApplicationView->start();
+ TargetApplicationView* targetApplicationView =
+ new TargetApplicationView(TargetApplication::self(),
+ mTutorialEditor);
+ targetApplicationView->start();
}
}
@@ -80,8 +85,13 @@
}
try {
- TargetApplication::self()->remoteEditorSupport()->testScriptedTutorial(
- temporaryFile->fileName());
+ if (mStepId.isEmpty()) {
+ TargetApplication::self()->remoteEditorSupport()->
+ testScriptedTutorial(temporaryFile->fileName());
+ } else {
+ TargetApplication::self()->remoteEditorSupport()->
+ testScriptedTutorial(temporaryFile->fileName(), mStepId);
+ }
} catch (DBusException e) {
QString text = i18nc("@label", "There was a problem when trying to "
"tell the target application to start the tutorial:<nl/>%1", e.message());
Modified: trunk/ktutorial/ktutorial-editor/src/TutorialTester.h
===================================================================
--- trunk/ktutorial/ktutorial-editor/src/TutorialTester.h 2011-06-08 12:46:04 UTC (rev 316)
+++ trunk/ktutorial/ktutorial-editor/src/TutorialTester.h 2011-06-08 12:48:46 UTC (rev 317)
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2010 by Daniel Calviño Sánchez *
+ * Copyright (C) 2010-2011 by Daniel Calviño Sánchez *
* dan...@gm... *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -22,7 +22,6 @@
#include <QObject>
class KTutorialEditor;
-class TargetApplicationView;
/**
* Utility class to test a tutorial in the target application, starting it if
@@ -39,7 +38,13 @@
*/
explicit TutorialTester(KTutorialEditor* tutorialEditor);
-public Q_SLOTS:
+ /**
+ * Sets the step to test the tutorial from.
+ * After starting the tutorial, it will be changed to the given step.
+ *
+ * @param stepId The id of the step to test the tutorial from.
+ */
+ void setStepToTestFrom(const QString& stepId);
/**
* Tests the current tutorial in the target application.
@@ -56,15 +61,16 @@
KTutorialEditor* mTutorialEditor;
/**
- * The TargetApplicationView used to start the target application.
+ * The id of the step to test the tutorial from, if any.
*/
- TargetApplicationView* mTargetApplicationView;
+ QString mStepId;
private Q_SLOTS:
/**
* Exports the current tutorial to a temporary Javascript file and sends the
- * file name to the target application to test the tutorial.
+ * file name (and, if set, the step id) to the target application to test
+ * the tutorial.
*/
void sendTutorialToTargetApplication();
Modified: trunk/ktutorial/ktutorial-editor/src/ktutorial-editorui.rc
===================================================================
--- trunk/ktutorial/ktutorial-editor/src/ktutorial-editorui.rc 2011-06-08 12:46:04 UTC (rev 316)
+++ trunk/ktutorial/ktutorial-editor/src/ktutorial-editorui.rc 2011-06-08 12:48:46 UTC (rev 317)
@@ -29,6 +29,7 @@
</Menu>
<Separator/>
<Action name="testTutorial"/>
+ <Action name="testTutorialFromCurrentStep"/>
</Menu>
<Menu name="view">
<Menu name="panels">
Modified: trunk/ktutorial/ktutorial-editor/src/targetapplication/RemoteEditorSupport.cpp
===================================================================
--- trunk/ktutorial/ktutorial-editor/src/targetapplication/RemoteEditorSupport.cpp 2011-06-08 12:46:04 UTC (rev 316)
+++ trunk/ktutorial/ktutorial-editor/src/targetapplication/RemoteEditorSupport.cpp 2011-06-08 12:48:46 UTC (rev 317)
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2010 by Daniel Calviño Sánchez *
+ * Copyright (C) 2010-2011 by Daniel Calviño Sánchez *
* dan...@gm... *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -100,9 +100,16 @@
mRemoteEventSpy = 0;
}
-void RemoteEditorSupport::testScriptedTutorial(const QString& filename)
+void RemoteEditorSupport::testScriptedTutorial(const QString& filename,
+ const QString& stepId)
throw (DBusException) {
- QDBusReply<void> reply = call("testScriptedTutorial", filename);
+ QDBusReply<void> reply;
+ if (stepId.isEmpty()) {
+ reply = call("testScriptedTutorial", filename);
+ } else {
+ reply = call("testScriptedTutorial", filename, stepId);
+ }
+
if (!reply.isValid()) {
throw DBusException(reply.error().message());
}
Modified: trunk/ktutorial/ktutorial-editor/src/targetapplication/RemoteEditorSupport.h
===================================================================
--- trunk/ktutorial/ktutorial-editor/src/targetapplication/RemoteEditorSupport.h 2011-06-08 12:46:04 UTC (rev 316)
+++ trunk/ktutorial/ktutorial-editor/src/targetapplication/RemoteEditorSupport.h 2011-06-08 12:48:46 UTC (rev 317)
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2010 by Daniel Calviño Sánchez *
+ * Copyright (C) 2010-2011 by Daniel Calviño Sánchez *
* dan...@gm... *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -117,10 +117,15 @@
/**
* Tests the scripted tutorial stored in the file with the given name.
* The target application just starts the tutorial and shows it to the user.
+ * If a step id is given, the tutorial is changed to that step after
+ * starting.
*
* @param filename The name of the file that contains the tutorial to test.
+ * @param stepId The id of the step to change to after starting.
*/
- void testScriptedTutorial(const QString& filename) throw (DBusException);
+ void testScriptedTutorial(const QString& filename,
+ const QString& stepId = QString())
+ throw (DBusException);
private:
Modified: trunk/ktutorial/ktutorial-editor/tests/unit/targetapplication/RemoteClassStubs.h
===================================================================
--- trunk/ktutorial/ktutorial-editor/tests/unit/targetapplication/RemoteClassStubs.h 2011-06-08 12:46:04 UTC (rev 316)
+++ trunk/ktutorial/ktutorial-editor/tests/unit/targetapplication/RemoteClassStubs.h 2011-06-08 12:48:46 UTC (rev 317)
@@ -216,6 +216,7 @@
int mEnableEventSpyCount;
int mDisableEventSpyCount;
QList<QString> mTestScriptedTutorialFilenames;
+ QList<QString> mTestScriptedTutorialStepIds;
StubEditorSupport(QObject* parent = 0): QObject(parent),
mEventSpy(0),
@@ -255,8 +256,13 @@
QDBusConnection::sessionBus().unregisterObject("/ktutorial/EventSpy");
}
- void testScriptedTutorial(const QString& filename) {
+ void testScriptedTutorial(const QString& filename,
+ const QString& stepId = QString()) {
mTestScriptedTutorialFilenames.append(filename);
+
+ if (!stepId.isEmpty()) {
+ mTestScriptedTutorialStepIds.append(stepId);
+ }
}
};
Modified: trunk/ktutorial/ktutorial-editor/tests/unit/targetapplication/RemoteEditorSupportTest.cpp
===================================================================
--- trunk/ktutorial/ktutorial-editor/tests/unit/targetapplication/RemoteEditorSupportTest.cpp 2011-06-08 12:46:04 UTC (rev 316)
+++ trunk/ktutorial/ktutorial-editor/tests/unit/targetapplication/RemoteEditorSupportTest.cpp 2011-06-08 12:48:46 UTC (rev 317)
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2010 by Daniel Calviño Sánchez *
+ * Copyright (C) 2010-2011 by Daniel Calviño Sánchez *
* dan...@gm... *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -66,7 +66,9 @@
void testDisableEventSpyWhenRemoteEditorSupportIsNotAvailable();
void testTestScriptedTutorial();
+ void testTestScriptedTutorialWithStepId();
void testTestScriptedTutorialWhenRemoteEditorSupportIsNotAvailable();
+ void testTestScriptedTutorialWithStepIdWhenRemoteEditorSupportIsNotAvailable();
private:
@@ -341,8 +343,24 @@
QCOMPARE(mEditorSupport->mTestScriptedTutorialFilenames.count(), 1);
QCOMPARE(mEditorSupport->mTestScriptedTutorialFilenames[0],
QString("/some/file"));
+ QCOMPARE(mEditorSupport->mTestScriptedTutorialStepIds.count(), 0);
}
+void RemoteEditorSupportTest::testTestScriptedTutorialWithStepId() {
+ RemoteObjectMapper mapper(QDBusConnection::sessionBus().baseService());
+ RemoteEditorSupport remoteEditorSupport(
+ QDBusConnection::sessionBus().baseService(), &mapper);
+
+ remoteEditorSupport.testScriptedTutorial("/some/file", "some step id");
+
+ QCOMPARE(mEditorSupport->mTestScriptedTutorialFilenames.count(), 1);
+ QCOMPARE(mEditorSupport->mTestScriptedTutorialFilenames[0],
+ QString("/some/file"));
+ QCOMPARE(mEditorSupport->mTestScriptedTutorialStepIds.count(), 1);
+ QCOMPARE(mEditorSupport->mTestScriptedTutorialStepIds[0],
+ QString("some step id"));
+}
+
void RemoteEditorSupportTest::
testTestScriptedTutorialWhenRemoteEditorSupportIsNotAvailable() {
RemoteObjectMapper mapper(QDBusConnection::sessionBus().baseService());
@@ -355,6 +373,19 @@
DBusException);
}
+void RemoteEditorSupportTest::
+ testTestScriptedTutorialWithStepIdWhenRemoteEditorSupportIsNotAvailable() {
+ RemoteObjectMapper mapper(QDBusConnection::sessionBus().baseService());
+ RemoteEditorSupport remoteEditorSupport(
+ QDBusConnection::sessionBus().baseService(), &mapper);
+
+ QDBusConnection::sessionBus().unregisterObject("/ktutorial");
+
+ EXPECT_EXCEPTION(remoteEditorSupport.testScriptedTutorial("/some/file",
+ "some step id"),
+ DBusException);
+}
+
QTEST_MAIN(RemoteEditorSupportTest)
#include "RemoteEditorSupportTest.moc"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|