summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@nokia.com>2011-06-15 07:15:48 (GMT)
committerKai Koehne <kai.koehne@nokia.com>2011-06-15 07:18:31 (GMT)
commitf4cd86c5a147c91f8ab671627b96606b373bcc2d (patch)
treeab14f60c6cf6a8fef0f2f57a3902238536c43146 /tests/auto
parent26a265924055bf8ccc74728620711b9f44626cb1 (diff)
downloadQt-f4cd86c5a147c91f8ab671627b96606b373bcc2d.zip
Qt-f4cd86c5a147c91f8ab671627b96606b373bcc2d.tar.gz
Qt-f4cd86c5a147c91f8ab671627b96606b373bcc2d.tar.bz2
Fix js debugging autotest on Windows + Add license header
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/qdeclarativedebugjs/app/main.cpp41
-rw-r--r--tests/auto/declarative/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp34
-rw-r--r--tests/auto/declarative/qdeclarativedebugjs/tst_qdeclarativedebugjs.pro2
3 files changed, 65 insertions, 12 deletions
diff --git a/tests/auto/declarative/qdeclarativedebugjs/app/main.cpp b/tests/auto/declarative/qdeclarativedebugjs/app/main.cpp
index 22f22e8..f5b830e 100644
--- a/tests/auto/declarative/qdeclarativedebugjs/app/main.cpp
+++ b/tests/auto/declarative/qdeclarativedebugjs/app/main.cpp
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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, Nokia gives you certain additional
+** rights. These rights are described in the Nokia 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.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#include <QApplication>
#include <QDebug>
#include <QDeclarativeComponent>
diff --git a/tests/auto/declarative/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp b/tests/auto/declarative/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp
index ca735b7..a40bcc0 100644
--- a/tests/auto/declarative/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp
+++ b/tests/auto/declarative/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp
@@ -338,13 +338,16 @@ QJSDebugProcess::QJSDebugProcess()
QJSDebugProcess::~QJSDebugProcess()
{
- m_process.terminate();
- m_process.waitForFinished();
+ if (m_process.state() != QProcess::NotRunning) {
+ m_process.kill();
+ m_process.waitForFinished(5000);
+ }
}
void QJSDebugProcess::start(const QStringList &arguments)
{
- m_process.start("app/app", arguments);
+ QString currentDir = QFileInfo(__FILE__).absoluteDir().absolutePath();
+ m_process.start(currentDir + "/app/app", arguments);
m_timer.start();
}
@@ -358,16 +361,25 @@ bool QJSDebugProcess::waitForStarted()
void QJSDebugProcess::processAppOutput()
{
const QString appOutput = m_process.readAll();
- if (appOutput.startsWith("Qml debugging is enabled")) // ignore
- return;
- if (appOutput.startsWith("QDeclarativeDebugServer:")) { // ignore
- if (appOutput.contains("Waiting for connection ")) {
- m_started = true;
- m_eventLoop.quit();
+ static QRegExp newline("[\n\r]{1,2}");
+ QStringList lines = appOutput.split(newline);
+ foreach (const QString &line, lines) {
+ if (line.isEmpty())
+ continue;
+ if (line.startsWith("Qml debugging is enabled")) // ignore
+ continue;
+ if (line.startsWith("QDeclarativeDebugServer:")) {
+ if (line.contains("Waiting for connection ")) {
+ m_started = true;
+ m_eventLoop.quit();
+ continue;
+ }
+ if (line.contains("Connection established")) {
+ continue;
+ }
}
- return;
+ qDebug() << line;
}
- qDebug() << appOutput;
}
inline QString TEST_FILE(const QString &filename)
diff --git a/tests/auto/declarative/qdeclarativedebugjs/tst_qdeclarativedebugjs.pro b/tests/auto/declarative/qdeclarativedebugjs/tst_qdeclarativedebugjs.pro
index dc6d2ff..8aea1b5 100644
--- a/tests/auto/declarative/qdeclarativedebugjs/tst_qdeclarativedebugjs.pro
+++ b/tests/auto/declarative/qdeclarativedebugjs/tst_qdeclarativedebugjs.pro
@@ -1,5 +1,5 @@
load(qttest_p4)
-contains(QT_CONFIG,declarative): QT += declarative script
+contains(QT_CONFIG,declarative): QT += declarative network script
macx:CONFIG -= app_bundle
HEADERS += ../shared/debugutil_p.h