summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Fix compiler warning from unused parameterVolker Hilsheimer2021-06-231-1/+1
| | | | | Change-Id: I227b7188eddbad024dcced908c894925cee56591 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Use UTC when parsing only a date or only a time, not a date-timeEdward Welbourne2021-06-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | This should reduce the amount of fall-out from DST complications. Also document the assumptions of QDateTimeParser's two fromString() methods (and fix the punctuation on the QDateTime parameter). Adjusted some tests to match. Since only QDateTime-returning methods will show the difference, and it's at least somewhat odd to be using those on QDateEdit or QTimeEdit, this should have little impact on API users. [ChangeLog][QtCore][Behavior Change] QDateEdit and QTimeEdit now operate in UTC, to avoid spurious complications arising from time-zone transitions (e.g. DST) causing the implicit other half to combine with the part being edited to make an invalid result. Returns from their dateTime() and other methods returning QDateTime (max/min) shall thus be in UTC where previously they were in local time. QDateTimeEdit continues using local time. The default can be over-ridden by setTimeSpec(), as ever. Change-Id: I44fece004c12342fe536bbe3048217d236fd97b2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix handling of day-of-week in QDateTimeParser and QDateTimeEditEdward Welbourne2021-06-231-12/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QDTP's absoluteMax(), setDigit() and getDigit() simply treated day-of-week as synonym for day-of-month. Consequently, QDTE::stepBy() did the same. This meant that wrapping happened at the month boundary, so would jump within the week if it wrapped around, otherwise the up/down arrow would "jam" at a particular day of the week when further steps would leave the month. Instead, when wrapping, wrap round the week while still moving the day-of-month to match, jumping back or forward a week to stay within the month on hitting a month boundary; otherwise, stop backwards stepping on hitting the locale-specific day of the week, or forward stepping when the step would be to or past this first day. Fixed various bugs found in the course of testing this. [ChangeLog][QtWidgets][QDateTimeEdit] Corrected handling of weekdays. Previously, changes to the week-day were simply changes to the day of the month. Weekday fields are now handled as such: changes to them do change the day of the month, but a change that would step past the end (or start) of the month is adjusted to the relevant day of the nearest week within the month. When wrapping is disabled, the locale-specific first and last days of the week are the bounds. Formats which specify day of week but not day of month will now preserve day of week when changing month or year, selecting the nearest day of month that matches. Change-Id: I7868b000fea7a4bc17a1b5687c44bcd56d42ae90 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QString: Respect precision when reading data for %.*s format stringUlf Hermann2021-06-221-0/+30
| | | | | | | | | | | If we disregard the precision we may read a very large string that we subsequently discard. Furthermore, people use this to read non-null-terminated strings, which randomly crashes. Pick-to: 5.15 6.1 6.2 Change-Id: Ifa255dbe71c82d3d4fb46adfef7a9dc74bd40cee Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QWidgetAction: add test for defaultWidget() being deleted before actionMarc Mutz2021-06-221-0/+12
| | | | | | | | | ... even though the documentation states that the action takes ownership of the widget. Change-Id: Ie5520fbda295a5a2774ff8b82165070e9d49e310 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* BLACKLIST tst_QListView::internalDragDropMove for OpenSUSE leapHeikki Halmet2021-06-211-0/+3
| | | | | | | | Task-number: QTBUG-94250 Change-Id: I9ea92b5952e1823cf90716f027f2f8eea1b86278 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
* Add basic benchmarks for QFutureSona Kurazyan2021-06-193-0/+332
| | | | | | | | | | The benchmark simply calls the non-trivial methods of QFuture, mostly to make sure that fixes in the parent patches don't have any performance implications. Task-number: QTBUG-92045 Change-Id: Ib4e8c314a70b3090a1af55f1b96d9dad4bc63861 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Move the linking logic of the object libraries to a common functionAlexey Edelev2021-06-181-1/+1
| | | | | | | | | | | | | | | | | | | The linking logic of object libraries should be reusable outside of the resource context. This introduces a __qt_internal_propagate_object_library function that prepares all the necessary genexes to link and propagate the object library to the end-point executable. Rename resource object finalizer API to make the naming more generic to object libraries of any kind. Amends 5fb99e3860eb43f4bacacec7f4a4626cb0159b14 Pick-to: 6.2 Task-number: QTBUG-93002 Task-number: QTBUG-94528 Change-Id: I69d0f34c0dadbd67232de91035aaa53af93d1fa1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Do not alter a widget's backing window's format once createdLaszlo Agocs2021-06-181-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changing anything on a QWindow's QSurfaceFormat has zero and null effects once the underlying native window has been created. Letting QWidget update the format is wrong in this case, because we always expect that the value returned from QWindow::format() reflects reality. (reality being the settings with which the underlying native resource was created, which is typically frozen after QWindow::create(), not the state of some QWidget attribute. There are certain exceptions to this, such as when preparing to recreate the underlying native window, in which case one will want to update all relevant fields of the format based on the current values of the widget attributes, which is exactly what QWidgetPrivate::create() implements, and that's good.) Such a mismatch can have fatal consequences when OpenGL and friends are involved, but this always depends heavily on the platform and windowing system. For example, claiming that the alpha buffer size is 0 when the native window was created with 8, or vice versa, can break OpenGL-related code (both in Qt itself and in applications), that tries to create a QOpengGLContext configured based on what QWindow::format() returns. If that format describes settings that are incompatible with the actual underlying native window, we end up with the classic Invalid pixel format, EGL_BAD_MATCH, and alike errors. This is exactly what is happening when a QOpenGLWidget (or QQuickWidget) is placed in a QDockWidget where one of the ancestors is forced to native (winId() was called or WA_NativeWindow was set). When undocking, various code paths in QWidget will try to update the opaque flag of the widget, which in turn calls updateIsTranslucent. Now, if this function unconditionally changes the alphaBufferSize in the QWindow's QSurfaceFormat (even though this is completely futile to do, it has no visible effect in practice), we get the problem described above: rendering breaking down due to OpenGL contexts created with a pixel format incompatible with the native window. Prevent all this by not touching the format once the QWindow has a QPlatformWindow. This is the right thing to do, regardless of the bug in question: a window's (or context's or any other native resource wrapping class's) format must describe the underlying native resource and must never deviate, unless we are preparing to create a new native resource underneath. When it comes to the autotest, this changes the test added in 555661b625c40f21a6a3e4c73e928a6e8a46db20: the autotest logic is inverted because what we should test for is that the QSurfaceFormat stays untouched once the application makes a - futile - attribute change on the widget. Fixes: QTBUG-85714 Pick-to: 6.2 6.1 Change-Id: I7bf90711867e8a0fd474895625bf9530a7821fd5 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* QHash: Fix erase() edge-caseMårten Nordheim2021-06-181-0/+19
| | | | | | | | | | | | | | | | | | | | | When the element you want to erase is the last element AND the next element (element 0), when rehashed, would be relocated to the last element, this leads to the state below. Which is similar to a test in tst_qhash for some seeds. auto it = hash.begin + (hash.size - 1) it = hash.erase(it) it != hash.end By forcing the iterator to increment if we were erasing the last element we always end up with a pointer which is equal to hash.end Befriend the tst_qhash class so we can set the seed to a known-bad one Pick-to: 6.2 6.1 Change-Id: Ie0b175003a2acb175ef5e3ab5a984e010f65d986 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix recursion crash when calling setStyleSheet with `qproperty-styleSheet`Zhang Yu2021-06-181-0/+18
| | | | | | | | | | | When calling `setStyleSheet` with property `qproperty-styleSheet`, `QStyleSheetStyle::polish` will call`QStyleSheetStyle::setProperties`, and then`QStyleSheetStyle::setProperties` goes on to call `setProperty`.Because there is property `qproperty-styleSheet`, it will update stylesheet by calling QStyleSheetStyle::polish`. This causes the recursive call to crash. Fixes: QTBUG-94448 Pick-to: 5.15 6.2 Change-Id: I79c51192a939b0b62e5b1d0dcc90d38f79e28222 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* QBindable: Use setter in setValue for QObjectCompatPropertyFabian Kosmale2021-06-171-0/+11
| | | | | | | | | | | | Directly writing to the underlying property storage has the potential of breaking all kinds of internal invariants. As we return QBindable in the public interface, we should not grant callers access to the internals of the object. Pick-to: 6.2 6.1 Change-Id: I737ff293b9d921b7de861da5ae23356c17690b78 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
* Avoid overflow in text layoutEirik Aavitsland2021-06-171-0/+14
| | | | | | | | | | Fixes oss-fuzz issue 34597. Fixes: QTBUG-94197 Pick-to: 6.2 6.1 5.15 Change-Id: Icabcd5a87b809b6a5ae0f1a696ec3b5dd906886b Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Universally pass QMetaType by valueUlf Hermann2021-06-171-3/+3
| | | | | | | ... and add Qt7 TODOs where we can't because of BC. Change-Id: Idce8b677ae95231e1690ac4265dc6f06818052e7 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix crash in concurrent disconnectLars Knoll2021-06-171-0/+49
| | | | | | | | | | | | | | This does not fix all data races that we have in the system yet. One major issue is the virtual disconnectNotify(), that can be called from any thread and thus is inherently problematic, as it can collide with the object getting destroyed at the same time in another thread. Pick-to: 6.2 6.1 5.15 Task-number: QTBUG-88248 Change-Id: I9d841eb363b7e4f0de1657aeb8f5340d0fd55190 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* fuzzing: Add instructions how to reproduce issues from oss-fuzzRobert Löhning2021-06-161-1/+23
| | | | | | Change-Id: I278516f527990b3c4477436a82695e68b5f6a713 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Tidy up tst_QString::localeAwareCompare()Edward Welbourne2021-06-161-121/+262
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was suppressed unconditionally (albeit in different places and with different levels of obviousness) almost everywhere, due to inability to set the system locale in use by the implementation. Several test-cases used ISO-8859-1 encoding on Q_OS_MAC, where the tests were all suppressed anyway. A block of no_NO tests was #if 0'd out; and should, in any case, have been nb_NO. Tests of any locale but en_US were skipped on Q_OS_WIN because we can't set the locale (but including the tests of en_US tacitly assumed that's the system locale). If setlocale() failed, for ICU or DARWIN, the test was skipped; but we might as well check for this in the _data() to save repetition. The test was laboriously going through the sign cases; relocate the QString::compare() test's sign() function so that we can use it here, too, and simply QCOMPARE() signs. Introduce a TransientLocale class, copied from tst_QLocale, to take care of setting and restoring the locale using setlocale(). Change the locale name to a QByteArray so that we save having to convert it to one in order to pass it to setlocale(). Since that changed every _data() row, reformat those rows in the process - most of them were long lines. On the systems where we can't set the locale used by the function being tested, condition each block of tests in the _data() on whether LC_COLLATE looks like the locale to be tested, and report how a determined developer at least can (by repeatedly running the test with different locales set) test all the cases; and we'll attempt the ones that we can, when one of the relevant locales is in use. If that leaves us with no tests we can do, QSKIP() in the _data() to avoid an assert failure for "Test data requested, but no testdata available." Change-Id: I75709fda8827dcbe74f80c4136042054da6fcb13 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Check the impact of static link order for user projectsAlexey Edelev2021-06-161-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For user projects we run the static link order check once 'find_package(Qt6 ...)' is called. If linker can resolve circular dependencies between static libraries and object files we set the _qt_link_order_matters property of the Qt::Platform target. This indicates the use of finalizers is not required and we may rely on CMake-base propagation of resource libraries and resource object files. If linker could not resolve circular dependencies depending on the _qt_resource_objects_finalizer_mode value: - Finalizer will be called and collected resource objects will be linked to the target directly. - Finalizer will be omitted and resource objects will be linked using the target_sources function implicitly. This only propagates resource one level up if consumer links the static library PUBLICly, but all symbols will be resolved correctly since object files are placed in the beginning of the linker line. In the CMake version 3.21 we expect that CMake will take care about the order of the resource object files in a linker line, it's expected that all object files are located at the beginning of the linker line. TODO: Need to confirm that the CMake 3.21 meets the expectations. Amends 4e901a2f99cbfda3b479253ea54b16f02e1c3aa5 Pick-to: 6.2 Task-number: QTBUG-93002 Task-number: QTBUG-94528 Change-Id: Ia68976df8182d3d3007b90c475c1e3928a305339 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Apple: Use POSIX IPC instead of System V in sandboxed applicationsTor Arne Vestbø2021-06-161-5/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | System V semaphores are not supported in sandboxed applications, so when Qt is configured with App Store compliance, or the user requests POSIX IPC explicitly, we use that instead. https://developer.apple.com/library/archive/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW24 As the shared memory name limit on Apple platforms is very low, we have to skip the existing logic for naming, and instead use a truncated hash of the key. This should still be fine for avoiding any collisions in practice. An explicit check for the ENAMETOOLONG error has been added to catch any cases where they key goes beyond the allowed length. Sandboxed applications also have an extra requirement that the key must include an application group identifier. This requirement has been pushed up to the user and documented, as we don't have enough information in Qt to know which identifier to use. Both tst_QSystemSemaphore and tst_QSharedMemory work as before with both sandboxed and non-sandboxed applications, after removing some assumptions in tst_QSharedMemory about System V behavior. Fixes: QTBUG-91130 Change-Id: Iaf1edb36a5d84d69e42ec31471a48d112faa8c6a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tests: update startsystemmove manual test with latest apiLiang Qi2021-06-161-3/+6
| | | | | Change-Id: Ib9a070f7878fa67b7db1e26c8ebbbb54873cb645 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QLoggingSettingsParser: port setContent() to QStringViewMarc Mutz2021-06-161-15/+15
| | | | | | | | | | | Amends 16f927a4f1ffeff399351b625d73ac3cd7bccd51. At the time the original change was written, QStringTokenizer had not been integrated, yet. Change-Id: I83c31d816199bc48c4baea855d13cbf9eda9aaa2 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* CMake: Allow promoting the Qt libraries to be global targetsAlexandru Croitor2021-06-164-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | User projects can set the QT_PROMOTE_TO_GLOBAL_TARGETS variable to true so that the various imported targets created by find_package(Qt6) are promoted to global targets. This would allow a project to find Qt packages in a subdirectory scope while using those Qt targets from a different scope. E.g. it fixes errors like CMake Error at CMakeLists.txt:5 (target_link_libraries): Error evaluating generator expression: $<TARGET_OBJECTS:Qt6::Widgets_resources_1> Objects of target "Qt6::Widgets_resources_1" referenced but no such target exists. when trying to use a static Qt from a sibling scope. Various 3rd party dependency targets (like Atomic or ZLIB) are not made global due to limitations in CMake, but as long as those targets are not mentioned directly, it shouldn't cause issues. The targets are made global in the generated QtFooAdditionalTargetInfo.cmake file. To ensure that resource object libraries promoted, the generation of the file has to be done at the end of the defining scope where qt_internal_export_additional_targets_file is called, which is achieved with a deferred finalizer. Replaced all occurrences of target promotion with a helper function which allows tracing of all promoted targets by specifying --log-level=debug to CMake. Pick-to: 6.2 Fixes: QTBUG-92878 Change-Id: Ic4ec03b0bc383d7e591a58c520c3974fbea746d2 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Improve tst_QColorSpace::imageConversion64PM testAllan Sandfeld Jensen2021-06-161-8/+17
| | | | | | | | Makes it able to catch the last bug of saturating color values above a certain value. Change-Id: Ib2a3918623a1defe2981efe61cf8118e019e9d4b Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix QFAIL() to interract correctly with QEXPECT_FAIL()Edward Welbourne2021-06-152-4/+3
| | | | | | | | | | | | | | | | | | | Previously, it went direct to QTestResults::addFailure() without going via the checking for expected failure. Add QTestResults::fail() to take care of this checking, as for verify() and compare(). Tidied up the code implementing expected failure and QFAIL(), while I was about it. Adjusted an existing test to verify that expecting a QFAIL() works, by using QFAIL() instead of QVERIFY(false). Remove the QVERIFY(false) whose comment brought this to my attention. [ChangeLog][QtTestLib][QFAIL] QEXPECT_FAIL() now correctly anticipates a subsequent QFAIL(). Previously QFAIL() counted as a fail regardless. Change-Id: Icc28cf70e5ff3006363791ea03aa01f2f591eb71 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Turn tst_QString::setRawData()'s QSKIP into QEXPECT_FAIL()sEdward Welbourne2021-06-151-1/+3
| | | | | | | | | | | | | In commit 287ace562ee5ddff22f7dbf4e49ae5f0520f2308, part of this test was suppressed without filing a Jira ticket (or, at least, without recording it in the QSKIP message). Since it's a known failure, it should at least be a QEXPECT_FAIL, not a QSKIP. Since only some of the subsequent parts of the test fail, I used QEXPECT_FAIL(,,Continue) on each of the failing tests. Task-number: QTBUG-94450 Change-Id: Iebc6801210c289b4502e59116e71d5901b71aa46 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Don't use APPLESS testing for QStringEdward Welbourne2021-06-151-1/+2
| | | | | | | | Its collation (and everything locale-related) is only supported during the lifetime of QApplication. Change-Id: Ide97795664d45768e66248d47c3b1da83935b0d6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix and clean up utterly confused (and confusing) transition testsEdward Welbourne2021-06-151-201/+241
| | | | | | | | | | | | | | | | | | | | | | | Various QDateTime tests relating to transitions * used a nomenclature that made them confusing to thing about; and * expected identically-initiallized variables to behave differently. The latter, naturally, lead to "expected fail" tests. Rewrote the tests to get the date-times they want to test at by means that avoid the ambiguities inherent in QDateTime's lack of a way to distinguish the two passes through the repeated hour in a fall-back (QTBUG-79923) and added commented-out tests indicating what should be true once that ambiguity is resolved. Verified the DST status is as expected in the cases where that's the correct distinction between date-times with the same date and time. Renamed various things to (hopefully) make them more intelligible. In the process, purged some leading 0s from numbers in code. Fixes: QTBUG-68936 Change-Id: Id7a348995238b70dcb81a96edb8a3fa5315f86fa Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Stabilize flaky scrollerSmoothScroll test caseVolker Hilsheimer2021-06-151-2/+4
| | | | | | | | | | | | | | This test failed when checking for a pre-condition of the tested scenario, so skip the test if that condition isn't met, as the test won't test anything. Amends b1fdcc8c0fefe0660302494618032342b623e199. Pick-to: 6.2 6.1 5.15 Task-number: QTBUG-64543 Change-Id: I135cd5b45efcae111305b9be338eb5429d3b97d5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Prefer QFAIL("Informative message") over QVERIFY(false)Edward Welbourne2021-06-147-24/+23
| | | | | Change-Id: I706b0aedfa870452331a8c2c488d55b279ee452a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Suppress gcc warning -Wmemset-elt-size on test codeEdward Welbourne2021-06-141-1/+5
| | | | | | | | | | | | | The test uses a 64-unit array and deliberately clears various portions of it, provoking a gcc warning: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size] The calls to memset() do, in fact, have a sizeof(T) factor in their size. Suppress this warning for the duration of that test. Change-Id: I7d144d655a75f5ef4449fa3b956f80bcc509a83b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QAIV: Don't open editor on release when press closed editorVolker Hilsheimer2021-06-141-0/+58
| | | | | | | | | | | | | | | | | A mouse press that transfers focus from an open editor back to the view will close the editor. To prevent that the corresponding release then opens the same editor again we need to know that the closeEditor call was caused by the mouse press. Since Qt first generates the focusOut event, and then delivers the mouse press, we have to start a zero-timer to check whether we are in the same event delivery process. If so, ignore the corresponding release. Add test case that simulates that chain of events. Fixes: QTBUG-20456 Pick-to: 6.2 6.1 Change-Id: I28fa32bfbc776db207c594c329961f575ae58ea9 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Remove the dead code for blocking methods from QtConcurrentSona Kurazyan2021-06-142-118/+29
| | | | | | | | | | | | | | After 79fd1cb2c631b6084bf10874205d27f5b53c907a the methods for running QtConcurrent algorithms in the blocking mode aren't used anymore. Since ThreadEngineBase and ThreadEngineStarter classes aren't meant to be used externally, it should be fine to remove startBlocking() methods now. Removed the unused code and adjusted the tests accordingly. Change-Id: Ifb13820ce207869d6f720bcb5be8d35bb355fe33 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* QLatin1String: Add a constructor taking QByteArrayViewMårten Nordheim2021-06-121-0/+31
| | | | | | Change-Id: Ie90645486431d7af3fe8128417b0fb6bd02a88b5 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QNetworkReply: Decompress when readingMårten Nordheim2021-06-125-3/+1515
| | | | | | | | | | | Rather than when the data is received. Source compatibility is achieved through double-decompressing the data. This lets us know how many bytes are available just as before but without having the uncompressed data left in memory. Fixes: QTBUG-83269 Change-Id: I352bd09581614c582e4628243e2a0e895ba4946b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* String API Symmetry: test for indexOf with large negative offsetMårten Nordheim2021-06-112-1/+4
| | | | | | | | | | | | | | Small change needed to make QString_char16 and QString_QChar return -1 in this case, but other combinations already returns -1. [ChangeLog][QtCore][Behavior Change] QString::indexOf(QChar) and QString::indexOf(char16_t) now treat a negative start-position, from, bigger than the string's size as invalid. It previously clipped such start-positions to the start of the string, inconsistently with other QString indexOf overloads. Change-Id: Ic56c8a558bf40a94845c649647db569892d4df02 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Ensure test using setlocale() doesn't leave it permanently changedEdward Welbourne2021-06-121-3/+6
| | | | | | | | | tst_QStringList::sort() wants to use the C locale; but, if it failed, it left that in force, since it only restored the prior locale on success. It should also use C.UTF-8, since Qt now wants UTF-8. Change-Id: If62e3d8da682081bf969075a719d03caebf09233 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Deliver WindowActivate/Deactivate events to QWindowVolker Hilsheimer2021-06-111-0/+43
| | | | | | | | | | We need those events to trigger palette color group changes in QQuickItem without having to connect every item to yet another QWindow signal. Task-number: QTBUG-93752 Pick-to: 6.2 Change-Id: I8534808cdaab828e5876f8fda31567aeb1b4272a Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add .UTF-8 suffixes to locale-names passed to setlocale()Edward Welbourne2021-06-112-3/+4
| | | | | | | | | | | We use UTF-8 locales by default since Qt 6; and relatively few systems have the encoding-unspecified locales we were trying to use, with the result that the setlocale() calls all failed. Task-number: COIN-689 Change-Id: Id791ba269bf4abac29da3daa4fd01684ca9caa7a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Remove two QEXPECT_FAIL()s that no longer appear to be validEdward Welbourne2021-06-111-12/+0
| | | | | | | | | Because they were followed by a QVERIFY(false), no-one noticed until now. Dates from 2011, when ICU support was first added. I guess someone fixed the problem in the intervening decade. Change-Id: I847816c297156e65397c652767f286bc4de193a2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLatin1String: Add overloads taking QLatin1CharMårten Nordheim2021-06-111-0/+15
| | | | | | | | | Without the overloads using QLatin1Char in QL1S member functions results in the QL1Char being converted to QChar and QL1String being converted to QString. Change-Id: Ic19545539a207f025a6293f0b2d929de475dc166 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_qsettings: reliably remove the empty.ini fileMarc Mutz2021-06-111-1/+2
| | | | | | | ... using QScopeGuard. Change-Id: I3693ca5e5ef32aa7ccabaa7e05a94bee69e0910b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove pure-virtual-signals.h include from tst_moc.cppEdward Welbourne2021-06-111-1/+0
| | | | | | | | | | | | | | | | | | The relevant test is conducted by tst_Moc::warnOnVirtualSignal(), added in 2009, <quote> Fix Warning saying that signal cannot be made virtual The test for virtual signal did not work. But we cannot make an error right now or it might break existing code (exemple in task 210879) </quote> but without removing the #include, so we do still get a warning about that when building tst_moc. Pick-to: 6.2 6.1 5.15 Change-Id: I5ea18058f22bbd483d1ff18b0ca7b360f6674ed9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Correct handling of last second of 1969 (again)Edward Welbourne2021-06-111-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In my prior attempt to handle the last second of 1969, I forgot that the QTime we're describing is a local time, so whether *it* thinks we're at the last second of the day is beside the point. Fortunately, preceding second should get -2 as return if mktime()'s initial -1 actually meant the last second of 1969, so we can test via that, after a cheap pre-test to save doing this too often (albeit we only even attempt the check if mktime() returned -1 in any case). Restructured qt_mktime() in the process to deal with the error case's early return promptly instead of doing it in an else clause. Also repackage the calls to mktime to isolate various quirks and simplify the logic in qt_mktime(). This also prepares for setting tm_isdst as a hint when we know when we came from, in massageAdjustedDateTime(). Refined one test, added two more test cases. These didn't fail before this fix, but a judiciously-placed qDebug() in testing revealed that localMSecsToEpochMSecs() resorted to its fall-back handling - as if the date-time were outside the time_t range - due to qt_mktime() failing, for these test-cases (and several others). This fix evades that fall-back behavior; a judiciously-placed qDebug() shows none of our test-cases now fail callMkTime(). Change-Id: I11aa5015191dc4a565c28482307f7bc341c207e7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Clean up tst_QDateTime's conditions on zoneIsCETEdward Welbourne2021-06-111-419/+414
| | | | | | | | | | | | | In setMSecsSinceEpoch(), the CET end-of-time is invalid anyway, so a whole block (rather than just one sub-test of it) was irrelevant for the max-qint64 test case (aside from verifying cet *is* invalid). Split out to a separate test the part of a data-driven test that was the same for all data rows. Reworked several ill-advised ways to use QSKIP(). Change-Id: If757d3e722c81fc42a87256125ceef605b6bfb64 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Hangul composition: use < base + count checks, not <= checksEdward Welbourne2021-06-111-0/+19
| | | | | | | | | | | | | | | Before Unicode 4.1.0 there was an error in the example code for Hangul normalization that used <= on the ends of some ranges of values, where they should have used < tests. This was faithfully copied but the need for correction has only lately come to light. Thanks to Ma Lin for pointing this out and providing the fix and test-cases. Fixes: QTBUG-71894 Pick-to: 6.2 6.1 5.15 Change-Id: I5c7fec1f9fac1f7a25b2d5e9c3109a90a7ff49e1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* remove cmake compatibility functions for old APIPeng Wenhao2021-06-111-1/+0
| | | | | | | QT_NO_INTERNAL_COMPATIBILITY_FUNCTIONS has been removed Change-Id: Ic77cdae4e5151e3b0fe05cc6dd5b43bffc24768c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Check scrollbar ScrollBarOverlap when computing QListView marginsZhang Hao2021-06-101-0/+31
| | | | | | | | | | | | | | | | | When the listview setWordWrap is true and ScrollBarPolicy is ScrollBarAsNeeded, if QStyle::PM_ScrollView_ScrollBarOverlap returns true, the text displayed an empty line. Fix this by not reserving the width of the vertical scrollbar if the flow is TopToBottom and the vertical scrollbar, and QStyle returns true for PM_ScrollView_ScrollBarOverlap. Amends aeef92c3c33e4ebcb7e5d8dd955020f4f4600e84 Pick-to: 6.1 6.2 Fixes: QTBUG-94248 Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io> Change-Id: I4d47c7e86bbb86474cb1a99bb26d8b67f0e8a7e2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add the check for linker capabilities to resolve circular dependenciesAlexey Edelev2021-06-101-2/+2
| | | | | | | | | | | | | | 'ld' only capable to resolve circular dependencies by wrapping the suspected static libraries and objects using --start/end-group arguments. We want to detect if linker is 'ld' at configure time to decide how to link the resource objects if finalizers are not enabled. The qt_config_compile_test function is extended with an extra argument since it's required to pass custom cmake flags to the ld-related test. Pick-to: 6.2 Change-Id: I484fcc99e2886952d8b0232f37e4e6a35d072931 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Introduce a mini-version of qsslsocket_openssl_symbols_p.h/.cppTimur Pocheptsov2021-06-094-37/+868
| | | | | | | | | | | For auto-tests that were temporarily disabled. Similar to network-settings.h, header-only stuff. Fixes: QTBUG-92866 Fixes: QTBUG-92877 Change-Id: I15b5c0b41f0d8bfe59b09c844884ff6d99e6d41a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QAbstractItemView: block autoScroll from interfering with QScrollerVolker Hilsheimer2021-06-091-0/+62
| | | | | | | | | | | | | | | | When pressing an index in order to start a flick gesture, QAIV sets the current index. When QScroller changes state to Dragging, then QAIV restores the current index to what it was before the press, as the user is clearly scrolling the view. With autoScroll enabled, this will produce an ugly jump if the old current index is no longer in the viewport. To prevent this, disable autoScroll before restoring the currentIndex. Fixes: QTBUG-64543 Pick-to: 6.2 6.1 5.15 Change-Id: I3e0a18a6a179d80b9d810fce5aa658f0cfff9a29 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>