[Ktutorial-commits] SF.net SVN: ktutorial:[256] trunk/ktutorial/ktutorial-library
Status: Alpha
Brought to you by:
danxuliu
|
From: <dan...@us...> - 2010-09-25 14:39:15
|
Revision: 256
http://ktutorial.svn.sourceforge.net/ktutorial/?rev=256&view=rev
Author: danxuliu
Date: 2010-09-25 14:39:08 +0000 (Sat, 25 Sep 2010)
Log Message:
-----------
Fix emitting Tutorial::stepActivated(Step*) before really activating the step, which lead to options created in the step setup to not to be shown in the StepWidget (as they weren't created yet when StepWidget::setStep(Step*) was called).
Modified Paths:
--------------
trunk/ktutorial/ktutorial-library/src/Tutorial.cpp
trunk/ktutorial/ktutorial-library/tests/TutorialTest.cpp
Modified: trunk/ktutorial/ktutorial-library/src/Tutorial.cpp
===================================================================
--- trunk/ktutorial/ktutorial-library/src/Tutorial.cpp 2010-09-25 03:40:16 UTC (rev 255)
+++ trunk/ktutorial/ktutorial-library/src/Tutorial.cpp 2010-09-25 14:39:08 UTC (rev 256)
@@ -79,10 +79,10 @@
//TODO remove
kDebug() << "Next step: " << step->id() << endl;
- emit stepActivated(step);
-
mCurrentStep = step;
mCurrentStep->setActive(true);
+
+ emit stepActivated(step);
}
//public slots:
Modified: trunk/ktutorial/ktutorial-library/tests/TutorialTest.cpp
===================================================================
--- trunk/ktutorial/ktutorial-library/tests/TutorialTest.cpp 2010-09-25 03:40:16 UTC (rev 255)
+++ trunk/ktutorial/ktutorial-library/tests/TutorialTest.cpp 2010-09-25 14:39:08 UTC (rev 256)
@@ -30,7 +30,12 @@
class TutorialTest: public QObject {
Q_OBJECT
+public slots:
+ void assertStepActive(Step* step) {
+ QVERIFY(step->isActive());
+ }
+
private slots:
void testConstructor();
@@ -267,6 +272,10 @@
int stepStarType = qRegisterMetaType<Step*>("Step*");
QSignalSpy stepActivatedSpy(&tutorial, SIGNAL(stepActivated(Step*)));
+ //Ensure that the step is already active when the signal is emitted
+ connect(&tutorial, SIGNAL(stepActivated(Step*)),
+ this, SLOT(assertStepActive(Step*)));
+
tutorial.nextStep("record");
QCOMPARE(stepActivatedSpy.count(), 1);
@@ -296,6 +305,10 @@
int stepStarType = qRegisterMetaType<Step*>("Step*");
QSignalSpy stepActivatedSpy(&tutorial, SIGNAL(stepActivated(Step*)));
+ //Ensure that the step is already active when the signal is emitted
+ connect(&tutorial, SIGNAL(stepActivated(Step*)),
+ this, SLOT(assertStepActive(Step*)));
+
stepStart->emitNextStepRequested("record");
QCOMPARE(stepActivatedSpy.count(), 1);
@@ -352,6 +365,10 @@
int stepStarType = qRegisterMetaType<Step*>("Step*");
QSignalSpy stepActivatedSpy(&tutorial, SIGNAL(stepActivated(Step*)));
+ //Ensure that the step is already active when the signal is emitted
+ connect(&tutorial, SIGNAL(stepActivated(Step*)),
+ this, SLOT(assertStepActive(Step*)));
+
tutorial.nextStep(step1);
QCOMPARE(stepActivatedSpy.count(), 1);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|