Commit Graph

14412 Commits

Author SHA1 Message Date
Thiago Macieira
742584b0f2 tst_QTcpServer: Output useful more useful info for addressReusable
To try to figure out why QProcess::waitForReadyRead is returning false
so quickly. Though we know it's going to be "Address in use".

FAIL  : tst_QTcpServer::addressReusable(WithoutProxy) 'process.waitForReadyRead(5000)' returned FALSE. (Failed to listen: The bound address is already in use
Netid State  Recv-Q Send-Q Local Address:Port  Peer Address:PortProcess
tcp   LISTEN 0      50         127.0.0.1:49199      0.0.0.0:*    users:(("crashingServer",pid=40529,fd=4))
)

Pick-to: 6.4 6.2
Change-Id: Ic43a460bfc7c7eb6379405b7a1a064e502b6fef3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-10-11 09:36:11 -07:00
Ievgenii Meshcheriakov
c4e550703c Update UCD to Revision 30
This corresponds to Unicode version 15.0.0.

Added the following scripts:

    * Kawi
    * Nag Mundari

Full support of these scripts requires harfbuzz version 5.2.0,
this version adds support for Unicode 15.0:

    https://github.com/harfbuzz/harfbuzz/releases/tag/5.2.0

Fixes: QTBUG-106810
Change-Id: Ib06c526e49b0f01ef9f21123bcf875c6b19f2601
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-10-11 14:10:59 +00:00
Edward Welbourne
35ff456407 tst_QString::compare(): rename a test tag to be unique
There were two data8 rows; and no data9, so that was easy to fix.

Change-Id: I8191de142e1a3be57bf1ad97e63d5780f2859fea
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-11 11:24:51 +02:00
Edward Welbourne
3af2747c46 tst_QString::number_base(): distinguish negative binary test-cases
Two test cases were called "base  2, negative"; one of them use -1 as
value, so s/negative/minus 1/ for it.

Change-Id: Ia5da3952d93976262cc8423d4e75ec19dab9a088
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-11 11:24:39 +02:00
Edward Welbourne
167da771f6 tst_QRE::wildcard(): use more informative data row tags
Using simply the pattern didn't work so well when some patters are
used repeatedly, on different haystacks. So include the haystack
in the tag name. Remove one straight up duplicate row.

Change-Id: Ib46364581f23c493e83d75e6d04ab09e4329a3a5
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
2022-10-11 11:24:11 +02:00
Edward Welbourne
042702d961 tst_QBAApiSymmetry::toInt_data(): deduplicate a data-row name
One "empty" test was base ten, the other left the code to work out the
base. Change the latter's name to reflect that difference.

Change-Id: I4918eb0d293420df315d86e532787950b8f05be8
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-10-11 11:24:01 +02:00
Edward Welbourne
cc204f96c9 tst_QCborValue: remove duplicate data row from tests
The addCommonCborData() helper had two identical rows named simple255.
It only needs one.

Change-Id: Ie934c31f373069788c3ef774fde8956b54814e67
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-11 11:23:50 +02:00
Edward Welbourne
2192d6a62e tst_QPlugin::scanInvalidPlugin(): de-duplicate a data-tag
Change-Id: Ibc25041b5e003cf21d781012f279e9bdd75a2ee9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-11 11:23:40 +02:00
Edward Welbourne
97470a7838 tst_QUuid::fromString(): tweak a test to avoid data-tag collision
Two of the uuidA test cases had an open-brace for the string and no
close; one of them ended with a space (which, apparently, is valid).
Since the data-tag was constructed by formatting the string in a
fixed-width field, padding with spaces, these two cases coincided.

Fortunately the only uuidB test-case had closing as well as opening
braces, so we can just switch the test for "trailing space is not an
error" to use it, instead.

Change-Id: I7068d40145c6b6b3b72777b029282850b1d1ea81
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mate Barany <mate.barany@qt.io>
2022-10-11 11:23:15 +02:00
Edward Welbourne
439066ea84 tst_QResourceEngine::checkStructure(): fix name of some data rows
The first "test1 text" test-case related to a file called test1.txt;
but the second related to a file called test2.txt; I suspect a
copy-and-paste with incomplete post-edit. In any case, change the
latter's data tag to reflect the difference.

Change-Id: I8354a3d1bd18715d6717dfd0962aa70faefbee90
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-11 11:23:04 +02:00
Edward Welbourne
f89d3484b2 tst_QUrl::fromUserInput(): distinguish to data rows by name tag
Change-Id: Ia3d232466ae618c26b95a6c33b094b197a2e4ec8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-11 11:22:53 +02:00
Edward Welbourne
6e4a5211a2 tst_QUrl: distinguish two ipvfuture test-case data tags
Change-Id: I20e318b4c17c35aae5f5440b2fd9c6e0af7c4a70
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-11 11:22:41 +02:00
Edward Welbourne
5455ea7ccd tst_QUrlQuery: remove duplicate of reconstructQuery data row
Change-Id: I7903eca0887c0cbccef9fcadac6e95009703e1c2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-11 11:22:31 +02:00
Edward Welbourne
ef8905aa2b tst_QFile: distinguish invalid from valid in mapResource data-tags
The test was using the same tags twice each, giving no clue to the
difference between the two test-cases for each.

Change-Id: I645b01c0c4008a766e505047cb05cc22640ee129
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
2022-10-11 11:22:22 +02:00
Edward Welbourne
50561716f0 Distinguish the repeats of QSystemSemaphor's processes tests
It's not clear why this test repeats each test-case five times, but
give the duplicates distinct names, at least.

Change-Id: I4a098d90c3fe6f61842745c1d5f62047fe13a9b5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-11 11:22:14 +02:00
Edward Welbourne
1f07199a48 Remove duplicate tst_QVariant canConvert:Int data row
There were simply two copies of the same row-adding code.

Change-Id: I12240dedf2649c314ad32984f4de9d6b9bf280d8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-10-11 11:22:04 +02:00
Edward Welbourne
691de7f696 Rename some tst_QTextStream::manipulators() data rows
Two rows named "hex" were a collision we should avoid.
The two "showpos" rows could be better distinguished.

Change-Id: I43727041eb00e6883ce8b34b346de5e2a63f1a34
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-10-11 11:21:57 +02:00
Edward Welbourne
16732e368a Reflow tst_QTextStream::manipulators_data()
Now I can read it and work out how to rename the duplicated data tag.

Change-Id: I78f2b3f38f955fa6e6a88cb87cfca6e4f755a177
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-10-11 11:21:47 +02:00
Edward Welbourne
11997578ac Provide optTitle for a NumberDoubleTestData testcase that needs it
The test-case for 0.0001 with precision 0 has the same expected text
as that for 0.0 with the same precision; which lead to QBA's test of
it getting a duplicated data tag. Add an optTitle for the one that
isn't precise to deduplicate.

Change-Id: I03600e2af43f6d11b53e05e8027924c92ed4db89
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-10-11 11:21:38 +02:00
Edward Welbourne
3f43ddbd10 Rename tst_QBA::toFromHex()'s longer no-leading-zero data-row
No two data-rows should have the same name.

Change-Id: I0e222498ca5bb973f703b7e6bd314fc38bb4db4d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-10-11 11:21:30 +02:00
Edward Welbourne
5c4dcd0697 Rename tst_QBA::movablity() to fix the typo
There's an i between b and l, as well as after l.

Change-Id: I9252935687e25f1f11aacb11286edf666ff9af8a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-10-11 11:21:15 +02:00
Edward Welbourne
e61dc8a83b Don't duplicate a column name in tst_QByteArray::movablity_data()
It first added a column, then some rows, then called
prependExtended_data(), which expects to be called first in a data
function and starts by adding the same column. So put that first and
drop the duplicate addition of the column.

Change-Id: Ia5cf86f821608e78f0e4872db2b3167ef81cc59e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-10-11 11:21:06 +02:00
Edward Welbourne
f71daf857c Fix tst_QQuaternion's duplicate test tags
Having the same test tag for two rows of a data table makes the report
less useful. We also intend to forbid doing that.

Change-Id: I67ec32514b6550f4f97610a2140f1383d0d85b23
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2022-10-11 11:20:58 +02:00
Alexandru Croitor
a6b430337c CMake: Only build ssl tests if the feature was enabled
Pick-to: 6.4
Task-number: QTBUG-107538
Change-Id: If2d473fbf8240b356d226be7bc4058506149a0e6
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-10-11 11:13:36 +02:00
Volker Hilsheimer
2ef130a41d JNI: add generic support for array-types
The typeSignature for a type T[] is always "[" + typeSignature<t>, so we
can just implicitly support arrays of any known type. To prevent support
for multi-dimensional arrays, make sure that the underlying type is not
also an array.

By adding a QJniTypes::isArrayType in addition (that is true for any
type with a signature starting with '['), methods like
QJniObject::callMethod could then return a special QJniArray type that
provides array-specific functionality.

As a drive-by, and since all lines need to be touched to add braces,
replace std::is_same<>::value with std::is_same_v.

Change-Id: Iccadf03cfceb8544381a8f635bb54baeddf46c99
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-10-10 20:19:30 +02:00
Mårten Nordheim
ad736e9150 tst_QTcpServer: blacklist addressReusable on macOS
For some reason it has become extremely flaky.
Blacklist to unblock most patches.

Pick-to: 6.4 6.2
Task-number: QTBUG-107500
Change-Id: I11c3ff5e018981be46c20282fa171bce687596b2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-10-10 19:22:32 +02:00
Mårten Nordheim
4f17a64f35 tst_QTcpServer: convert QSKIP to blacklist
So we can gather statistics on whether it is still failing

