summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSandro S. Andrade <sandroandrade@kde.org>2013-11-26 05:07:40 -0300
committerSandro S. Andrade <sandroandrade@kde.org>2013-11-26 09:03:06 +0100
commitcb4567f68fde059f014546eff434fa40d164a4e0 (patch)
treed6cb9e6783e72a34ac3ae302d879ca977ebe2d37 /tests
parent9cc11ffbb66d74ce0776ecd1647e412f9c64eac4 (diff)
Fix issue when removing QObject counterpart of model elements
Change-Id: I9c3a3ae63d8f8e738a8bdb903c02b47a48627b70 Reviewed-by: Sandro S. Andrade <sandroandrade@kde.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/auto.pro7
-rw-r--r--tests/auto/qtumlguardedcollection/qtumlguardedcollection.pro7
-rw-r--r--tests/auto/qtumlguardedcollection/tst_qtumlguardedcollection.cpp73
-rw-r--r--tests/auto/qtumlprovidedrequiredinterfaces/test.xmi4
-rw-r--r--tests/auto/qtumlprovidedrequiredinterfaces/tst_qtumlprovidedrequiredinterfaces.cpp2
5 files changed, 87 insertions, 6 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index d33bf4c7..4197a886 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -1,2 +1,7 @@
TEMPLATE=subdirs
-SUBDIRS = qtmofcontainment qtumlcontainment qtumlprovidedrequiredinterfaces qtumlconnectortypeandcomponentparts
+SUBDIRS = \
+ qtmofcontainment \
+ qtumlcontainment \
+ qtumlprovidedrequiredinterfaces \
+ qtumlconnectortypeandcomponentparts \
+ qtumlguardedcollection
diff --git a/tests/auto/qtumlguardedcollection/qtumlguardedcollection.pro b/tests/auto/qtumlguardedcollection/qtumlguardedcollection.pro
new file mode 100644
index 00000000..a5ddacc9
--- /dev/null
+++ b/tests/auto/qtumlguardedcollection/qtumlguardedcollection.pro
@@ -0,0 +1,7 @@
+CONFIG += testcase
+TARGET = tst_qtumlguardedcollection
+
+QT = modeling uml testlib
+
+SOURCES += \
+ tst_qtumlguardedcollection.cpp \
diff --git a/tests/auto/qtumlguardedcollection/tst_qtumlguardedcollection.cpp b/tests/auto/qtumlguardedcollection/tst_qtumlguardedcollection.cpp
new file mode 100644
index 00000000..4fcee5a8
--- /dev/null
+++ b/tests/auto/qtumlguardedcollection/tst_qtumlguardedcollection.cpp
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtUml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtTest/QtTest>
+
+#include <QtUml/QUmlComment>
+
+class TestQtUmlGuardedCollection : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void qtumlguardedcollection();
+};
+
+void TestQtUmlGuardedCollection::qtumlguardedcollection()
+{
+ QUmlComment *c1 = new QUmlComment;
+ c1->asQModelingObject()->setObjectName("c1");
+ QUmlComment *c2 = new QUmlComment;
+ c2->asQModelingObject()->setObjectName("c2");
+
+ c1->addOwnedComment(c2);
+
+ QCOMPARE(c1->ownedComments().size(), 1);
+
+ delete c2;
+
+ QCOMPARE(c1->ownedComments().size(), 0);
+
+ delete c1;
+}
+
+QTEST_MAIN(TestQtUmlGuardedCollection)
+#include "tst_qtumlguardedcollection.moc"
+
diff --git a/tests/auto/qtumlprovidedrequiredinterfaces/test.xmi b/tests/auto/qtumlprovidedrequiredinterfaces/test.xmi
index 901e7345..caa8a58a 100644
--- a/tests/auto/qtumlprovidedrequiredinterfaces/test.xmi
+++ b/tests/auto/qtumlprovidedrequiredinterfaces/test.xmi
@@ -17,24 +17,20 @@
<clientDependency href="_g59JXE_rEeOrf6v5LQGc0Q"/>
<interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_g59JXE_rEeOrf6v5LQGc0Q" name="MaxClientsControl-IMaxClientsControl-Realization" contract="_g59JWU_rEeOrf6v5LQGc0Q">
<supplier href="_g59JWU_rEeOrf6v5LQGc0Q"/>
- <client href="_g59JW0_rEeOrf6v5LQGc0Q"/>
</interfaceRealization>
</packagedElement>
<packagedElement xmi:type="uml:Dependency" xmi:id="_g59JXU_rEeOrf6v5LQGc0Q" name="MaxClientsControl-IAvgResponseTimeMonitor-Dependency">
<supplier href="_g59JWk_rEeOrf6v5LQGc0Q"/>
- <client href="_g59JW0_rEeOrf6v5LQGc0Q"/>
</packagedElement>
<packagedElement xmi:type="uml:Class" xmi:id="_g59JW0_rEeOrf6v5LQGc0R" name="BaseClass">
<clientDependency href="_g59JXU_rEeOrf6v5LQGc0R"/>
<clientDependency href="_g59JXE_rEeOrf6v5LQGc0R"/>
<interfaceRealization xmi:type="uml:InterfaceRealization" xmi:id="_g59JXE_rEeOrf6v5LQGc0R" name="BaseClass-IBaseProvidedInterface-Realization" contract="_g59JWU_rEeOrf6v5LQGc0R">
<supplier href="_g59JWU_rEeOrf6v5LQGc0R"/>
- <client href="_g59JW0_rEeOrf6v5LQGc0R"/>
</interfaceRealization>
</packagedElement>
<packagedElement xmi:type="uml:Dependency" xmi:id="_g59JXU_rEeOrf6v5LQGc0R" name="BaseClass-IBaseRequiredInterface-Dependency">
<supplier href="_g59JWk_rEeOrf6v5LQGc0R"/>
- <client href="_g59JW0_rEeOrf6v5LQGc0R"/>
</packagedElement>
</uml:Model>
</xmi:XMI>
diff --git a/tests/auto/qtumlprovidedrequiredinterfaces/tst_qtumlprovidedrequiredinterfaces.cpp b/tests/auto/qtumlprovidedrequiredinterfaces/tst_qtumlprovidedrequiredinterfaces.cpp
index a5ba7c9f..115a5ff8 100644
--- a/tests/auto/qtumlprovidedrequiredinterfaces/tst_qtumlprovidedrequiredinterfaces.cpp
+++ b/tests/auto/qtumlprovidedrequiredinterfaces/tst_qtumlprovidedrequiredinterfaces.cpp
@@ -84,7 +84,7 @@ void TestQtUmlProvidedRequiredInterfaces::qtumlprovidedrequiredinterfaces()
QCOMPARE(port3->required().contains(qmodelingelementproperty_cast<QUmlInterface *>(rootElements.first()->asQModelingObject()->findChild<QObject *>("IAvgResponseTimeMonitor"))), true);
QCOMPARE(port3->required().contains(qmodelingelementproperty_cast<QUmlInterface *>(rootElements.first()->asQModelingObject()->findChild<QObject *>("IBaseRequiredInterface"))), true);
-// qDeleteAll(rootElements);
+ qDeleteAll(rootElements);
}
QTEST_MAIN(TestQtUmlProvidedRequiredInterfaces)