summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qfile/tst_qfile.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2023-08-02 14:01:28 -0700
committerThiago Macieira <thiago.macieira@intel.com>2023-08-25 15:54:15 -0700
commita0550df6d9d9457dce43bb89c1979d49a4707e0d (patch)
tree7e506690457c285bc2d2cd11fc3c44af41d06e2d /tests/auto/corelib/io/qfile/tst_qfile.cpp
parent7ca82250e01cea6a270796beb2fa21de20b9b952 (diff)
tst_QFile: extend virtualFile() to test in unbuffered mode too
Change-Id: Ifbf974a4d10745b099b1fffd1777acb752350375 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/corelib/io/qfile/tst_qfile.cpp')
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp
index 1c53a2fa1b..911e373c4e 100644
--- a/tests/auto/corelib/io/qfile/tst_qfile.cpp
+++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp
@@ -228,6 +228,7 @@ private slots:
void readFromWriteOnlyFile();
void writeToReadOnlyFile();
#if defined(Q_OS_LINUX)
+ void virtualFile_data();
void virtualFile();
#endif
#ifdef Q_OS_UNIX
@@ -2613,8 +2614,17 @@ void tst_QFile::writeToReadOnlyFile()
#if defined(Q_OS_LINUX)
// This platform have 0-sized virtual files
+void tst_QFile::virtualFile_data()
+{
+ QTest::addColumn<QIODevice::OpenMode>("mode");
+ QTest::newRow("buffered") << QIODevice::OpenMode();
+ QTest::newRow("unbuffered") << QIODevice::OpenMode(QIODevice::Unbuffered);
+}
+
void tst_QFile::virtualFile()
{
+ QFETCH(QIODevice::OpenMode, mode);
+
// We need to test a large-ish /proc file on Linux, one that is usually
// over 4 kB (because the kernel writes in chunks of that), has a
// cross-platform file format, and is definitely readable. The best
@@ -2647,7 +2657,7 @@ void tst_QFile::virtualFile()
// open the file
QFile f(fname);
- QVERIFY2(f.open(QIODevice::ReadOnly), msgOpenFailed(f).constData());
+ QVERIFY2(f.open(QIODevice::ReadOnly | mode), msgOpenFailed(f).constData());
QCOMPARE(f.size(), Q_INT64_C(0));
QVERIFY(f.atEnd());