From f0ba75d407f72de60306e4505e9ebd259e5e287c Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 18 Dec 2013 12:07:38 +0100 Subject: tst_qquickpathview: Use QCOMPARE instead of QVERIFY. Attempting to get some diagnostic output for the failues. Task-number: QTBUG-35705 Change-Id: Iffebae89743c31e88125c0b1e21be172d3373b05 Reviewed-by: Frederik Gladhorn --- tests/auto/quick/qquickpathview/tst_qquickpathview.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp index 81d1bbd01d..2c868231c8 100644 --- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp +++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp @@ -793,7 +793,7 @@ void tst_QQuickPathView::dataModel() QCOMPARE(window->rootObject()->property("viewCount").toInt(), model.count()); QTRY_COMPARE(findItems(pathview, "wrapper").count(), 14); - QVERIFY(pathview->currentIndex() == 0); + QCOMPARE(pathview->currentIndex(), 0); QCOMPARE(pathview->currentItem(), findItem(pathview, "wrapper", 0)); QQuickText *text = findItem(pathview, "myText", 4); @@ -826,7 +826,7 @@ void tst_QQuickPathView::dataModel() QTest::qWait(100); QTRY_COMPARE(findItems(pathview, "wrapper").count(), 5); - QVERIFY(pathview->currentIndex() == 1); + QCOMPARE(pathview->currentIndex(), 1); QCOMPARE(pathview->currentItem(), findItem(pathview, "wrapper", 1)); text = findItem(pathview, "myText", 2); @@ -1876,7 +1876,7 @@ void tst_QQuickPathView::snapToItem() if (enforceRange) QVERIFY(pathview->currentIndex() != currentIndex); else - QVERIFY(pathview->currentIndex() == currentIndex); + QCOMPARE(pathview->currentIndex(), currentIndex); } @@ -1908,7 +1908,7 @@ void tst_QQuickPathView::snapOneItem() QSignalSpy snapModeSpy(pathview, SIGNAL(snapModeChanged())); window->rootObject()->setProperty("snapOne", true); - QVERIFY(snapModeSpy.count() == 1); + QCOMPARE(snapModeSpy.count(), 1); QTRY_VERIFY(!pathview->isMoving()); // ensure stable int currentIndex = pathview->currentIndex(); @@ -1923,9 +1923,9 @@ void tst_QQuickPathView::snapOneItem() QCOMPARE(pathview->offset(), fmodf(3.0 + startOffset - 1.0, 3.0)); if (enforceRange) - QVERIFY(pathview->currentIndex() == currentIndex+1); + QCOMPARE(pathview->currentIndex(), currentIndex + 1); else - QVERIFY(pathview->currentIndex() == currentIndex); + QCOMPARE(pathview->currentIndex(), currentIndex); } @@ -2061,7 +2061,7 @@ void tst_QQuickPathView::cacheItemCount() pathview->setOffset(0); pathview->setCacheItemCount(3); - QVERIFY(pathview->cacheItemCount() == 3); + QCOMPARE(pathview->cacheItemCount(), 3); QQmlIncubationController controller; window->engine()->setIncubationController(&controller); -- cgit v1.2.3 From 51f4f6f0c376607543cf046fb27b199aecac0912 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 9 Jan 2014 09:18:44 +0100 Subject: Fix nodetest autotest. GL context was initialized with the wrong surface format resulting in warnings, and we did not clean up the render context properly. Change-Id: I19f748ca985a0becf1f7a6caa987f21567029cfd Reviewed-by: Laszlo Agocs Reviewed-by: Alex Montgomery --- tests/auto/quick/nodes/tst_nodestest.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/quick/nodes/tst_nodestest.cpp b/tests/auto/quick/nodes/tst_nodestest.cpp index d07fd7177d..7c84cdb5cf 100644 --- a/tests/auto/quick/nodes/tst_nodestest.cpp +++ b/tests/auto/quick/nodes/tst_nodestest.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** -** This file is part of the Qt scene graph research project. +** This file is part of the test suite of the Qt toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -97,6 +97,8 @@ void NodesTest::initTestCase() void NodesTest::cleanupTestCase() { + renderContext->invalidate(); + delete renderContext; context->doneCurrent(); delete context; delete surface; -- cgit v1.2.3 From c70b046648522c8a899fc1fa6e4d4a5924206313 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 14 Jan 2014 12:31:39 +0100 Subject: Fix some compiler warnings in tests and examples. Change-Id: Ia739c995005635caf6fd0bd4e495ed8567350e83 Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com> --- tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp | 1 + tests/auto/quick/qquickimage/tst_qquickimage.cpp | 1 + tests/auto/quick/qquickview/tst_qquickview.cpp | 4 ---- 3 files changed, 2 insertions(+), 4 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp b/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp index 4f21231184..553663ac22 100644 --- a/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp +++ b/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp @@ -676,6 +676,7 @@ void tst_qqmlcontext::qobjectDerived() QQmlContext context(engine.rootContext()); QObject *o1 = component.create(&context); + Q_UNUSED(o1); QCOMPARE(command.count, 2); } diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp index 8bdb9c9de5..7fa58036dd 100644 --- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp +++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp @@ -885,6 +885,7 @@ public: QImage requestImage(const QString &id, QSize *size, const QSize& requestedSize) { + Q_UNUSED(requestedSize); if (id == QLatin1String("first-image.png")) { QTest::qWait(50); int width = 100; diff --git a/tests/auto/quick/qquickview/tst_qquickview.cpp b/tests/auto/quick/qquickview/tst_qquickview.cpp index a4ed1267ac..02c00ff073 100644 --- a/tests/auto/quick/qquickview/tst_qquickview.cpp +++ b/tests/auto/quick/qquickview/tst_qquickview.cpp @@ -186,10 +186,6 @@ void tst_QQuickView::resizemodeitem() delete view; } -static void silentErrorsMsgHandler(QtMsgType, const QMessageLogContext &, const QString &) -{ -} - void tst_QQuickView::errors() { QQuickView *view = new QQuickView; -- cgit v1.2.3 From 019598f57e892feacfb43b1095b3ccf5cec4d4ee Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 15 Jan 2014 12:30:36 +0100 Subject: Make sure that profiling can only be started if debugging is enabled. Enabling the profiler doesn't make much sense if there is no debug service as the messages can't be sent anywhere then. Furthermore, the profiler instance is only properly initialized if debugging is enabled and thus enabling profiling without debugging being enabled can cause problems. Change-Id: I784a110126d45a9a2bc9d9e14d9a22e2980c3a42 Reviewed-by: Kai Koehne --- .../qqmlprofilerservice/data/controlFromJS.qml | 68 ++++++++++++++++++++++ .../qqmlprofilerservice/qqmlprofilerservice.pro | 3 +- .../tst_qqmlprofilerservice.cpp | 19 ++++++ tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp | 4 +- 4 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 tests/auto/qml/debugger/qqmlprofilerservice/data/controlFromJS.qml (limited to 'tests/auto') diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/data/controlFromJS.qml b/tests/auto/qml/debugger/qqmlprofilerservice/data/controlFromJS.qml new file mode 100644 index 0000000000..7bcabc33ac --- /dev/null +++ b/tests/auto/qml/debugger/qqmlprofilerservice/data/controlFromJS.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite 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$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + Timer { + running: true + interval: 1 + onTriggered: { + console.profile(); + stopTimer.start(); + } + } + + Timer { + id: stopTimer + interval: 1000 + onTriggered: { + console.profileEnd(); + endTimer.start(); + } + } + + Timer { + id: endTimer + interval: 1000 + onTriggered: Qt.quit(); + } +} diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro index b2b325dc72..a83927e720 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro +++ b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro @@ -14,4 +14,5 @@ QT += core qml testlib gui-private DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 OTHER_FILES += \ - data/pixmapCacheTest.qml + data/pixmapCacheTest.qml \ + data/controlFromJS.qml diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp index 929b079a51..acbc62807b 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp +++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp @@ -180,6 +180,7 @@ private slots: void pixmapCacheData(); void scenegraphData(); void profileOnExit(); + void controlFromJS(); }; void QQmlProfilerClient::messageReceived(const QByteArray &message) @@ -494,6 +495,24 @@ void tst_QQmlProfilerService::profileOnExit() QCOMPARE(m_client->traceMessages.last().detailType, (int)QQmlProfilerClient::EndTrace); } +void tst_QQmlProfilerService::controlFromJS() +{ + connect(true, "controlFromJS.qml"); + QVERIFY(m_client); + QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled); + + m_client->setTraceState(false); + QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete())), "No trace received in time."); + + // must start with "StartTrace" + QCOMPARE(m_client->traceMessages.first().messageType, (int)QQmlProfilerClient::Event); + QCOMPARE(m_client->traceMessages.first().detailType, (int)QQmlProfilerClient::StartTrace); + + // must end with "EndTrace" + QCOMPARE(m_client->traceMessages.last().messageType, (int)QQmlProfilerClient::Event); + QCOMPARE(m_client->traceMessages.last().detailType, (int)QQmlProfilerClient::EndTrace); +} + QTEST_MAIN(tst_QQmlProfilerService) #include "tst_qqmlprofilerservice.moc" diff --git a/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp b/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp index e6f31dcb83..a37d705284 100644 --- a/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp +++ b/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp @@ -115,8 +115,8 @@ void tst_qqmlconsole::profiling() QUrl testUrl = testFileUrl("profiling.qml"); // profiling() - QTest::ignoreMessage(QtDebugMsg, "Profiling started."); - QTest::ignoreMessage(QtDebugMsg, "Profiling ended."); + QTest::ignoreMessage(QtWarningMsg, "Cannot start profiling because debug service is disabled. Start with -qmljsdebugger=port:XXXXX."); + QTest::ignoreMessage(QtWarningMsg, "Profiling was not started."); QQmlComponent component(&engine, testUrl); QObject *object = component.create(); -- cgit v1.2.3 From acd0baf6428601b7eab9f96eff559c27909f073e Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 16 Jan 2014 14:54:33 +0100 Subject: Increase the timeout for QPacketProtocol tests Recent failures when testing a completely unrelated one-line commit (https://codereview.qt-project.org/74584) suggest that the timeout is actually too small. Change-Id: I9c3fd0b09c6be2d42f92485c3c223fe88bb8328e Reviewed-by: Michael Brasser --- tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp b/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp index 8dfd25b58b..7fd1f47838 100644 --- a/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp +++ b/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp @@ -87,7 +87,7 @@ void tst_QPacketProtocol::init() m_client->connectToHost(m_server->serverAddress(), m_server->serverPort()); QVERIFY(m_client->waitForConnected()); - QVERIFY(m_server->waitForNewConnection(5000)); + QVERIFY(m_server->waitForNewConnection(10000)); m_serverConn = m_server->nextPendingConnection(); } -- cgit v1.2.3 From cc811f77fc4f48fb696784f0a51042bb736d7071 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Mon, 16 Dec 2013 10:40:04 -0800 Subject: Re-enable mac tests Task-number: QTBUG-35344 Change-Id: Ifc4d5420c95a615b35f02ec585c324b2cc93c5e0 Reviewed-by: Gunnar Sletta --- tests/auto/auto.pro | 7 ------- 1 file changed, 7 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 8809693647..30bc175346 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -8,13 +8,6 @@ SUBDIRS=\ qmldevtools.CONFIG = host_build -!mac { -SUBDIRS += \ - quick \ - particles \ - qmltest -} - installed_cmake.depends = cmake testcocoon: SUBDIRS -= headersclean -- cgit v1.2.3