From 237c620f6355fc81e85e65b9fd61249b0f77df5a Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 26 May 2011 17:01:33 +1000 Subject: Fixed failure of tst_qxmlquery::evaluateToReceiver Commit 8f95a19d330480bd86650c3d2e4e147d3bca5789 fixed the "missing Z" of QDateTime::toString for Qt::ISODate (see QTBUG-9698). The testdata for this test should have been updated at the same time, but it was forgotten. Reviewed-by: Jason McDonald Change-Id: I9b03519805533665afac15e0c970ac1c9e5d9ab4 --- tests/auto/qxmlquery/pushBaselines/allAtomics.ref | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qxmlquery/pushBaselines/allAtomics.ref b/tests/auto/qxmlquery/pushBaselines/allAtomics.ref index cceabfe..ddb5bc7 100644 --- a/tests/auto/qxmlquery/pushBaselines/allAtomics.ref +++ b/tests/auto/qxmlquery/pushBaselines/allAtomics.ref @@ -1,6 +1,6 @@ startOfSequence() atomicValue(xs:untypedAtomic) -atomicValue(2002-10-10T23:02:11) +atomicValue(2002-10-10T23:02:11Z) atomicValue(2002-10-10) atomicValue() atomicValue() -- cgit v0.12 From dd0e653981cfbba2d7ba6e74422bc8b206fab202 Mon Sep 17 00:00:00 2001 From: jasplin Date: Wed, 8 Jun 2011 17:13:13 +0200 Subject: Added -datatags option to QTestLib Passing the -datatags option to a QTestLib program prints the available data tags to standard output. Data tags for each test function (f() in this case) are printed in four different ways depending on the presence of local and global data tags: Case 1: No tags: f() Case 2: Local tags only: f() local tag 1 f() local tag 2 ... Case 3: Global tags only: f() __global__ global tag 1 f() __global__ global tag 2 ... Case 4: Local and global tags: f() local tag 1 __global__ global tag 1 f() local tag 2 __global__ global tag 1 ... f() local tag 1 __global__ global tag 2 f() local tag 2 __global__ global tag 2 ... ... Reviewed-by: Rohan McGovern Task-number: QTQAINFRA-226 Change-Id: I14de203b586a0085b8efda8e62772711e44677d2 --- doc/src/development/qtestlib.qdoc | 3 + src/testlib/qtestcase.cpp | 63 +++++++++++++++++++++ src/testlib/qtestlog.cpp | 11 ++++ tests/auto/selftests/expected_printdatatags.txt | 6 ++ .../expected_printdatatagswithglobaltags.txt | 12 ++++ .../auto/selftests/printdatatags/printdatatags.pro | 8 +++ .../selftests/printdatatags/tst_printdatatags.cpp | 48 ++++++++++++++++ .../printdatatagswithglobaltags.pro | 8 +++ .../tst_printdatatagswithglobaltags.cpp | 64 ++++++++++++++++++++++ tests/auto/selftests/selftests.pro | 3 +- tests/auto/selftests/selftests.qrc | 2 + tests/auto/selftests/tst_selftests.cpp | 14 +++++ 12 files changed, 241 insertions(+), 1 deletion(-) create mode 100644 tests/auto/selftests/expected_printdatatags.txt create mode 100644 tests/auto/selftests/expected_printdatatagswithglobaltags.txt create mode 100644 tests/auto/selftests/printdatatags/printdatatags.pro create mode 100644 tests/auto/selftests/printdatatags/tst_printdatatags.cpp create mode 100644 tests/auto/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro create mode 100644 tests/auto/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp diff --git a/doc/src/development/qtestlib.qdoc b/doc/src/development/qtestlib.qdoc index 80bf838..94c3c12 100644 --- a/doc/src/development/qtestlib.qdoc +++ b/doc/src/development/qtestlib.qdoc @@ -181,6 +181,9 @@ outputs the possible command line arguments and give some useful help. \o \c -functions \BR outputs all test functions available in the test. + \o \c -datatags \BR + outputs all data tags available in the test. + A global data tag is preceded by ' __global__ '. \o \c -o \e filename \BR write output to the specified file, rather than to standard output \o \c -silent \BR diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 023df89..efa0122 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1015,6 +1015,7 @@ static bool isValidSlot(const QMetaMethod &sl) } Q_TESTLIB_EXPORT bool printAvailableFunctions = false; +Q_TESTLIB_EXPORT bool printAvailableTags = false; Q_TESTLIB_EXPORT QStringList testFunctions; Q_TESTLIB_EXPORT QStringList testTags; @@ -1027,6 +1028,60 @@ static void qPrintTestSlots() } } +static void qPrintDataTags() +{ + // Get global data tags: + QTestTable::globalTestTable(); + invokeMethod(QTest::currentTestObject, "initTestCase_data()"); + const QTestTable *gTable = QTestTable::globalTestTable(); + + // Process test functions: + for (int i = 0; i < QTest::currentTestObject->metaObject()->methodCount(); ++i) { + QMetaMethod tf = QTest::currentTestObject->metaObject()->method(i); + if (isValidSlot(tf)) { + const char *slotName = tf.signature(); + + // Retrieve local tags: + QStringList localTags; + QTestTable table; + char member[512]; + char *slot = qstrdup(slotName); + slot[strlen(slot) - 2] = '\0'; + QTest::qt_snprintf(member, 512, "%s_data()", slot); + delete[] slot; + invokeMethod(QTest::currentTestObject, member); + for (int j = 0; j < table.dataCount(); ++j) + localTags << QLatin1String(table.testData(j)->dataTag()); + + // Print all tag combinations: + if (gTable->dataCount() == 0) { + if (localTags.count() == 0) { + // No tags at all, so just print the test function: + printf("%s\n", slotName); + } else { + // Only local tags, so print each of them: + for (int k = 0; k < localTags.size(); ++k) + printf("%s %s\n", slotName, localTags.at(k).toLatin1().data()); + } + } else { + for (int j = 0; j < gTable->dataCount(); ++j) { + if (localTags.count() == 0) { + // Only global tags, so print the current one: + printf("%s __global__ %s\n", slotName, gTable->testData(j)->dataTag()); + } else { + // Local and global tags, so print each of the local ones and + // the current global one: + for (int k = 0; k < localTags.size(); ++k) + printf( + "%s %s __global__ %s\n", slotName, + localTags.at(k).toLatin1().data(), gTable->testData(j)->dataTag()); + } + } + } + } + } +} + static int qToInt(char *str) { char *pEnd; @@ -1043,6 +1098,8 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml) const char *testOptions = " options:\n" " -functions : Returns a list of current testfunctions\n" + " -datatags : Returns a list of current data tags.\n" + " A global data tag is preceded by ' __global__ '.\n" " -xunitxml : Outputs results as XML XUnit document\n" " -xml : Outputs results as XML document\n" " -lightxml : Outputs results as stream of XML tags\n" @@ -1094,6 +1151,12 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml) qPrintTestSlots(); exit(0); } + } else if (strcmp(argv[i], "-datatags") == 0) { + QTest::printAvailableTags = true; + if (!qml) { + qPrintDataTags(); + exit(0); + } } else if(strcmp(argv[i], "-xunitxml") == 0){ QTestLog::setLogMode(QTestLog::XunitXML); } else if (strcmp(argv[i], "-xml") == 0) { diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp index 8a2d559..03fafe0 100644 --- a/src/testlib/qtestlog.cpp +++ b/src/testlib/qtestlog.cpp @@ -191,6 +191,8 @@ void initLogger() } } +extern Q_TESTLIB_EXPORT bool printAvailableTags; + } QTestLog::QTestLog() @@ -203,6 +205,9 @@ QTestLog::~QTestLog() void QTestLog::enterTestFunction(const char* function) { + if (QTest::printAvailableTags) + return; + QTEST_ASSERT(QTest::testLogger); QTEST_ASSERT(function); @@ -222,6 +227,9 @@ int QTestLog::unhandledIgnoreMessages() void QTestLog::leaveTestFunction() { + if (QTest::printAvailableTags) + return; + QTEST_ASSERT(QTest::testLogger); QTest::IgnoreResultList::clearList(QTest::ignoreResultList); @@ -244,6 +252,9 @@ void QTestLog::printUnhandledIgnoreMessages() void QTestLog::addPass(const char *msg) { + if (QTest::printAvailableTags) + return; + QTEST_ASSERT(QTest::testLogger); QTEST_ASSERT(msg); diff --git a/tests/auto/selftests/expected_printdatatags.txt b/tests/auto/selftests/expected_printdatatags.txt new file mode 100644 index 0000000..02390dc --- /dev/null +++ b/tests/auto/selftests/expected_printdatatags.txt @@ -0,0 +1,6 @@ +a() data tag a1 +a() data tag a2 +b() +c() data tag c1 +c() data tag c2 +c() data tag c3 diff --git a/tests/auto/selftests/expected_printdatatagswithglobaltags.txt b/tests/auto/selftests/expected_printdatatagswithglobaltags.txt new file mode 100644 index 0000000..a91e1b8 --- /dev/null +++ b/tests/auto/selftests/expected_printdatatagswithglobaltags.txt @@ -0,0 +1,12 @@ +a() data tag a1 __global__ global data tag 1 +a() data tag a2 __global__ global data tag 1 +a() data tag a1 __global__ global data tag 2 +a() data tag a2 __global__ global data tag 2 +b() __global__ global data tag 1 +b() __global__ global data tag 2 +c() data tag c1 __global__ global data tag 1 +c() data tag c2 __global__ global data tag 1 +c() data tag c3 __global__ global data tag 1 +c() data tag c1 __global__ global data tag 2 +c() data tag c2 __global__ global data tag 2 +c() data tag c3 __global__ global data tag 2 diff --git a/tests/auto/selftests/printdatatags/printdatatags.pro b/tests/auto/selftests/printdatatags/printdatatags.pro new file mode 100644 index 0000000..a134422 --- /dev/null +++ b/tests/auto/selftests/printdatatags/printdatatags.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +SOURCES += tst_printdatatags.cpp +QT = core + +mac:CONFIG -= app_bundle +CONFIG -= debug_and_release_target + +TARGET = printdatatags diff --git a/tests/auto/selftests/printdatatags/tst_printdatatags.cpp b/tests/auto/selftests/printdatatags/tst_printdatatags.cpp new file mode 100644 index 0000000..fe4bcf0 --- /dev/null +++ b/tests/auto/selftests/printdatatags/tst_printdatatags.cpp @@ -0,0 +1,48 @@ +#include + +class tst_Foo: public QObject +{ + Q_OBJECT +private slots: + void a_data() const; + void a() const; + + void b() const; + + void c_data() const; + void c() const; +}; + +void tst_Foo::a_data() const +{ + QTest::addColumn("x"); + QTest::addColumn("y"); + + QTest::newRow("data tag a1 ") << 1 << 2; + QTest::newRow("data tag a2") << 1 << 2; +} + +void tst_Foo::a() const +{ +} + +void tst_Foo::b() const +{ +} + +void tst_Foo::c_data() const +{ + QTest::addColumn("x"); + + QTest::newRow("data tag c1") << 1; + QTest::newRow("data tag c2") << 1; + QTest::newRow("data tag c3") << 1; +} + +void tst_Foo::c() const +{ +} + +QTEST_MAIN(tst_Foo) + +#include "tst_printdatatags.moc" diff --git a/tests/auto/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro b/tests/auto/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro new file mode 100644 index 0000000..100ba1c --- /dev/null +++ b/tests/auto/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +SOURCES += tst_printdatatagswithglobaltags.cpp +QT = core + +mac:CONFIG -= app_bundle +CONFIG -= debug_and_release_target + +TARGET = printdatatagswithglobaltags diff --git a/tests/auto/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp b/tests/auto/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp new file mode 100644 index 0000000..cc58bec --- /dev/null +++ b/tests/auto/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp @@ -0,0 +1,64 @@ +#include + +class tst_Foo: public QObject +{ + Q_OBJECT +private slots: + void initTestCase_data() const; + void initTestCase() const; + + void a_data() const; + void a() const; + + void b() const; + + void c_data() const; + void c() const; +}; + +void tst_Foo::initTestCase_data() const +{ + QTest::addColumn("f"); + QTest::addColumn("g"); + + QTest::newRow("global data tag 1 ") << 1 << 2; + QTest::newRow("global data tag 2") << 1 << 2; +} + +void tst_Foo::initTestCase() const +{ +} + +void tst_Foo::a_data() const +{ + QTest::addColumn("x"); + QTest::addColumn("y"); + + QTest::newRow("data tag a1 ") << 1 << 2; + QTest::newRow("data tag a2") << 1 << 2; +} + +void tst_Foo::a() const +{ +} + +void tst_Foo::b() const +{ +} + +void tst_Foo::c_data() const +{ + QTest::addColumn("x"); + + QTest::newRow("data tag c1") << 1; + QTest::newRow("data tag c2") << 1; + QTest::newRow("data tag c3") << 1; +} + +void tst_Foo::c() const +{ +} + +QTEST_MAIN(tst_Foo) + +#include "tst_printdatatagswithglobaltags.moc" diff --git a/tests/auto/selftests/selftests.pro b/tests/auto/selftests/selftests.pro index 2f1c327..74cd075 100644 --- a/tests/auto/selftests/selftests.pro +++ b/tests/auto/selftests/selftests.pro @@ -5,7 +5,8 @@ SUBDIRS = subtest test warnings maxwarnings cmptest globaldata skipglobal skip \ skipinit skipinitdata datetime singleskip assert waitwithoutgui differentexec \ exceptionthrow qexecstringlist datatable commandlinedata\ benchlibwalltime benchlibcallgrind benchlibeventcounter benchlibtickcounter \ - benchliboptions xunit badxml longstring + benchliboptions xunit badxml longstring printdatatags \ + printdatatagswithglobaltags INSTALLS = diff --git a/tests/auto/selftests/selftests.qrc b/tests/auto/selftests/selftests.qrc index f82722b..5bd0e12 100644 --- a/tests/auto/selftests/selftests.qrc +++ b/tests/auto/selftests/selftests.qrc @@ -89,6 +89,8 @@ expected_multiexec.txt expected_multiexec.xml expected_multiexec.xunitxml + expected_printdatatags.txt + expected_printdatatagswithglobaltags.txt expected_qexecstringlist.txt expected_singleskip.lightxml expected_singleskip.txt diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp index 1a95420..3686304 100644 --- a/tests/auto/selftests/tst_selftests.cpp +++ b/tests/auto/selftests/tst_selftests.cpp @@ -245,6 +245,8 @@ void tst_Selftests::runSubTest_data() << "xunit" << "longstring" << "badxml" + << "printdatatags" + << "printdatatagswithglobaltags" ; foreach (Logger const& logger, allLoggers()) { @@ -273,6 +275,12 @@ void tst_Selftests::runSubTest_data() else if (subtest == "badxml") { arguments << "-eventcounter"; } + else if (subtest == "printdatatags") { + arguments << "-datatags"; + } + else if (subtest == "printdatatagswithglobaltags") { + arguments << "-datatags"; + } // These tests don't work right with loggers other than plain, usually because // they internally supply arguments to themselves. @@ -289,6 +297,12 @@ void tst_Selftests::runSubTest_data() if (subtest == "waitwithoutgui") { continue; } + if (subtest == "printdatatags") { + continue; + } + if (subtest == "printdatatagswithglobaltags") { + continue; + } // `crashes' will not output valid XML on platforms without a crash handler if (subtest == "crashes") { continue; -- cgit v0.12 From 9c1e358df4b0af1a6299ea7932f8b2e8af840873 Mon Sep 17 00:00:00 2001 From: Jo Asplin Date: Wed, 22 Jun 2011 09:18:01 +0200 Subject: Compile on Symbian^3. Change-Id: Ie1f52be4e94ff1e51b9d5f47c75a8d2e8b7a63d4 --- tests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro b/tests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro index e621d50..b242d60 100755 --- a/tests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro +++ b/tests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro @@ -11,3 +11,8 @@ CONFIG += release # Input SOURCES += main.cpp + +symbian: { + TARGET.CAPABILITY = NetworkServices + INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE +} -- cgit v0.12 From 4246892bf3eefd67331369ad7dae487167373c92 Mon Sep 17 00:00:00 2001 From: Jo Asplin Date: Mon, 27 Jun 2011 10:42:40 +0200 Subject: Compile on symbian^3 Applies the fix of Commit 9c1e358df4b0af1a6299ea7932f8b2e8af840873 (review by Liang Qi) to four more test cases. Change-Id: I1483d4b7c2aecde960af5d98fb8b772aeba20ec5 Reviewed-by: Sergio Ahumada Reviewed-by: Liang Qi --- tests/benchmarks/corelib/io/qdir/tree/tree.pro | 5 +++++ tests/benchmarks/corelib/thread/qthreadstorage/qthreadstorage.pro | 5 +++++ tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro | 5 +++++ tests/benchmarks/network/ssl/qsslsocket/qsslsocket.pro | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/tests/benchmarks/corelib/io/qdir/tree/tree.pro b/tests/benchmarks/corelib/io/qdir/tree/tree.pro index 773f0f7..24a667e 100644 --- a/tests/benchmarks/corelib/io/qdir/tree/tree.pro +++ b/tests/benchmarks/corelib/io/qdir/tree/tree.pro @@ -9,3 +9,8 @@ SOURCES += bench_qdir_tree.cpp RESOURCES += bench_qdir_tree.qrc QT -= gui + +symbian: { + TARGET.CAPABILITY = NetworkServices + INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE +} diff --git a/tests/benchmarks/corelib/thread/qthreadstorage/qthreadstorage.pro b/tests/benchmarks/corelib/thread/qthreadstorage/qthreadstorage.pro index e8014d6..6e823ff 100644 --- a/tests/benchmarks/corelib/thread/qthreadstorage/qthreadstorage.pro +++ b/tests/benchmarks/corelib/thread/qthreadstorage/qthreadstorage.pro @@ -4,3 +4,8 @@ TARGET = tst_bench_qthreadstorage SOURCES += tst_qthreadstorage.cpp QT -= gui + +symbian: { + TARGET.CAPABILITY = NetworkServices + INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE +} diff --git a/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro b/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro index e5b9346..30b10d2 100644 --- a/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro +++ b/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro @@ -11,3 +11,8 @@ CONFIG += release # Input SOURCES += tst_qtcpserver.cpp + +symbian: { + TARGET.CAPABILITY = NetworkServices + INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE +} diff --git a/tests/benchmarks/network/ssl/qsslsocket/qsslsocket.pro b/tests/benchmarks/network/ssl/qsslsocket/qsslsocket.pro index da34a02..85ca1e3 100644 --- a/tests/benchmarks/network/ssl/qsslsocket/qsslsocket.pro +++ b/tests/benchmarks/network/ssl/qsslsocket/qsslsocket.pro @@ -11,3 +11,8 @@ CONFIG += release # Input SOURCES += tst_qsslsocket.cpp + +symbian: { + TARGET.CAPABILITY = NetworkServices + INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE +} -- cgit v0.12 From 5634ea81e57f26a376db75bcea0eeb82d815817f Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Mon, 27 Jun 2011 17:30:41 +0200 Subject: Add license header to printdatatags autotests --- .../selftests/printdatatags/tst_printdatatags.cpp | 42 ++++++++++++++++++++++ .../tst_printdatatagswithglobaltags.cpp | 42 ++++++++++++++++++++++ 2 files changed, 84 insertions(+) diff --git a/tests/auto/selftests/printdatatags/tst_printdatatags.cpp b/tests/auto/selftests/printdatatags/tst_printdatatags.cpp index fe4bcf0..4b533b3 100644 --- a/tests/auto/selftests/printdatatags/tst_printdatatags.cpp +++ b/tests/auto/selftests/printdatatags/tst_printdatatags.cpp @@ -1,3 +1,45 @@ +/**************************************************************************** +** +** 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 test suite 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 class tst_Foo: public QObject diff --git a/tests/auto/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp b/tests/auto/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp index cc58bec..931dc12 100644 --- a/tests/auto/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp +++ b/tests/auto/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp @@ -1,3 +1,45 @@ +/**************************************************************************** +** +** 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 test suite 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 class tst_Foo: public QObject -- cgit v0.12 From c2760148330166934b8443b3794767b8347ab5ba Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Wed, 1 Jun 2011 17:13:51 +1000 Subject: Fixed compile of tst_qscriptextensionplugin on some Windows configurations The debug and release versions of staticplugin are qmake'd with the same destination directory. This causes the generated staticplugin .prl file to always refer to the debug versions of Qt libraries, even if Qt was configured with -release. The .prl mechanism is not useful for this test, so simply disable it to solve the problem. Reviewed-by: ckamm (cherry picked from commit f5a63feb8953799de7e787f333575ee37fae8a3f) --- tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro b/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro index a003338..65c4e8f 100644 --- a/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro +++ b/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro @@ -1,5 +1,6 @@ TEMPLATE = lib CONFIG += static plugin +CONFIG -= create_prl # not needed, and complicates debug/release SOURCES = staticplugin.cpp RESOURCES = staticplugin.qrc QT = core script -- cgit v0.12 From f822f0cc8958c09428fc3be4252d82af92802ca9 Mon Sep 17 00:00:00 2001 From: Jo Asplin Date: Mon, 27 Jun 2011 13:10:03 +0200 Subject: Disabled benchmarks referring to private headers. Certain benchmarks that referred to private headers are removed from the list of 'trusted' benchmarks. Benchmarks referring to private headers are considered bad practice for several reasons: 1) Such tests won't even build if private headers are not avaiable in the installed version of Qt. 2) APIs should be designed well enough to be fully testable through its public headers only. Change-Id: Iccd81e12829a7b7f4bd2b88a72f3e9722520f6e2 Reviewed-by: Rohan McGovern --- tests/benchmarks/gui/gui.pro | 5 ++--- tests/benchmarks/network/network.pro | 3 +-- tests/benchmarks/script/script.pro | 1 - 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/benchmarks/gui/gui.pro b/tests/benchmarks/gui/gui.pro index d825458..06828f4 100644 --- a/tests/benchmarks/gui/gui.pro +++ b/tests/benchmarks/gui/gui.pro @@ -12,7 +12,6 @@ SUBDIRS = \ TRUSTED_BENCHMARKS += \ graphicsview/functional/GraphicsViewBenchmark \ - graphicsview/qgraphicsview \ - painting/qtracebench + graphicsview/qgraphicsview -include(../trusted-benchmarks.pri) \ No newline at end of file +include(../trusted-benchmarks.pri) diff --git a/tests/benchmarks/network/network.pro b/tests/benchmarks/network/network.pro index 692a0a1..52817f9 100644 --- a/tests/benchmarks/network/network.pro +++ b/tests/benchmarks/network/network.pro @@ -6,8 +6,7 @@ SUBDIRS = \ socket TRUSTED_BENCHMARKS += \ - kernel/qhostinfo \ socket/qtcpserver \ ssl/qsslsocket -include(../trusted-benchmarks.pri) \ No newline at end of file +include(../trusted-benchmarks.pri) diff --git a/tests/benchmarks/script/script.pro b/tests/benchmarks/script/script.pro index 5da05e7..3216b24 100644 --- a/tests/benchmarks/script/script.pro +++ b/tests/benchmarks/script/script.pro @@ -13,7 +13,6 @@ SUBDIRS = \ TRUSTED_BENCHMARKS += \ qscriptclass \ qscriptvalue \ - qscriptengine \ qscriptqobject include(../trusted-benchmarks.pri) -- cgit v0.12 From da68cb3ef67f8cb83e568ae94cc8272247c3f548 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Wed, 29 Jun 2011 10:20:48 +0200 Subject: Adding QTDIR validation in tst_symbols autotest If the variable QTDIR is not set, you might end up checking all the system libraries symbols. Change-Id: I7b079d7e10fccad962cd3b2ced317eb35840bd71 Reviewed-by: Rohan McGovern --- tests/auto/symbols/tst_symbols.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/auto/symbols/tst_symbols.cpp b/tests/auto/symbols/tst_symbols.cpp index d2c8c24..049c771 100644 --- a/tests/auto/symbols/tst_symbols.cpp +++ b/tests/auto/symbols/tst_symbols.cpp @@ -55,6 +55,8 @@ class tst_Symbols: public QObject { Q_OBJECT private slots: + void initTestCase(); + void prefix(); void globalObjects(); }; @@ -89,6 +91,12 @@ static QString symbolToLine(const QString &symbol, const QString &lib) return result; } +void tst_Symbols::initTestCase() +{ + QString qtDir = QString::fromLocal8Bit(qgetenv("QTDIR")); + QVERIFY2(!qtDir.isEmpty(), "This test needs $QTDIR"); +} + /* This test searches through all Qt libraries and searches for symbols starting with "global constructors keyed to " -- cgit v0.12 From 60cb54825f272547071d516ff8bd2d451b211147 Mon Sep 17 00:00:00 2001 From: Jo Asplin Date: Thu, 30 Jun 2011 13:34:36 +0200 Subject: Add test case name and drop parentheses for -datatags option. For completeness, the -datatags command-line option in QTestLib now prints the test case name at the start of each output line. NOTE: Although the file name is supposed to match the lower-case version of the test case name, this is currently not true in all cases (particularly not under tests/benchmarks). Even if there was a script to enforce this convention, the -datatags option now provides this information in a reliable way. This patch also drops the parentheses after the test function as these are always empty anyway. Data tags for each test function (f() in this case) are printed in four different ways depending on the presence of local and global data tags: Case 1: No tags: tst_MyTestCase f Case 2: Local tags only: tst_MyTestCase f local tag 1 tst_MyTestCase f local tag 2 ... Case 3: Global tags only: tst_MyTestCase f __global__ global tag 1 tst_MyTestCase f __global__ global tag 2 ... Case 4: Local and global tags: tst_MyTestCase f local tag 1 __global__ global tag 1 tst_MyTestCase f local tag 2 __global__ global tag 1 ... tst_MyTestCase f local tag 1 __global__ global tag 2 tst_MyTestCase f local tag 2 __global__ global tag 2 ... ... Change-Id: Id9273039a5d33527c32abf6eb1baef80193fa585 Reviewed-by: Rohan McGovern --- src/testlib/qtestcase.cpp | 25 +++++++++++++--------- tests/auto/selftests/expected_printdatatags.txt | 12 +++++------ .../expected_printdatatagswithglobaltags.txt | 24 ++++++++++----------- .../selftests/printdatatags/tst_printdatatags.cpp | 14 ++++++------ .../tst_printdatatagswithglobaltags.cpp | 18 ++++++++-------- 5 files changed, 49 insertions(+), 44 deletions(-) diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index efa0122..d2ea988 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1035,20 +1035,19 @@ static void qPrintDataTags() invokeMethod(QTest::currentTestObject, "initTestCase_data()"); const QTestTable *gTable = QTestTable::globalTestTable(); + const QMetaObject *currTestMetaObj = QTest::currentTestObject->metaObject(); + // Process test functions: - for (int i = 0; i < QTest::currentTestObject->metaObject()->methodCount(); ++i) { - QMetaMethod tf = QTest::currentTestObject->metaObject()->method(i); + for (int i = 0; i < currTestMetaObj->methodCount(); ++i) { + QMetaMethod tf = currTestMetaObj->method(i); if (isValidSlot(tf)) { - const char *slotName = tf.signature(); - // Retrieve local tags: QStringList localTags; QTestTable table; char member[512]; - char *slot = qstrdup(slotName); + char *slot = qstrdup(tf.signature()); slot[strlen(slot) - 2] = '\0'; QTest::qt_snprintf(member, 512, "%s_data()", slot); - delete[] slot; invokeMethod(QTest::currentTestObject, member); for (int j = 0; j < table.dataCount(); ++j) localTags << QLatin1String(table.testData(j)->dataTag()); @@ -1057,27 +1056,33 @@ static void qPrintDataTags() if (gTable->dataCount() == 0) { if (localTags.count() == 0) { // No tags at all, so just print the test function: - printf("%s\n", slotName); + printf("%s %s\n", currTestMetaObj->className(), slot); } else { // Only local tags, so print each of them: for (int k = 0; k < localTags.size(); ++k) - printf("%s %s\n", slotName, localTags.at(k).toLatin1().data()); + printf( + "%s %s %s\n", + currTestMetaObj->className(), slot, localTags.at(k).toLatin1().data()); } } else { for (int j = 0; j < gTable->dataCount(); ++j) { if (localTags.count() == 0) { // Only global tags, so print the current one: - printf("%s __global__ %s\n", slotName, gTable->testData(j)->dataTag()); + printf( + "%s %s __global__ %s\n", + currTestMetaObj->className(), slot, gTable->testData(j)->dataTag()); } else { // Local and global tags, so print each of the local ones and // the current global one: for (int k = 0; k < localTags.size(); ++k) printf( - "%s %s __global__ %s\n", slotName, + "%s %s %s __global__ %s\n", currTestMetaObj->className(), slot, localTags.at(k).toLatin1().data(), gTable->testData(j)->dataTag()); } } } + + delete[] slot; } } } diff --git a/tests/auto/selftests/expected_printdatatags.txt b/tests/auto/selftests/expected_printdatatags.txt index 02390dc..ac22f23 100644 --- a/tests/auto/selftests/expected_printdatatags.txt +++ b/tests/auto/selftests/expected_printdatatags.txt @@ -1,6 +1,6 @@ -a() data tag a1 -a() data tag a2 -b() -c() data tag c1 -c() data tag c2 -c() data tag c3 +tst_MyTestCase a data tag a1 +tst_MyTestCase a data tag a2 +tst_MyTestCase b +tst_MyTestCase c data tag c1 +tst_MyTestCase c data tag c2 +tst_MyTestCase c data tag c3 diff --git a/tests/auto/selftests/expected_printdatatagswithglobaltags.txt b/tests/auto/selftests/expected_printdatatagswithglobaltags.txt index a91e1b8..32feba4 100644 --- a/tests/auto/selftests/expected_printdatatagswithglobaltags.txt +++ b/tests/auto/selftests/expected_printdatatagswithglobaltags.txt @@ -1,12 +1,12 @@ -a() data tag a1 __global__ global data tag 1 -a() data tag a2 __global__ global data tag 1 -a() data tag a1 __global__ global data tag 2 -a() data tag a2 __global__ global data tag 2 -b() __global__ global data tag 1 -b() __global__ global data tag 2 -c() data tag c1 __global__ global data tag 1 -c() data tag c2 __global__ global data tag 1 -c() data tag c3 __global__ global data tag 1 -c() data tag c1 __global__ global data tag 2 -c() data tag c2 __global__ global data tag 2 -c() data tag c3 __global__ global data tag 2 +tst_MyTestCase a data tag a1 __global__ global data tag 1 +tst_MyTestCase a data tag a2 __global__ global data tag 1 +tst_MyTestCase a data tag a1 __global__ global data tag 2 +tst_MyTestCase a data tag a2 __global__ global data tag 2 +tst_MyTestCase b __global__ global data tag 1 +tst_MyTestCase b __global__ global data tag 2 +tst_MyTestCase c data tag c1 __global__ global data tag 1 +tst_MyTestCase c data tag c2 __global__ global data tag 1 +tst_MyTestCase c data tag c3 __global__ global data tag 1 +tst_MyTestCase c data tag c1 __global__ global data tag 2 +tst_MyTestCase c data tag c2 __global__ global data tag 2 +tst_MyTestCase c data tag c3 __global__ global data tag 2 diff --git a/tests/auto/selftests/printdatatags/tst_printdatatags.cpp b/tests/auto/selftests/printdatatags/tst_printdatatags.cpp index 4b533b3..79f8890 100644 --- a/tests/auto/selftests/printdatatags/tst_printdatatags.cpp +++ b/tests/auto/selftests/printdatatags/tst_printdatatags.cpp @@ -42,7 +42,7 @@ #include -class tst_Foo: public QObject +class tst_MyTestCase: public QObject { Q_OBJECT private slots: @@ -55,7 +55,7 @@ private slots: void c() const; }; -void tst_Foo::a_data() const +void tst_MyTestCase::a_data() const { QTest::addColumn("x"); QTest::addColumn("y"); @@ -64,15 +64,15 @@ void tst_Foo::a_data() const QTest::newRow("data tag a2") << 1 << 2; } -void tst_Foo::a() const +void tst_MyTestCase::a() const { } -void tst_Foo::b() const +void tst_MyTestCase::b() const { } -void tst_Foo::c_data() const +void tst_MyTestCase::c_data() const { QTest::addColumn("x"); @@ -81,10 +81,10 @@ void tst_Foo::c_data() const QTest::newRow("data tag c3") << 1; } -void tst_Foo::c() const +void tst_MyTestCase::c() const { } -QTEST_MAIN(tst_Foo) +QTEST_MAIN(tst_MyTestCase) #include "tst_printdatatags.moc" diff --git a/tests/auto/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp b/tests/auto/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp index 931dc12..6b0e61b 100644 --- a/tests/auto/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp +++ b/tests/auto/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp @@ -42,7 +42,7 @@ #include -class tst_Foo: public QObject +class tst_MyTestCase: public QObject { Q_OBJECT private slots: @@ -58,7 +58,7 @@ private slots: void c() const; }; -void tst_Foo::initTestCase_data() const +void tst_MyTestCase::initTestCase_data() const { QTest::addColumn("f"); QTest::addColumn("g"); @@ -67,11 +67,11 @@ void tst_Foo::initTestCase_data() const QTest::newRow("global data tag 2") << 1 << 2; } -void tst_Foo::initTestCase() const +void tst_MyTestCase::initTestCase() const { } -void tst_Foo::a_data() const +void tst_MyTestCase::a_data() const { QTest::addColumn("x"); QTest::addColumn("y"); @@ -80,15 +80,15 @@ void tst_Foo::a_data() const QTest::newRow("data tag a2") << 1 << 2; } -void tst_Foo::a() const +void tst_MyTestCase::a() const { } -void tst_Foo::b() const +void tst_MyTestCase::b() const { } -void tst_Foo::c_data() const +void tst_MyTestCase::c_data() const { QTest::addColumn("x"); @@ -97,10 +97,10 @@ void tst_Foo::c_data() const QTest::newRow("data tag c3") << 1; } -void tst_Foo::c() const +void tst_MyTestCase::c() const { } -QTEST_MAIN(tst_Foo) +QTEST_MAIN(tst_MyTestCase) #include "tst_printdatatagswithglobaltags.moc" -- cgit v0.12 From 4fe2205d2fe1e8eaf3d4122c74a29862b5d04bfe Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Mon, 25 Jul 2011 22:08:21 +0200 Subject: Fix QString compares to "" Do not compare a QString to "". Instead use the .isEmpty() method. Change-Id: I91ca870c6cd20a72e98f7c782c3f7e4947760ef9 Reviewed-by: Rohan McGovern --- tools/macdeployqt/shared/shared.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/macdeployqt/shared/shared.cpp b/tools/macdeployqt/shared/shared.cpp index c411683..d2ceedd 100644 --- a/tools/macdeployqt/shared/shared.cpp +++ b/tools/macdeployqt/shared/shared.cpp @@ -126,7 +126,7 @@ FrameworkInfo parseOtoolLibraryLine(const QString &line, bool useDebugLibs) while (part < parts.count()) { const QString currentPart = parts.at(part).simplified() ; ++part; - if (currentPart == "") + if (currentPart.isEmpty()) continue; if (state == QtPath) { -- cgit v0.12 From c8afa6feb8f87ae733bbb3237b1d2e84ab47b4de Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Wed, 10 Aug 2011 12:06:10 +0200 Subject: tests: fixed crash of tst_qdialog This test assumed that C++ exceptions could always be caught by the event loop. This is not the case when the Glib event loop is used. Skip the relevant portion of the test in that case. Change-Id: I2ad83386025a98f6c32202700c97e04ef3dff343 Reviewed-by: Kalle Lehtonen Reviewed-by: Sergio Ahumada (cherry picked from commit 569cd194d20e61d35768b210b4351f4eeb5c1ef8) --- tests/auto/qdialog/tst_qdialog.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/auto/qdialog/tst_qdialog.cpp b/tests/auto/qdialog/tst_qdialog.cpp index 6d9f798..86dde21 100644 --- a/tests/auto/qdialog/tst_qdialog.cpp +++ b/tests/auto/qdialog/tst_qdialog.cpp @@ -467,6 +467,22 @@ void tst_QDialog::throwInExec() #if defined(Q_WS_MAC) || (defined(Q_WS_WINCE) && defined(_ARM_)) QSKIP("Throwing exceptions in exec() is not supported on this platform.", SkipAll); #endif + +#if defined(Q_OS_LINUX) + // C++ exceptions can't be passed through glib callbacks. Skip the test if + // we're using the glib event loop. + QByteArray dispatcher = QAbstractEventDispatcher::instance()->metaObject()->className(); + if (dispatcher.contains("Glib")) { + QSKIP( + qPrintable(QString( + "Throwing exceptions in exec() won't work if %1 event dispatcher is used.\n" + "Try running with QT_NO_GLIB=1 in environment." + ).arg(QString::fromLatin1(dispatcher))), + SkipAll + ); + } +#endif + int caughtExceptions = 0; try { ExceptionDialog dialog; -- cgit v0.12 From 484bce6d53c77ec8be8df6ca43cac52dc7e402a5 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Wed, 10 Aug 2011 12:06:10 +0200 Subject: tests: fixed crash of tst_qdialog This test assumed that C++ exceptions could always be caught by the event loop. This is not the case when the Glib event loop is used. Skip the relevant portion of the test in that case. Change-Id: I2ad83386025a98f6c32202700c97e04ef3dff343 Reviewed-by: Kalle Lehtonen Reviewed-by: Sergio Ahumada (cherry picked from commit 569cd194d20e61d35768b210b4351f4eeb5c1ef8) --- tests/auto/qdialog/tst_qdialog.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/auto/qdialog/tst_qdialog.cpp b/tests/auto/qdialog/tst_qdialog.cpp index 6d9f798..86dde21 100644 --- a/tests/auto/qdialog/tst_qdialog.cpp +++ b/tests/auto/qdialog/tst_qdialog.cpp @@ -467,6 +467,22 @@ void tst_QDialog::throwInExec() #if defined(Q_WS_MAC) || (defined(Q_WS_WINCE) && defined(_ARM_)) QSKIP("Throwing exceptions in exec() is not supported on this platform.", SkipAll); #endif + +#if defined(Q_OS_LINUX) + // C++ exceptions can't be passed through glib callbacks. Skip the test if + // we're using the glib event loop. + QByteArray dispatcher = QAbstractEventDispatcher::instance()->metaObject()->className(); + if (dispatcher.contains("Glib")) { + QSKIP( + qPrintable(QString( + "Throwing exceptions in exec() won't work if %1 event dispatcher is used.\n" + "Try running with QT_NO_GLIB=1 in environment." + ).arg(QString::fromLatin1(dispatcher))), + SkipAll + ); + } +#endif + int caughtExceptions = 0; try { ExceptionDialog dialog; -- cgit v0.12 From 257477c65834570ddad6cfe804b2f0b132306b1c Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Tue, 9 Aug 2011 16:30:46 +0200 Subject: tests: Skip `qaudioinput' tests if there is no audio backend available This code was always passing when no audio backend was available, skip the tests in this case instead. Change-Id: I4c0060ff144fa497a21823ffcab101ff68b84e17 Reviewed-by: Rohan McGovern --- tests/auto/qaudioinput/tst_qaudioinput.cpp | 133 +++++++++++++++-------------- 1 file changed, 70 insertions(+), 63 deletions(-) diff --git a/tests/auto/qaudioinput/tst_qaudioinput.cpp b/tests/auto/qaudioinput/tst_qaudioinput.cpp index 6025bdb..0004c42 100644 --- a/tests/auto/qaudioinput/tst_qaudioinput.cpp +++ b/tests/auto/qaudioinput/tst_qaudioinput.cpp @@ -86,14 +86,14 @@ void tst_QAudioInput::initTestCase() // Only perform tests if audio input device exists! QList devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput); - if(devices.size() > 0) + if (devices.size() > 0) available = true; else { qWarning()<<"NOTE: no audio input device found, no test will be performed"; available = false; } - if(available) + if (available) audio = new QAudioInput(format, this); } @@ -124,6 +124,9 @@ void tst_QAudioInput::invalidFormat_data() void tst_QAudioInput::invalidFormat() { + if (!available) + QSKIP("No audio input device found, no test will be performed", SkipAll); + QFETCH(QAudioFormat, invalidFormat); QAudioInput audioInput(invalidFormat, this); @@ -140,81 +143,85 @@ void tst_QAudioInput::invalidFormat() void tst_QAudioInput::settings() { - if(available) { - // Confirm the setting we added in the init function. - QAudioFormat f = audio->format(); - - QVERIFY(format.channels() == f.channels()); - QVERIFY(format.frequency() == f.frequency()); - QVERIFY(format.sampleSize() == f.sampleSize()); - QVERIFY(format.codec() == f.codec()); - QVERIFY(format.byteOrder() == f.byteOrder()); - QVERIFY(format.sampleType() == f.sampleType()); - } + if (!available) + QSKIP("No audio input device found, no test will be performed", SkipAll); + + // Confirm the setting we added in the init function. + QAudioFormat f = audio->format(); + + QVERIFY(format.channels() == f.channels()); + QVERIFY(format.frequency() == f.frequency()); + QVERIFY(format.sampleSize() == f.sampleSize()); + QVERIFY(format.codec() == f.codec()); + QVERIFY(format.byteOrder() == f.byteOrder()); + QVERIFY(format.sampleType() == f.sampleType()); } void tst_QAudioInput::buffers() { - if(available) { - // Should always have a buffer size greater than zero. - int store = audio->bufferSize(); - audio->setBufferSize(4096); - QVERIFY(audio->bufferSize() > 0); - audio->setBufferSize(store); - QVERIFY(audio->bufferSize() == store); - } + if (!available) + QSKIP("No audio input device found, no test will be performed", SkipAll); + + // Should always have a buffer size greater than zero. + int store = audio->bufferSize(); + audio->setBufferSize(4096); + QVERIFY(audio->bufferSize() > 0); + audio->setBufferSize(store); + QVERIFY(audio->bufferSize() == store); } void tst_QAudioInput::notifyInterval() { - if(available) { - QVERIFY(audio->notifyInterval() == 1000); // Default + if (!available) + QSKIP("No audio input device found, no test will be performed", SkipAll); - audio->setNotifyInterval(500); - QVERIFY(audio->notifyInterval() == 500); // Custom + QVERIFY(audio->notifyInterval() == 1000); // Default - audio->setNotifyInterval(1000); // reset - } + audio->setNotifyInterval(500); + QVERIFY(audio->notifyInterval() == 500); // Custom + + audio->setNotifyInterval(1000); // reset } void tst_QAudioInput::pullFile() { - if(available) { - QFile filename(SRCDIR"test.raw"); - filename.open( QIODevice::WriteOnly | QIODevice::Truncate ); - - QSignalSpy readSignal(audio, SIGNAL(notify())); - QSignalSpy stateSignal(audio, SIGNAL(stateChanged(QAudio::State))); - - // Always have default states, before start - QVERIFY(audio->state() == QAudio::StoppedState); - QVERIFY(audio->error() == QAudio::NoError); - QVERIFY(audio->elapsedUSecs() == 0); - - audio->start(&filename); - QTest::qWait(20); - // Check state and periodSize() are valid non-zero values. - QVERIFY(audio->state() == QAudio::ActiveState); - QVERIFY(audio->error() == QAudio::NoError); - QVERIFY(audio->elapsedUSecs() > 10000 && audio->elapsedUSecs() < 800000); - QVERIFY(audio->periodSize() > 0); - QVERIFY(stateSignal.count() == 1); // State changed to QAudio::ActiveState - - // Wait until finished... - QTest::qWait(5000); - - QVERIFY(readSignal.count() > 0); - QVERIFY(audio->processedUSecs() > 0); - - audio->stop(); - QTest::qWait(20); - QVERIFY(audio->state() == QAudio::StoppedState); - QVERIFY(audio->elapsedUSecs() == 0); - // Can only check to make sure we got at least 1 more signal, but can be more. - QVERIFY(stateSignal.count() > 1); - - filename.close(); - } + if (!available) + QSKIP("No audio input device found, no test will be performed", SkipAll); + + QFile filename(SRCDIR"test.raw"); + filename.open( QIODevice::WriteOnly | QIODevice::Truncate ); + + QSignalSpy readSignal(audio, SIGNAL(notify())); + QSignalSpy stateSignal(audio, SIGNAL(stateChanged(QAudio::State))); + + // Always have default states, before start + QVERIFY(audio->state() == QAudio::StoppedState); + QVERIFY(audio->error() == QAudio::NoError); + QVERIFY(audio->elapsedUSecs() == 0); + + audio->start(&filename); + QTest::qWait(20); + // Check state and periodSize() are valid non-zero values. + QVERIFY(audio->state() == QAudio::ActiveState); + QVERIFY(audio->error() == QAudio::NoError); + QVERIFY(audio->elapsedUSecs() > 10000 && audio->elapsedUSecs() < 800000); + QVERIFY(audio->periodSize() > 0); + QVERIFY(stateSignal.count() == 1); // State changed to QAudio::ActiveState + + // Wait until finished... + QTest::qWait(5000); + + QVERIFY(readSignal.count() > 0); + QVERIFY(audio->processedUSecs() > 0); + + audio->stop(); + QTest::qWait(20); + QVERIFY(audio->state() == QAudio::StoppedState); + QVERIFY(audio->elapsedUSecs() == 0); + // Can only check to make sure we got at least 1 more signal, but can be more. + QVERIFY(stateSignal.count() > 1); + + filename.close(); } QTEST_MAIN(tst_QAudioInput) -- cgit v0.12 From 84d51bff971607e2e32680841a355209d97a2235 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Mon, 25 Jul 2011 22:22:20 +0200 Subject: Fix files that don't end with a newline character These are cosmetic changes to files that do not end with a newline character. Change-Id: I5b3e270386a1ef1ea2c1f57a1de3f7e3a8a52f5a Reviewed-by: Rohan McGovern --- config.tests/mac/xcodeversion.cpp | 6 +++--- demos/embedded/lightmaps/lightmaps.h | 2 +- demos/embedded/lightmaps/mapzoom.h | 2 +- demos/embedded/lightmaps/slippymap.h | 2 +- demos/mobile/guitartuner/src/guitartuner.rc | 2 +- doc/src/snippets/qcolumnview/main.cpp | 2 +- doc/src/snippets/textdocument-imagedrop/main.cpp | 2 +- doc/src/snippets/textdocument-imagedrop/textedit.h | 6 +++--- examples/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.cpp | 2 +- examples/tutorials/gettingStarted/gsQml/filedialog/directory.cpp | 2 +- examples/tutorials/gettingStarted/gsQml/filedialog/file.cpp | 2 +- examples/tutorials/gettingStarted/gsQml/filedialog/file.h | 2 +- examples/tutorials/modelview/4_headers/main.cpp | 2 +- examples/tutorials/threads/clock/clockthread.h | 2 +- src/gui/dialogs/qfiledialog_win_p.h | 2 +- tools/macdeployqt/tests/tst_deployment_mac.cpp | 2 +- tools/qtconcurrent/codegenerator/src/codegenerator.cpp | 4 ++-- tools/qtestlib/wince/cetest/deployment.h | 2 +- 18 files changed, 23 insertions(+), 23 deletions(-) diff --git a/config.tests/mac/xcodeversion.cpp b/config.tests/mac/xcodeversion.cpp index df208e3..0cc3777 100644 --- a/config.tests/mac/xcodeversion.cpp +++ b/config.tests/mac/xcodeversion.cpp @@ -73,7 +73,7 @@ int main(int argc, const char **argv) const char * ok3 ="3.0"; // ptr = fail1; // printf ("string: %s\n", ptr); - + int length = strlen(ptr); if (length < 3) // expect "x.y" at least return internal_error; @@ -94,6 +94,6 @@ int main(int argc, const char **argv) if (ptr[4] < '1') return fail; - + return success; -} \ No newline at end of file +} diff --git a/demos/embedded/lightmaps/lightmaps.h b/demos/embedded/lightmaps/lightmaps.h index 45b5c18..0e458ea 100644 --- a/demos/embedded/lightmaps/lightmaps.h +++ b/demos/embedded/lightmaps/lightmaps.h @@ -85,4 +85,4 @@ private: bool invert; }; -#endif \ No newline at end of file +#endif diff --git a/demos/embedded/lightmaps/mapzoom.h b/demos/embedded/lightmaps/mapzoom.h index ac70a23..935660c 100644 --- a/demos/embedded/lightmaps/mapzoom.h +++ b/demos/embedded/lightmaps/mapzoom.h @@ -66,4 +66,4 @@ private: QNetworkSession *networkSession; }; -#endif \ No newline at end of file +#endif diff --git a/demos/embedded/lightmaps/slippymap.h b/demos/embedded/lightmaps/slippymap.h index 64ba5c3..480dc81 100644 --- a/demos/embedded/lightmaps/slippymap.h +++ b/demos/embedded/lightmaps/slippymap.h @@ -84,4 +84,4 @@ private: QUrl m_url; }; -#endif \ No newline at end of file +#endif diff --git a/demos/mobile/guitartuner/src/guitartuner.rc b/demos/mobile/guitartuner/src/guitartuner.rc index 85cee0b..b4f7a11 100644 --- a/demos/mobile/guitartuner/src/guitartuner.rc +++ b/demos/mobile/guitartuner/src/guitartuner.rc @@ -20,4 +20,4 @@ BEGIN BEGIN VALUE "Translation", 0x409, 1252 END -END \ No newline at end of file +END diff --git a/doc/src/snippets/qcolumnview/main.cpp b/doc/src/snippets/qcolumnview/main.cpp index c39a4bb..fecff12 100644 --- a/doc/src/snippets/qcolumnview/main.cpp +++ b/doc/src/snippets/qcolumnview/main.cpp @@ -76,4 +76,4 @@ int main(int argc, char *argv[]) columnView.show(); return app.exec(); -} \ No newline at end of file +} diff --git a/doc/src/snippets/textdocument-imagedrop/main.cpp b/doc/src/snippets/textdocument-imagedrop/main.cpp index 24cd2de..0cdf3a1 100644 --- a/doc/src/snippets/textdocument-imagedrop/main.cpp +++ b/doc/src/snippets/textdocument-imagedrop/main.cpp @@ -49,4 +49,4 @@ int main(int argc, char * argv[]) textEdit->show(); return app.exec(); -} \ No newline at end of file +} diff --git a/doc/src/snippets/textdocument-imagedrop/textedit.h b/doc/src/snippets/textdocument-imagedrop/textedit.h index 9e0492b..9db9f17 100644 --- a/doc/src/snippets/textdocument-imagedrop/textedit.h +++ b/doc/src/snippets/textdocument-imagedrop/textedit.h @@ -46,11 +46,11 @@ class TextEdit : public QTextEdit { Q_OBJECT - -public: + +public: TextEdit(QWidget *parent=0); bool canInsertFromMimeData( const QMimeData *source ) const; void insertFromMimeData( const QMimeData *source ); }; -#endif \ No newline at end of file +#endif diff --git a/examples/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.cpp b/examples/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.cpp index fde24d9..3b02c63 100644 --- a/examples/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.cpp +++ b/examples/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.cpp @@ -51,4 +51,4 @@ void DialogPlugin::registerTypes(const char *uri) } //FileDialog is the plugin name (same as the TARGET in the project file) and DialogPlugin is the plugin classs -Q_EXPORT_PLUGIN2(FileDialog, DialogPlugin); \ No newline at end of file +Q_EXPORT_PLUGIN2(FileDialog, DialogPlugin); diff --git a/examples/tutorials/gettingStarted/gsQml/filedialog/directory.cpp b/examples/tutorials/gettingStarted/gsQml/filedialog/directory.cpp index c675fc9..52bdfc7 100644 --- a/examples/tutorials/gettingStarted/gsQml/filedialog/directory.cpp +++ b/examples/tutorials/gettingStarted/gsQml/filedialog/directory.cpp @@ -221,4 +221,4 @@ void Directory::refresh() } m_fileList.append(file); } -} \ No newline at end of file +} diff --git a/examples/tutorials/gettingStarted/gsQml/filedialog/file.cpp b/examples/tutorials/gettingStarted/gsQml/filedialog/file.cpp index 44b0915..17740f2 100644 --- a/examples/tutorials/gettingStarted/gsQml/filedialog/file.cpp +++ b/examples/tutorials/gettingStarted/gsQml/filedialog/file.cpp @@ -54,4 +54,4 @@ void File::setName(const QString &str){ m_name = str; emit nameChanged(); } -} \ No newline at end of file +} diff --git a/examples/tutorials/gettingStarted/gsQml/filedialog/file.h b/examples/tutorials/gettingStarted/gsQml/filedialog/file.h index 21e8ebb..6aa6a6a 100644 --- a/examples/tutorials/gettingStarted/gsQml/filedialog/file.h +++ b/examples/tutorials/gettingStarted/gsQml/filedialog/file.h @@ -64,4 +64,4 @@ class File : public QObject{ QString m_name; }; -#endif \ No newline at end of file +#endif diff --git a/examples/tutorials/modelview/4_headers/main.cpp b/examples/tutorials/modelview/4_headers/main.cpp index c89829a..8a4ab8f 100755 --- a/examples/tutorials/modelview/4_headers/main.cpp +++ b/examples/tutorials/modelview/4_headers/main.cpp @@ -50,4 +50,4 @@ int main(int argc, char *argv[]) tableView.setModel( &myModel ); tableView.show(); return a.exec(); -} \ No newline at end of file +} diff --git a/examples/tutorials/threads/clock/clockthread.h b/examples/tutorials/threads/clock/clockthread.h index 966dbea..d77a52b 100644 --- a/examples/tutorials/threads/clock/clockthread.h +++ b/examples/tutorials/threads/clock/clockthread.h @@ -61,4 +61,4 @@ private slots: }; //! [1] -#endif // CLOCKTHREAD_H \ No newline at end of file +#endif // CLOCKTHREAD_H diff --git a/src/gui/dialogs/qfiledialog_win_p.h b/src/gui/dialogs/qfiledialog_win_p.h index 1ff29d2..1408057 100644 --- a/src/gui/dialogs/qfiledialog_win_p.h +++ b/src/gui/dialogs/qfiledialog_win_p.h @@ -240,4 +240,4 @@ DECLARE_INTERFACE_(IFileOpenDialog, IFileDialog) STDMETHOD(GetResults)(THIS_ IShellItemArray **ppenum) PURE; STDMETHOD(GetSelectedItems)(THIS_ IShellItemArray **ppsai) PURE; }; -#endif \ No newline at end of file +#endif diff --git a/tools/macdeployqt/tests/tst_deployment_mac.cpp b/tools/macdeployqt/tests/tst_deployment_mac.cpp index 858dc45..5921199 100644 --- a/tools/macdeployqt/tests/tst_deployment_mac.cpp +++ b/tools/macdeployqt/tests/tst_deployment_mac.cpp @@ -230,4 +230,4 @@ void tst_deployment_mac::testFindAppBinarty() QTEST_MAIN(tst_deployment_mac) -#include "tst_deployment_mac.moc" \ No newline at end of file +#include "tst_deployment_mac.moc" diff --git a/tools/qtconcurrent/codegenerator/src/codegenerator.cpp b/tools/qtconcurrent/codegenerator/src/codegenerator.cpp index b8436b9..c81fe97 100644 --- a/tools/qtconcurrent/codegenerator/src/codegenerator.cpp +++ b/tools/qtconcurrent/codegenerator/src/codegenerator.cpp @@ -134,7 +134,7 @@ const Compound operator+(const Item &a, const char * const text) const Compound operator+(const char * const text, const Item &b) { - return Compound(Text(text), b); + return Compound(Text(text), b); } -} \ No newline at end of file +} diff --git a/tools/qtestlib/wince/cetest/deployment.h b/tools/qtestlib/wince/cetest/deployment.h index f3645e0..a5ef32d 100644 --- a/tools/qtestlib/wince/cetest/deployment.h +++ b/tools/qtestlib/wince/cetest/deployment.h @@ -72,4 +72,4 @@ private: inline void DeploymentHandler::setConnection(AbstractRemoteConnection *connection) { m_connection = connection; } inline AbstractRemoteConnection* DeploymentHandler::connection() const { return m_connection; } -#endif \ No newline at end of file +#endif -- cgit v0.12 From 3be7f871f07041477b5bca0182623b36afd2b3e6 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Sat, 13 Aug 2011 00:18:18 +0200 Subject: test: Fix `tst_qfiledialog' in a namespaced build Reviewed-by: Pierre Rossi --- tests/auto/qfiledialog/tst_qfiledialog.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp index 08d2e88..81da8a3 100644 --- a/tests/auto/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp @@ -80,7 +80,9 @@ # define SRCDIR "C:/Private/" TOSTRING(SYMBIAN_SRCDIR_UID) "/" #elif defined(Q_OS_UNIX) #ifdef QT_BUILD_INTERNAL +QT_BEGIN_NAMESPACE extern Q_GUI_EXPORT QString qt_tildeExpansion(const QString &path, bool *expanded = 0); +QT_END_NAMESPACE #endif #endif -- cgit v0.12