summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Habacker <[email protected]>2015-06-13 09:39:45 +0200
committerRalf Habacker <[email protected]>2015-06-13 09:39:45 +0200
commit8d37b62b20a5fc94793be81b09d972af06318030 (patch)
treec8dc4f7a5988c00b443b159a8cf586b8bfa1af2a
parentc1912b005c9d4f6e9416112ec551012f88537ac5 (diff)
Order unit test cases for class UMLObject alphabetical.
-rw-r--r--unittests/TEST_umlobject.cpp129
-rw-r--r--unittests/TEST_umlobject.h10
2 files changed, 70 insertions, 69 deletions
diff --git a/unittests/TEST_umlobject.cpp b/unittests/TEST_umlobject.cpp
index c9d92ca..7fbe76b 100644
--- a/unittests/TEST_umlobject.cpp
+++ b/unittests/TEST_umlobject.cpp
@@ -38,6 +38,36 @@ const bool IS_NOT_IMPL = false;
//-----------------------------------------------------------------------------
+void TEST_UMLObject::test_copyInto()
+{
+ UMLPackage parent("Test Parent");
+ UMLObject a("Test A");
+ a.setUMLPackage(&parent);
+ UMLObject b("Test B");
+ b.setUMLPackage(&parent);
+ b.copyInto(&a);
+ QCOMPARE(a, b);
+}
+
+void TEST_UMLObject::test_clone()
+{
+ UMLPackage parent("Test Parent");
+ UMLObject a("Test A");
+ a.setUMLPackage(&parent);
+ UMLObject &b = *a.clone();
+ QCOMPARE(a, b);
+}
+
+void TEST_UMLObject::test_doc()
+{
+ UMLPackage parent("Test Parent");
+ UMLObject a("Test A");
+ QCOMPARE(a.hasDoc(), false);
+ a.setDoc(QLatin1String("new doc"));
+ QCOMPARE(a.hasDoc(), true);
+ QCOMPARE(a.doc(), QLatin1String("new doc"));
+}
+
void TEST_UMLObject::test_equal()
{
UMLPackage parent("Test Parent");
@@ -53,24 +83,38 @@ void TEST_UMLObject::test_equal()
QCOMPARE(c == d, false);
}
-void TEST_UMLObject::test_copyInto()
+void TEST_UMLObject::test_fullyQualifiedName()
{
- UMLPackage parent("Test Parent");
UMLObject a("Test A");
+ QCOMPARE(a.fullyQualifiedName(), QLatin1String("Test A"));
+
+ UMLPackage topParent("Top Parent");
+ UMLPackage parent("Test Parent");
+ parent.setUMLPackage(&topParent);
a.setUMLPackage(&parent);
- UMLObject b("Test B");
- b.setUMLPackage(&parent);
- b.copyInto(&a);
- QCOMPARE(a, b);
+ QCOMPARE(a.umlPackage()->fullyQualifiedName(), a.package());
+ QCOMPARE(a.fullyQualifiedName(), QLatin1String("Top Parent::Test Parent::Test A"));
+ QCOMPARE(a.fullyQualifiedName(QLatin1String("-")), QLatin1String("Top Parent-Test Parent-Test A"));
+
+ UMLFolder *f = UMLApp::app()->document()->rootFolder(Uml::ModelType::Logical);
+ parent.setUMLPackage(f);
+ QCOMPARE(a.fullyQualifiedName(QLatin1String("::"), true), QLatin1String("Logical View::Test Parent::Test A"));
}
-void TEST_UMLObject::test_clone()
+void TEST_UMLObject::test_isAbstract()
{
- UMLPackage parent("Test Parent");
UMLObject a("Test A");
- a.setUMLPackage(&parent);
- UMLObject &b = *a.clone();
- QCOMPARE(a, b);
+ QCOMPARE(a.isAbstract(), false);
+ a.setAbstract(true);
+ QCOMPARE(a.isAbstract(), true);
+}
+
+void TEST_UMLObject::test_isStatic()
+{
+ UMLObject a("Test A");
+ QCOMPARE(a.isStatic(), false);
+ a.setStatic(true);
+ QCOMPARE(a.isStatic(), true);
}
void TEST_UMLObject::test_resolveRef()
@@ -107,22 +151,24 @@ void TEST_UMLObject::test_setBaseType()
QCOMPARE(a.baseType(), UMLObject::ot_Class);
}
-void TEST_UMLObject::test_isAbstract()
+void TEST_UMLObject::test_setSterotype()
{
UMLObject a("Test A");
- QCOMPARE(a.isAbstract(), false);
- a.setAbstract(true);
- QCOMPARE(a.isAbstract(), true);
+ QCOMPARE(a.stereotype(), QLatin1String(""));
+ a.setStereotypeCmd(QLatin1String("test"));
+ QCOMPARE(a.stereotype(), QLatin1String("test"));
}
-void TEST_UMLObject::test_isStatic()
+void TEST_UMLObject::test_setUMLPackage()
{
+ UMLPackage parent("Test Parent");
UMLObject a("Test A");
- QCOMPARE(a.isStatic(), false);
- a.setStatic(true);
- QCOMPARE(a.isStatic(), true);
+ QCOMPARE(a.umlPackage(), (UMLPackage*)0);
+ a.setUMLPackage(&parent);
+ QCOMPARE(a.umlPackage(), &parent);
}
+
void TEST_UMLObject::test_setVisibility()
{
UMLObject a("Test A");
@@ -137,55 +183,10 @@ void TEST_UMLObject::test_setVisibility()
QCOMPARE(a.visibility(), Uml::Visibility::FromParent);
}
-void TEST_UMLObject::test_setSterotype()
-{
- UMLObject a("Test A");
- QCOMPARE(a.stereotype(), QLatin1String(""));
- a.setStereotypeCmd(QLatin1String("test"));
- QCOMPARE(a.stereotype(), QLatin1String("test"));
-}
-
-void TEST_UMLObject::test_setUMLPackage()
-{
- UMLPackage parent("Test Parent");
- UMLObject a("Test A");
- QCOMPARE(a.umlPackage(), (UMLPackage*)0);
- a.setUMLPackage(&parent);
- QCOMPARE(a.umlPackage(), &parent);
-}
-
void TEST_UMLObject::test_toString()
{
QCOMPARE(UMLObject::toString(UMLObject::ot_Class), QLatin1String("ot_Class"));
QCOMPARE(UMLObject::toI18nString(UMLObject::ot_Class), i18n("Class &name:"));
}
-void TEST_UMLObject::test_fullyQualifiedName()
-{
- UMLObject a("Test A");
- QCOMPARE(a.fullyQualifiedName(), QLatin1String("Test A"));
-
- UMLPackage topParent("Top Parent");
- UMLPackage parent("Test Parent");
- parent.setUMLPackage(&topParent);
- a.setUMLPackage(&parent);
- QCOMPARE(a.umlPackage()->fullyQualifiedName(), a.package());
- QCOMPARE(a.fullyQualifiedName(), QLatin1String("Top Parent::Test Parent::Test A"));
- QCOMPARE(a.fullyQualifiedName(QLatin1String("-")), QLatin1String("Top Parent-Test Parent-Test A"));
-
- UMLFolder *f = UMLApp::app()->document()->rootFolder(Uml::ModelType::Logical);
- parent.setUMLPackage(f);
- QCOMPARE(a.fullyQualifiedName(QLatin1String("::"), true), QLatin1String("Logical View::Test Parent::Test A"));
-}
-
-void TEST_UMLObject::test_doc()
-{
- UMLPackage parent("Test Parent");
- UMLObject a("Test A");
- QCOMPARE(a.hasDoc(), false);
- a.setDoc(QLatin1String("new doc"));
- QCOMPARE(a.hasDoc(), true);
- QCOMPARE(a.doc(), QLatin1String("new doc"));
-}
-
QTEST_MAIN(TEST_UMLObject)
diff --git a/unittests/TEST_umlobject.h b/unittests/TEST_umlobject.h
index 22d700f..67210b3 100644
--- a/unittests/TEST_umlobject.h
+++ b/unittests/TEST_umlobject.h
@@ -27,19 +27,19 @@ class TEST_UMLObject : public TestBase
{
Q_OBJECT
private slots:
- void test_equal();
void test_copyInto();
void test_clone();
+ void test_doc();
+ void test_equal();
+ void test_fullyQualifiedName();
void test_isAbstract();
+ void test_isStatic();
void test_resolveRef();
void test_setBaseType();
- void test_isStatic();
- void test_setVisibility();
void test_setSterotype();
void test_setUMLPackage();
+ void test_setVisibility();
void test_toString();
- void test_doc();
- void test_fullyQualifiedName();
};
#endif // TEST_UMLOBJECT_H