diff options
Diffstat (limited to 'tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp')
-rw-r--r-- | tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp | 57 |
1 files changed, 40 insertions, 17 deletions
diff --git a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp index e529c74acc..615de0885a 100644 --- a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp +++ b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** 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 The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/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 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** @@ -56,6 +51,7 @@ private slots: void errors(); void rewriteErrors(); void singletonTypeTarget(); + void enableDisable_QTBUG_36350(); private: QQmlEngine engine; @@ -329,6 +325,33 @@ void tst_qqmlconnections::singletonTypeTarget() delete object; } +void tst_qqmlconnections::enableDisable_QTBUG_36350() +{ + QQmlEngine engine; + QQmlComponent c(&engine, testFileUrl("test-connection.qml")); + QQuickItem *item = qobject_cast<QQuickItem*>(c.create()); + QVERIFY(item != 0); + + QQmlConnections *connections = item->findChild<QQmlConnections*>("connections"); + QVERIFY(connections); + + connections->setEnabled(false); + QCOMPARE(item->property("tested").toBool(), false); + QCOMPARE(item->width(), 50.); + emit item->setWidth(100.); + QCOMPARE(item->width(), 100.); + QCOMPARE(item->property("tested").toBool(), false); //Should not have received signal to change property + + connections->setEnabled(true); //Re-enable the connectSignals() + QCOMPARE(item->property("tested").toBool(), false); + QCOMPARE(item->width(), 100.); + emit item->setWidth(50.); + QCOMPARE(item->width(), 50.); + QCOMPARE(item->property("tested").toBool(), true); //Should have received signal to change property + + delete item; +} + QTEST_MAIN(tst_qqmlconnections) #include "tst_qqmlconnections.moc" |