diff options
Diffstat (limited to 'tests/auto/networkselftest/tst_networkselftest.cpp')
-rw-r--r-- | tests/auto/networkselftest/tst_networkselftest.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/networkselftest/tst_networkselftest.cpp b/tests/auto/networkselftest/tst_networkselftest.cpp index 00ccadb..4e60101 100644 --- a/tests/auto/networkselftest/tst_networkselftest.cpp +++ b/tests/auto/networkselftest/tst_networkselftest.cpp @@ -41,6 +41,14 @@ #include <QtTest/QtTest> #include <QtNetwork/QtNetwork> + +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +// Current path (C:\private\<UID>) contains only ascii chars +//#define SRCDIR QDir::currentPath() +#define SRCDIR "." +#endif + #include "../network-settings.h" class tst_NetworkSelfTest: public QObject @@ -57,6 +65,7 @@ private slots: void serverReachability(); void remotePortsOpen_data(); void remotePortsOpen(); + void fileLineEndingTest(); // specific protocol tests void ftpServer(); @@ -392,6 +401,31 @@ void tst_NetworkSelfTest::remotePortsOpen() QVERIFY(socket.state() == QAbstractSocket::ConnectedState); } + +void tst_NetworkSelfTest::fileLineEndingTest() +{ + QString referenceName = SRCDIR "/rfc3252.txt"; + long long expectedReferenceSize = 25962; + + QString lineEndingType("LF"); + + QFile reference(referenceName); + QVERIFY(reference.open(QIODevice::ReadOnly)); + QByteArray byteLine = reference.readLine(); + if(byteLine.endsWith("\r\n")) + lineEndingType = "CRLF"; + else if(byteLine.endsWith("\r")) + lineEndingType = "CR"; + + QString referenceAsTextData; + QFile referenceAsText(referenceName); + QVERIFY(referenceAsText.open(QIODevice::ReadOnly)); + referenceAsTextData = referenceAsText.readAll(); + + QVERIFY2(expectedReferenceSize == referenceAsTextData.length(), QString("Reference file %1 has %2 as line ending and file size not matching - Git checkout issue !?!").arg(referenceName, lineEndingType).toLocal8Bit()); + QVERIFY2(!lineEndingType.compare("LF"), QString("Reference file %1 has %2 as line ending - Git checkout issue !?!").arg(referenceName, lineEndingType).toLocal8Bit()); +} + static QList<Chat> ftpChat() { return QList<Chat>() << Chat::expect("220") |