Pick-to: 6.4 6.2
Change-Id: I1f4080f4d96f31ce2b689cda175af3a35563e232
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-10-10 19:22:32 +02:00
Marc Mutz
dd562b3672 Replace qExchange with std::exchange
None of these users require C++20 constexpr or C++23 noexcept, the
only remaining difference between std::exchange and qExchange.

This leaves a single qExchange() user, in QScopedValueRollback, that
requires the constexpr version, only available from C++20, and thus
remains unported.

Task-number: QTBUG-99313
Change-Id: Iea46f6ed61d6bd8a5b2fd9d9ec4d70c980b443a2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-07 18:11:36 +02:00
Liang Qi
8b143f0aed tests: skip two tests in tst_QDockWidget on Wayland
This amends 9ff40b59da .

Task-number: QTBUG-107153
Pick-to: 6.4 6.2
Change-Id: Ie66205c5402d4346ffb61619ccb6a955623f5984
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-07 13:20:24 +02:00
Liang Qi
e37baad7fc tests: skip tst_QAction::disableShortcutInMenuAction() on Wayland
QWindow::requestActivate() is not supported.

Task-number: QTBUG-107153
Pick-to: 6.4 6.2
Change-Id: Iacdcf4ad4f6da4a5a996f26d3b97fb507a4b116b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-07 13:20:22 +02:00
Liang Qi
7d38320c4b tests: skip two tests in tst_QAbstractItemView on Wayland
QWindow::requestActivate() is not supported.

Task-number: QTBUG-107153
Pick-to: 6.4 6.2
Change-Id: I9080fbb0ae0a604ad4a7ffa55ba3243d1cf96be8
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-07 13:20:21 +02:00
Liang Qi
1dcd4d7171 tests: skip tst_QGraphicsView::embeddedViewsWithFocus() on Wayland
QWindow::requestActivate() is not supported.

Task-number: QTBUG-107153
Pick-to: 6.4 6.2
Change-Id: Ie9583e55d298fe392d8ab09e9a10d8fce5ce3fee
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-07 13:20:18 +02:00
Liang Qi
a247da320c tests: fix window activation usage in tst_QGraphicsWidget
- Skip tests that depend on programmatic window activation on platforms
  where this is not supported, such as Wayland.
- Change tests that don't rely on the window being activated to use
  qWaitForWindowExposed() instead.

Task-number: QTBUG-107153
Pick-to: 6.4 6.2
Change-Id: Ieb4280343a725a2cbdc46a8ac5c657beeb2e7e57
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-07 13:20:16 +02:00
Liang Qi
19dabbbc73 tests: skip two tests in tst_QGraphicsProxyWidget on Wayland
QWindow::requestActivate() is not supported.

Task-number: QTBUG-107153
Pick-to: 6.4 6.2
Change-Id: I41c0c24c73ea5add821109172470d37a9b6211a8
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-07 13:20:15 +02:00
Liang Qi
65d9b48a70 tests: skip tst_QDialog::showAsTool() on Wayland
QWindow::requestActivate() is not supported.

Task-number: QTBUG-107153
Pick-to: 6.4 6.2
Change-Id: Id8f9cc1d6a29b4d608a080f5b40a5369d7bd8da9
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-07 13:20:13 +02:00
Liang Qi
f8898cae83 Revert "tests: XFAIL tst_QOpenGL::bufferMapRange() on Wayland"
This reverts commit e49d2daf19.

This doesn't fail on Wayland, perhaps a false alarm.

Fixes: QTBUG-100918
Pick-to: 6.4 6.2
Change-Id: I1415afdeaf1bff26dba3b3100b2aafcda00bcdd9
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-07 13:20:12 +02:00
Liang Qi
dd608329b2 tests: skip tst_QApplication::activateDeactivateEvent() on Wayland
Task-number: QTBUG-107153
Pick-to: 6.4 6.2
Change-Id: I69bd4a0d4217b5e4c2cbee8b25c5bd69509e3329
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-07 13:20:10 +02:00
Liang Qi
5ddb015038 Revert "tests: XFAIL tst_QGuiApplication::genericPluginsAndWindowSystemEvents()"
This reverts commit ae1197fc56.

This doesn't fail on Wayland, perhaps a false alarm.

Fixes: QTBUG-100891
Pick-to: 6.4 6.2
Change-Id: I3e1d2488b090f186c64d63cb6c9f97dfaafc8fff
Reviewed-by: Liang Qi <liang.qi@qt.io>
2022-10-07 13:20:08 +02:00
Ievgenii Meshcheriakov
df6ba4bc16 tst_qurluts46: Support \u escapes in the test data
These escapes were documented but not used until the version 15.0.0
of Unicode.

Task-number: QTBUG-106810
Change-Id: If48dcd80acf32989e3f47676ca3d41848a325c0e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-06 14:26:25 +02:00
Axel Spoerl
b439f06941 Remove focusProxyAndInputMethods from tst_QWidget
focusProxyAndInputMethods tests focus acquisition and inheritance with
a toplevel widget, acting as a focus proxy for a child.
X11 window managers are set to be bypassed, programmatic focus is set
with QApplicationPrivate::setActiveWindow().

The test is flaky on Linux/XCB, and therefore blacklisted on most
Linuxes.

This patch removes focusProxyAndInputMethods, considering that
- focus proxying is tested in tst_QWidget::focusProxy()
- window activation and focus inheritance are tested in
tst_QWindow::isActive()

Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I510fd935399d9ad0b6cd76f1bd5db0811e0702f6
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-10-06 10:49:16 +02:00
Vladimir Belyavsky
4945fd93f1 QTextLayout: fix maximumWidth() for a text containing spaces
When laying out a text and calculating maxWidth, we must _always_ take
into account the accumulated width of spaces (lbh.spaceData.textWidth)
regardless of wrapMode, other text content, spaces position, etc.

Fixes: QTBUG-106947
Change-Id: I2ac9af92ed7dd07c1e040bfcf83949a358d1c9c9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-06 08:43:11 +00:00
Marc Mutz
df9d882d41 Port from container.count()/length() to size()
This is semantic patch using ClangTidyTransformator:

  auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)
  makeRule(cxxMemberCallExpr(on(QtContainerClass),
                             callee(cxxMethodDecl(hasAnyName({"count", "length"),
                                                  parameterCountIs(0))))),
           changeTo(cat(access(o, cat("size"), "()"))),
           cat("use 'size()' instead of 'count()/length()'"))

a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'.

<classes> are:

    // sequential:
    "QByteArray",
    "QList",
    "QQueue",
    "QStack",
    "QString",
    "QVarLengthArray",
    "QVector",
    // associative:
    "QHash",
    "QMultiHash",
    "QMap",
    "QMultiMap",
    "QSet",
    // Qt has no QMultiSet

Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-10-04 07:40:08 +02:00
Volker Hilsheimer
109e088c7c Make sure that palette cache keys are unique
After 1d961491d8, palettes are different
if they either have different brush data, or a different private. Two
privates can share data, but still must generate different cache keys.
The cacheKey has so far been composted of the serial number of the Data
struct, and a detach number that is incremented when we detach the
private.

This failed for two reasons:

- the implicit copy constructor of the Data class copied the serial
number, when it should have incremented it. Fix that by member-
initializing the serial number rather than doing it only in the default
constructor. The member initialization is also executed for the copy
constructor.

- the detach_no logic as it was implemented does not guarantee that two
copies of the same palette that share data, but have different resolve
masks (and thus different privates) have different detach_no values.
Use a static serial counter for that number as well.

Amend the test case to verfiy that cache keys, and the elements of the
cache keys, change when they are expected to.

Fixes: QTBUG-106984
Pick-to: 6.2 6.4
Change-Id: I84d7055ce8bfe0d42f1f8e9766f3f1ad610f4ec8
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-10-03 23:39:23 +02:00
Timur Pocheptsov
ee85f65b8e tst_qsslcertificate: remove ifery which breaks the test
In the presence of QT_CONFIG(opensslv30).

Fixes: QTBUG-107027
Change-Id: I481db3cdf3bbb1aa7127cc5498f0c0217df8c35b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-30 09:35:38 +02:00
Eskil Abrahamsen Blomfeldt
1fe7144a07 Introduce QGlyphRun::stringIndexes()
This introduces a way to trace each entry in the glyph index
array to a specific index in the original text passed to
QTextLayout, as well as a convenience function to access
the original string from the QGlyphRun.

The index information is stored in the logClusters array internally
in Qt, but it contains the inverse information: For each
character in the output string, it contains an index into the
glyph array. In order to get the string indexes for each glyph,
which makes a lot more sense in the context of the QGlyphRun
API, we need to do a little search to construct the data.

To avoid adding unnecessary allocations, we make the new APIs
opt-in. If you do not specify anything, you will only get the
glyph indexes and glyph positions as before. However, you
can now specify exactly which parts of the layout to extract
using an optional flags parameter.

This also adds a manual test which can be very handy to
visualize QTextLayouts and how they are split into QGlyphRuns.

Fixes: QTBUG-103932
Change-Id: Ie4288fff338b9482aba0aba29fc7e1e59fa60900
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
2022-09-29 18:06:40 +02:00
Giuseppe D'Angelo
42b66bd809 QTaggedPointer: disable operator= with an empty initializer list
Given a QTaggedPointer, users may write

  taggedPtr = {};

to mean "reset it". This is error-prone: due to overload resolution,
this actually ends up calling QTaggedPointer<T>::operator=(T *),
which changes the pointer but *not* the tag, and not the implicitly
declared QTaggedPointer<T>:operator=(const QTaggedPointer<T> &)
which would reset both pointer and tag.

Given the idiomatic usage of {} is indeed to perform a full reset (cf.
std::exchange(obj, {}), std::take, etc.), work around this by disabling
the operator= overload for pointers in case an initializer list is
passed. In other words, make `={}` fall back to the implicitly
declared overload.

Note, this breaks some usages, such as

  taggedPtr = {rawPtr};

