summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-06-10 23:27:10 +0200
committerLiang Qi <liang.qi@qt.io>2016-06-10 23:27:10 +0200
commitcbe332405aa22257d432f1797b325f5e57007c20 (patch)
tree0d817dc7ed2f3a2f6035f924a824d351420910c5 /tests/auto/corelib
parentd2c6294bd5cc3c2e61aaa0c83bfd74941ced150e (diff)
parent67ca72796e23269451795baf9adde02a184a7b9e (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: configure mkspecs/macx-ios-clang/features/default_pre.prf mkspecs/macx-ios-clang/features/sdk.prf mkspecs/unsupported/freebsd-g++46/qplatformdefs.h src/widgets/styles/qgtkstyle.cpp tests/auto/corelib/io/qdiriterator/qdiriterator.pro tests/auto/corelib/io/qfileinfo/qfileinfo.pro Change-Id: Ia943555d1e59234a66f7dc65bdfda838e40001b5
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/io/qdebug/tst_qdebug.cpp6
-rw-r--r--tests/auto/corelib/io/qdir/qdir.pro2
-rw-r--r--tests/auto/corelib/io/qdir/tst_qdir.cpp63
-rw-r--r--tests/auto/corelib/io/qdiriterator/qdiriterator.pro2
-rw-r--r--tests/auto/corelib/io/qfileinfo/qfileinfo.pro2
-rw-r--r--tests/auto/corelib/plugin/qplugin/qplugin.pro34
-rw-r--r--tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp39
7 files changed, 89 insertions, 59 deletions
diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
index abec4e7aba..7147405f3b 100644
--- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
+++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
@@ -359,14 +359,14 @@ void tst_QDebug::qDebugQChar() const
MessageHandlerSetter mhs(myMessageHandler);
{
QDebug d = qDebug();
- d << QChar('f');
- d.nospace().noquote() << QChar('o') << QChar('o');
+ d << QChar('f') << QChar(QLatin1Char('\xE4')); // f, ä
+ d.nospace().noquote() << QChar('o') << QChar('o') << QChar(QLatin1Char('\xC4')); // o, o, Ä
}
#ifndef QT_NO_MESSAGELOGCONTEXT
file = __FILE__; line = __LINE__ - 5; function = Q_FUNC_INFO;
#endif
QCOMPARE(s_msgType, QtDebugMsg);
- QCOMPARE(s_msg, QString::fromLatin1("'f' oo"));
+ QCOMPARE(s_msg, QString::fromLatin1("'f' '\\u00e4' oo\\u00c4"));
QCOMPARE(QString::fromLatin1(s_file), file);
QCOMPARE(s_line, line);
QCOMPARE(QString::fromLatin1(s_function), function);
diff --git a/tests/auto/corelib/io/qdir/qdir.pro b/tests/auto/corelib/io/qdir/qdir.pro
index e5739f7e0a..4870922312 100644
--- a/tests/auto/corelib/io/qdir/qdir.pro
+++ b/tests/auto/corelib/io/qdir/qdir.pro
@@ -11,5 +11,3 @@ contains(CONFIG, builtin_testdata): DEFINES += BUILTIN_TESTDATA
android {
RESOURCES += android_testdata.qrc
}
-
-win32: CONFIG += insignificant_test # Crashes on Windows in release builds
diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp
index 703e9c5b07..48b8db949f 100644
--- a/tests/auto/corelib/io/qdir/tst_qdir.cpp
+++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp
@@ -208,6 +208,7 @@ private slots:
void cdNonreadable();
+ void cdBelowRoot_data();
void cdBelowRoot();
private:
@@ -2259,31 +2260,37 @@ void tst_QDir::cdNonreadable()
#endif
}
+void tst_QDir::cdBelowRoot_data()
+{
+ QTest::addColumn<QString>("rootPath");
+ QTest::addColumn<QString>("cdInto");
+ QTest::addColumn<QString>("targetPath");
+
+#if defined(Q_OS_ANDROID)
+ QTest::newRow("android") << "/" << "system" << "/system";
+#elif defined(Q_OS_UNIX)
+ QTest::newRow("unix") << "/" << "tmp" << "/tmp";
+#elif defined(Q_OS_WINRT)
+ QTest::newRow("winrt") << QDir::rootPath() << QDir::rootPath() << QDir::rootPath();
+#else // Windows+CE
+ const QString systemDrive = QString::fromLocal8Bit(qgetenv("SystemDrive")) + QLatin1Char('/');
+ const QString systemRoot = QString::fromLocal8Bit(qgetenv("SystemRoot"));
+ QTest::newRow("windows-drive")
+ << systemDrive << systemRoot.mid(3) << QDir::cleanPath(systemRoot);
+#endif // Windows
+}
+
void tst_QDir::cdBelowRoot()
{
-#if defined (Q_OS_ANDROID)
-#define ROOT QString("/")
-#define DIR QString("/system")
-#define CD_INTO "system"
-#elif defined (Q_OS_UNIX)
-#define ROOT QString("/")
-#define DIR QString("/tmp")
-#define CD_INTO "tmp"
-#elif defined (Q_OS_WINRT)
-#define ROOT QDir::rootPath()
-#define DIR QDir::rootPath()
-#define CD_INTO QDir::rootPath()
-#else
-#define ROOT QString::fromLocal8Bit(qgetenv("SystemDrive"))+"/"
-#define DIR QString::fromLocal8Bit(qgetenv("SystemRoot")).replace('\\', '/')
-#define CD_INTO QString::fromLocal8Bit(qgetenv("SystemRoot")).mid(3)
-#endif
+ QFETCH(QString, rootPath);
+ QFETCH(QString, cdInto);
+ QFETCH(QString, targetPath);
- QDir root(ROOT);
- QVERIFY(!root.cd(".."));
- QCOMPARE(root.path(), ROOT);
- QVERIFY(root.cd(CD_INTO));
- QCOMPARE(root.path(), DIR);
+ QDir root(rootPath);
+ QVERIFY2(!root.cd(".."), qPrintable(root.absolutePath()));
+ QCOMPARE(root.path(), rootPath);
+ QVERIFY(root.cd(cdInto));
+ QCOMPARE(root.path(), targetPath);
#ifdef Q_OS_UNIX
if (::getuid() == 0)
QSKIP("Running this test as root doesn't make sense");
@@ -2291,13 +2298,13 @@ void tst_QDir::cdBelowRoot()
#ifdef Q_OS_WINRT
QSKIP("WinRT has no concept of system root");
#endif
- QDir dir(DIR);
- QVERIFY(!dir.cd("../.."));
- QCOMPARE(dir.path(), DIR);
- QVERIFY(!dir.cd("../abs/../.."));
- QCOMPARE(dir.path(), DIR);
+ QDir dir(targetPath);
+ QVERIFY2(!dir.cd("../.."), qPrintable(dir.absolutePath()));
+ QCOMPARE(dir.path(), targetPath);
+ QVERIFY2(!dir.cd("../abs/../.."), qPrintable(dir.absolutePath()));
+ QCOMPARE(dir.path(), targetPath);
QVERIFY(dir.cd(".."));
- QCOMPARE(dir.path(), ROOT);
+ QCOMPARE(dir.path(), rootPath);
}
QTEST_MAIN(tst_QDir)
diff --git a/tests/auto/corelib/io/qdiriterator/qdiriterator.pro b/tests/auto/corelib/io/qdiriterator/qdiriterator.pro
index 2d8dfba996..5404e9058f 100644
--- a/tests/auto/corelib/io/qdiriterator/qdiriterator.pro
+++ b/tests/auto/corelib/io/qdiriterator/qdiriterator.pro
@@ -8,5 +8,3 @@ TESTDATA += entrylist
contains(CONFIG, builtin_testdata): DEFINES += BUILTIN_TESTDATA
wince*mips*|wincewm50smart-msvc200*: DEFINES += WINCE_BROKEN_ITERATE=1
-
-win32: CONFIG += insignificant_test # Crashes on Windows in release builds
diff --git a/tests/auto/corelib/io/qfileinfo/qfileinfo.pro b/tests/auto/corelib/io/qfileinfo/qfileinfo.pro
index 8aa81896cc..48673b20a9 100644
--- a/tests/auto/corelib/io/qfileinfo/qfileinfo.pro
+++ b/tests/auto/corelib/io/qfileinfo/qfileinfo.pro
@@ -6,5 +6,3 @@ RESOURCES += qfileinfo.qrc \
testdata.qrc
win32:!wince:!winrt:LIBS += -ladvapi32 -lnetapi32
-
-win32: CONFIG += insignificant_test # Crashes on Windows in release builds
diff --git a/tests/auto/corelib/plugin/qplugin/qplugin.pro b/tests/auto/corelib/plugin/qplugin/qplugin.pro
index 918ffb44bd..5283c2d52b 100644
--- a/tests/auto/corelib/plugin/qplugin/qplugin.pro
+++ b/tests/auto/corelib/plugin/qplugin/qplugin.pro
@@ -1,27 +1,17 @@
-QT = core
TEMPLATE = subdirs
+TESTPLUGINS =
+
win32 {
- exists($$[QT_INSTALL_LIBS/get]/QtCore4.dll) {
- SUBDIRS = releaseplugin
- }
- exists($$[QT_INSTALL_LIBS/get]/QtCored4.dll) {
- SUBDIRS += debugplugin
- }
-}
-mac {
- CONFIG(debug, debug|release): {
- SUBDIRS += debugplugin
- tst_qplugin_pro.depends += debugplugin
- }
- CONFIG(release, debug|release): {
- SUBDIRS += releaseplugin
- tst_qplugin_pro.depends += releaseplugin
- }
+ contains(QT_CONFIG, debug): TESTPLUGINS += debugplugin
+ contains(QT_CONFIG, release): TESTPLUGINS += releaseplugin
+} else:osx {
+ CONFIG(debug, debug|release): TESTPLUGINS += debugplugin
+ CONFIG(release, debug|release): TESTPLUGINS += releaseplugin
+} else {
+ TESTPLUGINS = debugplugin releaseplugin
}
-!win32:!mac:{
- SUBDIRS = debugplugin releaseplugin
- tst_qplugin_pro.depends += debugplugin releaseplugin
-}
-SUBDIRS += tst_qplugin.pro
+SUBDIRS += main $$TESTPLUGINS
+main.file = tst_qplugin.pro
+main.depends = $$TESTPLUGINS
diff --git a/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp b/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp
index 8a153a4599..26d443c2c6 100644
--- a/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp
+++ b/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp
@@ -556,6 +556,7 @@ private slots:
void checkCommentIndentation() const;
void checkCommentIndentation_data() const;
void crashInXmlStreamReader() const;
+ void write8bitCodec() const;
void hasError() const;
private:
@@ -1576,5 +1577,43 @@ void tst_QXmlStream::hasError() const
}
+void tst_QXmlStream::write8bitCodec() const
+{
+ QBuffer outBuffer;
+ QVERIFY(outBuffer.open(QIODevice::WriteOnly));
+ QXmlStreamWriter writer(&outBuffer);
+ writer.setAutoFormatting(false);
+
+ QTextCodec *codec = QTextCodec::codecForName("IBM500");
+ if (!codec) {
+ QSKIP("Encoding IBM500 not available.");
+ }
+ writer.setCodec(codec);
+
+ writer.writeStartDocument();
+ writer.writeStartElement("root");
+ writer.writeAttribute("attrib", "1");
+ writer.writeEndElement();
+ writer.writeEndDocument();
+ outBuffer.close();
+
+ // test 8 bit encoding
+ QByteArray values = outBuffer.data();
+ QVERIFY(values.size() > 1);
+ // check '<'
+ QCOMPARE(values[0] & 0x00FF, 0x4c);
+ // check '?'
+ QCOMPARE(values[1] & 0x00FF, 0x6F);
+
+ // convert the start of the XML
+ const QString expected = ("<?xml version=\"1.0\" encoding=\"IBM500\"?>");
+ QTextDecoder *decoder = codec->makeDecoder();
+ QVERIFY(decoder);
+ QString decodedText = decoder->toUnicode(values);
+ delete decoder;
+ QVERIFY(decodedText.startsWith(expected));
+}
+
+
#include "tst_qxmlstream.moc"
// vim: et:ts=4:sw=4:sts=4