summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-09-22 11:11:41 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-09-22 11:11:41 (GMT)
commite9d0019c40dc49144dabacd3ab8436f1c190d5e3 (patch)
treea7b8b7eb1d684c7cd9be873f5c44669d7684ce91 /tests
parentb7ba409b0dabd382876310a6c110a96cf0e3c6bf (diff)
parent63c4c0449361ced03838e51d18e1113740f27fa9 (diff)
downloadQt-e9d0019c40dc49144dabacd3ab8436f1c190d5e3.zip
Qt-e9d0019c40dc49144dabacd3ab8436f1c190d5e3.tar.gz
Qt-e9d0019c40dc49144dabacd3ab8436f1c190d5e3.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: Mitigate private header problems in QtCreator by adding semi-private API Update QtDeclarative def files Add exports for Bauhaus Fix corkboards example for smaller screens Fix easing example having wrong contentHeight Fix a crash in QDeclarativeVisualDataModel Small optimization for QDeclarativeVisualDataModel.
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h25
-rw-r--r--tests/auto/declarative/qdeclarativedebughelper/qdeclarativedebughelper.pro5
-rw-r--r--tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp68
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/data/multipleroles.qml25
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp16
5 files changed, 139 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h b/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h
new file mode 100644
index 0000000..a403c45
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h
@@ -0,0 +1,25 @@
+#ifndef QDECLARATIVEDEBUGHELPER_P_H
+#define QDECLARATIVEDEBUGHELPER_P_H
+
+#include <QtCore/qglobal.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class QScriptEngine;
+class QDeclarativeEngine;
+
+// Helper methods to access private API through a stable interface
+// This is used in the qmljsdebugger library of QtCreator.
+class Q_DECLARATIVE_EXPORT QDeclarativeDebugHelper
+{
+public:
+ static QScriptEngine *getScriptEngine(QDeclarativeEngine *engine);
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QDECLARATIVEDEBUGHELPER_P_H
diff --git a/tests/auto/declarative/qdeclarativedebughelper/qdeclarativedebughelper.pro b/tests/auto/declarative/qdeclarativedebughelper/qdeclarativedebughelper.pro
new file mode 100644
index 0000000..c52c652
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativedebughelper/qdeclarativedebughelper.pro
@@ -0,0 +1,5 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += network declarative script
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qdeclarativedebughelper.cpp
diff --git a/tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp b/tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp
new file mode 100644
index 0000000..db62455
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+
+#include <QDeclarativeEngine>
+#include <private/qdeclarativeengine_p.h>
+
+// We have copied the header which is used in the qmljsdebugger (part of QtCreator)
+// to catch BC changes. Don't update it unless you know what you are doing!
+#include "private_headers/qdeclarativedebughelper_p.h"
+
+class tst_qdeclarativedebughelper : public QObject {
+ Q_OBJECT
+private slots:
+ void getScriptEngine();
+};
+
+void tst_qdeclarativedebughelper::getScriptEngine()
+{
+ QDeclarativeEngine engine;
+
+ QScriptEngine *scriptEngine = QDeclarativeDebugHelper::getScriptEngine(&engine);
+ QVERIFY(scriptEngine);
+ QCOMPARE(scriptEngine, QDeclarativeEnginePrivate::getScriptEngine(&engine));
+}
+
+QTEST_MAIN(tst_qdeclarativedebughelper)
+
+#include "tst_qdeclarativedebughelper.moc"
+
diff --git a/tests/auto/declarative/qdeclarativelistmodel/data/multipleroles.qml b/tests/auto/declarative/qdeclarativelistmodel/data/multipleroles.qml
new file mode 100644
index 0000000..b8f2f32
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistmodel/data/multipleroles.qml
@@ -0,0 +1,25 @@
+import Qt 4.7
+ListView {
+ width: 100
+ height: 250
+ delegate: Rectangle {
+ width: 100
+ height: 50
+ color: black ? "black": "white"
+ }
+ model: ListModel {
+ objectName: "listModel"
+ ListElement {
+ black: false
+ rounded: false
+ }
+ ListElement {
+ black: true
+ rounded: false
+ }
+ ListElement {
+ black: true
+ rounded: false
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
index f456778..31cb545 100644
--- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
@@ -98,6 +98,7 @@ private slots:
void get_worker_data();
void get_nested();
void get_nested_data();
+ void crash_model_with_multiple_roles();
};
int tst_qdeclarativelistmodel::roleFromName(const QDeclarativeListModel *model, const QString &roleName)
{
@@ -886,6 +887,21 @@ void tst_qdeclarativelistmodel::get_nested_data()
get_data();
}
+//QTBUG-13754
+void tst_qdeclarativelistmodel::crash_model_with_multiple_roles()
+{
+ QDeclarativeEngine eng;
+ QDeclarativeComponent component(&eng, QUrl::fromLocalFile(SRCDIR "/data/multipleroles.qml"));
+ QObject *rootItem = component.create();
+ QVERIFY(component.errorString().isEmpty());
+ QVERIFY(rootItem != 0);
+ QDeclarativeListModel *model = rootItem->findChild<QDeclarativeListModel*>("listModel");
+ QVERIFY(model != 0);
+
+ // used to cause a crash in QDeclarativeVisualDataModel
+ model->setProperty(0, "black", true);
+}
+
QTEST_MAIN(tst_qdeclarativelistmodel)
#include "tst_qdeclarativelistmodel.moc"