From 9a029c9de409976b8983fce81ae2029e010cb5f7 Mon Sep 17 00:00:00 2001 From: Ivan Komissarov Date: Tue, 26 May 2015 12:10:51 +0300 Subject: Fix sizes QStorageInfo returns for invalid drives Zero is a legitimate size to be returned by bytesFree/bytesAvailable functions, so change those functions to return some 'invalid' size in case of an invalid drive. This is also consistent with the original version from the Qt Systems framework. [ChangeLog][QtCore][QStorageInfo] Fixed sizes returned for invalid drives. Task-number: QTBUG-45724 Change-Id: I312fba521fdf8d52d7a0ac0e46cacca625775e80 Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- .../auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp b/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp index 2190c32c01..a7a0cf4ddb 100644 --- a/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp +++ b/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp @@ -61,9 +61,9 @@ void tst_QStorageInfo::defaultValues() QVERIFY(!storage.isRoot()); QVERIFY(storage.device().isEmpty()); QVERIFY(storage.fileSystemType().isEmpty()); - QVERIFY(storage.bytesTotal() == 0); - QVERIFY(storage.bytesFree() == 0); - QVERIFY(storage.bytesAvailable() == 0); + QVERIFY(storage.bytesTotal() == -1); + QVERIFY(storage.bytesFree() == -1); + QVERIFY(storage.bytesAvailable() == -1); } void tst_QStorageInfo::operatorEqual() @@ -106,9 +106,9 @@ void tst_QStorageInfo::root() QVERIFY(!storage.device().isEmpty()); QVERIFY(!storage.fileSystemType().isEmpty()); #ifndef Q_OS_HAIKU - QVERIFY(storage.bytesTotal() > 0); - QVERIFY(storage.bytesFree() > 0); - QVERIFY(storage.bytesAvailable() > 0); + QVERIFY(storage.bytesTotal() >= 0); + QVERIFY(storage.bytesFree() >= 0); + QVERIFY(storage.bytesAvailable() >= 0); #endif } @@ -121,9 +121,9 @@ void tst_QStorageInfo::currentStorage() QVERIFY(appPath.startsWith(storage.rootPath(), Qt::CaseInsensitive)); QVERIFY(!storage.device().isEmpty()); QVERIFY(!storage.fileSystemType().isEmpty()); - QVERIFY(storage.bytesTotal() > 0); - QVERIFY(storage.bytesFree() > 0); - QVERIFY(storage.bytesAvailable() > 0); + QVERIFY(storage.bytesTotal() >= 0); + QVERIFY(storage.bytesFree() >= 0); + QVERIFY(storage.bytesAvailable() >= 0); } void tst_QStorageInfo::storageList() -- cgit v1.2.3