From ed38067e63cebfe8973992d37852436d305348bd Mon Sep 17 00:00:00 2001 From: Rainer Keller Date: Fri, 8 May 2015 09:18:03 +0200 Subject: Avoid namespacing QTEST_MAIN The test tries to be smart but it won't work once GPU blacklists are supported because QTEST_MAIN will contain some imports that cannot be namespaced. Change-Id: Id0538cf1ba3885736d8b177e64064bd06f8fef2e Reviewed-by: Laszlo Agocs Reviewed-by: Kai Koehne --- .../debugger/qqmldebuggingenabler/data/test.qml | 52 ------ .../qqmldebuggingenabler/qqmldebuggingenabler.pro | 15 +- .../qqmldebuggingenabler/data/test.qml | 52 ++++++ .../qqmldebuggingenabler/qqmldebuggingenabler.pro | 13 ++ .../tst_qqmldebuggingenabler.cpp | 168 ++++++++++++++++++ .../qqmldebuggingenablerserver.cpp | 66 +++++++ .../qqmldebuggingenablerserver.pro | 11 ++ .../tst_qqmldebuggingenabler.cpp | 189 --------------------- 8 files changed, 313 insertions(+), 253 deletions(-) delete mode 100644 tests/auto/qml/debugger/qqmldebuggingenabler/data/test.qml create mode 100644 tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/data/test.qml create mode 100644 tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/qqmldebuggingenabler.pro create mode 100644 tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp create mode 100644 tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.cpp create mode 100644 tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.pro delete mode 100644 tests/auto/qml/debugger/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp (limited to 'tests') diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/data/test.qml b/tests/auto/qml/debugger/qqmldebuggingenabler/data/test.qml deleted file mode 100644 index 5a7fa718f2..0000000000 --- a/tests/auto/qml/debugger/qqmldebuggingenabler/data/test.qml +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** 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. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** 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 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 -** 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. -** -** 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$ -** -****************************************************************************/ - -import QtQuick 2.0 - -//DO NOT CHANGE - -Item { - Component.onCompleted: { - var a = [1, 2] - var b = {a: "hello", d: 1 } - var c - var d = 12 - } - function foo() { - var a = [1, 2] - var b = {a: "hello", d: 1 } - var c - var d = 12 - } -} - diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler.pro b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler.pro index eb41f759c9..4bcbc2a97e 100644 --- a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler.pro +++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler.pro @@ -1,13 +1,4 @@ -CONFIG += testcase -TARGET = tst_qqmldebuggingenabler -QT += qml testlib gui-private core-private -osx:CONFIG -= app_bundle +TEMPLATE = subdirs +SUBDIRS = qqmldebuggingenabler qqmldebuggingenablerserver -SOURCES += tst_qqmldebuggingenabler.cpp - -INCLUDEPATH += ../shared -include(../../../shared/util.pri) -include(../shared/debugutil.pri) - -OTHER_FILES += data/test.qml -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 QT_QML_DEBUG_NO_WARNING +qqmldebuggingenabler.depends = qqmldebuggingenablerserver diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/data/test.qml b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/data/test.qml new file mode 100644 index 0000000000..5a7fa718f2 --- /dev/null +++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/data/test.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** 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. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 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 +** 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. +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 + +//DO NOT CHANGE + +Item { + Component.onCompleted: { + var a = [1, 2] + var b = {a: "hello", d: 1 } + var c + var d = 12 + } + function foo() { + var a = [1, 2] + var b = {a: "hello", d: 1 } + var c + var d = 12 + } +} + diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/qqmldebuggingenabler.pro b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/qqmldebuggingenabler.pro new file mode 100644 index 0000000000..f8014f04f4 --- /dev/null +++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/qqmldebuggingenabler.pro @@ -0,0 +1,13 @@ +CONFIG += testcase +TARGET = tst_qqmldebuggingenabler +QT += qml testlib gui-private core-private +CONFIG -= debug_and_release_target +osx:CONFIG -= app_bundle + +SOURCES += tst_qqmldebuggingenabler.cpp + +INCLUDEPATH += ../../shared +include(../../../../shared/util.pri) +include(../../shared/debugutil.pri) + +OTHER_FILES += data/test.qml diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp new file mode 100644 index 0000000000..4ab1ac0a4c --- /dev/null +++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp @@ -0,0 +1,168 @@ +/**************************************************************************** +** +** 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. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 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 +** 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. +** +** 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$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include + +#include "debugutil_p.h" +#include "qqmldebugclient.h" +#include "../../../shared/util.h" + +class tst_QQmlDebuggingEnabler : public QQmlDataTest +{ + Q_OBJECT + + bool init(bool blockMode, bool qmlscene, int portFrom, int portTo); + +private slots: + void initTestCase(); + void cleanupTestCase(); + void cleanup(); + void qmlscene(); + void qmlsceneBlock(); + + void custom(); + void customBlock(); + +private: + QQmlDebugProcess *process; + QQmlDebugConnection *connection; + QTime t; +}; + +void tst_QQmlDebuggingEnabler::initTestCase() +{ + QQmlDataTest::initTestCase(); + t.start(); + process = 0; + connection = 0; +} + +void tst_QQmlDebuggingEnabler::cleanupTestCase() +{ + if (process) { + process->stop(); + delete process; + } + + if (connection) + delete connection; +} + +bool tst_QQmlDebuggingEnabler::init(bool blockMode, bool qmlscene, int portFrom, int portTo) +{ + connection = new QQmlDebugConnection(); + + if (qmlscene) { + process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this); + process->setMaximumBindErrors(1); + } else { + process = new QQmlDebugProcess(QCoreApplication::applicationDirPath() + QLatin1String("/qqmldebuggingenablerserver"), this); + process->setMaximumBindErrors(portTo - portFrom); + } + + if (qmlscene) { + process->start(QStringList() << QLatin1String("-qmljsdebugger=port:") + + QString::number(portFrom) + QLatin1String(",") + QString::number(portTo) + + QLatin1String(blockMode ? ",block": "") << + testFile(QLatin1String("test.qml"))); + } else { + QStringList args; + if (blockMode) + args << QLatin1String("-block"); + args << QString::number(portFrom) << QString::number(portTo); + process->start(args); + } + + if (!process->waitForSessionStart()) { + return false; + } + + const int port = process->debugPort(); + connection->connectToHost("127.0.0.1", port); + if (!connection->waitForConnected()) { + qDebug() << "could not connect to host!"; + return false; + } + return true; +} + +void tst_QQmlDebuggingEnabler::cleanup() +{ + if (QTest::currentTestFailed()) { + qDebug() << "Process State:" << process->state(); + qDebug() << "Application Output:" << process->output(); + } + + if (process) { + process->stop(); + delete process; + } + + + if (connection) + delete connection; + + process = 0; + connection = 0; +} + +void tst_QQmlDebuggingEnabler::qmlscene() +{ + QVERIFY(init(false, true, 5555, 5565)); +} + +void tst_QQmlDebuggingEnabler::qmlsceneBlock() +{ + QVERIFY(init(true, true, 5555, 5565)); +} + +void tst_QQmlDebuggingEnabler::custom() +{ + QVERIFY(init(false, false, 5555, 5565)); +} + +void tst_QQmlDebuggingEnabler::customBlock() +{ + QVERIFY(init(true, false, 5555, 5565)); +} + +QTEST_MAIN(tst_QQmlDebuggingEnabler) + +#include "tst_qqmldebuggingenabler.moc" + diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.cpp b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.cpp new file mode 100644 index 0000000000..68279413e0 --- /dev/null +++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** 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. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 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 +** 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. +** +** 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$ +** +****************************************************************************/ + +#include "debugutil_p.h" +#include + +int main(int argc, char *argv[]) +{ + bool block = false; + int portFrom = 0; + int portTo = 0; + + QCoreApplication app(argc, argv); + QStringList arguments = app.arguments(); + arguments.removeFirst(); + + if (arguments.size() && arguments.first() == QLatin1String("-block")) { + block = true; + arguments.removeFirst(); + } + + if (arguments.size() >= 2) { + portFrom = arguments.takeFirst().toInt(); + portTo = arguments.takeFirst().toInt(); + } + + if (!portFrom || !portTo) + qFatal("Port range has to be specified."); + + while (portFrom <= portTo) + QQmlDebuggingEnabler::startTcpDebugServer(portFrom++, block); + QQmlEngine engine; + Q_UNUSED(engine); + return app.exec(); +} + diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.pro b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.pro new file mode 100644 index 0000000000..fdd9ce8f11 --- /dev/null +++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenablerserver/qqmldebuggingenablerserver.pro @@ -0,0 +1,11 @@ +QT += qml testlib +osx:CONFIG -= app_bundle +CONFIG -= debug_and_release_target +INCLUDEPATH += ../../shared +SOURCES += qqmldebuggingenablerserver.cpp +DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 QT_QML_DEBUG_NO_WARNING + +DESTDIR = ../qqmldebuggingenabler + +target.path = $$[QT_INSTALL_TESTS]/tst_qqmldebuggingenabler +INSTALLS += target diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp b/tests/auto/qml/debugger/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp deleted file mode 100644 index 73abc03e28..0000000000 --- a/tests/auto/qml/debugger/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/**************************************************************************** -** -** 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. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** 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 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 -** 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. -** -** 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$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include - -#include "debugutil_p.h" -#include "qqmldebugclient.h" -#include "../../../shared/util.h" - -class tst_QQmlDebuggingEnabler : public QQmlDataTest -{ - Q_OBJECT - - bool init(bool blockMode, bool qmlscene, int portFrom, int portTo); - -private slots: - void initTestCase(); - void cleanupTestCase(); - void cleanup(); - void qmlscene(); - void qmlsceneBlock(); - - void custom(); - void customBlock(); - -private: - QQmlDebugProcess *process; - QQmlDebugConnection *connection; - QTime t; -}; - -void tst_QQmlDebuggingEnabler::initTestCase() -{ - QQmlDataTest::initTestCase(); - t.start(); - process = 0; - connection = 0; -} - -void tst_QQmlDebuggingEnabler::cleanupTestCase() -{ - if (process) { - process->stop(); - delete process; - } - - if (connection) - delete connection; -} - -bool tst_QQmlDebuggingEnabler::init(bool blockMode, bool qmlscene, int portFrom, int portTo) -{ - connection = new QQmlDebugConnection(); - - if (qmlscene) { - process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this); - process->setMaximumBindErrors(1); - } else { - process = new QQmlDebugProcess(QCoreApplication::applicationFilePath(), this); - process->setMaximumBindErrors(portTo - portFrom); - } - - if (qmlscene) { - process->start(QStringList() << QLatin1String("-qmljsdebugger=port:") + - QString::number(portFrom) + QLatin1String(",") + QString::number(portTo) + - QLatin1String(blockMode ? ",block": "") << - testFile(QLatin1String("test.qml"))); - } else { - QStringList args; - args << QLatin1String("-server"); - if (blockMode) - args << QLatin1String("-block"); - args << QString::number(portFrom) << QString::number(portTo); - process->start(args); - } - - if (!process->waitForSessionStart()) { - return false; - } - - const int port = process->debugPort(); - connection->connectToHost("127.0.0.1", port); - if (!connection->waitForConnected()) { - qDebug() << "could not connect to host!"; - return false; - } - return true; -} - -void tst_QQmlDebuggingEnabler::cleanup() -{ - if (QTest::currentTestFailed()) { - qDebug() << "Process State:" << process->state(); - qDebug() << "Application Output:" << process->output(); - } - - if (process) { - process->stop(); - delete process; - } - - - if (connection) - delete connection; - - process = 0; - connection = 0; -} - -void tst_QQmlDebuggingEnabler::qmlscene() -{ - QVERIFY(init(false, true, 5555, 5565)); -} - -void tst_QQmlDebuggingEnabler::qmlsceneBlock() -{ - QVERIFY(init(true, true, 5555, 5565)); -} - -void tst_QQmlDebuggingEnabler::custom() -{ - QVERIFY(init(false, false, 5555, 5565)); -} - -void tst_QQmlDebuggingEnabler::customBlock() -{ - QVERIFY(init(true, false, 5555, 5565)); -} - -namespace QQmlDebuggingEnablerTest { - QTEST_MAIN(tst_QQmlDebuggingEnabler) -} - -int main(int argc, char *argv[]) -{ - if (argc > 1 && QLatin1String(argv[1]) == QLatin1String("-server")) { - int one = 1; - QCoreApplication app(one, argv); - bool block = argc > 2 && QLatin1String(argv[2]) == QLatin1String("-block"); - int portFrom = QString(QLatin1String(argv[argc - 2])).toInt(); - int portTo = QString(QLatin1String(argv[argc - 1])).toInt(); - while (portFrom <= portTo) - QQmlDebuggingEnabler::startTcpDebugServer(portFrom++, block); - QQmlEngine engine; - Q_UNUSED(engine); - app.exec(); - } else { - QQmlDebuggingEnablerTest::main(argc, argv); - } -} - -#include "tst_qqmldebuggingenabler.moc" - -- cgit v1.2.3