diff options
author | Liang Qi <liang.qi@qt.io> | 2016-05-19 11:04:19 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-05-19 12:55:27 +0200 |
commit | 818014b449ef996099b4795a82f09651cf1c0129 (patch) | |
tree | 02f991007097fa368491a81eebbabe4cc162a0e0 /tests/auto/corelib/io/qstorageinfo | |
parent | e6cc1d788dddda2998a9f941664ede928ce1e212 (diff) | |
parent | 640441882d20f86db05ab5fd1141abe39a0bd409 (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
configure
src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
src/network/access/qnetworkaccessmanager.cpp
src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp
src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.h
src/widgets/widgets/qlineedit_p.cpp
src/widgets/widgets/qlineedit_p.h
src/winmain/winmain.pro
tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp
tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h
tests/auto/testlib/selftests/expected_cmptest.teamcity
tests/auto/testlib/selftests/expected_cmptest.txt
tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
tools/configure/configureapp.cpp
Change-Id: Ib9997b0d0f91946e4081d36c0c6b696c5c983b2a
Diffstat (limited to 'tests/auto/corelib/io/qstorageinfo')
-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(); |