summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/quicktestbrowser/BrowserWindow.qml (renamed from tests/quicktestbrowser/quickwindow.qml)0
-rw-r--r--tests/quicktestbrowser/main.cpp28
-rw-r--r--tests/quicktestbrowser/quicktestbrowser.pro12
-rw-r--r--tests/quicktestbrowser/quickwindow.cpp66
-rw-r--r--tests/quicktestbrowser/resources.qrc2
-rw-r--r--tests/quicktestbrowser/util.h73
-rw-r--r--tests/quicktestbrowser/utils.h (renamed from tests/quicktestbrowser/quickwindow.h)24
7 files changed, 46 insertions, 159 deletions
diff --git a/tests/quicktestbrowser/quickwindow.qml b/tests/quicktestbrowser/BrowserWindow.qml
index d840ac7d0..d840ac7d0 100644
--- a/tests/quicktestbrowser/quickwindow.qml
+++ b/tests/quicktestbrowser/BrowserWindow.qml
diff --git a/tests/quicktestbrowser/main.cpp b/tests/quicktestbrowser/main.cpp
index d44f644c3..c81b92794 100644
--- a/tests/quicktestbrowser/main.cpp
+++ b/tests/quicktestbrowser/main.cpp
@@ -39,7 +39,8 @@
**
****************************************************************************/
-#include "quickwindow.h"
+#include "utils.h"
+
#ifndef QT_NO_WIDGETS
#include <QtWidgets/QApplication>
typedef QApplication Application;
@@ -47,7 +48,24 @@ typedef QApplication Application;
#include <QtGui/QGuiApplication>
typedef QGuiApplication Application;
#endif
-#include <qtwebengineglobal.h>
+#include <QtQml/QQmlApplicationEngine>
+#include <QtQml/QQmlContext>
+#include <QtWebEngine/qtwebengineglobal.h>
+
+static QUrl startupUrl()
+{
+ QUrl ret;
+ QStringList args(qApp->arguments());
+ args.takeFirst();
+ Q_FOREACH (const QString& arg, args) {
+ if (arg.startsWith(QLatin1Char('-')))
+ continue;
+ ret = Utils::fromUserInput(arg);
+ if (ret.isValid())
+ return ret;
+ }
+ return QUrl(QStringLiteral("http://qt.io/"));
+}
int main(int argc, char **argv)
{
@@ -58,7 +76,11 @@ int main(int argc, char **argv)
qputenv("QTWEBENGINE_REMOTE_DEBUGGING", "1337");
QtWebEngine::initialize();
- ApplicationEngine appEngine;
+ QQmlApplicationEngine appEngine;
+ Utils utils;
+ appEngine.rootContext()->setContextProperty("utils", &utils);
+ appEngine.load(QUrl("qrc:/BrowserWindow.qml"));
+ QMetaObject::invokeMethod(appEngine.rootObjects().first(), "load", Q_ARG(QVariant, startupUrl()));
return app.exec();
}
diff --git a/tests/quicktestbrowser/quicktestbrowser.pro b/tests/quicktestbrowser/quicktestbrowser.pro
index 942a54c7d..898370b2c 100644
--- a/tests/quicktestbrowser/quicktestbrowser.pro
+++ b/tests/quicktestbrowser/quicktestbrowser.pro
@@ -5,16 +5,14 @@ TARGET = quicktestbrowser
macx: CONFIG -= app_bundle
-HEADERS = quickwindow.h \
- util.h
-SOURCES = quickwindow.cpp \
- main.cpp
+HEADERS = utils.h
+SOURCES = main.cpp
-OTHER_FILES += ButtonWithMenu.qml \
+OTHER_FILES += BrowserWindow.qml \
+ ButtonWithMenu.qml \
ContextMenuExtras.qml \
DownloadView.qml \
- FeaturePermissionBar.qml \
- quickwindow.qml
+ FeaturePermissionBar.qml
RESOURCES += resources.qrc
diff --git a/tests/quicktestbrowser/quickwindow.cpp b/tests/quicktestbrowser/quickwindow.cpp
deleted file mode 100644
index ec7b6f94a..000000000
--- a/tests/quicktestbrowser/quickwindow.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWebEngine module 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 "quickwindow.h"
-
-#include "util.h"
-
-#include <QFileInfo>
-#include <QObject>
-#include <QQmlContext>
-#include <QQmlEngine>
-#include <QUrl>
-
-class Utils : public QObject {
- Q_OBJECT
-public:
- Utils(QObject* parent = 0) : QObject(parent) { }
- Q_INVOKABLE static QUrl fromUserInput(const QString& userInput) { return urlFromUserInput(userInput); }
-};
-
-#include "quickwindow.moc"
-
-ApplicationEngine::ApplicationEngine()
-{
- rootContext()->setContextProperty("utils", new Utils(this));
- load(QUrl("qrc:/quickwindow.qml"));
- QMetaObject::invokeMethod(rootObjects().first(), "load", Q_ARG(QVariant, startupUrl()));
-}
diff --git a/tests/quicktestbrowser/resources.qrc b/tests/quicktestbrowser/resources.qrc
index 3c9fd5dd7..7bb41b1aa 100644
--- a/tests/quicktestbrowser/resources.qrc
+++ b/tests/quicktestbrowser/resources.qrc
@@ -1,6 +1,6 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/">
- <file>quickwindow.qml</file>
+ <file>BrowserWindow.qml</file>
<file>ContextMenuExtras.qml</file>
<file>FeaturePermissionBar.qml</file>
<file>ButtonWithMenu.qml</file>
diff --git a/tests/quicktestbrowser/util.h b/tests/quicktestbrowser/util.h
deleted file mode 100644
index 85db8c25b..000000000
--- a/tests/quicktestbrowser/util.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWebEngine module 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 UTIL_H
-#define UTIL_H
-
-#include <QtCore/QCoreApplication>
-#include <QtCore/QFileInfo>
-#include <QtCore/QUrl>
-#include <QtCore/QStringList>
-
-QUrl urlFromUserInput(const QString& userInput)
-{
- QFileInfo fileInfo(userInput);
- if (fileInfo.exists())
- return QUrl::fromLocalFile(fileInfo.absoluteFilePath());
- return QUrl::fromUserInput(userInput);
-}
-
-QUrl startupUrl()
-{
- QUrl ret;
- QStringList args(qApp->arguments());
- args.takeFirst();
- Q_FOREACH (const QString& arg, args) {
- if (arg.startsWith(QLatin1Char('-')))
- continue;
- ret = urlFromUserInput(arg);
- if (ret.isValid())
- return ret;
- }
- return QUrl(QStringLiteral("http://qt-project.org/"));
-}
-
-
-#endif // UTIL_H
diff --git a/tests/quicktestbrowser/quickwindow.h b/tests/quicktestbrowser/utils.h
index ed25a23b8..3cb3fec5d 100644
--- a/tests/quicktestbrowser/quickwindow.h
+++ b/tests/quicktestbrowser/utils.h
@@ -38,18 +38,24 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+#ifndef UTILS_H
+#define UTILS_H
-#ifndef QUICKWINDOW_H
-#define QUICKWINDOW_H
+#include <QtCore/QFileInfo>
+#include <QtCore/QUrl>
-#include <QQmlApplicationEngine>
-
-class QWebEngineView;
-
-class ApplicationEngine : public QQmlApplicationEngine {
+class Utils : public QObject {
Q_OBJECT
public:
- ApplicationEngine();
+ Q_INVOKABLE static QUrl fromUserInput(const QString& userInput);
};
-#endif // QUICKWINDOW_H
+inline QUrl Utils::fromUserInput(const QString& userInput)
+{
+ QFileInfo fileInfo(userInput);
+ if (fileInfo.exists())
+ return QUrl::fromLocalFile(fileInfo.absoluteFilePath());
+ return QUrl::fromUserInput(userInput);
+}
+
+#endif // UTILS_H