summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* tst_qtouchevent: remove two QMutableEventPoint::from() usesMarc Mutz2022-01-061-2/+2
| | | | | | | | | The input is already a QMutableEventPoint. Task-number: QTBUG-99615 Pick-to: 6.2 6.3 Change-Id: I82b3e83ffa5b87c9a562cb3bb1d7bad0a0cd5245 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QTextMarkdownImporter: don't apply text char format to list item blockShawn Rutledge2022-01-061-0/+29
| | | | | | | | | | | | | | | | | | We want an ordered list item's number to be rendered with default char format, like the others in the same list, even if the list item's text begins with a span that has a different char format. So insert the list item's block with a default char format first, then change the char format of the cursor to suit the text that's about to be inserted. In HTML interpretation, it means the <li> does not have a style, but contains a styled span. Fixes: QTBUG-92445 Task-number: QTBUG-3583 Task-number: QTBUG-99148 Pick-to: 5.15 6.2 6.3 Change-Id: I7eb58a8d1171c16503cac01c8cce109d9f12e1af Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Blacklist tst_QTouchEvent::multiPointRawEventTransOnTouchPad - macOSShawn Rutledge2022-01-061-0/+2
| | | | | | | Task-number: QTBUG-99489 Change-Id: Ia74b0f7e3a82fe7cf68248109e84e8decbbc4ae3 Reviewed-by: Dimitrios Apostolou <jimis@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Blacklist quitOnLastWindowClosedWithEventLoopLocker on B2QtTor Arne Vestbø2022-01-061-0/+3
| | | | | | | | It's flakey according to http://testresults.qt.io/grafana/goto/1WdyblA7k Pick-to: 6.2 6.3 Change-Id: I4e5a3492d55222675534359416c1017dcba2cbfe Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* rhi: Add support for separate image and sampler objectsLaszlo Agocs2022-01-065-0/+145
| | | | | | | | | | | | | | | | | | | | | For Direct 3D, Metal, and Vulkan this is natively supported. (and makes no difference in particular for D3D and Metal because they do not have the legacy combined image sampler concept anyways) With OpenGL it will work too, but this relies on SPIR-Cross magic and is still using a combined sampler (e.g. a sampler2D) in the GLSL shader. The GL backend walks back and forth in the mapping tables from the shader baker in order to make this work, which is presumably slightly more expensive than combined image samplers. Do note that combined image samplers (i.e. sampler2D in the shader and QRhiShaderResourceBinding::sampledTexture() in code) continue to be the primary, recommended way for any user of the rhi for the time being. Change-Id: I194721bc657b1ffbcc1bb79e6eadebe569a25087 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Add QTextDocumentFragment::toRawText()Kai Köhne2022-01-061-0/+9
| | | | | | | | | | | | Like QTextDocument::toRawText(), QTextDocumentFragment::toRawText() does allow access to the raw string without normalizing nbsp, line separator, paragraph separator unicode characters. [ChangeLog][QtGui][Text] Added QTextDocumentFragment::toRawText() function. Task-number: QTBUG-99572 Change-Id: Ia74150a3870ea0e6326fdcda4d9d0410019124ae Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* tst_QGraphicsView: fix memleakMarc Mutz2022-01-051-4/+4
| | | | | | | | | | Found by asan. Amends 01aeb5f7e4fd977e9698fffdc7650897664ecb82. Pick-to: 6.3 6.2 5.15 Change-Id: Id61fc1bc1f40494371ac27cb258a22c89db24683 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* wasm: add secondary thread exec manual testMorten Johan Sørvig2022-01-055-0/+132
| | | | | | Pick-to: 6.3 Change-Id: Id16cddd703682d325d77ad597996960a8f521d1c Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* tst_qanimationgroup: fix memleaksMarc Mutz2022-01-051-2/+4
| | | | | | | | Silences asan. Pick-to: 6.3 6.2 5.15 Change-Id: I4995d9a6f0d4bb617fbb82b68289f7ad1ec0e96b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* tst_QItemModel: fix memleaksMarc Mutz2022-01-051-3/+3
| | | | | | | | | | | When creating proxied models, make the source model a QObject child of the proxy model, so the source isn't leaked when the proxy is deleted. This drove asan nuts. Pick-to: 6.3 6.2 5.15 Change-Id: I0f7fc9ab8e99d030c941cfb336ee4e2323b362ae Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix qobject_cast on partially destroyed QWidget/QWindowGiuseppe D'Angelo2022-01-052-20/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QWidget and QWindow use bits in QObjectPrivate to provide for a couple of shortcuts -- one in qobject_cast, and another in the isWidgetType() / isWindowType() functions in QObject. These can be optimized by simply looking at the bits, without actually doing more expensive runtime casts. These bits were set on construction, but not unset on destruction. The result was for instance that destroying a QWidget would report that the object was still a QWidget when ~QObject was reached. Fix this 1) by setting the bits only when QWidget / QWindow constructors start; 2) by resetting the bits once ~QWidget / ~QWindow are completed. Technically speaking this is not 100% correct in the presence of data members, but luckily those classes don't have any. Amend an existing test for QWidget (whose comment said exactly the opposite of what the test actually did) and add a test for QWindow. Some other code was wrongly relying on isWidgetType() returning true for destroyed QWidgets; amend it as needed. [ChangeLog][QtCore][QObject] Using qobject_cast on partially constructed or destroyed QWidget/QWindow instances now yields correct results. Similarly, using the convenience isWidgetType() / isWindowType() functions now correctly return false on such instances. Before, qobject_cast (and the convenience functions) would erroneously report that a given object was a QWidget (resp. QWindow) even during that object's construction (before QObject's constructor had completed) or destruction (after QWidget's (resp. QWindow's) destructors had been completed). This was semantically wrong and inconsistent with other ways of gathering runtime type information regarding such an object (e.g. dynamic_cast, obj->metaObject()->className() and so on). Pick-to: 6.3 Change-Id: Ic45a887951755a9d1a3b838590f1e9f2c4ae6e92 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* rhi: Drop the profiler for nowLaszlo Agocs2022-01-048-766/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | The system we inherited from the original Qt 5.14 introduction of QRhi is a text stream based solution where resource creation and frame timings are sent in a comma-separated format to a QIODevice. This, while useful to get insights about the number of resources at a given time, is not actively helpful. The frameworks built on top (Qt Quick, Qt Quick 3D) are expected to provide solutions for logging timings in a different way (e.g. via the QML Profiler). Similarly, tracking active resources and generating statistics from that is better handled on a higher level. The unique bits, such as the Vulkan memory allocator statistics and the GPU frame timestamps, are converted into APIs in QRhi. This way a user of QRhi can query it at any time and do whatever it sees fit with the data. When it comes to the GPU timestamps, that has a somewhat limited value due to the heavy asynchronousness, hence the callback based API. Nonetheless, this is still useful since it is the only means of reporting some frame timing data (an approx. elapsed milliseconds for a frame) from the GPU side. Change-Id: I67cd58b81aaa7e343c11731f9aa5b4804c2a1823 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Remove faulty #include from widgets baseline testEirik Aavitsland2022-01-041-2/+0
| | | | | | | | | | Since there is an actual qwidgetbaselinetest.h header file, one should not include a .moc file. The build system will take care of it, and currently warns about this #include. Pick-to: 6.3 Change-Id: I4fbff9ef75c901fe3db4df54d6f3ff0d9307edce Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add baseline test for text renderingVolker Hilsheimer2022-01-045-0/+147
| | | | | | | | | | Data-driven test case that renders the HTML files into an 800x600 image for baseline comparison. Task-number: QTBUG-99148 Pick-to: 6.3 Change-Id: I9ccc0cd21a1e94ff68d23bb82b84e1da46d6335a Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* rhi: Enable exposing separate image and sampler objects from the shaderLaszlo Agocs2022-01-033-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds the following in a QShader/QShaderDescription: - a list of separate images - a list of separate samplers - a list of "combined_sampler_uniform_name" -> [ separate_texture_binding, separate_sampler_binding ] mappings (relevant for GLSL only) On the QShader (and qsb/QShaderBaker) level not having separate image (texture) and sampler objects exposed in the reflection info is not entirely future proof. Right now we benefit strongly from the fact that Vulkan/SPIR-V supports both combined and separate images/samplers, while for HLSL and MSL SPIRV-Cross translates combined image samplers to separate texture and sampler objects, but it is not given that relying on combined image samplers will always be possible in the long run; it is mostly a legacy OpenGL thing that just happens to be supported in Vulkan/SPIR-V due to some benefits with certain implementations/hw, but is not something present in any newer APIs. In addition, before this patch, attempting to run a shader with separate textures and samplers through qsb will just fail for GLSL, even though SPIRV-Cross does have the ability to generate a "fake" combined sampler for each separate texture+sampler combination. Take this into use. This also involves generating and exposing a combined_name->[separate_texture_binding,separate_sampler_binding] mapping table for GLSL, not unlike we have the native binding map for HLSL and MSL. A user (such as, the GL backend of QRhi) would then use this table to recognize what user-provided texture+sampler binding point numbers correspond to which auto-generated sampler2Ds in the GL program. Take the following example: layout(binding = 1) uniform texture2D sepTex; layout(binding = 2) uniform sampler sepSampler; layout(binding = 3) uniform sampler sepSampler2; Inn the reflection info (QShaderDescription) this (assuming a corresponding qtshadertools patch in place) now gives one entry in separateImages() and two in separateSamplers(). Assuming sepTex is used both with sepSampler and sepSampler2, the GLSL output and mapping table from QShaderBaker will have two auto-generated sampler2Ds (and no 'texture2D' or 'sampler'). One immediate benefit is that it is now possible to create a shader that relies only on separate images and samplers, feed it into qsb, generate all the possible targets, and then also feed the SPIR-V binary into a tool or library such as Tint (e.g. to generate WGSL) that canot deal with combined image samplers. Change-Id: I9b19847ea5854837b45d3a23edc788c48502aa15 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* tst_qtranslator: fix memleakMarc Mutz2022-01-031-3/+3
| | | | | | | | | | QCoreApplication::installTranslator() does not take ownership of the QTranslator. The QTranslator dtor removes itself from QCoreApplication again. Pick-to: 6.3 6.2 5.15 Change-Id: I17eb7ab350631eb32fe76af29d9a576a0efa05d8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Exclude filesystem autotests for INTEGRITYTatiana Borisova2021-12-301-0/+4
| | | | | | | | | - There is no mounted partition, where we can create/delete files at runtime. Tests should be excluded for now. Pick-to: 6.2 6.3 Change-Id: I1c4db13d35da7d570c4bf787299d829e08951195 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_QStringList: check that join(u'\0') embeds NULsMarc Mutz2021-12-281-0/+5
| | | | | | | | | | | ... as opposed to QByteArray::toHex('\0'), which doesn't. Picking to all LTSs because it's in a test. Pick-to: 6.3 6.2 5.15 Change-Id: I392d5714c4865e530a246ed30a13cdac26b98e0b Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Exclude tst_qxmlstream test for INTEGRITYTatiana Borisova2021-12-281-1/+1
| | | | | | | | | | - There is no possibility to unpack *.zip archive anywhere on test device or save any file. Currently we don't have mounted file system. Task-number: QTBUG-99123 Pick-to: 6.2 6.3 Change-Id: I8c8d272a92b4475a7548bd10d32fc4203672926b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix tst_qtextstream / tst_json run time failures on INTEGRITY deviceTatiana Borisova2021-12-283-2/+24
| | | | | | | | | - add test resources to binaries Task-number: QTBUG-99123 Pick-to: 6.2 6.3 Change-Id: Ibeed93af43b4f951ca55f044fbfab00d4ab30468 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Windows: Fix handling of childGroups() when fallbacks are disabledJeremie Graulle2021-12-271-0/+10
| | | | | | | | | | When fallbacks are disabled for QSettings then it should not be falling back to any child groups or keys that might exist in a fallback set of settings. Fixes: QTBUG-85295 Change-Id: I563999293a103702035c8d3b027b59b94ca43c0e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* tst_qsharedmemory: skip readOnly() test under asanMarc Mutz2021-12-231-0/+2
| | | | | | | | | | | The test helper is expected to crash, but when built with asan, it just fails. Skip the test in that case. Pick-to: 6.3 6.2 5.15 Change-Id: I583142f5ec623895df62498100c1a30539b149ab Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QTextHtmlParser: fix prefix lookahead and html commentsOliver Eftevaag2021-12-221-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | The hasPrefix() function would only use the second 'lookahead' parameter to check if there was more unparsed text after the current character. When it's obvious from the codebase that it should actually look ahead of the current character being processed, and compare againt that future character. Html comments were also not handled quite right. Partially because of the broken hasPrefix() function, but also because it would advance the current index tracker by 3 instead of 2. Remember that the beginning of an html comment is <!-- meaning that there are only supposed to be 2 dashes required, not 3. The result would be that something like this <!----> would not automatically close, because the current index tracker would jump over the first 3 dashes when it begins a comment, and the remaining unprocessed string would be -> Also, because of the broken lookahead in hasPrefix(), a comment could actually be started with just <!- not requiring a second dash at all. Pick-to: 6.3 6.2 5.15 Fixes: QTBUG-99147 Change-Id: I8f4d4a1107eaf2dae16d16b7b860525d45a1c474 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* tst_qmetatype: fix memleaksMarc Mutz2021-12-221-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | We didn't delete the new'ed up QMetaTypeInterfaces, causing asan to complain. Fix by storing them in strong references alongside their users in a statically-allocated container. We use shared_ptr to hold them, because QMetaTypeInterface doesn't have a virtual destructor, so deleting objects of the TypeInfo types (plural!) derived from QMetaTypeInterface though a pointer to the base class is UB. The shared_ptr constructor, however, is templated, so it stores the correct call (~TypeInfo()) in its type-erased deleter. We can't use std::make_shared(), because that doesn't support aggregate initialization until C++20, so we manually new up the TypeInfos. 5.15 is not affected. Pick-to: 6.3 6.2 Change-Id: Ic7ec88c34e02a9e0dd3421848c0c0885f4756702 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* tst_QStringBuilder: remove test that doesn't test anythingMarc Mutz2021-12-221-10/+0
| | | | | | | | | | | | We now have a more reliable test for the case with freeSpaceAtBegin(), so remove the old test, after we verified it actually doesn't even test that case. Task-number: QTBUG-99330 Pick-to: 6.3 6.2 Change-Id: Ic108a722cd2fef1e63a05085a76d7572d1f8c875 Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Exclude tst_QLocalSocket::verifySocketOptions() on webOSJanne Juntunen2021-12-221-1/+1
| | | | | | | | | | This test case fails on qemux86_64-webos-linux environment and based on comment on the test case, it probably cannot be expected to pass on webOS. Fixes: QTQAINFRA-4717 Change-Id: Ifb34b0c85da2d180a59529791d1109185fef2665 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Stabilize tst_QGraphicsProxyWidget::scrollUpdateVolker Hilsheimer2021-12-221-1/+1
| | | | | | | | | | | | | The test waits a bit hoping that all paint events are delivered after showing the widget so that we can count the rectangles that are getting updated when scrolling. Waiting for 20ms is too short unless the system is completely idle. Based on testing on a local VM, 150ms produces reliable results. Pick-to: 6.2 6.3 Change-Id: I7729e94eae41476be67291a2f664cff784f96c7d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* tst_QStringBuilder: verify a comment is actually misleadingMarc Mutz2021-12-211-0/+2
| | | | | | | | | | | | | | | | The construction of the byte array doesn't actually yield freeSpaceAtBegin() (anymore?), so the comment above it is misleading (and the test didn't manage to catch QTBUG-99330, either). Before removing the misleading test, verify that this assumption is actually correct across all platforms. Task-number: QTBUG-99330 Pick-to: 6.3 6.2 Change-Id: I2f497321abc26c4148ced5ac12a5880b9ff5ba9f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* QStringBuilder: handle freeSpaceAtBegin() in op+=Marc Mutz2021-12-211-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Amends 9b320edb535a0fbe118933d2e983b73f90c32685. The above commit made the mistake of relying on the 30yr+ old fundamental relation size() - capacity() == freeSpaceAtEnd() which, however, Qt 6's prepend()-optimization (freeSpaceAtBegin()) broke. Because of that, while size() - capacity() may be large enough to hold the new data, if freeSpaceAtBegin() > 0, then freeSpaceAtEnd() may not. Fix by inspecting freeSpaceAtEnd() instead of capacity(). The following reserve() call is unaffected, since it internally already adds freeSpaceAtBegin() to the requested size, which is why the unconditional reserve() in 9b320edb535a0fbe118933d2e983b73f90c32685^ worked while 9b320edb535a0fbe118933d2e983b73f90c32685's capacity() check did not. Fixes: QTBUG-99330 Pick-to: 6.2 6.3 Change-Id: I520f36216011423f97a24484263acd40d8b1fa43 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* QtConcurrent::run crashes on program exitTianlu Shao2021-12-201-0/+12
| | | | | | | | | | | | When an application is about to be closed and all the destructors are called, if there isQtConcurrent::run on the way, it crashes as the internal threadpool pointer is nullptr. Fixes: QTBUG-98901 Pick-to: 6.2 6.3 Change-Id: Idd84d1518fc6a225263e6666a0f1de2ccef79c82 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* tst_qglobalstatic is halted on INTEGRITY deviceTatiana Borisova2021-12-201-0/+6
| | | | | | | | | | | - Stress test creates too many threads on run time. Testing system is limited in 123. Task-number: QTBUG-99123 Pick-to: 6.2 6.3 Change-Id: I215074fa432c8aa18b2a753169646841c01d0b2a Reviewed-by: Kimmo Ollila <kimmo.ollila@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QXmlStreamReader: update test distributionIvan Solovev2021-12-19653-3918/+27
| | | | | | | | | | | | | | | | | | | | | | | | As mentioned in the linked bugreport, we are not allowed to distribute the uncompressed files from one of the XML test datasets that we use in our tests. This patch removes the uncompressed version, and replaces it by the xmltest.zip archive taken from [0]. Once the test is started, QZipReader is used to uncompress the archive, and once the test is done, the uncompressed data is removed. However the test data from [0] is very old, so it is slightly different from what we had previously (the previous data was taken from w3c). As a result, 4 test cases are failing with this data. To fix it, we store the updated versions of 4 xml files separately, and replace them after uncompressing the archive. [0]: http://www.jclark.com/xml/ Fixes: QTBUG-81503 Pick-to: 6.3 6.2 5.15 Change-Id: Ied5233970a529deebca56b1eab07fe1c328a2ee0 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* tst_QPropertyAnimation: fix leaks occurring under normal operationMarc Mutz2021-12-181-11/+10
| | | | | | | | | | | | Tests were leaking objects even if all tests passed. In two cases, there just wasn't a delete at all, in a third, the existing delete wasn't reached because of a QSKIP. tst_QPropertyAnimation is now, locally, LSan-clean. Pick-to: 6.3 6.2 5.15 Change-Id: Ia53d6f6e467f1d2598a7c50efcdf3a3732fe54df Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QVariant: use a typedef name when saving user types to QDataStreamThiago Macieira2021-12-174-0/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to the way Qt 5 and 6 registered type names, they end up producing different type names for the same content for a typedef. For example, because Q_DECLARE_METATYPE can't manage a comma (it's a macro), users are forced to write something like: using MyTypeMap = QMap<QString, MyType> Q_DECLARE_METATYPE(MyTypeMap) Qt 5's Q_DECLARE_METATYPE's argument "MyTypeMap" was the only name we knew about the type, so that's what got saved in the stream. However, Qt 6 QtPrivate::typenameHelper is much more clever and obtains the name from the compiler itself, so it "sees through" the typedef and registers "QMap<QString,MyType>" as the official type name. If another library/plugin has a different typedef name for the same type (e.g., StringTypeMap), it's indeterminate which type gets saved and will even change from run to run (depends on the QHash order). [ChangeLog][QtCore][QDataStream] If QDataStream is used with a QDataStream::Version < Qt_6_0 to serialize a user type that was registered via a typedef with the metatype system, the typedef's name is used in the stream instead of the non-typedef name. This restores compatibility with Qt 5, allowing existing content to read the same QDataStreams; reading from older Qt 6 versions should not be affected. (Note: if more than one typedef name is registered, it's indetermine which name gets used) Fixes: QTBUG-96916 Pick-to: 6.3 6.2 Change-Id: I2bbf422288924c198645fffd16a8d811aa58201e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* tst_QHash: Update the erase_edge_case testMårten Nordheim2021-12-171-3/+29
| | | | | | | | | | | | | | | | | By using the bucketForHash function we can loop through and find some appropriate keys to test the edge-case. This will then automatically keep the test working even if some internals of QHash changes. We do this because certain changes which change the bucket the pre-selected keys would end up in could make the test a no-op, without warning. And recent and upcoming changes have changed both this and erase(). We limit the search-space to the minimum numBuckets * 4, where minimum numBuckets is current 128. Change-Id: I13b0bce15ee884144e3248846be34667fb5d35cc Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* tst_QPropertyAnimation: fix wrong commentMarc Mutz2021-12-171-1/+5
| | | | | | | | | | ... and add some additional checks that hopefully leave the next reader of the code a little less confused than this one was. Pick-to: 6.3 6.2 5.15 Change-Id: I73c1b9b1ed1683e3b2de0d811d9b20d65464dff4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Blacklist flaky tst_qgraphicswidget:initialShow on OpenSUSEDimitrios Apostolou2021-12-171-0/+1
| | | | | | Task-number: QTBUG-98921 Change-Id: Ie2c3bed56fdd548a54035565639803c19819d4be Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Properly indent qtestlib's XML outputDimitrios Apostolou2021-12-1791-13536/+13535
| | | | | | | | | Also regenerate the expected output for tst_selftests, to match new output. Changed one line source code in tst_seftests for the same purpose. Change-Id: I930ba4bb290568d6f67a8910a781725f01f08bf1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix helper script to run successfully on X11Dimitrios Apostolou2021-12-171-1/+1
| | | | | | | | | Without the fix, some tests from tst_selftests were failing with: Invalid MIT-MAGIC-COOKIE-1 key Change-Id: I2d07f28d9b2c69fe8575fdf10b362d962f456970 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* tst_QIODevice: fix UB (precondition violation) in ↵Marc Mutz2021-12-161-3/+6
| | | | | | | | | | | | | | | | | | SequentialReadBuffer::readData() memcpy() mustn't be called with a nullptr, even if the size is zero. Fixes ubsan error: tst_qiodevice.cpp:561:15: runtime error: null pointer passed as argument 1, which is declared to never be null Even though ubsan only complained about one of them, fix all three occurrences of the pattern in the test. Pick-to: 6.3 6.2 5.15 Change-Id: I5c06ab4a20a9e9f8831392c46c6969c05248fdac Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tst_QByteArray: fix UB (signed overflow)Marc Mutz2021-12-161-2/+3
| | | | | | | | | | | | | | | The first case is simple, as it's a static overflow. Theoretically, the compiler would be allowed to just remove the complete function as dead code. This is an error left from the port from int to qsizetype: Qt 5.15 there has uint(MaxAllocSize) + 1, so use quint here again, qint64 is wrong. In the second case, we _may_ reach alloc == MaxAllocSize. Check that, if we do, we don't then add 1 to it. Pick-to: 6.3 6.2 Change-Id: I93044ed6f1b77559642fa1e4e8f313cf59eeeb79 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix autotest runtime failures on INTEGRITYTatiana Borisova2021-12-1610-7/+50
| | | | | | | | | | | - add test resources to binaries - link Qt::Gui to tst_qpointer for static build case Task-number: QTBUG-99123 Pick-to: 6.2 6.3 Change-Id: I311827b9c641eaf9537091b051c15f9fcbcb9f0c Reviewed-by: Kimmo Ollila <kimmo.ollila@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_qmetatype: remove traces of compiler workarounds againMarc Mutz2021-12-163-13/+0
| | | | | | | | | Now that all platforms can deal with the full tst_QMetaType again, remove the last traces of the workaround. Pick-to: 6.3 Change-Id: I530cab8413f8b68903991b30a1f29b5871877a88 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix hash lookup using the value of a key iteratorLars Knoll2021-12-161-0/+17
| | | | | | | | | | | | | | | QHash::operator[] could grow the hash even if the key being looked up already existed. This in turn invalidated all iterators. Avoid this by refactoring findOrInsert() to not grow if the key already exists. Added advantage is that this should make lookups of existing keys slightly faster. Fixes: QTBUG-97752 Pick-to: 6.3 6.2 Change-Id: I9df30459797b42c434ba0ee299fd1d55af8d2313 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* tst_qmetatype: remove the previous MingW workaroundMarc Mutz2021-12-161-8/+0
| | | | | | | | | | Let's see whether splitting the TUs has made the test amenable to be compiled with MinGW again. Pick-to: 6.3 Change-Id: Icde1bad20943c7648dbb119ca879bce62325bd6c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Make QRingBuffer a move-only typeMarc Mutz2021-12-161-2/+13
| | | | | | | | | | | | There's no sense in copying a ring buffer. Moving is enough. This marks an important step on the way to preventing accidental copies of ring buffer content, because the 'QList buffers' member can now no longer be implicitly shared. While the compiler will still emit the code for detach()ing, it will now never be executed. Pick-to: 6.3 Change-Id: I968bfe3e50c46720ed4baca55c99c1f9c518f653 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QIODevice: use QVLA to hold the ring buffers, not QListMarc Mutz2021-12-151-2/+2
| | | | | | | | | | | | | | | The only users of more than one read- or write channel are the SCTP code and QProcess. SCTP being pretty rare, optimize for the common case of at most two QRingBuffers for reading (QProcess) and one for writing. Even with more channels, QVLA shouldn't be slower than QList - on the contrary. Need to adjust tst_toolsupport and TypeInformationVersion, as QFilePrivate::fileName has changed. Pick-to: 6.3 Change-Id: I3baf982ba1f4dc51463be8730e414f6164072d8b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* wasm: add rasterwindow manual testMorten Johan Sørvig2021-12-156-0/+383
| | | | | | | Simplest possible graphical app, with event logging. Change-Id: I6b1eb88c270a190becb23cc63d6d755ffbafcf52 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* tst_qmetatype: remove the previous clang-arm workaroundMarc Mutz2021-12-151-5/+0
| | | | | | | | | Let's see whether splitting the TUs has made the test amenable to be compiled on Clang for ARM again. Pick-to: 6.3 Change-Id: I6bf1e31189f5058dc393adefabaf3014dce4bcf2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add css media rule support for QTextDocument::setHtml()Ralf Habacker2021-12-151-0/+38
| | | | | | | | | | | | | | | | | CSS styles can contain '@media <rule> {...}' blocks, which were previously ignored for all values except "screen". To use a media rule other than the default "screen" rule, specify it before calling setHtml() with setMetaInformation() and the new info value 'CssMedia'. [ChangeLog][Gui][QTextDocument] Add css media rule support for QTextDocument::setHtml() Pick-to: 6.3 Fixes: QTBUG-98408 Change-Id: Ie05f815a6dedbd970210f467e26b116f6ee3b9ca Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>