but at least we get a compile error for these, and they don't look
common at all.

[ChangeLog][QtCore][QTaggedPointer] The operator assignment
taking a raw pointer has been reimplemented in order to avoid
subtle issues when assigning `{}` to a QTaggedPointer. This will
cause code that assigns a braced-init-list to a QTaggedPointer object
to stop compiling (for instance, `tagPtr = {ptr}` is now ill-formed).

Change-Id: I5e572a9b0f119ddb2df17f1797934933dff2ba7b
Task-number: QTBUG-106070
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-29 16:18:55 +02:00
Edward Welbourne
18439a449f Support serializing time-zone fields in date-times more flexibly
[ChangeLog][QtCore][QDateTime] The 't' format character in a
toString() template can now be repeated to get alternatives to the
(unparseable) zone abbreviation. Thus 'tt' now gets the zone offset
without colon, [+-]hhmm; 'ttt' gets the same with colon, [+-]hh:mm,
and 'tttt' gets the zone name. Previously, each 't' was replaced by
another copy of the abbreviation.

Task-number: QTBUG-95966
Change-Id: Iccccd11f06fa732ed27c0e5d4e40a3d4b5f79f8d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-29 14:42:56 +02:00
Edward Welbourne
0bc92c01e3 Support parsing time-zone specifiers more selectively
[ChangeLog][QtCore][QDateTime] The 't' format used in fromString() can
now be repeated to restrict parsing to particular forms. Thus 'tt' now
matches the [+-]hhmm offset format (no colon), 'ttt' the [+-]hh:mm
offset format (with colon), and 'tttt' matches an actual zone
name. When used singly, 't' still matches anything the parser knows
how to interpret as a zone specifier.

[ChangeLog][QtCore][QLocale] The 't' format in toDateTime() now has
repeated forms, as for QDateTime::fromString().

Task-number: QTBUG-95966
Change-Id: I73753145cb66a56bc25a5c2dd5cb051ba982fa2c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-29 14:42:55 +02:00
Eirik Aavitsland
72a3da3d4d Style sheets: add placeholder text color property for edit widgets
The placeholder text was given its own QPalette color role in Qt 5.12,
but there has been no way to specify it from a Qt style sheet.

Fixes: QTBUG-93009
Change-Id: If58ca844c19c65b7eee14c6d5730a4ba27640c33
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-09-29 08:20:56 +02:00
Thiago Macieira
1e625033be tst_QSharedMemory: remove mention of gravlaks.troll.no
It was our old, HP-UX machine on Itanium (ran on big-endian mode). We
don't support HP-UX any more; HP will still support the 11i v3 release
until 2025, but I doubt anyone wants to run any new software there. One
hopes that HP has long since fixed the issue, but I doubt it since the
last release is from 2007. Gravlaks probably ran HP-UX 11i v3.

There are a couple other left-overs of ".troll.no" in the repository,
the majority of which are URL manipulation in tst_qurl.cpp and in
tst_qnetworkcookie.cpp, then the certificates for fluke.troll.no (valid
until 2035) and aspiriniks.troll.no (expired in 2009, but we don't need
it for validity).

Change-Id: I810d70e579eb4e2c8e45fffd1719122747d7b85a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-09-28 15:56:45 -07:00
Mårten Nordheim
7fea2d34fb Update tst_bench_qhash hash functions to use size_t
Pre-requisite for a fix for qHash. The Qt50String inherits from QString
and becomes ambiguous once it no longer goes through a catch-all
template function because qHash(QString, size_t) has a better match for
the second argument.

Pick-to: 6.2 6.4
Change-Id: I23c7afb1b3aa167d40dc4838e82b7763de015f6b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-27 23:30:30 +02:00
Arno Rehn
7a7051b58f QMetaType: Support custom unary converters with optional<To> return type
To indicate success of a conversion, the public API has previously only
supported registering member functions of the form To (From::*)(bool *).
When adding custom converters for types that cannot be modified, this is
usually not a possibility.
As an alternative, this patch adds support for std::optional in the
UnaryFunction overload of QMetaType::registerConverter. If the returned
optional has no value, the conversion is considered failed.

Task-number: QTBUG-92902
Change-Id: Ibac52d2cb9b5a2457081b4bebb0def1f03e3c55d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-09-27 20:59:21 +02:00
Eirik Aavitsland
df0b70eece StyleSheetStyle: Fix color of placeholder texts in text edits
Prior to 5.12, the placeholder text color was hardcoded to be the same
as the text color, but with an alpha of 128, i.e. semi-transparent. In
5.12, it instead got its own ColorRole in QPalette. So behavior
changed (In some cases in 5.12 and later, consistently from Qt 6):
placeholder texts no longer got a "light" (semi-transparent) version
of the css-styled color, but just the default gray/semi-transparent
black. That problem was reported as QTBUG-89815. However, the fix for
that bug did not apply the semi-transparency, but only used the same
color as the text. That caused a confusing visual expression, as
actual and placeholder text would look the same. This commit fixes
that.

The problem was made worse since there is no way to specify the
placeholder text color from css, i.e. to style it independently. A
follow up commit will aim to add that.

Fixes: QTBUG-92199
Task-number: QTBUG-93009
Pick-to: 6.4 6.2 5.15
Change-Id: I9e6698d34eba91cbf65c4da07aa5ac6d9f96a9ed
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-09-27 20:22:02 +02:00
Alexey Edelev
b89d63515b Replace the syncqt.pl script with syncqt tool
syncqt.pl adds an extra dependency on perl when building Qt. Modern C++
provides the convenient cross-platform way to access a filesystem and
to use regular expressions, so we may replace the perl script with C++
application. The syncqt executable is built at configure time and
installed as QtCore tool. It's running at configure time to deliver the
required header files for IDE to build a consistent code model and at
the build time to keep tracking changes in header files and generate
the missing aliases without reconfiguring. 'syncqt' only parses header
files from a CMake build tree, so the resulting Qt installation only
contains interfacing headers that belong to the platform that Qt is
built for. 'sync.profile' files are not used as the 'source of truth'
for sync qt procedure anymore, all the necessary information is taken
from either CMake files at configure time or from the module header
files while parsing them.

syncqt.pl is still in place since it's required as fallback solution
for a smooth transition to the new syncqt implementation for all qt
repositories.

This patchset only enables the C++ based syncqt for 'qtbase'
repository.

From the performance perspective C++ version works faster then perl
script, also the configure time is reduced significally on subsequent
reconfigurations - up x2 times faster when re-configuring repository,
but it also takes time to compile the tool itself the first time.
Numbers for qtbase:
           syncqt.pl  syncqt.cpp
 initial:  0m16,035s  0m20,413s
 reconfig: 0m6,819s   0m3,725s

The syncing procedure can be run separately for each module using
<ModuleName>_sync_headers targets. The 'sync_headers' target can be
used to sync all the modules at once.

Task-number: QTBUG-87480
Task-number: QTBUG-103196
Change-Id: I8c938bcaf88a8713b39bbfd66d9e7ef12b2c3523
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-27 13:12:11 +02:00
Eirik Aavitsland
458ec4cb54 Fix setScaledClipRect autotest for reading SVG format
Since setScaledClipRect will actually render only the necessary parts,
there may be insignificant differences in rounding/anitaliasing
compared to rendering the whole image first and then clipping.

Hence this autotest case would always fail. But that would not happen
in CI, since it tests qtbase without the qtsvg module, and then the
SVG tests are skipped. (For some reason, one ran into this in wayland
testing and made an exception for that, but obviously this failure has
nothing to do with wayland).

Work around the issue by converting the rendered images to 4 bpc
format, so the differences in the least significant bits get truncated
away.

Fixes: QTBUG-100917
Task-number: QTBUG-81044
Pick-to: 6.4
Change-Id: I1c14e98af22d0ae22a751960b69e692c7a38399b
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-09-27 13:12:11 +02:00
Ville Voutilainen
e08f05ac6e QDebug: Support standard strings and string views directly
[ChangeLog][QtCore][QDebug] QDebug now supports printing
std::strings and std::string_views (and their wide, u16, and
u32 variants) directly.

Task-number: QTBUG-96878
Change-Id: I7baf4fe688bfff50580b1cee9417af13949374cc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-27 14:12:11 +03:00
Fabian Kosmale
5222df2be7 moc: Add basic support for nested inline namespaces
This improves moc's support for nested inline namespaces, so that code
containing them will not break compilation.
For simplicity, we allow nested inline namespaces even in C++17 mode
(the actual C++ compiler will reject the code anyway, and probably with
a better error message than moc could output).
moc still has no real awareness how inline namespaces work, but that is
a preexisting issue.

Pick-to: 6.4 6.2
Fixes: QTBUG-106920
Change-Id: I7b415a99133575f101bc81d01d4670a5f752917f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-26 21:14:39 +02:00
Eskil Abrahamsen Blomfeldt
ce4c26c8d1 Revert "QTextLayout: fix maximumWidth() for a text containing line separator"
This reverts commit 013c346a8d. It was
determined to cause a regression in Qt Quick: QTBUG-106899.

In order to unblock integrations, we need to revert the change. It
can be re-committed later when the problem has been analyzed and
addressed.

Pick-to: 6.2 6.4
Fixes: QTBUG-106899
Task-number: QTBUG-89557
Task-number: QTBUG-104986
Change-Id: I04054587f68ab39fdb038b02fc69ebfa3dc7d197
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-09-23 20:08:56 +02:00
Mikolaj Boc
b1b61636b3 Introduce centralized means of checking for asyncify
The new function has an advantage of not requring EM_JS.

