diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2023-08-02 13:59:12 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2023-10-04 12:04:45 -0700 |
commit | 3a49d7d4e5af01d1a6016e94f0b2dbb765798e19 (patch) | |
tree | ce4878f5d2d9ce542ca2866f96291932e0cbcc53 /tests/auto/corelib/io | |
parent | b956fec7eed57713faa5736917661280e5cec16c (diff) |
tst_QFile: extend virtualFile() to find QtCore and QtTest
In non-static builds, of course.
Change-Id: Ifbf974a4d10745b099b1fffd1777ac97c0921759
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/corelib/io')
-rw-r--r-- | tests/auto/corelib/io/qfile/tst_qfile.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 5fda0c04e3..794cc32053 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -2685,6 +2685,28 @@ void tst_QFile::virtualFile() lines += std::move(data); } + if (!QT_CONFIG(static) && !QTestPrivate::isRunningArmOnX86()) { + // we must be able to find QtCore and QtTest somewhere + static const char corelib[] = "libQt" QT_STRINGIFY(QT_VERSION_MAJOR) "Core"; + static const char testlib[] = "libQt" QT_STRINGIFY(QT_VERSION_MAJOR) "Test"; + auto contains = [&](QByteArrayView text, quintptr ptr = 0) { + // this is not the same a QList::contains() + return std::any_of(lines.constBegin(), lines.constEnd(), [=](QByteArrayView entry) { + if (!entry.contains(text)) + return false; + if (!ptr) + return true; + qsizetype dash = entry.indexOf('-'); + qsizetype space = entry.indexOf(' ', dash); + quintptr start = entry.left(dash).toULong(nullptr, 16); + quintptr end = entry.left(space).mid(dash + 1).toULong(nullptr, 16); + return start <= ptr && ptr <= end; + }); + }; + QVERIFY(contains(corelib, quintptr(f.metaObject()))); + QVERIFY(contains(testlib)); + } + // read all: QVERIFY(f.seek(0)); data = f.readAll(); |