[Ktutorial-commits] SF.net SVN: ktutorial:[121] trunk/ktutorial/ktutorial-editor
Status: Alpha
Brought to you by:
danxuliu
|
From: <dan...@us...> - 2010-03-07 23:11:43
|
Revision: 121
http://ktutorial.svn.sourceforge.net/ktutorial/?rev=121&view=rev
Author: danxuliu
Date: 2010-03-07 23:11:37 +0000 (Sun, 07 Mar 2010)
Log Message:
-----------
Fix setting parent QObject in Step and Tutorial classes.
Modified Paths:
--------------
trunk/ktutorial/ktutorial-editor/src/Step.cpp
trunk/ktutorial/ktutorial-editor/src/Tutorial.cpp
trunk/ktutorial/ktutorial-editor/tests/unit/StepTest.cpp
trunk/ktutorial/ktutorial-editor/tests/unit/TutorialTest.cpp
Modified: trunk/ktutorial/ktutorial-editor/src/Step.cpp
===================================================================
--- trunk/ktutorial/ktutorial-editor/src/Step.cpp 2010-03-07 22:50:16 UTC (rev 120)
+++ trunk/ktutorial/ktutorial-editor/src/Step.cpp 2010-03-07 23:11:37 UTC (rev 121)
@@ -20,7 +20,7 @@
//public:
-Step::Step(QObject* parent) {
+Step::Step(QObject* parent): QObject(parent) {
}
QString Step::id() const {
Modified: trunk/ktutorial/ktutorial-editor/src/Tutorial.cpp
===================================================================
--- trunk/ktutorial/ktutorial-editor/src/Tutorial.cpp 2010-03-07 22:50:16 UTC (rev 120)
+++ trunk/ktutorial/ktutorial-editor/src/Tutorial.cpp 2010-03-07 23:11:37 UTC (rev 121)
@@ -24,7 +24,7 @@
//public:
-Tutorial::Tutorial(QObject* parent) {
+Tutorial::Tutorial(QObject* parent): QObject(parent) {
}
Tutorial::~Tutorial() {
Modified: trunk/ktutorial/ktutorial-editor/tests/unit/StepTest.cpp
===================================================================
--- trunk/ktutorial/ktutorial-editor/tests/unit/StepTest.cpp 2010-03-07 22:50:16 UTC (rev 120)
+++ trunk/ktutorial/ktutorial-editor/tests/unit/StepTest.cpp 2010-03-07 23:11:37 UTC (rev 121)
@@ -25,6 +25,8 @@
private slots:
+ void testConstructor();
+
void testSetId();
void testSetText();
@@ -35,6 +37,13 @@
};
+void StepTest::testConstructor() {
+ QObject parent;
+ Step* step = new Step(&parent);
+
+ QCOMPARE(step->parent(), &parent);
+}
+
//Step* must be declared as a metatype to be used in qvariant_cast
Q_DECLARE_METATYPE(Step*);
Modified: trunk/ktutorial/ktutorial-editor/tests/unit/TutorialTest.cpp
===================================================================
--- trunk/ktutorial/ktutorial-editor/tests/unit/TutorialTest.cpp 2010-03-07 22:50:16 UTC (rev 120)
+++ trunk/ktutorial/ktutorial-editor/tests/unit/TutorialTest.cpp 2010-03-07 23:11:37 UTC (rev 121)
@@ -28,6 +28,8 @@
void initTestCase();
+ void testConstructor();
+
void testId();
void testIdWithEmptyName();
void testIdWithSpaceName();
@@ -58,6 +60,13 @@
mStepStarType = qRegisterMetaType<Tutorial*>("Step*");
}
+void TutorialTest::testConstructor() {
+ QObject parent;
+ Tutorial* tutorial = new Tutorial(&parent);
+
+ QCOMPARE(tutorial->parent(), &parent);
+}
+
void TutorialTest::testId() {
Tutorial tutorial;
tutorial.setName("ThE name of a tutoRial");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|