diff options
author | Liang Qi <liang.qi@qt.io> | 2016-05-20 13:46:21 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2016-05-23 21:09:46 +0200 |
commit | 56d6e000f7487c59172330ebd23a718268c508f1 (patch) | |
tree | 1494432583b1569816075091a8075b31d795f77c /tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp | |
parent | 9fd407fc6a29c94b4568dd042a05c208255179e0 (diff) | |
parent | c276aa51303b7c6f8e4cd854aadf8344a906e50f (diff) |
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
mkspecs/wince80colibri-armv7-msvc2012/qmake.conf
qmake/generators/win32/msvc_vcproj.cpp
src/corelib/global/qnamespace.h
src/corelib/global/qnamespace.qdoc
src/corelib/io/qfsfileengine_win.cpp
src/corelib/tools/tools.pri
src/network/ssl/qsslconfiguration_p.h
src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp
src/plugins/platforms/windows/windows.pri
src/src.pro
src/tools/bootstrap/bootstrap.pro
src/tools/uic/cpp/cppwriteinitialization.cpp
src/widgets/dialogs/qfilesystemmodel.cpp
tests/auto/testlib/selftests/expected_cmptest.teamcity
tests/auto/testlib/selftests/expected_cmptest.txt
Change-Id: I4d2ac78f0dcc97f008186bbbc769c6fe588ab0e5
Diffstat (limited to 'tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp')
-rw-r--r-- | tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp b/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp index 802bbe9963..8b1aa105de 100644 --- a/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp +++ b/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp @@ -27,14 +27,18 @@ ****************************************************************************/ #include <QtTest/QtTest> - #include <QStorageInfo> +#include <stdarg.h> + +#include "../../../../manual/qstorageinfo/printvolumes.cpp" + class tst_QStorageInfo : public QObject { Q_OBJECT private slots: void defaultValues(); + void dump(); void operatorEqual(); #ifndef Q_OS_WINRT void operatorNotEqual(); @@ -61,6 +65,33 @@ void tst_QStorageInfo::defaultValues() QCOMPARE(storage.bytesAvailable(), -1); } +static int qInfoPrinter(const char *format, ...) +{ + static char buf[1024]; + static size_t bufuse = 0; + + va_list ap; + va_start(ap, format); // use variable arg list + int n = qvsnprintf(buf + bufuse, sizeof(buf) - bufuse, format, ap); + va_end(ap); + + bufuse += n; + if (bufuse >= sizeof(buf) - 1 || format[strlen(format) - 1] == '\n') { + // flush + QtMessageHandler qt_message_print = qInstallMessageHandler(0); + qInstallMessageHandler(qt_message_print); // restore the handler + qt_message_print(QtInfoMsg, QMessageLogContext(), QString::fromLocal8Bit(buf)); + bufuse = 0; + } + + return 1; +} + +void tst_QStorageInfo::dump() +{ + printVolumes(QStorageInfo::mountedVolumes(), qInfoPrinter); +} + void tst_QStorageInfo::operatorEqual() { { @@ -157,6 +188,7 @@ void tst_QStorageInfo::tempFile() #endif qint64 free = storage1.bytesFree(); + QVERIFY(free != -1); file.write(QByteArray(1024*1024, '1')); file.flush(); @@ -180,6 +212,7 @@ void tst_QStorageInfo::caching() qint64 free = storage1.bytesFree(); QStorageInfo storage2(storage1); QCOMPARE(free, storage2.bytesFree()); + QVERIFY(free != -1); file.write(QByteArray(1024*1024, '\0')); file.flush(); |