Change-Id: Ib9ad0e6b59cfe2e6864697a14b5cfdb39f62af2d
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-09-23 10:14:28 +02:00
Øystein Heskestad
d8387fc538 Reduce foldCasing of the needle in Boyer-Moore QString searches
Before searching, foldCase the first up to 256 characters, and use this
buffer to compare against the haystack. If the needle is larger than the
buffer, compare the rest of the needle against the rest of the haystack
for every potential match. The buffer is placed on the stack and must be
refolded for each search, but this change does not break the API.

This is faster than the old implementation, except if the needle is long
and it is found near the beginning of the haystack, or if the needle is
long and it is not found in a short haystack where few comparisons are
done and hence few case foldings were needed in the old implementation.

Benchmarking using tst_bench_qstringtokenizer tokenize_qstring_qstring
shows an improvement for the the total testcase and usually for each
individual test.

Fixes: QTBUG-100239
Change-Id: Ie61342eb5c19f32de3c1ba0a51dbb0db503bdf3a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-22 18:05:44 +02:00
Mårten Nordheim
c633f4644c tst_QHash: Fix outdated rehash test
Inserting the same key repeatedly with QMultiHash will not
test rehashing behavior because in Qt6 those entries all
end up in a linked list.

Pick-to: 6.4
Change-Id: I78c45eed0f35a13af6d6da75d7189a6933750f13
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-22 17:34:51 +02:00
Edward Welbourne
f553e4b4c3 tst_QDom: replace a final u"..."_qs (deprecated) with u"..."_s
It seems all the others have had this treatment, but one got missed or
added while the others were being fixed.

Change-Id: If47e2c6bf939b7a55f2c38b029c1df3a901e8bfc
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-09-22 17:34:51 +02:00
Mårten Nordheim
1fa0e86995 QNetworkReply: honor legacy behavior of setting Accept-Encoding
And don't decompress the data

Pick-to: 6.4
Fixes: QTBUG-106689
Change-Id: I93a96be8178e24ff0b0bb8647276828161445cf5
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-09-22 15:34:51 +00:00
Edward Welbourne
0462dba766 Skip early return from test loops during cleanup()
The QTRY_* macros and QTestEventLoop exit early if the test has
resolved; however, in the cleanup phase of a test, even if the test
has failed, these loops should continue as normal.

[ChangeLog][QtTest] During the cleanup() phase of a test, the QTRY_*
macros and QTestEventLoop now ignore the test resolution, in contrast
to when they are used from the test itself, which (since 6.3.0) exits
the loops early if the test has failed.

Pick-to: 6.4 6.3
Fixes: QTBUG-104441
Change-Id: I2673161967cbbc57815155af698a9338ab98a686
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2022-09-22 17:34:51 +02:00
Edward Welbourne
abab3c5dad Fix error in TAP test logger's regex to recognize QVERIFY() output
The regex used a greedy .+ to match an actual dot and a space,
preceding an open parenthesis, with the result that if the message
contained any parentheses that .+ swallowed everything up to the last
of them. Correct the regex so that recently-added tests' error
messages show up correctly.

Change-Id: I6e52c9b2a6e7959335fcddbb4266f65b589eba68
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2022-09-22 17:34:51 +02:00
Edward Welbourne
16f5132b21 Add test-case for TAP logging glitch
The recently added test for QTestEventLoop produced a message which
the TAP test-logger mis-parses. Since that message shall soon go away
(when I fix the bug the new test exists to verify), modify one of
cmptest's QVERIFY2() messages to trip up the same bug, so we can spot
any regressions on this in future (after the imminent fix to this TAP
issue).

Change-Id: Ibbe9931c01c75df529c9571e2bbdbd34010dd9ec
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2022-09-22 17:34:51 +02:00
Edward Welbourne
73a2320278 Fix signed/unsigned comparison warning in shader test
Trivial, noticed while looking for deprecation warnings.

Change-Id: Ie2c450d457e25b998fb686c4c22333781364073c
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-09-22 17:34:51 +02:00
Axel Spoerl
10a143ccd7 Prevent dock widget from resizing upon unplugging from main window
QDockWidgetLayoutState::itemRect() has been used to calculate a dock
widget's size when unplugging from the main window. This method is meant
to calculate the size of the rubber band, showing the dock widget's
dock area.

The rubber band is by QDockAreaLayout::sep wider (top or bottom dock)
or higher (left or right dock) than the respective dock widget. This is
to make sure the rubber band is never fully covered by the dock widget.

By wrongly using itemRect() also for the dock widget's size after
unplugging, the dock widget grows in size each time it is unplugged.

This patch passes an invalid QRect to QDockWidgetPrivate::unplug(), in
order to prevent resizing.

tst_QDockWidget::unplugAndResize() is extended to check size
consistency after unplugging (corrected for frame margins).

Fixes: QTBUG-106531
Pick-to: 6.4 6.2
Change-Id: I1cf9f695691b0e165a5cb2881781602426e5d587
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-09-21 18:41:43 +00:00
Fabian Kosmale
a8ccd9cd84 moc: Do not fail to compile meta-methods containing non-const ref types
Amends 2d0c31e7d9. We were using
MetaTypeDecay in qTryMetaTypeInterfaceForType; but that is not used by
moc when complete types are enforced. Change qt_metaTypeArray to also
use qTryMetaTypeInterfaceForType, so that the code path for "force
complete types"[0] and the normal one do not diverge.

[0] Most easily enabled by using one of the QML type registration
macros.

Fixes: QTBUG-106672
Pick-to: 6.4 6.4.0
Change-Id: I9bf14873d1d0c4127a676643f7e8eb77f6e42dc8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-09-21 18:41:43 +00:00
Sona Kurazyan
24dedaeaa1 QFuture: fix handling of cancelled continuation chain
To support cancellation of continuations attached via the parent future,
for each future returned by a continuation we store a pointer to its
parent (i.e. future the continuation is attached to). Later, before
executing a continuation, we go through chain of parents and check if
any of them is cancelled. However, if one of the parents is destroyed
while the chain is executing, the next continuations' parent pointers
will become invalid. So storing the parent pointers isn't safe.

This commit changes the logic of handling the cancelled continuation
chain in the following way:

- Instead of storing a parent pointer in the continuation future's data,
  we do the opposite: we store a pointer to continuation's future in the
  parent.
- When a future is cancelled, we mark all continuation futures in the
  chain with a flag indicating that the chain is cancelled.
