aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickitem/tst_qquickitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qquickitem/tst_qquickitem.cpp')
-rw-r--r--tests/auto/quick/qquickitem/tst_qquickitem.cpp64
1 files changed, 37 insertions, 27 deletions
diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
index 5993008c4a..0ce0ded28b 100644
--- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp
+++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** 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
+** 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.
+** 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.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** 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$
**
****************************************************************************/
@@ -173,7 +165,9 @@ private slots:
void visualParentOwnership();
void visualParentOwnershipWindow();
- void testSGInitializeAndInvalidate();
+ void testSGInvalidate();
+
+ void objectChildTransform();
private:
@@ -1886,35 +1880,51 @@ void tst_qquickitem::visualParentOwnershipWindow()
}
}
-void tst_qquickitem::testSGInitializeAndInvalidate()
+class InvalidatedItem : public QQuickItem {
+ Q_OBJECT
+signals:
+ void invalidated();
+public slots:
+ void invalidateSceneGraph() { emit invalidated(); }
+};
+
+void tst_qquickitem::testSGInvalidate()
{
for (int i=0; i<2; ++i) {
QScopedPointer<QQuickView> view(new QQuickView());
- QQuickItem *item = new QQuickItem();
+ InvalidatedItem *item = new InvalidatedItem();
- int expected;
+ int expected = 0;
if (i == 0) {
// First iteration, item has contents and should get signals
expected = 1;
item->setFlag(QQuickItem::ItemHasContents, true);
} else {
// Second iteration, item does not have content and will not get signals
- expected = 0;
}
- QSignalSpy initializeSpy(item, SIGNAL(sceneGraphInitialized()));
- QSignalSpy invalidateSpy(item, SIGNAL(sceneGraphInvalidated()));
+ QSignalSpy invalidateSpy(item, SIGNAL(invalidated()));
item->setParentItem(view->contentItem());
view->show();
QVERIFY(QTest::qWaitForWindowExposed(view.data()));
- QCOMPARE(initializeSpy.size(), expected);
delete view.take();
QCOMPARE(invalidateSpy.size(), expected);
}
+}
+
+void tst_qquickitem::objectChildTransform()
+{
+ QQuickView view;
+ view.setSource(testFileUrl("objectChildTransform.qml"));
+
+ QQuickItem *root = qobject_cast<QQuickItem*>(view.rootObject());
+ QVERIFY(root);
+ root->setProperty("source", QString());
+ // Shouldn't crash.
}
QTEST_MAIN(tst_qquickitem)