Since QHash is missing the overload, too, just ignore the hint for
now, but provide the STL-compatible signature so generic code can use
QSet as a normal sequential container.
[ChangeLog][QtCore][QSet] Added insert() overload taking an insertion
hint, for STL compatibility.
Change-Id: I9fe41877343ebff721b650fb7b9cd4e06b6608d8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Make the string into a list and call setFontFamilies.
Pick-to: 6.0
Change-Id: I1b70db784fd6e495b48917141d07bacd1e883882
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
The right include is QTest, QtTest drags in all of QtCore.
Change-Id: Icc2964ccdb85fe1bfc9fe8f43351a4605a34329b
Pick-to: 6.0 5.15
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
One test in tst_qfiledialog2 only succeeded if the directory "~/foo"
did not exist. This patch changes the path used to "~/Vugiu1co"
which has hopefully a much lower probability of existing.
The string "Vugiu1co" is taken from a call to "pwgen".
Pick-to: 6.0
Change-Id: Ia82b07902a91eb908a74aa90cdbdf4761d432d9a
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
tst_qlibrary depends on a library (targets mylib and mylib2) to be
built. They create a library with the same name, in two versions.
This is done in order to test versioned library loading.
However, those two libraries were fighting over the creation of
"libmylib.so". In a fresh build, mylib2 wins, as intended. But after
a rebuild, mylib won, which led to failing unit tests.
This patch changes the situation. With this change, mylib no longer
tries to create "libmylib.so". Thus no fighting and no problem.
Pick-to: 6.0
Change-Id: Id89baa5503c9f078a8737ff0b8616edf09044f72
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
When we are using the offscreen plugin, there might or might not
be a working system tray icon. This patch disables the unit test in
that case as we do not know what to expect.
Change-Id: I34fded516300cc9aab1eb67644dcef8631ecfdf1
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
- Add test for static hash() method
- Add tests for addData() overloads
- Add input data for sha384 and sha512
Task-number: QTBUG-88183
Change-Id: I7e16419b3a582468fd1de15613e1157af428bc4c
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
tst_qlibraries needs to test libraries to be built in order to run
successfully. However, these libraries were not mentioned as
dependencies in CMake.
This patch fixes that.
Fixes: QTBUG-88445
Pick-to: 6.0
Change-Id: Ic335e46664edd98217bd55a9bca5a58a39cffe66
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
By extending (a bit) an auto-test to cover paths found by LCOV. All of them
is just to trigger the code that checks input parameters.
Pick-to: 5.15
Pick-to: 6.0
Change-Id: I62f9a9045038ff8d123fd1396f4bfd85e75c6d8f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
By adding auto-tests that were missing/not triggering the paths found
by LCOV.
Pick-to: 5.15
Pick-to: 6.0
Change-Id: I472f59e8e7292786c80d7c8dcebde53a2982e1ec
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Not testing the result of the copying, just verifying that it doesn't
assert.
Pick-to: 6.0
Change-Id: Ib51129134b74c17eada7e3819ccfff10bb9affbf
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This information is required in the QML engine to handle list properties
(instances of QQmlListproperty<T> and list<T> types from QML).
Pick-to: 6.0.0 6.0
Change-Id: I1e30572f1c91f58b290cb9b4b07433af99a1db6f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
[ChangeLog][QtCore][QFuture] Add convenience functions to create
a ready QFuture and a QFuture with an exception
Task-number: QTBUG-86713
Change-Id: Ic7f9ca590a8ea8a9696b84f35bad074780794461
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Suppress warning:
..\tst_qprocess.cpp:272:13: warning: 'void childProcessModifier(int)'
defined but not used ...
Change-Id: Idf601df78be256cfbee0ca80252d1c364c712c8e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
[ChangeLog][QtCore][QMargins] QMargins is usable in a structured
binding.
[ChangeLog][QtCore][QMarginsF] QMarginsF is usable in a structured
binding.
Change-Id: I0c501847b9377c47bd0e63da3735792075bd0079
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Coverage tests revealed that
QAnyStringView::compare(QAnyStringView, QAnyStringView, CaseSensitivity)
was not tested in our unit tests. This patch adds a test for this.
Pick-to: 6.0
Change-Id: Id8e0d8af87e7e7ab192fb7554a278ddbb890fb14
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
tst_qprinterinfo compared the output of "lpstat -p" with the
result of a call to "cupsGetDests". "lpstat -p" only returns local
printers, "cupsGetDests" also returns printers on the local network.
This patch fixes the test by using "lpstat -e", which also
shows printers on the local network.
Pick-to: 6.0
Change-Id: Ia70adad8b8467f4c738f769d34757786fc9645b2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
The QFont::fromString() needs to differ between strings
produced before and after Qt 6.0 when interpreting the
weight value, since in older strings this will be the legacy
scale.
Luckily the number of tokens in the string can be used for this
purpose, since many tokens were added in Qt 6.0.
This broke KDE, where font settings are stored in QSettings
and serialized using QFont::toString() from Qt 5.
Fixes: QTBUG-88589
Pick-to: 6.0.0 6.0
Change-Id: I199737fed61917f8b9d8f86176ead29a89eb8e0c
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
QPoint(F) are "naturally" destructurable in their x/y
counterparts (hello Mac/Carbon users, we don't live in 1999
any more, it's x and then y, and not vice versa...).
[ChangeLog][QtCore][QPoint] QPoint is usable in a structured
binding.
[ChangeLog][QtCore][QPointF] QPointF is usable in a structured
binding.
Change-Id: I8718a4e80be4ce03f37f012034f1fba009304b32
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
By simply extending the basic test to trigger qHash, isEqual and
a bunch of getters.
Pick-to: 6.0
Pick-to: 5.15
Change-Id: Ib1d88fc6d2ad623743cea77ac286ae6ac819dfd1
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Coverage analysis showed that QCalendar::YearMonthDate was not
rigorously tested. This patch adds a unit test.
Pick-to: 6.0
Change-Id: I0af485d13c4883764b61ea1e35455905cc77b966
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
QString::insert(qsizetype, QChar) can insert at negative positions,
then counting from the end of the string. Coverage analysis revealed we
do not have a unit test for this. This patch adds a unit test.
Pick-to: 6.0
Change-Id: I8d41b38df964c07fe2d2e7be444f8236c9e19b5d
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
tst_qsslcipher was quite useless - now we test that default constructed
QSslCipher reports expected values. Test the non-default from the
different auto-test, where we are sure we have really useful
ciphersuites (with different parameters obtained from a TLS backend,
where it's possible).
Pick-to: 6.0
Pick-to: 5.15
Change-Id: Iff14a0580fed889cf9e0873bee01d968773626db
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
... instead of failing the test. On Ubuntu 20.04 when calling
'connect' with 0.0.0.1 we get EINPROGRESS and nothing else,
since our own internal timer has 30 s. timeout, the event loop
in the test stops before this and no socket error detected yet.
Handle such situation without failing a test.
Fixes: QTBUG-88042
Change-Id: Id6add27fcf9bbbe5fbf83a193652edf08fbad8d6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Make sure ulonglong variant converts to a double JSON value when the
value is greater than 2^63.
Change-Id: I4d4392b05de29c220624056d5d0d4664fb2c08b7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
By depending on setFamilies() then we can be sure that font names with
spaces, commas, quotes and so on are correctly handled without being
misinterpreted. For now it will split on the comma when a string
containing one is passed to setFamily. But from Qt 6.2 this will be
removed to preserve the family string as a convenience function.
[ChangeLog][QtGui][QFont] Indicated that setFamilies/families is
preferred over setFamily/family to ensure that font family names are
preserved when spaces, commas and so on are used in the name.
Change-Id: Id3c1a4e827756a4c928fed461a4aafa5a0f06633
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This reverts commit ee122077b0.
Reason for revert: This causes QProcess::readAll() to sometimes
return nothing after the process has ended.
Fixes: QTBUG-88624
Change-Id: I34fa27ae7fb38cc7c3a1e8eb2fdae2a5775584c2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 23100ee61e33680d20f934dcbc96b57e8da29bf9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Ensure the values are reasonable regardless of screen DPI. Velocity
is supposed to be in logical pixels / second.
Task-number: QTBUG-88252
Task-number: QTBUG-88346
Change-Id: Ic209887f8ed0381c033a9ff04ae48b072c444df4
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
QString::replace(pos, len, *unicode, size) can handle positions
which are outside of the this-string. In that case, it is a no-op.
Coverage analysis revealed we do not have a unit test for this.
This patch adds one.
Change-Id: Id4a407e860fff0d5c7c0a200c379e5e3961c86d2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Coverage analysis showed that an if-branch marked "Q_LIKELY" was never
taken. It turns out the code was incorrect, but behaved correctly.
This patch fixes the logic and adds a unit test.
Pick-to: 5.15
Change-Id: I9b4ba76392b52f07b8e21188496e23f98dba95a9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This patch adds a basic fuzzing test for
QDateTime::fromString.
Task-number: QTBUG-87104
Pick-to: 5.15
Change-Id: Icc51386f06f6d4d2a4495734f7fa45de80c6e065
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
This was so far problematic as it gave various link errors. The solution
to that seems to be to make the default constructor of QPairVariantInterfaceImpl
constexpr to get around one set of problems.
The other problem to solve where undefined references to metaobjects. The
reason for that is apparently that QMetaTypeInterface contains a direct
pointer to the meta object, something the linker doesn't like. Adding a
level of indirection by using a function that returns the pointer seems
to solve that problem.
Fixes: QTBUG-88468
Change-Id: I5612ae807ea3b7e49bc40349d8d1fca1be9bd7ee
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
For bases other than 10, negative numbers have been converted
to QString by casting them to an unsigned number and
converting that. Thus QString::number(-17, 16) returned
"0xffffffffffffffef", for example.
This patch changes the behavior so that
negative numbers are converted like positive numbers.
Additinally, this patch adds unit tests for QString::number.
[ChangeLog][Important Behavior Changes]
Changed QString::number(integer, base) for negative numbers
and bases other than 10 to return the string corresponding
to the absolute value, prefixed by "-".
Fixes: QTBUG-53706
Change-Id: I0ad3ca3f035d553860b262f5bec17dc81714d8ac
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QSortFilterProxyModel did not emit dataChanged when calling
setSourceModel() after modifying the source model.
QSortFilterProxyModel::setSourceModel and
QSortFilterProxyModelPrivate::_q_sourceReset(), _q_clearMapping
is called to delete the source_index_mapping. They also need to
call create_mapping function to re-create it.
Fixes: QTBUG-87781
Pick-to: 5.15
Change-Id: Idbe34696c9d3a2fbf354b653c870bac61378811d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Four code-paths that weren't tested are simply those with the
parameters swapped from code-paths we did test. In any case, the
float-distance between values should be symmetric, so test that.
Task-number: QTBUG-88183
Change-Id: I2060eb77b1abada5b0fd5f4557dbb1761c5cfd02
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Tests can run faster now, but we still expect calculations based on
the timestamp (such as QEventPoint::velocity()) to be correct.
Change-Id: Ie962604c9ebd139384dcd89a157de66b4b773cc9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Previously QFutureInterface::setProgressValue was silently ignoring
the progress range and allowed to set any progress value.
Also no checks were performed in QFutureInterface::setProgressRange,
which allowed the user to set minimum > maximum.
Add checking of the current progress range, when settings the
progress value.
Add checks for minimum and maximum values while setting the progress
range.
The implementation of the checks is mostly based on the logic
that is used in QProgressBar.
- If maximum is smaller than minimum, minimum becomes the only legal
value.
- If the current progress value falls outside the new range, the
progress value is set to be minimum.
- If both progressMinimum() and progressMaximum() return 0, the
current progress range is considered to be unused, and any progress
value can be set.
- When setting the value using setProgressValue(), if the value falls
out of the progress range, the method has no effect.
Task-number: QTBUG-84729
Change-Id: I29cf4f94b8e98e1af30dd46fbdba39c421cf66bf
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>