summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Add an expansion limit for entitiesLars Knoll2020-03-251-2/+21
| | | | | | | | | | | | | | | | | | | | Recursively defined entities can easily exhaust all available memory. Limit entity expansion to a default of 4096 characters to avoid DoS attacks when a user loads untrusted content. [ChangeLog][QtCore][QXmlStream] QXmlStreamReader does now limit the expansion of entities to 4096 characters. Documents where a single entity expands to more characters than the limit are not considered well formed. The limit is there to avoid DoS attacks through recursively expanding entities when loading untrusted content. Qt 5.15 will add methods that allow changing that limit. Fixes: QTBUG-47417 Change-Id: I94387815d74fcf34783e136387ee57fac5ded0c9 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit fd4be84d23a0db4186cb42e736a9de3af722c7f7) Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Try to stabilize flaky test cases of tst_qsequentialanimationgroupSona Kurazyan2020-03-121-4/+3
| | | | | | | | Use QTRY_COMPARE in the flaky tests instead of waiting. Change-Id: Ic18fc5fde3fa47f3b3ef21e6acd876bd6990981d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 0ae6803d3956cf59801bbcc52143b95de9fc96d1)
* Fix 'out of process' autotestsTimur Pocheptsov2020-03-121-28/+54
| | | | | | | | | | | | | | We are, arguably, not testing QProcess and its ability to start or finish, we test QUdpSocket. If, for some reason (as we discovered on some specific machines recently) the process does not start or does not produce any output (canReadLine), we QSKIP instead of failing. Also, all those QCOMPARE will bypass the part there we stop processes - so must be RAII-protected. Fixes: QTBUG-82717 Change-Id: Idfb0d4a483d753f336b3827875eeaf51c79270e2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit c668fd940d0c610324254d5aa5aab6e0769f78a6)
* TCP socket auto-test: reduce flakynessTimur Pocheptsov2020-03-121-4/+13
| | | | | | | | | | | | | | | increaseReadBufferSize has several cases, surprisingly, subsequent runs can be affected by close notification from the previous tests, and then they ... break the expected logic test (by resetting read buffer size and trying to read as much as possible). Ah, and as it often happens with our auto-test - a client socket leaked if some of COMPARE/VERIFY failed. unique_ptr to rescue. Fixes: QTBUG-82776 Change-Id: I9dc79072fdefc08417274dc341b88fca70c54dae Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* xcb: Fix logic for minimized stateJiDe Zhang2020-03-091-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When _NET_WM_STATE_HIDDEN is not contains in the _NET_WM_STATE window property, the window should not be considered to be minimized According to https://specifications.freedesktop.org/wm-spec/1.3/ar01s05.html _NET_WM_STATE_HIDDEN should be set by the Window Manager to indicate that a window would not be visible on the screen if its desktop/viewport were active and its coordinates were within the screen bounds. The canonical example is that minimized windows should be in the _NET_WM_STATE_HIDDEN state. Pagers and similar applications should use _NET_WM_STATE_HIDDEN instead of WM_STATE to decide whether to display a window in miniature representations of the windows on a desktop. For mutter/GNOME Shell, without _NET_WM_STATE_HIDDEN, window manager will not reply XCB_ICCCM_WM_STATE_ICONIC settings in WM_CHANGE_STATE client message. Task-number: QTBUG-76147 Task-number: QTBUG-76354 Task-number: QTBUG-68864 Done-With: Liang Qi <liang.qi@qt.io> Change-Id: Ic9d26d963979b7f0ef4d1cf322c54ef8c40fa004 Reviewed-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 4f370d36ec5caa02f78545ceee5704d94edf0530)
* Revert "Blacklist tst_QWindow::isActive on Ubuntu"Liang Qi2020-03-071-2/+0
| | | | | | | | | | | | | This reverts commit c6ee1899eaa50dae56c07b6c4b3490cc5aeb60e6. It has been BPASSed since 2019-10-11 based on status in grafana. See also 6c136973fd9b82420c818668086abe93f534993d, which has unblacklisted this in 5.14 and later. Task-number: QTBUG-67768 Change-Id: Id8f44169ba1e4ecef170c9cd00c363d1bf521283 Reviewed-by: Daniel Smith <Daniel.Smith@qt.io> Reviewed-by: Kari Oikarinen <kari.oikarinen@qt.io>
* Blacklist test that times out on windowsDimitrios Apostolou2020-03-061-0/+4
| | | | | | | | | | It seems something is going on with infrastructure and all windows VMs are slower. Blacklisting until we figure it out. Task-number: QTBUG-82717 Change-Id: Icab430125747df0a2d0ea4da8093a33ae75c5f13 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Try again to make QDeadlineTimer test robust against context switchesVolker Hilsheimer2020-03-061-16/+34
| | | | | | | | | | | | | | | Instead of comparing to absolute values, compare the result from QDeadlineTimer with the reference clock types from std::chrono. Pass the test as long as we are within 10% of that reference. In addition, handle the case where QTest::qSleep sleeps for more than 10% longer or shorter than what is requested, and if so, abort the test. Change-Id: If8b77aea55a8c5c53e96427b2fff2f78281d0f82 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 4a1de178c9cc891560f38d64d89074799b0fa0e1) Reviewed-by: Liang Qi <liang.qi@qt.io>
* Fix flaky QElapsedTimer::elapsed test caseVolker Hilsheimer2020-03-061-17/+30
| | | | | | | | | | | | | | | | | | | Much of this test case was testing that the machine it runs on didn't take more than an expected amount of time, which is an assumption that won't hold in a virtual environment where the hypervisor might decide to not allocate any CPU time to the machine at certain times. Instead, take the samples that we want to compare with once, then use them as reference for further comparisons. Also, split the test in two, with the comparison operators and msecsTo test moved into a separate test function. Change-Id: I7db12b8e02552f4d63af933c1b0fee9d62b591eb Fixes: QTBUG-58713 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 715468df40e4ce97da04f327b6e34d535ff9b97d) Reviewed-by: Liang Qi <liang.qi@qt.io>
* Make QDeadlineTimer test more resilient against VM starvationVolker Hilsheimer2020-03-061-4/+19
| | | | | | | | | | | | | | | | Flaky fails in this test suggest that the VM on which the test is executed does not get CPU resources allocated for enough time to make this test pass. This change makes the test more resilient by taking the measurements as quickly as possible. In addition, use a sanity-check based on std::chrono APIs to abort the test completely if we see that the clock has advanced too far to make the following tests meaningful. Change-Id: Ie6ac4ffb52f20e7774014f8222c9cd8f54d8a263 Fixes: QTBUG-64517 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 8b9a02537300507d21d58ac7d3db4fe1a2f2fe62)
* QShaderGenerator: Allow more expressions in input nodesNicolas Guichard2020-02-281-0/+50
| | | | | | | | | | | | | | | | | | | Currently QShaderGenerator will crash when encountering some expressions in input nodes. For example, this node prototype would make it crash: "VERTEX_COLOR": { "outputs": ["color", "alpha"], "rules": [ "headerSnippets": ["in vec4 vertexColor;"], "substitution": "vec3 $color = vertexColor.rgb; float $alpha = vertexColor.a;" ] } Change-Id: I37abb8099d376843a4cb13228140467dc1b8f60c Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit f9086ebd0198c53e8a811af47e0ff0c84d78eb30)
* QShaderGraph: don't generate statements with undefined inputsNicolas Guichard2020-02-211-8/+4
| | | | | | | | | | | | | | | | This fixes the shader generation for graphs like this one: Function0 ------> Output0 (with unbound input) Input ------> Function1 ------> Output1 With those graphs, createStatements will not return any statement for nodes Function0 and Output0. Change-Id: Iec32aa51623e176b03ae23e580f06d14df80a194 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit 7981dbfaf371a368fbd69e935768b310f42a0e5a)
* QShaderGenerator: Don't crash when a node has multiple outputsNicolas Guichard2020-02-211-0/+73
| | | | | | | | | | | | | | | | | | | | | | | It was already possible to declare a node prototype with multiple outputs, but trying to assign to all those outputs was not possible and instead resulted in a crash. It is now possible to declare nodes like this without crashing: "SEPERATE_XYZ": { "inputs": ["vector"], "outputs": ["x", "y", "z"], "rules": [ { "substitution": "float $x = $vector.x; float $y = $vector.y; float $z = $vector.z;" } ] } Change-Id: I748e77e84c9120dc688c573eee33dc13c6bfbace Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit 39994e0705f11afc45e20872b95fb3a6e684c913)
* Fix QShaderGenerator crashing when a node port name prefixed another oneNicolas Guichard2020-02-201-0/+70
| | | | | | | | | | | | | | | QShaderGenerator didn't handle substitutions like `vec4 $color = mix($color1, $color2, $fac);` Note that `$color` is a prefix to `$color1` and `$color2`. For the substitution `QByteArray::replace` was used so if `$color` was handled first and replaced by `v1`, `$color1` and `$color2` were never correctly replaced and instead became `v11` and `v12` which caused a crash later on. Change-Id: Idaf800fdac468f33c323eb722701da5f8eb918d6 (cherry picked from commit 49dbe760e4e0d8a781b5336efdce4748a7d73a33) Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* QShaderGraph: Fix statement creation for graphs with dangling branchesNicolas Guichard2020-02-181-0/+45
| | | | | | | | | | | | | | | | | | For graphs like this one: Input ----> Function1 ----> Output \ ---> Function2 (unbound output) We would have generated only 2 statements, for Function1 and Output. This change fixes this by treating Function2 like an output. Therefore it generates 4 statements: Input, Function1, Output and Function2. Change-Id: Iaada40b9b949d771806dd47efad4f7ef2a775b48 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* QXmlStreamReader: early return in case of malformed attributesGiuseppe D'Angelo2020-02-102-0/+9005
| | | | | | | | | There's no point at keep raising errors after encountering the first malformed attribute. (cherry picked from commit 4d8a515a230ca9864a94830fd376a1d3ecbe6886) Change-Id: I1c5e8caf92b09c91ec8c37eb72c72f2f937013e6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QWidget: React to platform surface being created or destroyedTor Arne Vestbø2020-01-231-0/+54
| | | | | | | | | | | | | | | | The platform window may create or destroy its surface from other entry points than the QWidget API, in which case QWidget needs to sync up its own state to match. In particular WA_WState_Created and the winId needs to be recomputed. Fixes: QTBUG-69289 Fixes: QTBUG-77350 Fixes: QTBUG-80859 Change-Id: I769e58ead3c2efcf8c451c363108848feade9388 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> (cherry picked from commit 009abcd7b66738bece6cf354776dfb2ef401636b) Reviewed-by: Liang Qi <liang.qi@qt.io>
* CoreText: Modernize style hint fallback lookupTor Arne Vestbø2019-11-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The DefaultFontFallbacks.plist system file that we used for looking up style fallbacks does not exists in macOS 10.15, nor did it ever exists on iOS. Instead of relying on this file, we hard-code a set of default families, that we then look up the fallbacks for. The result of QFont::defaultFamily() on macOS is now: QFont::Helvetica --> "Helvetica" QFont::Times --> "Times New Roman" QFont::Courier --> "American Typewriter" QFont::OldEnglish --> "" QFont::System --> "Lucida Grande" QFont::AnyStyle --> "Lucida Grande" QFont::Cursive --> "Apple Chancery" QFont::Monospace --> "Menlo" QFont::Fantasy --> "Zapfino" And on iOS: QFont::Helvetica --> "Helvetica" QFont::Times --> "Times New Roman" QFont::Courier --> "American Typewriter" QFont::OldEnglish --> "" QFont::System --> "Helvetica" QFont::AnyStyle --> "Helvetica" QFont::Cursive --> "" QFont::Monospace --> "Menlo" QFont::Fantasy --> "Zapfino" Fixes: QTBUG-78240 Change-Id: Ie9bc13c9c1031d89f024199e4736a046c568a48d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> (cherry picked from commit 7f0faddf9fe25adc0a3e0827e21c030d6a7a1035) Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Ensure that child windows are visible again when showing their parentAndy Shaw2019-10-311-0/+23
| | | | | | | | | | | | | | | When a window is closed, then it will cause the child windows to be closed as well as a result. Therefore in order to ensure that they are shown again as a result, we need to remove the WA_WState_ExplicitShowHide attribute if the widget was not already hidden before. This enables us to test for this attribute when calling showChildren(), so that if the window has a windowHandle then we can make sure that this widget is shown again. Fixes: QTBUG-73021 Change-Id: I1186242b889899dfcd38d782a67567348e2055ee Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit ccd3bf0871b81dfc09bb469b161f32dfb47ee53e)
* DTLS auto-test(s) - fix a buggy logic with pending datagramsTimur Pocheptsov2019-10-112-4/+4
| | | | | | Fixes: QTBUG-79128 Change-Id: Ifebd5b056541b7732b15b5cf063ad22ab754a64c Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Fix QRandomGenerator initialization on AMD CPUsDmitry Kazakov2019-10-081-3/+3
| | | | | | | | | | | | | | | | Some AMD CPUs (e.g. AMD A4-6250J and AMD Ryzen 3000-series) have a failing random generation instruction, which always returns 0xffffffff, even when generation was "successful". This code checks if hardware random generator generates four consecutive equal numbers. If it does, then we probably have a failing one and should disable it completely. Change-Id: I38c87920ca2e8cce4143afbff5e453ce3845d11a Fixes: QTBUG-69423 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 5839714d986f28412c9f9ed4801d1bf9378f7b51) Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update lancelot tests to use non-system-specific host info collectionDaniel Smith2019-09-231-18/+10
| | | | | | | | | | | Change the lancelot baseline test runner to use generic text files for host info data collection. This also avoids relying on QProcess and scraping the bash scripts output from stdout. Fixes: QTBUG-71836 Change-Id: I88a46c99dbb11f71afc18cae5a6d2fbebcbe76c5 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit 651dd26403052f98397783927ad02e008acf0552)
* MS TZ data: avoid calculating a date in year 0Edward Welbourne2019-09-191-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | There is no year 0 in the proleptic Gregorian calendar, so QDate() won't be happy if asked for a date in it. Tweak scanning of the data we get from MS-Win so as to avoid a date calculation that could otherwise happen in year 0 when constructing QDateTime(QDate(1, 1, 1), QTime(0, 0, 0), QTimeZone("Australia/Sydney")). Added a test for this case, which Oliver Wolff has kindly verified does reproduce the assertion failure. However, Coin is unable to reproduce, as all its MS builds are configured with -release, so Q_ASSERT() does nothing. (The relevant code then skips over year 0, albeit for the wrong reasons, and gets the right results, albeit inefficiently, leaving no other symptom by which to detect the problem.) Fixes: QTBUG-78051 Change-Id: Ife8a7470e5bd450bc421e89b3f1e1211756fc889 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 8286daba038d3c90d2bc06785ffcf9c0c603cb83) Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Merge remote-tracking branch 'origin/5.12.5' into 5.12Qt Forward Merge Bot2019-09-071-0/+17
|\ | | | | | | Change-Id: I41a252fdbf22551aadb0b1a6e9ecf3f95f99fbd4
| * Fix crash when text contains too many directional charsRainer Keller2019-08-301-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case a text to be layouted contains more than 128 directional characters it causes the application to crash The function initScriptAnalysisAndIsolatePairs() collects information of RTL/LTR chaaracters into vector "isolatePairs". The size of the vector is capped to 128. Later the function generateDirectionalRuns() iterates the text again and tries to access items from the previously capped vector above the upper bound. Task-number: QTBUG-77819 Change-Id: Ibb7bf12c12b1db22f43ff46236518da3fdeed26a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | QShortcut: call base class implementation in event()Christian Ehrlicher2019-09-051-0/+10
| | | | | | | | | | | | | | | | | | | | | | QShortcut::event() did not call the base class implementation QObject::event() which caused that e.g. QEvent::DeferredDelete was not handled. Fix it by calling QObject::event() when the event was not handled. Fixes: QTBUG-66809 Change-Id: Ideebc980bc658f8f2b9ec4417e738bccda5eeab5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | tst_http2::goaway - run in ALPN mode onlyTimur Pocheptsov2019-09-041-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | I was observing rare crashes on my mac, where I was using SecureTransport. This would imply both the client (the test) and the server were working in h2c mode. But this is against the test's logic - the first request will be HTTP/1.1 (and upgrading protocol) and I wanted to send 3 HTTP/2 requests instead. Fixes: QTBUG-77476 Change-Id: I048ca242e2096ca36dd112277807d1fee530150c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | QPainter lancelot test: improve drawImage testingEirik Aavitsland2019-09-021-2/+8
|/ | | | | | | | | | | | | In QPainter, there is a shortcut code path for the drawImage(point, image) call, relative to the full drawImage(targetRect, img, srcRect). The lance script interpreter would only use the latter, so the former was not covered by the tests. As a driveby, remove the pointless usage of non-default dithering flags in drawImage(), since it is more important to test the default. Change-Id: Id373fd528a0c4c40b6bd8eea37b960fd7cdb2cc7 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Make the inputRejected test compatible with -no-feature-clipboardJames McDonnell2019-08-151-0/+4
| | | | | | | | | Qt for QNX is, by default, built without the clipboard feature. Change-Id: Ie8a36ceb0c0f0a695ae7d0fcf6f0bd70d2a43e0c Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Dan Cape <dcape@qnx.com> Reviewed-by: Rafael Roquetto <rafael@roquetto.com>
* QTextureFileReader: backport ASTC supportEirik Aavitsland2019-08-154-24/+51
| | | | | | | | | | Add support for astc format files as an experimental feature. To enable, configure with "-feature-texture_format_astc_experimental" (Backported from commit 5a4db421bd94acd12a4ac1f77031996b95f85dbf) Change-Id: I9a2f7b1fa20ba344b79637bafb50ff2bd0596747 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Fix qinstall on Windows for directories containing read-only filesJoerg Bornemann2019-08-151-3/+0
| | | | | | | | Initial patch by: Vlad Lipskiy <eswcvlad@yahoo.com> Fixes: QTBUG-77299 Change-Id: I803b809d1f23d844252b701cb070f6e4ba34eca1 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Add tst_qmake::qinstallJoerg Bornemann2019-08-143-0/+108
| | | | | | | | ...with a failing test case for QTBUG-77299. Task-number: QTBUG-77299 Change-Id: I42c4fc4bb96f8660f8ff9bea97e6096ca6cec972 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Make test less dependent on moving the cursorMorten Johan Sørvig2019-08-111-1/+1
| | | | | | | | | | | | | | | | | | | | The sendMouseMove() function calls QTest::mouseMove(), which again calls QCursor::setPos() to move the cursor. It then creates and sends a MouseMove event, using the constructor which picks up the global position by calling QCursor::pos(). On macOS 10.14, QCursor::setPos() may silently fail if the user does not grant the application permission to move the cursor (via a dialog). As result of this the mouse move event gets an incorrect global position. Provide the global position directly when creating the event to make sure it gets the correct value. Task-number: QTBUG-75786 Change-Id: I3e8df450fea802783a3d1dbe471753f502b42de3 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QWizard: Account for missing background image on macOS 10.14+Morten Johan Sørvig2019-08-111-10/+9
| | | | | | | | | | | We were loading “Background.png” from the KeyboardSetupAssistant app bundle. As of macOS 10.14 that image is no longer there. Adjust auto tests and document the behavior. Change-Id: Icb4dd73b3fa88927e87bb86db2bc9f7b4a8094f7 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add nullptr guard to QHighDScaling::scaleAndOrigin(QPlatformScreen *)Morten Johan Sørvig2019-08-111-0/+18
| | | | | | | | | Commit b6ded193 added an unconditional dereference of the platformScreen pointer, for calls where nativePostion is non-nullptr. Change-Id: I4a6fbbd0337f91d4fcb76c17b4dc60e1b9ad10ed Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QBitArray: fix fromBits() and actually test itThiago Macieira2019-08-081-0/+57
| | | | | | | | | | | | | | | When I initially added it, it was ony for QCborValue, but I never added the tests. Turns out there were two bugs: [ChangeLog][QtCore][QBitArray] Fixed two bugs that caused QBitArrays created using fromBits() not to compare equal to the equivalent QBitArray created using other methods if the size was zero or not a multiple of 4. If the size modulus 8 was 5, 6, or 7, the data was actually incorrect. Fixes: QTBUG-77285 Change-Id: Ife213d861bb14c1787e1fffd15b70573d162042c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* A GCC 4.8 build fixVille Voutilainen2019-08-081-1/+1
| | | | | Change-Id: Ic128486711118e1124739e8dca30547ab8ba9816 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix crash in QTextDocument::clearUndoRedoStacks()Eskil Abrahamsen Blomfeldt2019-08-081-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | When calling QTextDocument::clearUndoRedoStacks() with UndoStack, there were two bugs: The first was that we were retrieving the item at "undoState" and deleting this. This is actually the upper limit of the for loop. If the stack does not contain any redos, then it would be == undoStack.size() and we would assert. If there were redos, then we would delete the item at undoState multiple times (actually undoState times). In addition, when the loop exited, we first removed the dangling pointers using remove() and then there was a weird resize() to the new size minus the old undoState. This would either assert because we tried to resize to a negative number, or it would arbitrarily remove items from the stack. [ChangeLog][QtGui][Text] Fixed a crash bug in QTextDocument::clearUndoRedoStacks(QTextDocument::UndoStack). Task-number: QTBUG-69546 Change-Id: I8a93e828ec27970763a2756071fa0b01678d2dcd Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* tst_http2::connectToHost - fix flakinessTimur Pocheptsov2019-08-072-6/+0
| | | | | | | | | | | some assumptions were incorrect: our test server immediately sends its SETTINGS frame, as a result we have to reply with client preface + SETTINGS(ACK). So QVERIFY(!prefaceOK) was wrong from the beginning and was only passing by pure luck. Change-Id: Ie43f0d4ac41deb0e5339badaae6149a9b2f9d9b3 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* tst_http2::connectToHost - add a fix for SecureTransport backendTimur Pocheptsov2019-08-011-0/+13
| | | | | | | | | | | One of the tests above was unsetting a variable that enforces the use of a temporary keychain. We have to set it back, otherwise the test is failing. What surprises me though - why I had this problem only locally and not on CI? Apparently, SecureTransport is not covered by our configurations ... Change-Id: I0ff1e3e304632869391ed61213c245b949d8c778 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Blacklist tst_http2::connectToHostTimur Pocheptsov2019-08-011-0/+3
| | | | | | | Test if flakey. Change-Id: I1f956f47ab4cf0602f3631e4f7908df35f5ce83f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QHighDPI: Fix broken scaling of QPoint(F)Friedemann Kleint2019-08-013-0/+86
| | | | | | | | | | | | | | For some reason, the overload resolution of the High DPI scale() functions introduced by b6ded193ee64ffe67df6d22e7a23aa1ea9e02ec7 chose the wrong overloads for QPointF and/or QPoint; it fell back to the generic template intended for qreal, QSize, etc, ignoring the origin. Remove the template and spell out all overloads. Fixes: QTBUG-77255 Change-Id: I5661f16f7326f65156f646f430f5a0c71d5302d2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QHostInfo: Always post results through the event loop to the receiverVolker Hilsheimer2019-07-261-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | Lookups performed via QHostInfoRunnable must not synchronously call the user-code's receiver objects, as that would execute user-code in the wrong thread. Instead, post a metacall event through the event loop of the receiver object, or the thread that initiated the lookup. This was done correctly for the trivial cases of empty host name or cached results, so the code generally existed. By moving it from a global function into a member function of QHostInfoResult, we can simply access the required data to construct and post the event. As we process that posted event, we need to check that the context object (which is already guarded via QPointer) is still alive, if we had one in the first place. If we had one, and it's deleted, then abort. [ChangeLog][QtNetwork][QHostInfo] Functors used in the lookupHost overloads are now called correctly in the thread of the context object. When used without context object, the thread that initiates the lookup will run the functor, and is required to run an event loop. Change-Id: I9b38d4f9a23cfc4d9e07bc72de2d2cefe5d0d033 Fixes: QTBUG-76276 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Implement 'preconnect-https' and 'preconnect-http' for H2Timur Pocheptsov2019-07-241-0/+123
| | | | | | | | | | | | | | | | | | | | | | | | QNetworkAccessManager::connectToHostEncrypted()/connectToHost() creates 'fake' requests with pseudo-schemes 'preconnect-https'/ 'preconnect-http'. QHttp2ProtocolHandler should handle this requests in a special way - reporting them immediately as finished (so that QNAM emits finished as it does in case of HTTP/1.1) and not trying to send anything. We also have to properly cache the connection - 'https' or 'http' scheme is too generic - it allows (unfortunately) mixing H2/HTTP/1.1 in a single connection in case an attribute was missing on a request, which is wrong. h2c is more complicated, since it needs a real request to negotiate the protocol switch to H2, with the current QNetworkHttpConnection(Channel)'s design it's not possible without large changes (aka regressions and new bugs introduced). Auto-test extended. Fixes: QTBUG-77082 Change-Id: I03467673a620c89784c2d36521020dc9d08aced7 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix lancebench results oddnessAllan Sandfeld Jensen2019-07-231-10/+10
| | | | | | | | | | | | Imports were expanded in the list of commands every time they were evaluated. This meant any test with imports ran slower and slower the more iterations it got through. Fixed by creating a new PaintCommands object every time and living with initialization of it being part of the benchmark results. Change-Id: Ib53a3a25f1393437452bc5aede04ccb63e8715a6 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix QCborStreamReader not flushing QIODevices due to internal bufferingThiago Macieira2019-07-192-19/+168
| | | | | | | | | | | | | | | When successfully finishing a parse, it's reasonable to expect that the QIODevice was advanced to the end of the input data. [ChangeLog][QtCore][QCborStreamReader] Fixed a bug that caused the QIODevice that the data was being read from not to show the entire CBOR message as consumed. This allows the user to consume data that may follow the CBOR payload. Fixes: QTBUG-77076 Change-Id: I1024ee42da0c4323953afffd15b23f5d8fcc6f50 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* tst_http2 - make the test less rough in generalTimur Pocheptsov2019-07-181-11/+40
| | | | | | | | | | | | | | 1. Use per-case QNAM objects 2. In a slots (connected to QNetworkReplies) - if an error detected - stop the event loop (no reason to continue waiting) and then do normal QVERIFY/QCOMPARE things. 3. In tests, check QTest::currentTestFailed after the event loop returned - if an error was detected by a slot, no need to continue with QCOMPARE/QVERIFY in the test itself. Task-number: QTBUG-77053 Change-Id: I3827a629a2749becd3dc6eee7fd6994d96441e65 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* tst_http2::flowControlServerSideTimur Pocheptsov2019-07-151-0/+7
| | | | | | | | | fix the bloody test for good - the idea to have a shared QNAM (shared by test cases in this test) was somewhat wrong to start with. Fixes: QTBUG-77053 Change-Id: I5755e96ec988e2dd546f527f3f902fc43914b0b7 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove unused arguments from QWidgetPrivate::create_sysTor Arne Vestbø2019-07-121-3/+3
| | | | | | | | | | | | | The public QWidget::create still has them, but we don't need to propagate them on - that just makes debugging the window creation flow harder. The window argument to QWidget::create is technically used to guard an early exit in the function, but to keep behavior the same we leave it for now. Change-Id: Ic0287575aa25f1272e216adc1b75e34d6f55f6d9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QSaveFile: Fix changing the file name after hitting on readonly fileFriedemann Kleint2019-07-111-0/+34
| | | | | | | | | The call to QFileDevice::unsetError() in QSaveFile::open() does not clear QSaveFilePrivate::writeError. Clear it in addition. Fixes: QTBUG-77007 Change-Id: I5e5009750f1726d1c74c1b4eb1c33f3a5393fe4f Reviewed-by: David Faure <david.faure@kdab.com>