- To guarantee that the pointers to continuation future's data don't
  become invalid, we clean the continuation (that stores a copy of its
  future's data and keeps it alive) only when the associated promise
  is destructed, instead of cleaning it after the continuation is run.

Fixes: QTBUG-105182
Fixes: QTBUG-106083
Pick-to: 6.2 6.3 6.4
Change-Id: I48afa98152672c0fc737112be4ca3b1b42f6ed30
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-21 01:18:31 +02:00
Edward Welbourne
89d58147ea Fix use of 0 as null pointer in tst_QDateTimeEdit
Change-Id: Ie529150801e3bbfc7c3203e49f712239cb3e82bd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-20 19:47:34 +02:00
Johannes Kauffmann
184743cc79 tst_qtnoeventloop: add missing override
Change-Id: I24ad2f4d069ce1c7a894f8466927acb6dfd266d3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-20 19:09:31 +02:00
Johannes Kauffmann
2ce2992f5e tst_qprocess: remove unused loop counter
Change-Id: I1eece5a676cfa02fff27be01f25b07ddd82c40d6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-20 19:09:31 +02:00
Tor Arne Vestbø
8e577b6d10 windowflags: Add control to toggle Qt::NoDropShadowWindowHint
Change-Id: I53b496c7b27a73cfb6052af3cd8643a971609523
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-09-20 16:34:57 +02:00
Tor Arne Vestbø
6fc751aedf windowflags: Report QWindow compound window states
Pick-to: 6.4
Change-Id: I44b923df6851d0f51ac39bcbb4a569cb2fde775d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-09-20 16:34:57 +02:00
Vladimir Belyavsky
013c346a8d QTextLayout: fix maximumWidth() for a text containing line separator
When laying out, we need to increase layout's maximum width _only_
if the previous line was not explicitly wrapped by a line or paragraph
separator, or if the current line's width is greater than the
previously accumulated layout's maximum width.

Fixes: QTBUG-89557
Fixes: QTBUG-104986
Pick-to: 6.2 6.4
Change-Id: Ib7cc4b9dda8f20166dcbd5cfd3b56424bb33d14a
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-09-20 06:52:21 +00:00
Liang Qi
571e7a41f5 tests: improve tst_gestures on GNOME
There are some issues when testing QGraphicsView on GNOME(xorg)
overlapping with the default top bar. This change only move
the view a bit.

Notes:

* There is no CentOS in CI any more.
* panelPropagation() and panelStacksBehindParent() failed in CI
and local vm on Ubuntu 20.04, but only in CI on Ubuntu 22.04.

For example, we can turn the top bar off:

In Extension Manager, install Just Perfection, and disable Panel
in Visibility in it, all tests will pass too.

Task-number: QTBUG-84258
Task-number: QTBUG-103054
Pick-to: 6.4 6.2
Change-Id: I05c262540c85af00182cd142760c4a29554b04c9
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-09-19 14:39:28 +00:00
Allan Sandfeld Jensen
0e90bdbaa4 Fix flaky FP32x4 test
The composition implementation may act unexpectedly on Inf or NaN input
values. This change avoid those values, without changing the current
implementation.

Pick-to: 6.4
Fixes: QTBUG-101236
Change-Id: I8e4ee67f53093b7f81e014b28d8a028ba2ddcc47
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-09-16 21:02:31 +02:00
Thiago Macieira
864fbd6582 tst_QFile::setPermissions/Unix: test both chmod() and fchmod()
On Unix, we have the fchmod(2) system call that changes the permissions
of an open file descriptor. This commit adds a test for that, by not
closing the QFile before setPermissions().

Pick-to: 6.4
Change-Id: If5d5ef6220874ae8858efffd171255b9f20ed501
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-16 08:37:50 -07:00
Thiago Macieira
0193b4d219 tst_QFile::setPermissions: add QScopeGuard to remove temporary file
Pick-to: 6.4
Change-Id: If5d5ef6220874ae8858efffd17125580b5943cc2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-16 08:37:50 -07:00
Thiago Macieira
4b997d1851 QFileDevice: clear cached permissions on setPermission()
In theory, if we succeed, the permissions should be what we set, but
let's not make that assumption. And if we failed, it might be because
the file disappeared or something else, so re-stat()ing the file is a
good idea.

Pick-to: 6.4
Fixes: QTBUG-7211
Change-Id: If5d5ef6220874ae8858efffd171255506b7bbee0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-16 08:37:49 -07:00
Mårten Nordheim
68f641095c QNetworkReplyFileImpl: Don't emit 'finished' in the ctor
Pick-to: 5.15 6.2 6.4
Fixes: QTBUG-105618
Change-Id: I3bd36fbd5818d54088098e750643c3e2de30496e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-09-16 17:02:06 +02:00
Konrad Kujawa
ec2af0a9df Remove preprocessor conditionals for chrono include
__has_include(<chrono>) is always true, because C++11 chrono include
is required since 6.0.

Pick-to: 6.4 6.3 6.2
Change-Id: I50cb92571bf4f1f86e2f3f2b5f486dd3c3f30f4a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-16 08:09:05 +02:00
Mårten Nordheim
7447d73327 tst_QLocale: use fenv everywhere
And remove the platform-specific code.
fenv is available since c++11.

Change-Id: Ia5540be93b54117d4b5e9c7579100039c151dcc5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-15 23:41:51 +02:00
Joerg Bornemann
c9c04291f5 CMake: Add Linux support to qt_deploy_runtime_dependencies
Before this change, qt_deploy_runtime_dependencies supported Windows and
macOS only.  We add a generic deployment method implemented in
cmake-language with file(GET_RUNTIME_DEPENDENCIES).  This deployment
method is now enabled for shared builds on Linux.

The file(GRD) command requires that the EXECUTABLE argument points to
the executable in the build directory.

Only libraries in Qt's installation directory are considered for
deployment.  This includes Qt's own libraries and also things like
libicu*.so we're shipping with the installer.

Unlike macdeployqt and windeployqt, the generic
qt_deploy_runtime_dependencies does not yet support deploying
translations.  We will catch up on this in a later commit.

Change-Id: Iea23abcdba774d4c1885c8d2c243eb3e48fb7fae
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-15 12:55:23 +02:00
Liang Qi
6329fed0a8 tests: blacklist tst_QSocks5SocketEngine::passwordAuth() on all Ubuntu
Task-number: QTBUG-106020
Pick-to: 6.4 6.3 6.2
Change-Id: I98de5b890d23ff6721e3e5f2644a3cf73a532e6c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-15 12:55:23 +02:00
Allan Sandfeld Jensen
dc2927be4d Disable bad tests relying on wrong behavior
These tested results are all wrong and caused by internal overflows.

Note the behavior can not be fixed either as it involves moving an
already maximized QRect, which can not be done without overflow.

Change-Id: If35db68102889012c56eb149fe49bc48954d3422
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2022-09-15 12:07:02 +02:00
Mårten Nordheim
b31d902913 Http: Don't clear (de)compressed data on error
Some errors, such as 404, may still present useful data. As opposed to
errors such as 'RemoteDisconnected'. So, just keep the data around until
the reply is deleted.

Pick-to: 6.4
Fixes: QTBUG-106573
Change-Id: I6c86b5a55a45f837ea9b42559d88cd3e0ac2fa5c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-09-14 19:53:49 +02:00
Tor Arne Vestbø
2e58e242b4 Don't rely on synthetic mouse events in updateFocusChainWhenChildDie test
Synthetic mouse events are not reliable, as the platform might restrict
synthetic mouse moves. In addition, the WM might automatically activate
the window when the other window is hidden, which makes the EXPECT_FAIL
flakey.

Since the test was not written to test window activation, let's just
explicitly activate the window.

Fixes: QTBUG-23699
Pick-to: 6.4
Change-Id: I0ac1d3bc0658dfbd600a1f5d960839860be6dd2c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-09-14 19:07:14 +02:00
Edward Welbourne
6d10ecc699 Tidy up tst_QTimeZone
Its debug member can be set where it's declared, making the
constructor redundant.

Change-Id: Ic1195108766a6a86c3392a5bcf7f197ea31e8068
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-14 17:46:39 +02:00
Yuhang Zhao
40523b68c1 QWinRegistryKey: refactor
Refactor QWinRegistryKey to make it more modern and more
usable from outside.

Adjust the test for QWinRegistryKey to test the new functions,
merged with the original test.

Will port raw registry accessing code in QtBase to use this
class in follow-up commits. This change is the first step.

The long term goal is to port QSettings registry code to
this class instead of using raw Win32 APIs, however, there's
much more registry code in QSettings and migrate them to this
class needs a large refactor, so jsut leave it for now. Will
fix it in some future commit.

Change-Id: Iada2adb41b4d58e1b658ff6870a4b31ace479d43
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-14 09:31:41 +08:00
Tor Arne Vestbø
63754bd7ae Blacklist tst_QGraphicsWidget::updateFocusChainWhenChildDie() on macOS 13 in CI
For some reason when running this test on macOS 13 in the CI the window
is activated, as on other platforms, but this is not reproducible
locally, so we can't just remove the QEXPECT_FAIL.

Task-number: QTBUG-104210
Task-number: QTBUG-23699
Change-Id: Ib1cacb36d90d2be357756c82af2427f2b3ab9999
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-09-13 18:19:38 +02:00
Mikolaj Boc
701852e17b Add window-modal show option to dialogs manual test
This provides an easy way to test window modality using a ready
available test.

Change-Id: Ia23736c61fd56dda8f72ae19f5f102163951271b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-09-13 18:13:00 +02:00
Mårten Nordheim
9e12ea37ea tst_QNetworkreply: fix a path to test-data
For some reason it fails on Ubuntu 22.04, but it's anyway
not following the trend the rest of the file uses, so just
assume it's the code at fault and fix it.

Thanks to Liang Qi for debugging this!

Pick-to: 6.4
Fixes: QTBUG-106016
Change-Id: I9d0563a081827eaa037d61643f0ea46301e11493
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2022-09-13 16:00:44 +00:00
Edward Welbourne
411b17150e Make time parsing accept zz as equivalent to z
Expand a test to cover millsecond format variants more thoroughly,
including a test for the new usage of zz. This applies to parsing the
complement to commit 0a36a7c1db173089c25ea09029505a589a1c59e5's change
to serialization. Fixed minor glitch in the serialization's doc, too.

[ChangeLog][QtCore][QDateTime] When parsing a datetime, the 'zz'
format specifier is now equivalent to 'z', as for serialization.

Change-Id: I1c5700064738d9c92d5e8ce10bff8050131e190f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-13 17:10:04 +02:00
Edward Welbourne
5832087859 Include global data tags in teamcity's test function names
Use the standard mechanism instead of a hand-rolled way of identifying
function/data-tag combinations. Adds missing data relevant to
identifying test cases, some of which previously had apparently the
same name, with no hint at why the test-case was seemingly run
repeatedly.

Change-Id: I6225c6d1990069c94a1f1c8dbb179993b96076e7
Reviewed-by: Jason McDonald <macadder1@gmail.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-09-13 14:51:00 +02:00
Linus Jahn
cd37a773ca QCryptographicHash: Add getter for algorithm()
This can be helpful when you calculate multiple hashes, store them in a
vector and you want to know which result belongs to which algorithm.

[ChangeLog][QtCore][QCryptographicHash] Added getter algorithm().

Change-Id: Ifcf78536f215619a6e2e3035a95598327d0ed733
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-09-12 20:47:24 +02:00
Linus Jahn
358248b495 Make QCryptographicHash move constructible
This adds a move constructor, a move assignment operator and a swap
function to QCryptographicHash. This can (to name one example) be useful
when you want to store multiple hashes in a vector.

[ChangeLog][QtCore][QCryptographicHash] Added move constructor, move
assignment operator and swap() function.

Change-Id: Id54594fa69104ec25ad78581f962a021e85531c2
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-09-12 18:47:23 +00:00
Mikolaj Boc
91d7dcea11 Fix QWasmWindowStack::topWindow when the stack is empty
The method should by contract return nullptr when the stack is empty,
but it crashes in this case.

Also, unit-test the case.

Pick-to: 6.4
Change-Id: If64b71e761efd9a5cd5af407cd68cba7f8dbc8e2
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-09-12 20:09:03 +02:00
Mårten Nordheim
5387b88aa9 QNetworkReply: Fix missing final emission of readyRead
If we receive compressed data we will decompress it as it comes in,
in some cases the final byte we receive doesn't actually contribute
to the final output. If this byte is handled by itself then, when
combined with QNetworkReply's signal compression, we ended up not
emitting the readyRead signal for any of the data we received while
compressing the signals.

So, instead of relying on checking difference in bytes downloaded
for each batch of data received we keep track of how much data
we had received the last time we emitted readyRead.

Pick-to: 6.3 6.4 6.4.0
Fixes: QTBUG-106354
Change-Id: I4777be29b46bf0de968667e9de9d975c735ac6e6
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-09-12 13:06:50 +02:00
Mårten Nordheim
c288733541 Make tst_qnetworkreply depend on the 'echo' helper
Because it's convenient to have it build automatically.

Pick-to: 6.2 6.3 6.4
Change-Id: Iecd5bd1f9fe518f683b8ee9eb6529e48ce76fb33
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-09-12 01:20:19 +02:00
Mikolaj Boc
1d401e34ac Compile guard tests in corelib/kernel that need threading support
Some tests in corelib/kernel need threading support, but they are not
guarded against compilation if Qt is built without threading.
Such tests have been disabled in this case.

Change-Id: I2f5dc9582f2a59b6af2a9e56638b045dca06193d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-09-11 19:36:49 +02:00
Timur Pocheptsov
17e8f322eb tst_QSslSocket::serverCipherPreferencies - fix for OpenSSL v3
Test was not really good to start with - it was assuming the presence of
particular ciphersuites. Furthermore, it was ignoring the fact that
TLS 1.2 and TLS 1.3 set ciphersuites differently in OpenSSL.

Pick-to: 6.4 6.3 6.2 5.15
Task-number: QTBUG-106018
Task-number: QTBUG-95123
Change-Id: I6c8ba20154cdeb9275878462ab945729d6c82ecc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-08 17:07:49 +02:00
Edward Welbourne
6a14ad4993 Perform uiLanguages() likely-adjusted processing purely on IDs
The collection of translations available to us need not have anything
to do with whether CLDR has matching data, so preserve the system UI
language list's entries as they are, rather than forcing them through
the QLocale constructor's exercise of likely sub-tag rules.

Instead, simply parse the given locale tags to QLocaleId instances and
use these in the likely-subtag processing to determine what other
entries to add to the list in addition to those supplied by the
operating system. Since going via QLocale did usually supply a
territory, that was included in the BCP 47 name, it's now possible for
the given entry to lack the language_territory name, so be sure to add
that if missing.

This incidentally reduces heap traffic and saves a fair deal of hidden
likely-subtag processing in calls to the constructor and bcp47Name().

Expand testing of QLocale::uiLanguages(), both plain and system.  In
the process, cross-link the two closely-related tests, move a comment
on one's _data() to the other's, where it really belongs, and add
reporting of the actual lists on failure. Enable MySystemLocale to
remember the requested locale's ID, before likely sub-tag processing,
so that we can make query() report results for language, script and
territory as requested, to ensure the fake system locale really does
match what was requested. The new german-britain test failed without
it, because there is no de-GB locale in CLDR.

Task-number: QTBUG-99531
Change-Id: Ide041577772c442a4413e3b9a590e11140c48f49
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-07 15:29:39 +02:00
Edward Welbourne
ebe9aca900 Simplify system locale management
Have QSystemLocale manage a stack, so that tests can install an
over-ride for the actual system-specific one reliably and restore the
system-specific one when finished. Leave the QSystemLocaleSingleton
out of the stack, all the same. In the process, mark the QDoc comments
for QSystemLocale all as \internal, since this is not public API.

Change-Id: I8faed49780215e42f32be10cf936c32bb46105bf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-09-07 15:29:39 +02:00
Edward Welbourne
753bfdf6a1 Work round macOS's omission of en_DE from its own uiLanguages()
When the system locale is en_DE, macOS seems to think we should use
en_GB as the right translation. While that probably is a sensible
choice in the absence of an en_DE translation, we should definitely
use the en_DE translation if available, especially if en_GB isn't
available (which lead to a fall-back to de_DE, given later entries in
macOS's list). So prepend the system locale's own pcp47Name() if it
(isn't the C locale and) is missing from what we would otherwise have
used for uiLanguages(), after likely sub-tag perturbations.

Add a test simulating (some approximation to) what macOS was doing
that would have caught this case; and add a scope-guard reporter to
the test to report what shows up when lists don't match.

Fixes: QTBUG-104930
Pick-to: 6.4 6.4.0 6.3 6.2 5.15
Change-Id: I116234708067e1717d9157aebc84da76e04a9f38
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-09-07 13:29:39 +00:00
Mårten Nordheim
070446d5eb tst_qlocale: only restore the fp control masks we change
Certain masks are not supported outside 32-bit x86, and will assert on
x64.

Pick-to: 6.2 6.3 6.4
Fixes: QTBUG-106000
Change-Id: Ic9f58e5a19c1db3309edeb5ec529e7a78c929665
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-09-07 13:15:27 +00:00
Alexey Edelev
33a12988e2 Guard windows-specific includes with Q_OS_WIN
Change-Id: I0a7c605c55c815c7220024f302f511e302005ab9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-07 14:39:25 +02:00
Mårten Nordheim
c76f7cbbcb QTextStream: Fix logical error in setEncoding
We only want to enable writing BOM if we have _not_ started
writing.

Fixes: QTBUG-106279
Pick-to: 6.2 6.3.2 6.4 6.4.0
Change-Id: Ibcbc101b931615fddb2507f01307bf9619772d7b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-07 01:09:31 +02:00
Ivan Solovev
3dff397284 tst_qmatrixnxn: port away from deprecated APIs
Replace the deprecated operator*() calls with various
overloads of QMatrix4x4::map()

Add a separate test for deprecated API and guard it with
QT_DEPRECATED_SINCE checks.

Task-number: QTBUG-104858
Change-Id: Ief2e03198696382dc626f01b209614fe320e70b2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-09-06 13:59:57 +02:00
Mate Barany
aa99bf532d qdbusxml2cpp: modify the behavior of -m/--moc option
qdbusxml2cpp has a -m/--moc option. Change and modify the behavior
such that
-p foo -m includes moc_foo.cpp in the generated .cpp
-p :foo.cpp includes moc_foo.cpp in the generated .cpp
-p foo.h:foo.cpp includes moc_foo.cpp in the generated .cpp

Change the Qt6DbusMacros.cmake file accordingly.

[ChangeLog][qdbusxml2cpp] The -m/--moc option now generates
idiomatic moc file names (moc_base.cpp for headers, base.moc
for implementation files)(was: always base.moc). Build systems
using workarounds for the non-idiomatic naming of moc files
used by qdbusxml2cpp in the past can now drop these workarounds
for Qt versions >= 6.5.

Fixes: QTBUG-103313
Change-Id: I754b1b276f130cb8645166470e1b457a676590f7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-09-06 11:44:22 +02:00
Mårten Nordheim
b4a5f0c57c tst_QSsSocket: fix verifyClientCertificate with OpenSSL 3
OpenSSL 3 by default disables TLS < 1.2 in the conf files. We're not
going to work against that, so we bump the version of TLS used.
Keep the client-side TLS 1.0 Or Later just to keep testing that this
part works.

Task-number: QTBUG-95123
Task-number: QTBUG-106018
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: Ia6cb10495875de232d69a886832ae74c5f5ac15f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-09-05 18:29:12 +02:00
Tang Haixiang
8aae49019d QTextDocumentLayout: Account for topMargin when hit-testing
When TopMargin is set in TextBlock and the mouse click position is
between Margin (the mouse is not on the textrect), the cursor will
usually jump to the end. So topMargin should be considered when
hitTest() calculates coordinates.

Fixes: QTBUG-91774
Pick-to: 6.4 6.3 6.2
Change-Id: I231377263855b9cd7152684203fc4ed2e9299bb9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tang Haixiang <tanghaixiang@uniontech.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-09-05 16:29:11 +00:00
Eskil Abrahamsen Blomfeldt
20d23f7003 Fix tst_QWindow::requestUpdate on Wayland
On Wayland there is a special case when decorations are enabled,
where we post an initial update request to ensure widgets are
redrawn after the buffer is recreated (see
af7b60ade5c4be81cbc58eb18307c017d5594071 in qtwayland). To
make sure the test behaves the same on Wayland as on other
platforms, we disable client-side decorations when running
these tests.

The flag is primarily required for the requestUpdate() test
at the moment, but it is only queried once per application
run, so it has to be set before any tests are run.

Pick-to: 6.4
Fixes: QTBUG-100889
Change-Id: Ica6d744083ecae4a3722b6d04b956e7615f0dfe5
Reviewed-by: Inho Lee <inho.lee@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2022-09-05 18:29:11 +02:00
Volker Hilsheimer
bf3500a631 Fix cmake warnings from using deprecated PUBLIC_LIBRARIES
Pick-to: 6.4
Change-Id: I8d4f0d9e98edc4e06dda9f58e62197572b4cbdbc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-05 18:29:10 +02:00
Volker Hilsheimer
3b91bab465 Fix compiler warning: don't copy in ranged-for loop
Change-Id: If21f4e34324f33300009a427fb81e23ab49d4ad0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-03 19:10:42 +02:00
Timur Pocheptsov
a7657d3c5f tst_QSslSocket::oldErrorsOnSocketReuse - make it work with OpenSSL v3
The initial problem was in server not starting encryption, because
its certificate was rejected by OpenSSL (v3) saying 'weak md'.
After the certificate was replaced, we got another problem - due
to the fixed TLS v.1 protocol for both client and server - handshake
is interrupted early with 'tls v1 alert' and error message
saying about not found signature algorithms. Don't fix the protocol
version, use proper QSsl::SecureProtocols (default).

Pick-to: 6.4 6.3 6.2 5.15
Task-number: QTBUG-106018
Task-number: QTBUG-95123
Change-Id: I0f22f5304f4405933ad511195bc61c640518e7d8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-03 13:01:06 +02:00
Mårten Nordheim
28693abb64 tst_QSslSocket: regenerate certificate used for setLocalCertificateChain
The certificate was using SHA-1 for signing its certificate, which is
considered 'not good enough' by some TLS libraries.
Regenerate it with SHA-512 and a larger RSA key.

Also include the files needed to generate it.

Pick-to: 6.4 6.3 6.2 5.15
Task-number: QTBUG-106018
Task-number: QTBUG-95123
Change-Id: I535e047d540e663c8cec334695196044173949fc
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-09-02 22:39:22 +02:00
Mikolaj Boc
8e307a6cf9 Don't batch qmetaobject_compat
Batching the tests leads to one of the tests tst_qmetaobject and
tst_qmetaobject_compat not being registered in the batch. Attempts to
batch those together fail as batch test name is defined per-source,
which, in this rare case, is the same across the two targets.

Change-Id: I356931feabc004c39ba0b6863b5f64e06d739a58
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-02 19:22:32 +00:00
Timur Pocheptsov
d2544b3bb2 tst_QSslSocket::protocolServerSide - make it work with OpenSSL v3
OpenSSL v3 by default sets SECLEVEL = 2 unless overridden in conf files.
SECLEVEL >= 1 means TLS <= 1.1 is disabled. Remove cases that were
previously expected to work. Arguably, we should not test deprecated
protocols at all, but the cases expecting a failure still work
and logically correct.

Task-number: QTBUG-95123
Task-number: QTBUG-106018
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: Ifa59fa902b433338dbed7abf086cfdef9470384c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-02 21:02:27 +02:00
Shawn Rutledge
ef9b51ce99 Use testlib for multiPointRawEventTranslationOnTouchScreen events
It was an old test written in a very low-level way, which perhaps is ok
to be independent of testlib in a few tests; OTOH, it was blacklisted
on a couple of platforms. Perhaps doing touch events the standard way
could be more stable.

While we're at it:
- verify that the touch events are accepted, and thus verify the new
  bool return value from commit()
- implement paintEvent() to help understand the layout, and touchpoint
  locations
- remove repeated QCOMPARE lines
- skip the test if window positioning fails
- try to un-blacklist it, on the assumption that window positioning
  failure was the reason

Task-number: QTBUG-87025
Task-number: QTBUG-104656
Pick-to: 6.4
Change-Id: Ie22eb24abf95cd849990a56212be87d06ce8e574
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
2022-09-02 19:07:21 +02:00
Thiago Macieira
0380dd5051 QMetaObject: pass the QMetaTypes in variadic invoke/newInstance
[ChangeLog][QtCore][Meta Object] QMetaMethod::invoke(),
QMetaObject::invokeMethod(), and QMetaObject::newInstance() are no
longer limited to 10 arguments.

[ChangeLog][QtCore][Meta Object] The use of the Q_ARG macro is no longer
necessary when using QMetaMethod::invoke(), QMetaObject::invokeMethod(),
and QMetaObject::newInstance(). Types may now be passed
directly. Similarly, Q_RETURN_ARG can be replaced by the free function
qReturnArg().

[ChangeLog][Potentially Source-Incompatible Changes]
QMetaMethod::invoke(), QMetaObject::invokeMethod(), and
QMetaObject::newInstance() no longer support passing forward-declared
types in the argument list (it was possible to pass them by
const-ref). From Qt 6.5 onwards, all types in the argument list must be
fully defined.

[ChangeLog][Potentially Source-Incompatible Changes] Attempting to use
the internal types QArgument, QReturnArgument, QGenericArgument, or
QGenericReturnArgument directly with QMetaMethod::invoke(),
QMetaObject::invokeMethod() or QMetaObject::newInstance() may fail to
compile. Those are internal types that were never meant to be used
directly and will be removed in Qt 7. If really necessary, ensure all
arguments passed to those functions are directly using those classes and
not mixed with Q_ARG and Q_RETURN_ARG. Implementations of bindings to
other languages should contact the Qt development mailing list to
discuss options.

Change-Id: I36b24183fbd041179f2ffffd1701e3e8e47e0fba
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-01 21:29:04 -03:00
Eirik Aavitsland
54aa7e75b8 QVariant: fix conversions of Q_ENUM that are QFlags<> to string
The doc of QMetaEnum::valueToKey() says to use ::valueToKeys() instead
for flag types.

Pick-to: 6.4
Change-Id: I48e5ba47324137f2ce2710f1d876e93e7c562e9f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-09-01 20:48:49 +02:00
Timur Pocheptsov
8e21844683 tst_QSslKey - make OpenSSL v3 detection fully runtime
Otherwise, checks are useles in non-developer build.

Pick-to: 6.4 6.3 6.2
Fixes: QTBUG-106036
Change-Id: I41b6d8f250021ff9fa4981f9df9244c269ed2999
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-01 20:10:03 +02:00
Laszlo Agocs
c681c7c23f rhi: metal: Add support for tessellation
Change-Id: Ie8d226a6a959aa5e78284ea72505fd26aec1e671
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-09-01 19:44:19 +02:00
Marc Mutz
812a0d3125 QAnyStringView: construct from any T implicitly convertible to QString/QByteArray
This includes QDBusReply, QProperty, and QStringBuilder expressions.

The new constructor subsumes the QStringBuilder case without requiring
jumping though hoops to delay the definition of the ctor the way we
had to for the explicit QStringBuilder constructor, so remove the
explicit QStringBuilder one again.

[ChangeLog][QtCore][QAnyStringView] Can now be constructed from
anything that implicitly converts to either QString or QByteArray.

Fixes: QTBUG-105389
Change-Id: I0e584dd3e20d591381609a3329ef47cec7356ecc
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-09-01 15:51:48 +02:00
Sona Kurazyan
50b05e3e2a Move qVersion() from qglobal.h to qlibraryinfo.h
Since qVersion() might be called also from C code, disable the parts of
qlibraryinfo.h that are relevant only for C++ code if __cplusplus is not
defined.

[ChangeLog][Potentially Source-Incompatible Changes] qVersion() is
moved from qglobal.h to qlibraryinfo.h, '#include <QtCore/QLibraryInfo>'
needs to be added where it's used.

Task-number: QTBUG-99313
Change-Id: I3363ef3fa4073114e5151cb3a2a1e8282ad42a4d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-09-01 13:26:30 +02:00
Sona Kurazyan
b077c419ea Move QMacAutoReleasePool from qglobal.h to qcore_mac_p.h
And include qcore_mac_p.h where needed.

Task-number: QTBUG-99313
Change-Id: Idb1b005f1b5938e8cf329ae06ffaf0d249874db2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-09-01 13:26:30 +02:00
Thiago Macieira
f123212880 RCC: fix zlib compression when --no-zstd was specified
Since we had code to default to zstd as the default algorithm instead of
"Best", we ended up not compressing anything.

[ChangeLog][rcc] Fixed a bug that caused rcc not to compress files with
any compression algorithm if the --no-zstd option was present.

Pick-to: 6.2 6.3 6.4
Fixes: QTBUG-106012
Change-Id: Ic6547f8247454b47baa8fffd170fddae429f82d2
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2022-08-31 16:55:00 -03:00
Timur Pocheptsov
0f2397f03d QSslCertificate::toText(): add a file to compare against
With OpenSSL 3.0.5 we see X509_print giving us the text representation
not matching any of previous ones - mostly a question of spaces
and formatting. Let's add a proper version to compare against and
remove useless 0.9.8, 1.0.0, 1.0.1, - we don't support them anymore
and thus QSslCertificate::toText() will never give a match.

Pick-to: 6.4 6.3 6.2 5.15
Task-number: QTBUG-106017
Change-Id: Ida11321c23e74c7313acc682237ab78408cf2803
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-31 21:55:00 +02:00
Timur Pocheptsov
0206eb137f tst_QSslCertificate::pkcs12 - skip the test if OpenSSL version >= 3
leaf.p12 is using RC2 for encryption and it's disabled by default
in openssl v3.

Pick-to: 6.4 6.3 6.2 5.15
Fixes: QTBUG-106017
Change-Id: I4edd0d29506d1e50b2b618b6a00cceeb4b156204
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-31 21:55:00 +02:00
Alexandru Croitor
cd4a3a1dc7 CMake: Fix tst_qlibrary to work on macOS with debug builds
The test expects the helper libraries to contain the .dylib suffix
rather than .so.

Replace glob copying of the libraries (which depends on the underlying
shell) with manual copy calls.
This also ensures the libraries don't contain a _debug postfix in the
file name even in a debug build, which would break the tests.

Amends f8c1909320
Amends 1dff26dd95

Change-Id: I20361c33c4a1b9dd4b5273fcdb8cc79c9f266327
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-31 14:12:00 +02:00
Timur Pocheptsov
267d923ed9 tst_QDtls::verifyClientCertficiate - update certs for OpenSSL v3
Because this version does not seem to like MD5 which old cert was using.

Fixes: QTBUG-106019
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: Id354d1e32acb0528685b2788ee9c7326c43397bd
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-31 13:29:11 +02:00
Thiago Macieira
fe92b08065 QMetaObject: add a new, variadic invoke/invokeMethod/newInstance
[ChangeLog][QtCore][Meta Objects] The QMetaObject::invokeMethod() taking
a method name by string, QMetaObject::newInstance(), and
QMetaMethod::invoke() now support more than 10 arguments.

[ChangeLog][QtCore][Meta Objects] The use of the Q_ARG and Q_RETURN_ARG
macros is now optional with QMetaObject::invokeMethod(),
QMetaObject::newInstance(), and QMetaMethod::invoke(): the type name
will be obtained from the C++ type (the same as QMetaType). The function
qReturnArg() can be used in place of the Q_RETURN_ARG macro. The macros
are still useful in rare conditions where the type was typedef'ed from
its original name.

Change-Id: I36b24183fbd041179f2ffffd17022a2b48c7639b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-08-30 22:29:07 -03:00
Heikki Halmet
191419e980 Blacklist: tst_QGraphicsAnchorLayout::layoutDirection for Ubuntu 22.04
Task-number: QTBUG-87728
Pick-to: 6.4 6.3 6.2
Change-Id: Ic78a17146c265ffe6baf6f08a0f9c29750bd0d58
Reviewed-by: Liang Qi <liang.qi@qt.io>
2022-08-31 00:39:25 +03:00
Michael Weghorn
8b947bae72 a11y: Don't reassign unique ID to other object right away
For the case that a newly created and registered accessible
interface gets removed again from the cache before another one
gets registered, the next registered interface was
previously assigned the same "unique ID" again, which e.g. breaks
assistive technology when using caching
with AT-SPI, since that relies on the assumption
that the ID is actually unique for each object.
(But here, the new object was using the same object path
as the old one, so data from the old object would be
used for the new one.)

To prevent that from happening, increment the
counter for the next ID to try at the end of
QAccessibleCache::acquireId, so the next time
the method gets called, it doesn't try again
whether the same ID as used previously is
available again.

For consistency, also rename the variable used
for the counter from lastUsedId to nextId.

This also adds a corresponding test case.

Fixes: QTBUG-105962
Pick-to: 6.4
Change-Id: Iddf4f3b35c57895bcfbb623a5377edf8344ab6c2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-08-30 22:53:09 +02:00
Ivan Solovev
56ec6a392a tst_qguiapplication: guard the usage of deprecated signals
The paletteChanged() and fontChanged() signals were deprecated
in Qt 6.0, but the test was still using them unconditionally.

This patch guards the usage of the deprecated signals with
the usual QT_DEPRECATED_SINCE(6, 0) check, so that the test
can be built and run with QT_DISABLE_DEPRECATED_UP_TO >= 0x060000

This commit amends 68ea9c0227

Task-number: QTBUG-104858
Change-Id: Idb2da6d91afcdb664f325f23ec625947c9a7fac0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-08-30 22:46:35 +02:00
Ivan Solovev
2e69ef6af9 Rest of QtBase tests: port away from deprecated methods
Small changes to fix builds with
QT_DISABLE_DEPRECATED_UP_TO >= 0x060500

Task-number: QTBUG-104858
Change-Id: Ia531a3cee97f13827e36b3d63f28eed879fe9a40
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-30 22:46:35 +02:00
Ivan Solovev
95542b386a tst_qobject: port away from deprecated methods
The patch includes the following replacements:
* QMetaType::type("name") -> QMetaType::fromType<Type>().id()
* QMetaProperty::type() -> QMetaProperty::typeId()
* QVariant::Type -> QMetaType::Type
* qRegisterMetaType<T>("name") -> qResigeterMetaType<T>()
* The static QMetaType::{load,save} methods are replaced with
  non-static versions
* Replace QCOMPARE(property.type(), QVariant::UserType) with
  QCOMPARE_GT(property.typeId(), QMetaType::User), because the
  deprecated type() method was treating each custom type
  (id >= QVariant::UserType) as QVariant::UserType, while the
  typeId() method simply returns the actual id.

As a drive-by: remove unneeded QMetaType registration tests
as we have tst_QMetaType to check it.

Task-number: QTBUG-104858
Change-Id: Ia08e002efdf07ff83366a5193164dba96a956f9a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-30 22:46:35 +02:00
Ivan Solovev
ad12d779cc tst_qvariant: port away from deprecated methods
The most common changes are:
* guard the tests for deprecated APIs with QT_DEPRECATED_SINCE
* QVariant(QVariant::Type) ctor -> QVariant(QMetaType) ctor
* QVariant::type() -> QVariant::typeId()
* QVariant::canConvert(int) -> QVariant::canConvert(QMetaType)
* QVariant::convert(int) -> QVariant::convert(QMetaType)
* QVariant::Type -> QMetaType::Type

Task-number: QTBUG-104858
Change-Id: I00584acb24d29b461faa1115f8f8d36a0b443883
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-30 22:46:34 +02:00
Ivan Solovev
91eec59b87 tst_qmetatype: port away from deprecated calls
The most common changes are:
* Replace QMetaType::type("name") with QMetaType::fromName("name").id()
  or QMetaType::fromType<Type>().id()
* QMetaType::typeName(int) -> QMetaType(int).name()
* QMetaType::typeFlags(int) -> QMetaType(int).flags()
* QMetaType::metaObjectForType(int) -> QMetaType(int).metaObject()
* The static QMetaType::{load,save} methods are replaced with
  non-static versions
* The static QMetaType::{create,destroy,construct, destruct} methods
  are guarded by QT_DEPRECATED_SINCE calls. The tests are also
  extended with non-static calls where they were missing. Fixed
  potential memory-leaks in these tests.

Add separate unit-tests for deprecated APIs and guard them with
QT_DEPRECATED_SINCE

As a drive-by: use nullptr instead of 0 in some places

Task-number: QTBUG-104858
Change-Id: I4b0cdd29bc197c186b835002372240aae3098c33
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-30 22:46:34 +02:00
Mikolaj Boc
337a853cb5 Adapt tests/auto/wasm for batching
Use consistent defines across both tests in the directory

Change-Id: Idd84603135c8c164d09ae41d5faa7ca3a5fc7c3c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-08-30 22:27:07 +02:00
Thiago Macieira
db64694b4c tst_qlibrary.cpp: remove extraneous _data function
The test function itself is MIA.

Change-Id: Ie4bb662dcb274440ab8bfffd170a06fde5c1cd51
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-08-30 15:56:46 -03:00
Thiago Macieira
98e21f0979 QVariant: fix conversions of string keys to Q_ENUM that are QFlags<>
Since Qt 6.0, QMetaType stores the name obtained from the C++ compiler,
which means we know a type like Qt::Alignment by its proper, full name
of QFlags<Qt::AlignmentFlag>. However, the meta object records only the
bare name of the enumeration, not the full flags.

Pick-to: 6.2 6.3 6.4
Fixes: QTBUG-105932
Fixes: QTBUG-96185
Change-Id: Ic6547f8247454b47baa8fffd170eab977e306377
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-30 18:56:46 +00:00
Timur Pocheptsov
9540a4eb90 QHttp2Configuration: in QNAM, use old, higher values in flow control
Initially, stream receive window's size was quite significant.
At some point when dealing with a server that did not want
our windows' sizes and was closing the connection (they only
accept 64K) we reduced this size, which ended in a regression
with download speed significantly throttled. We return the old
values (or even more, presuming we have 10 multiplexed streams
and not 100). And also making QNAM consistent with its documentation
(it was not updated).

[ChangeLog][QtNetwork] Stream receive window that HTTP/2 protocol in QNAM is using
increased to 214748364 octets (from the previous 64K) not to throttle download
speed. Clients, working with servers, not accepting such parameters,
must set HTTP/2 configuration on their requests accordingly.

Fixes: QTBUG-105043
Pick-to: 6.4 6.3 6.2
Change-Id: I252b6b5eefe92a7304dad15c67928d5a57d9597f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-30 20:20:38 +02:00
Tor Arne Vestbø
1bc7e9e77b Add QComHelper class for dealing with COM on Windows
Unifies our approach to calling CoInitializeEx and CoUninitialize,
removing a lot of boilerplate in the process, and also fixes a few
bugs where we would incorrectly balance our calls to CoInitializeEx
and CoUninitialize.

The optimistic approach of qfilesystemengine_win.cpp of calling
CoCreateInstance without initializing the COM library explicitly
has been removed, as calling CoInitializeEx should be a noop in
the situation where it's already been loaded.

Change-Id: I9e2ec101678c2ebb9946504b5e8034e58f1bb56a
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2022-08-29 15:39:34 +02:00
Thiago Macieira
f039147165 tst_QMap: avoid tripping MSVC debug-mode iterator assertions
It does a check to ensure you aren't comparing outside the container.

Fixes: QTBUG-106001
Pick-to: 6.2 6.3 6.4
Change-Id: Ic6547f8247454b47baa8fffd170eef346b7f4f24
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-08-28 11:04:14 -03:00
Tor Arne Vestbø
2436e259ce Deprecate QApplication::setActiveWindow() and mark as internal
The function is used the internal window activation machinery and
should not be called by user code.

Many tests still use this function, and should be ported over to
QWidget::activateWindow(). For now they are using the private
helper in QApplicationPrivate, so that we can progress with the
public API deprecation.

Change-Id: I29f1575acf9efdcbae4c005ee9b2eb1bb0c8e5b5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-27 20:22:29 +02:00
Michael Weghorn
0c0eadc484 a11y: Prevent one case of losing a11y interface when setting event child
9a369a25dd added a
QAccessibleEvent ctor that takes a QAccessibleInterface*
instead of a QObject*.

Retrieving the QAccessibleInterface* later is done using the
interface's unique ID stored in the m_uniqueId member.

However, the fact that m_uniqueId is a member
of the union alongside with m_child means that setting
a child via QAccessibleEvent::setChild also overwrites
the stored unique ID, which breaks retrieving the accessible
interface later.

Fix this for the case where the QAccessibleInterface has
an associated QObject by assigning m_object in the ctor as well.
This means that a QAccessibleEvent created using either of the two
constructors (the one taking the QObject* and the one taking
the QAccessibleInterface* associated with the object) now behaves
the same.

Fixing the case where there is no associated QObject would require
further changes (e.g. adding a member for the QAccessibleInterface*
or making the m_uniqueId member a separate member instead of having
it in a union with m_child). However, I see no way to do so without
breaking the ABI, so that is left unchanged.

This also adds a corresponding test case.

Fixes: QTBUG-105988
Pick-to: 6.4
Change-Id: I71a548af0277a5034e9e207f066fa3e25c5393f3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-27 03:38:16 +00:00
Ivan Solovev
88974b0a3e tst_qscopedpointer: port away from deprecated APIs
The QScopedPointer::take() call in comparison() test was used to
avoid a double-deletion error, because the test is creating two
QScopedPointer instances referencing the same memory.

Avoid the take() call by providing a custom DummyDeleter and
managing the memory by the extarnal std::unique_ptr.

As the test now has no test-cases for QScopedPointer::take()
calls, create a new test for this deprecated API, and guard
it with QT_DEPRECATED_SINCE checks.

Task-number: QTBUG-104858
Change-Id: Iecc28d44d76c9ce5835e6b1a1df7db30e2a9ca25
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-27 02:07:54 +02:00