summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjkobus <jaroslaw.kobus@theqtcompany.com>2015-01-27 10:47:52 +0100
committerKai Koehne <kai.koehne@theqtcompany.com>2015-01-27 13:52:14 +0000
commit838f3284963c00dc4407cff5c35ff823b0d3123c (patch)
tree9863a857daf3d65304c5023442cb3d30e297b922 /tests
parent4a74d31c63dde5cd6be9518cc4636f42919df071 (diff)
Fix the invocation order of entering() and page callback
Task-number: QTIFW-620 Change-Id: I1a40aae35dc1c259a96043a1056aa631bf7279b2 Reviewed-by: Niels Weber <niels.weber@theqtcompany.com> Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/installer/scriptengine/data/enteringpage.qs44
-rw-r--r--tests/auto/installer/scriptengine/scriptengine.qrc1
-rw-r--r--tests/auto/installer/scriptengine/tst_scriptengine.cpp64
3 files changed, 109 insertions, 0 deletions
diff --git a/tests/auto/installer/scriptengine/data/enteringpage.qs b/tests/auto/installer/scriptengine/data/enteringpage.qs
new file mode 100644
index 000000000..96d7f9013
--- /dev/null
+++ b/tests/auto/installer/scriptengine/data/enteringpage.qs
@@ -0,0 +1,44 @@
+/**************************************************************************
+**
+** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Installer Framework.
+**
+** $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 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
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+**
+** $QT_END_LICENSE$
+**
+**************************************************************************/
+
+function Controller()
+{
+}
+
+Controller.prototype.EnteringPageCallback = function()
+{
+ var page = gui.pageWidgetByObjectName("EnteringPage");
+ page.callbackInvoked();
+}
+
diff --git a/tests/auto/installer/scriptengine/scriptengine.qrc b/tests/auto/installer/scriptengine/scriptengine.qrc
index 06829326e..d630f3196 100644
--- a/tests/auto/installer/scriptengine/scriptengine.qrc
+++ b/tests/auto/installer/scriptengine/scriptengine.qrc
@@ -5,6 +5,7 @@
<file>data/component2.qs</file>
<file>data/broken_connect.qs</file>
<file>data/dynamicpage.qs</file>
+ <file>data/enteringpage.qs</file>
<file>data/form.ui</file>
<file>data/userinterface.qs</file>
</qresource>
diff --git a/tests/auto/installer/scriptengine/tst_scriptengine.cpp b/tests/auto/installer/scriptengine/tst_scriptengine.cpp
index 12915e30a..09785850e 100644
--- a/tests/auto/installer/scriptengine/tst_scriptengine.cpp
+++ b/tests/auto/installer/scriptengine/tst_scriptengine.cpp
@@ -96,6 +96,55 @@ private:
QWidget *m_widget;
};
+class EnteringPage : public PackageManagerPage
+{
+ Q_OBJECT
+ Q_PROPERTY(QStringList invocationOrder READ invocationOrder)
+public:
+ explicit EnteringPage(PackageManagerCore *core)
+ : PackageManagerPage(core)
+ {
+ setObjectName(QLatin1String("EnteringPage"));
+ }
+ QStringList invocationOrder() const {
+ return m_invocationOrder;
+ }
+public slots:
+ Q_INVOKABLE void enteringInvoked() {
+ m_invocationOrder << QLatin1String("Entering");
+ }
+ Q_INVOKABLE void callbackInvoked() {
+ m_invocationOrder << QLatin1String("Callback");
+ }
+
+protected:
+ void entering() {
+ enteringInvoked();
+ }
+private:
+ QStringList m_invocationOrder;
+};
+
+class EnteringGui : public PackageManagerGui
+{
+ Q_OBJECT
+public:
+ explicit EnteringGui(PackageManagerCore *core)
+ : PackageManagerGui(core)
+ {}
+
+ EnteringPage *enteringPage() const {
+ return m_enteringPage;
+ }
+
+ void init() {
+ m_enteringPage = new EnteringPage(packageManagerCore());
+ setPage(0, m_enteringPage);
+ }
+private:
+ EnteringPage *m_enteringPage;
+};
+
class EmitSignalObject : public QObject
{
Q_OBJECT
@@ -377,6 +426,21 @@ private slots:
QCOMPARE(gui.widget()->property("complete").toString(), QString("true"));
}
+ void checkEnteringCalledBeforePageCallback()
+ {
+ EnteringGui gui(&m_core);
+ gui.init();
+ setExpectedScriptOutput("Loaded control script \":///data/enteringpage.qs\" ");
+ gui.loadControlScript(":///data/enteringpage.qs");
+ gui.show();
+
+ EnteringPage *enteringPage = gui.enteringPage();
+
+ QStringList expectedOrder;
+ expectedOrder << QLatin1String("Entering") << QLatin1String("Callback");
+ QCOMPARE(enteringPage->invocationOrder(), expectedOrder);
+ }
+
private:
void setExpectedScriptOutput(const char *message)
{