summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPasi Petäjäjärvi <pasi.petajajarvi@qt.io>2021-12-07 11:41:52 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-02-17 21:23:09 +0000
commit77c18805b3257143f7230871302f83740a3becb7 (patch)
tree3d87889ad16741100d4c9cbd4d2a3a1c2e03848b
parent8bab6c730a5d3a2e63ea455e992b6531c48a54bb (diff)
Check if platform has enough RAM for hugeQImage test
The hugeQImage test loads, as its name suggests, a huge image. At 2.5 GiB it's too big for the hard-coded 1 GiB limit on RAM that the QNX toolchain hard-codes when it's started in QEMU. Task-number: QTBUG-100929 Change-Id: I8e8caaff7fd1dd0e648ada5df613c793f72bcf5d Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 964c964193e42dacb6e64323809e81761270b591) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--tests/auto/gui/image/qimage/tst_qimage.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp
index 6f9e0641ac..5abc164e1a 100644
--- a/tests/auto/gui/image/qimage/tst_qimage.cpp
+++ b/tests/auto/gui/image/qimage/tst_qimage.cpp
@@ -3945,7 +3945,10 @@ void tst_QImage::hugeQImage()
#if Q_PROCESSOR_WORDSIZE < 8
QSKIP("Test only makes sense on 64-bit machines");
#else
- QImage image(25000, 25000, QImage::Format_RGB32);
+ std::unique_ptr<char[]> enough(new (std::nothrow) char[qsizetype(25000)*25000*4]);
+ if (!enough)
+ QSKIP("Could not allocate enough memory");
+ QImage image((uchar*)enough.get(), 25000, 25000, QImage::Format_RGB32);
QVERIFY(!image.isNull());
QCOMPARE(image.height(), 25000);