diff options
Diffstat (limited to 'src/qmltest')
-rw-r--r-- | src/qmltest/qmltest.pro | 4 | ||||
-rw-r--r-- | src/qmltest/qtestoptions_p.h | 14 | ||||
-rw-r--r-- | src/qmltest/quicktest.cpp | 21 | ||||
-rw-r--r-- | src/qmltest/quicktest.h | 14 | ||||
-rw-r--r-- | src/qmltest/quicktestevent.cpp | 41 | ||||
-rw-r--r-- | src/qmltest/quicktestevent_p.h | 16 | ||||
-rw-r--r-- | src/qmltest/quicktestglobal.h | 14 | ||||
-rw-r--r-- | src/qmltest/quicktestresult.cpp | 23 | ||||
-rw-r--r-- | src/qmltest/quicktestresult_p.h | 14 |
9 files changed, 97 insertions, 64 deletions
diff --git a/src/qmltest/qmltest.pro b/src/qmltest/qmltest.pro index 04588f110c..24b87588b8 100644 --- a/src/qmltest/qmltest.pro +++ b/src/qmltest/qmltest.pro @@ -5,8 +5,8 @@ QT = core QT_PRIVATE = testlib-private quick qml-private gui core-private # Testlib is only a private dependency, which results in our users not -# inheriting CONFIG+=console transitively. Make it explicit. -MODULE_CONFIG = console +# inheriting testlibs's MODULE_CONFIG transitively. Make it explicit. +MODULE_CONFIG += $${QT.testlib.CONFIG} qtHaveModule(widgets) { QT += widgets diff --git a/src/qmltest/qtestoptions_p.h b/src/qmltest/qtestoptions_p.h index 76b8ceefb1..af6764f98b 100644 --- a/src/qmltest/qtestoptions_p.h +++ b/src/qmltest/qtestoptions_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtTest module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** 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 +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp index 74732ee3c2..5e9712d202 100644 --- a/src/qmltest/quicktest.cpp +++ b/src/qmltest/quicktest.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** 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 +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -215,9 +215,11 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD // Look for QML-specific command-line options. // -import dir Specify an import directory. + // -plugins dir Specify a directory where to search for plugins. // -input dir Specify the input directory for test cases. // -translation file Specify the translation file. QStringList imports; + QStringList pluginPaths; QString testPath; QString translationFile; int index = 1; @@ -228,6 +230,9 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD if (strcmp(argv[index], "-import") == 0 && (index + 1) < argc) { imports += stripQuotes(QString::fromLocal8Bit(argv[index + 1])); index += 2; + } else if (strcmp(argv[index], "-plugins") == 0 && (index + 1) < argc) { + pluginPaths += stripQuotes(QString::fromLocal8Bit(argv[index + 1])); + index += 2; } else if (strcmp(argv[index], "-input") == 0 && (index + 1) < argc) { testPath = stripQuotes(QString::fromLocal8Bit(argv[index + 1])); index += 2; @@ -327,6 +332,8 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD (QLatin1String("qtest"), QTestRootObject::instance()); // Deprecated. Use QTestRootObject from Qt.test.qtestroot instead foreach (const QString &path, imports) view->engine()->addImportPath(path); + foreach (const QString &path, pluginPaths) + view->engine()->addPluginPath(path); foreach (const QString &file, files) { const QFileInfo fi(file); if (!fi.exists()) diff --git a/src/qmltest/quicktest.h b/src/qmltest/quicktest.h index aa34e0f19a..49bd7edfaa 100644 --- a/src/qmltest/quicktest.h +++ b/src/qmltest/quicktest.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** 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 +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/qmltest/quicktestevent.cpp b/src/qmltest/quicktestevent.cpp index 907d2c0673..df8de14c14 100644 --- a/src/qmltest/quicktestevent.cpp +++ b/src/qmltest/quicktestevent.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** 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 +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -111,7 +111,7 @@ namespace QTest { namespace QtQuickTest { - enum MouseAction { MousePress, MouseRelease, MouseClick, MouseDoubleClick, MouseMove }; + enum MouseAction { MousePress, MouseRelease, MouseClick, MouseDoubleClick, MouseMove, MouseDoubleClickSequence }; static void mouseEvent(MouseAction action, QWindow *window, QObject *item, Qt::MouseButton button, @@ -131,6 +131,15 @@ namespace QtQuickTest return; } + if (action == MouseDoubleClickSequence) { + mouseEvent(MousePress, window, item, button, stateKey, _pos); + mouseEvent(MouseRelease, window, item, button, stateKey, _pos); + mouseEvent(MousePress, window, item, button, stateKey, _pos); + mouseEvent(MouseDoubleClick, window, item, button, stateKey, _pos); + mouseEvent(MouseRelease, window, item, button, stateKey, _pos); + return; + } + QPoint pos; QQuickItem *sgitem = qobject_cast<QQuickItem *>(item); if (sgitem) @@ -162,7 +171,7 @@ namespace QtQuickTest QSpontaneKeyEvent::setSpontaneous(&me); if (!qApp->notify(window, &me)) { static const char *mouseActionNames[] = - { "MousePress", "MouseRelease", "MouseClick", "MouseDoubleClick", "MouseMove" }; + { "MousePress", "MouseRelease", "MouseClick", "MouseDoubleClick", "MouseMove", "MouseDoubleClickSequence" }; QString warning = QString::fromLatin1("Mouse event \"%1\" not accepted by receiving window"); QWARN(warning.arg(QString::fromLatin1(mouseActionNames[static_cast<int>(action)])).toLatin1().data()); } @@ -269,6 +278,20 @@ bool QuickTestEvent::mouseDoubleClick return true; } +bool QuickTestEvent::mouseDoubleClickSequence + (QObject *item, qreal x, qreal y, int button, + int modifiers, int delay) +{ + QWindow *view = eventWindow(); + if (!view) + return false; + QtQuickTest::mouseEvent(QtQuickTest::MouseDoubleClickSequence, view, item, + Qt::MouseButton(button), + Qt::KeyboardModifiers(modifiers), + QPointF(x, y), delay); + return true; +} + bool QuickTestEvent::mouseMove (QObject *item, qreal x, qreal y, int delay, int buttons) { diff --git a/src/qmltest/quicktestevent_p.h b/src/qmltest/quicktestevent_p.h index 5176019d01..b7f8f3eda2 100644 --- a/src/qmltest/quicktestevent_p.h +++ b/src/qmltest/quicktestevent_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** 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 +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -63,6 +63,8 @@ public Q_SLOTS: int modifiers, int delay); bool mouseDoubleClick(QObject *item, qreal x, qreal y, int button, int modifiers, int delay); + bool mouseDoubleClickSequence(QObject *item, qreal x, qreal y, int button, + int modifiers, int delay); bool mouseMove(QObject *item, qreal x, qreal y, int delay, int buttons); #ifndef QT_NO_WHEELEVENT diff --git a/src/qmltest/quicktestglobal.h b/src/qmltest/quicktestglobal.h index 300280ef58..15da6b93fa 100644 --- a/src/qmltest/quicktestglobal.h +++ b/src/qmltest/quicktestglobal.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** 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 +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/qmltest/quicktestresult.cpp b/src/qmltest/quicktestresult.cpp index 868a378318..3f91ce85a8 100644 --- a/src/qmltest/quicktestresult.cpp +++ b/src/qmltest/quicktestresult.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** 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 +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -475,13 +475,12 @@ void QuickTestResult::stringify(QQmlV4Function *args) QV4::ScopedValue value(scope, (*args)[0]); QString result; - QV8Engine *engine = args->engine(); //Check for Object Type if (value->isObject() && !value->asFunctionObject() && !value->asArrayObject()) { - QVariant v = engine->toVariant(value, QMetaType::UnknownType); + QVariant v = scope.engine->toVariant(value, QMetaType::UnknownType); if (v.isValid()) { switch (v.type()) { case QVariant::Vector3D: @@ -497,7 +496,9 @@ void QuickTestResult::stringify(QQmlV4Function *args) } else { result = QLatin1String("Object"); } - } else { + } + + if (result.isEmpty()) { QString tmp = value->toQStringNoThrow(); if (value->asArrayObject()) result.append(QString::fromLatin1("[%1]").arg(tmp)); @@ -505,7 +506,7 @@ void QuickTestResult::stringify(QQmlV4Function *args) result.append(tmp); } - args->setReturnValue(args->engine()->toString(result)); + args->setReturnValue(QV4::Encode(args->v4engine()->newString(result))); } bool QuickTestResult::compare diff --git a/src/qmltest/quicktestresult_p.h b/src/qmltest/quicktestresult_p.h index 0da29e8bd4..80f84bfa55 100644 --- a/src/qmltest/quicktestresult_p.h +++ b/src/qmltest/quicktestresult_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** 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 +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ |