aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual')
-rw-r--r--tests/manual/qmltypememory/README3
-rw-r--r--tests/manual/qmltypememory/TestPlugin/plugin.cpp63
-rw-r--r--tests/manual/qmltypememory/TestPlugin/plugin.pro7
-rw-r--r--tests/manual/qmltypememory/TestPlugin/qmldir2
-rw-r--r--tests/manual/qmltypememory/TestType.qml43
-rw-r--r--tests/manual/qmltypememory/main.cpp56
-rw-r--r--tests/manual/qmltypememory/main.qml54
-rw-r--r--tests/manual/qmltypememory/qmldir2
-rw-r--r--tests/manual/qmltypememory/qmltypememory.pro8
-rw-r--r--tests/manual/qmltypememory/testdriver.cpp105
-rw-r--r--tests/manual/qmltypememory/testdriver.h65
11 files changed, 408 insertions, 0 deletions
diff --git a/tests/manual/qmltypememory/README b/tests/manual/qmltypememory/README
new file mode 100644
index 0000000000..b1237a1fc7
--- /dev/null
+++ b/tests/manual/qmltypememory/README
@@ -0,0 +1,3 @@
+This test just continually builds up and tears down a QML scene. Watch over a long period to see if the memory usage goes up.
+
+This test specifically is targeting the QQmlType cache which is a global static.
diff --git a/tests/manual/qmltypememory/TestPlugin/plugin.cpp b/tests/manual/qmltypememory/TestPlugin/plugin.cpp
new file mode 100644
index 0000000000..40c2af20f5
--- /dev/null
+++ b/tests/manual/qmltypememory/TestPlugin/plugin.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtQml/QQmlExtensionPlugin>
+#include <QtQml/qqml.h>
+#include <qdebug.h>
+
+class TestType : public QObject
+{
+ Q_OBJECT
+};
+
+class TestPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(uri == QLatin1String("TestPlugin"));
+ qmlRegisterType<TestType>(uri, 1, 0, "TestTypePlugin");
+ }
+};
+
+#include "plugin.moc"
diff --git a/tests/manual/qmltypememory/TestPlugin/plugin.pro b/tests/manual/qmltypememory/TestPlugin/plugin.pro
new file mode 100644
index 0000000000..7575442800
--- /dev/null
+++ b/tests/manual/qmltypememory/TestPlugin/plugin.pro
@@ -0,0 +1,7 @@
+TEMPLATE = lib
+CONFIG += plugin
+QT += qml
+
+TARGET = testplugin
+
+SOURCES += plugin.cpp
diff --git a/tests/manual/qmltypememory/TestPlugin/qmldir b/tests/manual/qmltypememory/TestPlugin/qmldir
new file mode 100644
index 0000000000..f0624dfd82
--- /dev/null
+++ b/tests/manual/qmltypememory/TestPlugin/qmldir
@@ -0,0 +1,2 @@
+module TestPlugin
+plugin testplugin
diff --git a/tests/manual/qmltypememory/TestType.qml b/tests/manual/qmltypememory/TestType.qml
new file mode 100644
index 0000000000..59e0bcf477
--- /dev/null
+++ b/tests/manual/qmltypememory/TestType.qml
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the manual tests 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$
+**
+****************************************************************************/
+
+import QtQml 2.0
+QtObject{property int notJustAStandardQtObject: 10 }
diff --git a/tests/manual/qmltypememory/main.cpp b/tests/manual/qmltypememory/main.cpp
new file mode 100644
index 0000000000..da086ec9f7
--- /dev/null
+++ b/tests/manual/qmltypememory/main.cpp
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the manual tests 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 <QtQml>
+#include <QGuiApplication>
+#include "testdriver.h"
+
+int main (int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+ int i = -1;
+ if (argc > 1)
+ i = atoi(argv[1]);
+ if (i < 1)
+ i = -1;
+ TestDriver td(QUrl::fromLocalFile("main.qml"), i);
+ return app.exec();
+}
diff --git a/tests/manual/qmltypememory/main.qml b/tests/manual/qmltypememory/main.qml
new file mode 100644
index 0000000000..7bc9006aec
--- /dev/null
+++ b/tests/manual/qmltypememory/main.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the manual tests 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$
+**
+****************************************************************************/
+
+import QtQml 2.0
+import QtQuick 2.0
+import QtQuick.Window 2.0
+import QtQuick.LocalStorage 2.0
+import Test 2.0
+import TestPlugin 1.0
+import "."
+
+QtObject {
+ property TestType tt //No object, although it should be properly parented if there were one
+ property TestTypeCpp tt2 //No object, although it should be properly parented if there were one
+ property TestTypePlugin tt3
+}
diff --git a/tests/manual/qmltypememory/qmldir b/tests/manual/qmltypememory/qmldir
new file mode 100644
index 0000000000..edb8c894c4
--- /dev/null
+++ b/tests/manual/qmltypememory/qmldir
@@ -0,0 +1,2 @@
+TestFromDir 2.0 TestType.qml
+internal TestFromDirInt TestType.qml
diff --git a/tests/manual/qmltypememory/qmltypememory.pro b/tests/manual/qmltypememory/qmltypememory.pro
new file mode 100644
index 0000000000..2bd873d554
--- /dev/null
+++ b/tests/manual/qmltypememory/qmltypememory.pro
@@ -0,0 +1,8 @@
+TEMPLATE = app
+TARGET = qmltypememory
+INCLUDEPATH += .
+QT += qml
+
+# Input
+HEADERS += testdriver.h
+SOURCES += main.cpp testdriver.cpp
diff --git a/tests/manual/qmltypememory/testdriver.cpp b/tests/manual/qmltypememory/testdriver.cpp
new file mode 100644
index 0000000000..42de18c4d4
--- /dev/null
+++ b/tests/manual/qmltypememory/testdriver.cpp
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the manual tests 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 "testdriver.h"
+#include <QCoreApplication>
+const int interval = 0;
+
+QObject* singleFactory(QQmlEngine *, QJSEngine*)
+{
+ QObject* ret = new QObject; //NOTE: No parent - but also shouldn't need to be created
+ return ret;
+}
+
+TestDriver::TestDriver(const QUrl &componentUrl, int maxIter)
+ : QObject(0), e(0), c(0), i(maxIter)
+{
+ testFile = componentUrl;
+ QTimer::singleShot(interval, this, SLOT(setUp()));
+}
+
+void TestDriver::setUp()
+{
+ qmlRegisterType<TestType>("Test", 2, 0, "TestTypeCpp");
+ for (int j=2; j<1000; j++) {
+ qmlRegisterType<TestType>("Test", j, 0, "TestType");
+ qmlRegisterType<TestType>("Test", j, 1, "TestType");
+ qmlRegisterType<TestType>("Test", j, 2, "TestType");
+ qmlRegisterType<TestType>("Test", j, 3, "TestType");
+ qmlRegisterType<TestType>("Test", j, 4, "TestType");
+ qmlRegisterType<TestType>("Test", j, 5, "TestType");
+ qmlRegisterType<TestType>("Test", j, 6, "TestType");
+ qmlRegisterType<TestType>("Test", j, 7, "TestType");
+ qmlRegisterType<TestType>("Test", j, 8, "TestType");
+ qmlRegisterType<TestType>("Test", j, 9, "TestType");
+ }
+ qmlRegisterType<TestType>("Test2", 1, 0, "TestType");
+ qmlRegisterType<TestType>("Test2", 3, 0, "TestType");
+ qmlRegisterType<TestType>("Test3", 9, 0, "TestType");
+ qmlRegisterType(QUrl::fromLocalFile(QDir::currentPath() + QLatin1String("TestType.qml")), "Test", 2, 0, "TestType2");
+ qmlRegisterUncreatableType<TestType2>("Test", 2, 0, "CannotDoThis", QLatin1String("Just don't"));
+ qmlRegisterType<TestType3>();
+ qmlRegisterSingletonType<QObject>("Test", 2, 0, "Singlet", singleFactory);
+
+ e = new QQmlEngine(this);
+ c = new QQmlComponent(e, testFile);
+ QObject* unused = c->create();
+ if (!unused) {
+ qDebug() << "Creation failure" << c->errorString();
+ exit(1);
+ }
+ unused->setParent(c); //Not testing leaky objects in the tree
+ QTimer::singleShot(interval, this, SLOT(tearDown()));
+}
+
+void TestDriver::tearDown()
+{
+ delete c;
+ e->collectGarbage();
+ delete e;
+ qmlClearTypeRegistrations();
+ //Note that i < 0 will effectively never terminate. This is deliberate as a prime use is to run indefinitely and watch the memory *not* grow
+ i--;
+ if (!i)
+ qApp->quit();
+ else
+ QTimer::singleShot(interval, this, SLOT(setUp()));
+}
diff --git a/tests/manual/qmltypememory/testdriver.h b/tests/manual/qmltypememory/testdriver.h
new file mode 100644
index 0000000000..711a725aa1
--- /dev/null
+++ b/tests/manual/qmltypememory/testdriver.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the manual tests 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$
+**
+****************************************************************************/
+
+#ifndef TESTDRIVER_H
+#define TESTDRIVER_H
+#include <QtCore>
+#include <QtQml>
+
+class TestDriver : public QObject
+{
+ Q_OBJECT
+public:
+ TestDriver(const QUrl &componentUrl, int maxIter = -1);
+public slots:
+ void setUp();
+ void tearDown();
+private:
+ QUrl testFile;
+ QQmlEngine* e;
+ QQmlComponent* c;
+ signed long int i;
+};
+
+class TestType : public QObject { Q_OBJECT };
+class TestType2 : public QObject { Q_OBJECT };
+class TestType3 : public QObject { Q_OBJECT };
+#endif