summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/io/qprocess/qprocess.pro6
-rw-r--r--tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/main.cpp50
-rw-r--r--tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/testSetNamedPipeHandleState.pro4
-rw-r--r--tests/auto/corelib/io/qprocess/tst_qprocess.cpp15
-rw-r--r--tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp16
-rw-r--r--tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp12
-rw-r--r--tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp31
7 files changed, 131 insertions, 3 deletions
diff --git a/tests/auto/corelib/io/qprocess/qprocess.pro b/tests/auto/corelib/io/qprocess/qprocess.pro
index 4155e3f73d..6ba54b1e92 100644
--- a/tests/auto/corelib/io/qprocess/qprocess.pro
+++ b/tests/auto/corelib/io/qprocess/qprocess.pro
@@ -8,7 +8,11 @@ SUBDIRS += testProcessSpacesArgs/nospace.pro \
testProcessSpacesArgs/twospaces.pro \
testSpaceInName
-win32:!wince*:SUBDIRS+=testProcessEchoGui
+win32:!wince* {
+ SUBDIRS += \
+ testProcessEchoGui \
+ testSetNamedPipeHandleState
+}
test.depends += $$SUBDIRS
SUBDIRS += test
diff --git a/tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/main.cpp b/tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/main.cpp
new file mode 100644
index 0000000000..b2cc793b51
--- /dev/null
+++ b/tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/main.cpp
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 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$
+**
+****************************************************************************/
+
+#include <windows.h>
+
+int main()
+{
+ DWORD mode = PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT;
+ if (SetNamedPipeHandleState(GetStdHandle(STD_INPUT_HANDLE), &mode, NULL, NULL))
+ return 0;
+ return GetLastError();
+}
diff --git a/tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/testSetNamedPipeHandleState.pro b/tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/testSetNamedPipeHandleState.pro
new file mode 100644
index 0000000000..e236e05c7d
--- /dev/null
+++ b/tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/testSetNamedPipeHandleState.pro
@@ -0,0 +1,4 @@
+SOURCES = main.cpp
+CONFIG -= qt app_bundle
+CONFIG += console
+DESTDIR = ./
diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
index d248f022ed..37f224ff28 100644
--- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
+++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
@@ -93,6 +93,7 @@ private slots:
void echoTest2();
#ifdef Q_OS_WIN
void echoTestGui();
+ void testSetNamedPipeHandleState();
void batFiles_data();
void batFiles();
#endif
@@ -538,7 +539,6 @@ void tst_QProcess::echoTest2()
#endif
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
-//Batch files are not supported on Winfows CE
// Reading and writing to a process is not supported on Qt/CE
//-----------------------------------------------------------------------------
void tst_QProcess::echoTestGui()
@@ -556,11 +556,22 @@ void tst_QProcess::echoTestGui()
QCOMPARE(process.readAllStandardOutput(), QByteArray("Hello"));
QCOMPARE(process.readAllStandardError(), QByteArray("Hello"));
}
+
+void tst_QProcess::testSetNamedPipeHandleState()
+{
+ QProcess process;
+ process.setProcessChannelMode(QProcess::SeparateChannels);
+ process.start("testSetNamedPipeHandleState/testSetNamedPipeHandleState");
+ QVERIFY2(process.waitForStarted(5000), qPrintable(process.errorString()));
+ QVERIFY(process.waitForFinished(5000));
+ QCOMPARE(process.exitCode(), 0);
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+}
#endif // !Q_OS_WINCE && Q_OS_WIN
//-----------------------------------------------------------------------------
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
-//Batch files are not supported on Winfows CE
+// Batch files are not supported on Windows CE
void tst_QProcess::batFiles_data()
{
QTest::addColumn<QString>("batFile");
diff --git a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
index 0570985e46..0e7005799e 100644
--- a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
+++ b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
@@ -75,6 +75,8 @@ private slots:
void usage_connect();
void usage_templateConnect();
+ void classNameFirstInStringData();
+
private:
static bool checkForSideEffects
(const QMetaObjectBuilder& builder,
@@ -1694,6 +1696,20 @@ void tst_QMetaObjectBuilder::usage_templateConnect()
QVERIFY(!con);
}
+void tst_QMetaObjectBuilder::classNameFirstInStringData()
+{
+ QMetaObjectBuilder builder;
+ builder.addMetaObject(&SomethingOfEverything::staticMetaObject);
+ builder.setClassName(QByteArrayLiteral("TestClass"));
+ QMetaObject *mo = builder.toMetaObject();
+
+ QByteArrayDataPtr header;
+ header.ptr = const_cast<QByteArrayData*>(mo->d.stringdata);
+ QCOMPARE(QByteArray(header), QByteArrayLiteral("TestClass"));
+
+ free(mo);
+}
+
QTEST_MAIN(tst_QMetaObjectBuilder)
#include "tst_qmetaobjectbuilder.moc"
diff --git a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
index d5b3323506..cbbb30a598 100644
--- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
+++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
@@ -69,6 +69,7 @@ private slots:
void testUnknownOptionErrorHandling();
void testDoubleDash_data();
void testDoubleDash();
+ void testDefaultValue();
void testProcessNotCalled();
void testEmptyArgsList();
void testMissingOptionValue();
@@ -322,6 +323,17 @@ void tst_QCommandLineParser::testDoubleDash()
QCOMPARE(parser.unknownOptionNames(), QStringList());
}
+void tst_QCommandLineParser::testDefaultValue()
+{
+ QCommandLineOption opt(QStringLiteral("name"), QStringLiteral("desc"),
+ QStringLiteral("valueName"), QStringLiteral("default"));
+ QCOMPARE(opt.defaultValues(), QStringList(QStringLiteral("default")));
+ opt.setDefaultValue(QStringLiteral(""));
+ QCOMPARE(opt.defaultValues(), QStringList());
+ opt.setDefaultValue(QStringLiteral("default"));
+ QCOMPARE(opt.defaultValues(), QStringList(QStringLiteral("default")));
+}
+
void tst_QCommandLineParser::testProcessNotCalled()
{
QCoreApplication app(empty_argc, empty_argv);
diff --git a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
index 0a63ffeeaf..d81bfc33fb 100644
--- a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
+++ b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
@@ -56,6 +56,7 @@ private slots:
void createTest();
void nullTest();
void dataStreamTest();
+ void isTimeZoneIdAvailable();
void availableTimeZoneIds();
void stressTest();
void windowsId();
@@ -347,6 +348,36 @@ void tst_QTimeZone::dataStreamTest()
QCOMPARE(tz2.id(), tz1.id());
}
+void tst_QTimeZone::isTimeZoneIdAvailable()
+{
+ QList<QByteArray> available = QTimeZone::availableTimeZoneIds();
+ foreach (const QByteArray &id, available)
+ QVERIFY(QTimeZone::isTimeZoneIdAvailable(id));
+
+ // a-z, A-Z, 0-9, '.', '-', '_' are valid chars
+ // Can't start with '-'
+ // Parts separated by '/', each part min 1 and max of 14 chars
+ QCOMPARE(QTimeZonePrivate::isValidId("az"), true);
+ QCOMPARE(QTimeZonePrivate::isValidId("AZ"), true);
+ QCOMPARE(QTimeZonePrivate::isValidId("09"), true);
+ QCOMPARE(QTimeZonePrivate::isValidId("a/z"), true);
+ QCOMPARE(QTimeZonePrivate::isValidId("a.z"), true);
+ QCOMPARE(QTimeZonePrivate::isValidId("a-z"), true);
+ QCOMPARE(QTimeZonePrivate::isValidId("a_z"), true);
+ QCOMPARE(QTimeZonePrivate::isValidId(".z"), true);
+ QCOMPARE(QTimeZonePrivate::isValidId("_z"), true);
+ QCOMPARE(QTimeZonePrivate::isValidId("12345678901234"), true);
+ QCOMPARE(QTimeZonePrivate::isValidId("12345678901234/12345678901234"), true);
+ QCOMPARE(QTimeZonePrivate::isValidId("a z"), false);
+ QCOMPARE(QTimeZonePrivate::isValidId("a\\z"), false);
+ QCOMPARE(QTimeZonePrivate::isValidId("a,z"), false);
+ QCOMPARE(QTimeZonePrivate::isValidId("/z"), false);
+ QCOMPARE(QTimeZonePrivate::isValidId("-z"), false);
+ QCOMPARE(QTimeZonePrivate::isValidId("123456789012345"), false);
+ QCOMPARE(QTimeZonePrivate::isValidId("123456789012345/12345678901234"), false);
+ QCOMPARE(QTimeZonePrivate::isValidId("12345678901234/123456789012345"), false);
+}
+
void tst_QTimeZone::availableTimeZoneIds()
{
if (debug) {