Use the QWindow-based overloads of QTest::mouseMove(), which do
not move the cursor position.
Amends ba13960392,
3f3d5e6716.
Task-number: QTBUG-89082
Pick-to: 6.0 6.1 5.15
Change-Id: I2cc62e4d1f24e4baebafd0d76fbf0fbdb6f588c7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The test has been observed to fail with:
FAIL! : tst_QDoubleSpinBox::setReadOnly() 'QTest::qWaitForWindowActive(&spin)' returned FALSE. ()
/Users/qt/work/qt/qtbase/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp(863) : failure location
Remove the widget member and use a widget instantiated on the stack instead.
Add a check for top level widget leaks in cleanup() and fix leaking task224497_fltMax()
by instantiating the widget on the stack.
Pick-to: 6.1
Change-Id: Idbbb5d859c0df2d9b9f49fb9f69ef6bb7d1ee150
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
When a foreign event loop that does not enter an alertable wait state
is running (which is also the case when a native dialog window is
modal), pipe handlers would freeze temporarily due to their APC
callbacks not being invoked.
We address this problem by moving the I/O callbacks to the Windows
thread pool, and only posting completion events to the main loop
from there. That makes the actual I/O completely independent from
any main loop, while the signal delivery works also with foreign
loops (because Qt event delivery uses Windows messages, which foreign
loops typically handle correctly).
As a nice side effect, performance (and in particular scalability)
is improved.
Several other approaches have been tried:
1) Using QWinEventNotifier was about a quarter slower and scaled much
worse. Additionally, it also required a rather egregious hack to
handle the (pathological) case of a single thread talking to both
ends of a QLocalSocket synchronously.
2) Queuing APCs from the thread pool to the main thread and also
posting wake-up events to its event loop, and handling I/O on the
main thread; this performed roughly like this solution, but scaled
half as well, and the separate wake-up path was still deemed hacky.
3) Only posting wake-up events to the main thread from the thread pool,
and still handling I/O on the main thread; this still performed
comparably to 2), and the pathological case was not handled at all.
4) Using this approach for reads and that of 3) for writes was slightly
faster with big amounts of data, but scaled slightly worse, and the
diverging implementations were deemed not desirable.
Fixes: QTBUG-64443
Change-Id: I66443c3021d6ba98639a214c3e768be97d2cf14b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Avoid painting errors with dpr < 1, also for the PassThrough
mode.
This limits the minimum high-dpi scale factor to 1,
for the code path which determines the scale factor
based on screen DPI.
Pick-to: 6.1
Task-number: QTBUG-89948
Change-Id: I14b3f130f0ae141d5f05c87437f926a9f76d1dec
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Move the cursor out of the way to prevent it from interfering.
Amends 3f3d5e6716.
Task-number: QTBUG-89082
Pick-to: 5.15
Pick-to: 6.0
Change-Id: I0efbe2b5618a04e92839083a1bd3383e05d6ff93
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Before this change, the QMetaType for T const* where T is derived from
QObject would not store the static QMetaObject of T. This commit changes
this. As a consequence, the metatype system can now convert between
const and non-const pointers to QObject. Note that this allows casting
const away; but so does C++ with const_cast.
In addition, a new flag, QMetaType::IsImmutable is introduced, and used
to tag the metatypes of pointer to const types. This allows code to
discern between pointers to mutable and const QObjects, which is
relevant for the QML engine.
Task-number: QTBUG-82354
Change-Id: I3e4e4f39f565bd99a65e161528ce5304df73d6d6
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
After QPoint(F), it's now the time of QSize(F) and QVectorND,
which can be unambiguously decomposed.
[ChangeLog][QtCore][QSize] QSize is now usable in a structured
binding declaration.
[ChangeLog][QtCore][QSizeF] QSizeF is now usable in a structured
binding declaration.
[ChangeLog][QtGui][QVector2D] QVector2D is now usable in a
structured binding declaration.
[ChangeLog][QtGui][QVector3D] QVector3D is now usable in a
structured binding declaration.
[ChangeLog][QtGui][QVector4D] QVector4D is now usable in a
structured binding declaration.
Change-Id: I67bb152f4210f2be27607179cd2ec522174cc483
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
When attaching a continuation with the default (QtFuture::Launch::Sync)
policy, it will be launched in the same thread where the parent has
been executing, or in the thread where the parent lives, if the
continuation is attached after the parent has already finished. Fixed
the test-case to make sure the continuations are attached while the
parent is still running, so that they can be resolved in the parent's
context.
Fixes: QTBUG-91373
Pick-to: 6.1
Change-Id: I82b3b0c47b76d121b44bd512659c08b3b474e351
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Only RGB444 and RGB666 were treated slighlty different from the rest,
but the test had a few additional mistakes.
Pick-to: 6.1 6.0 5.15
Change-Id: I4728b4036affedfffce8bca5c1e7be3869344fbe
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
In QTimeZonePrivate::dataForLocalTime(), mistrust the Android
backend's hasDaylightTime(), as it has a comment saying it only knows
about future transitions, not past. This caller of it really needs to
query "has ever had a transition", which this doesn't answer. Many
zones that have no plans for future transitions have had transitions
in the past; these were failing the transitionEachZone() test.
In the process, refine the test itself, making sure we catch some
quirk cases that shouldn't arise and making the debug message on
failure more informative (while eliding the zone name, as this is part
of the test name anyway, so added to the output by qDebug() itself).
Fixes: QTBUG-69131
Change-Id: I88a0528182c247acb8b6327b40516178e455bcc0
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
[ChangeLog][Build System] Tools that are called by the build system and
are unlikely to be called by the user are now installed to the libexec
directory.
This is a step towards easier co-installability of different Qt
versions.
Pick-to: 6.1
Task-number: QTBUG-88791
Change-Id: Id19575b5ba27795f7715e4ea6a09391b26dd4942
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Extend and rename the pixmap() crash test to also verify
that a non-null pixmap is returned.
Change-Id: Ia972c4f705724cfa1394521a2dfd87451d9c5d64
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This patch marks some functions "override" to silence the corresponding
warning.
Change-Id: I88ccc5fa7521ecccc84a6cba9f06ea185cc5679e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
We haven't used the spawn functionality on QNX since Qt 5.7 (commit
005a8bfbf0) because that's when we dropped
support for QNX 6.5.0.
Change-Id: Ic90d8429a0eb4837971dfffd1664f9712bdce2d8
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
And set *pid to -1.
[ChangeLog][QtCore][QProcess] If a startDetached() fails to start the
target application, the QProcess object should now have a proper error
string in errorString().
Pick-to: 6.1
Change-Id: Ic90d8429a0eb4837971dfffd1664e825ffcb923e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
The idea is to have QSslKey(Private) backend-neutral and hide
all library-specific code inside plugins.
Fixes: QTBUG-90953
Task-number: QTBUG-65922
Change-Id: I2eeee3b2b72c78c2e24f2fb914abce3caa913be8
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 0352cf8e1bf57615b9faf3f6f383896444e762ac)
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
That qWarning cannot be in the child process (we don't know if a user
logger is fork-no-exec-safe) and the failure to chdir() should be
reported as a failure in QProcess::startDetached() instead.
Change-Id: Ic90d8429a0eb4837971dfffd1664e7577c81610b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: David Llewellyn-Jones <david.llewellyn-jones@jolla.com>
I get a warning about the variable t_var being set but not used.
This patch fixes the warning.
Change-Id: Ib2df5ed2dddd283eb87f71a8b85951d1f67f04f2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The QTimeZone tests have some helper functions to test details of a
QTZP instance; these use QCOMPARE(), so may return early on failure.
The callers then need to notice the failure and, in their turn, also
return.
Change-Id: I0a188e9641ced70c9ffedd95e91f39681fad768a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Its back-end lacks transition data, so the test can't possibly
succeed. Make the skip conditional on the tested zone having
transitions, so that the test will come back into play if we ever gain
support for transitions on Android.
Fixes: QTBUG-69129
Change-Id: Ie4f96601b8b18cd496efbde7cf2557875cf3c1c9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Applications on macOS are automatically activated (put into the foreground),
when launched from the Finder, or via 'open' on the command line. But when
launched from the terminal, e.g. foo.app/Contents/MacOS/foo, the application
will launch in the background (inactive).
In Qt we override this behavior, activating the app even when launched from
the terminal, as a convenience, as long as the application is a GUI application.
Unfortunately this means that when tst_qapplication launches a subprocess that
is a GUI app, it will steal activation from tst_qapplication, which in turn
will break tests that later try to activate a window and check that the window
is then active. The window will not be active until the application is active.
We can work around it by preventing Qt from activating the application, but
ideally we'd find a better solution to this, as we don't want to sprinkle
overrides all over our tests.
Fixes: QTBUG-90699
Pick-to: 6.1 6.0 5.15
Change-Id: If53a86548002b739df0c0a7153d6244924a4a205
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
A recent change ( a7ca8b1a28 )
led to failure of binding removal in setInterval().
This was fixed by introducing setterScope.
This patch add unit tests for this regression.
Change-Id: Ic8da1f2d82ad6c8ccd81c9b1eff72d42cf75f28a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Apparently we used to have (back in 2007, only on Windows,
incompatibly with what we were then using on Unix) a TextDate format
(only for QDateTime, QDate used what it still uses) that put the
day-of-month number, with a dot after it, before the month's short
name. We have retained parsing of this format, on all platforms, ever
since.
It no longer matches the format we now use (since 5.2, in 2013, commit
61b56a89a1, which harmonised the format
with Unix and QDate); now seems like a good time to stop complicating
our parser for its sake.
[ChangeLog][QtCore][QDateTime] The parsing of Qt::TextDate in
QDateTime::fromString() no longer supports the old TextDate format
used (only) on Windows by Qt < 5.2 ("ddd d. MMM yyyy" with an
"HH:mm:ss" time either appended or inserted before "yyyy").
Change-Id: I73a798ab78f187543e415119cc4a11f1cfd73820
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Since fromString() can't parse the (ambiguous at the best of times;
also backend-dependent and thus potentially system-locale-dependent)
abbreviations currently produced (since 5.9) and can parse UTC-based
offsets, the OffsetName of the zone is a more robust format for the
zone-suffix. This also makes it possible to consistently use the C
locale, compatibly with everything else about post-6.0 date-time
serialization.
[ChangeLog][QtCore][QDateTime] When spec is Qt::TimeZone, the
offset-suffix now used for the toString(Qt::TextDate) format is now a
UTC-based offset string, compatible with the parsing (now) supported
by fromString(). The zone-abbreviation suffix in use since 5.9 was not
parseable.
Change-Id: I4024ae87980c6d3590c68a67b8d1c8f433e36855
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
There are GMT-offset zones whose convention for the sign of the offset
is the reverse of what we are (still) using, which is the usual
convention for UTC-offset zone: for example, the Olson Database's
Etc/GMT+3 has offset -3 hours in the UTC-based system we use, so we
give it suffix GMT-0300. The UTC-based suffix is also what we use as
the abbreviation for OffsetFromUTC() in toString().
For now this only adds support for parsing a planned future form: the
old form using GMT is retained, to give client code some chance to
prepare for a backwards-compatible transition. Although the GMT prefix
is matched case-insensitively, only match UTC if fully upper-case;
there is no meaningful precedent for case-insensitive usage here.
[ChangeLog][QtCore][QDateTime] The Qt::TextDate format now recognizes
UTC-based offset suffixes in addition to suffixes based on the
deprecated alias GMT. This prepares for toString() to use such
UTC-based suffixes for time-zones (fromString() cannot parse the
present abbreviation suffix). A future release of Qt shall use
UTC-based suffixes in place of the present GMT-based suffixes (which
conflict with GMT-based IANA zone names) for Qt::LocalTime and
Qt::OffsetFromUTC time-specs. Client code is encouraged to use and
recognize UTC-based zone suffixes in preparation for that transition,
unless compatibility with versions before 6.2 is required.
Change-Id: I5a42a488f1232a30f4b427b7954759283423b9b3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When changing transferfunction the look-up-tables needs to be
regenerated.
Pick-to: 6.1 6.0 5.15
Change-Id: I83ca5fe570f85d478a374f52c0a82db84e70c3b8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
The emulation detection has been usable only on qtbase tests, move it to
QTest so that it can be used in other modules as well.
Pick-to: 6.1
Change-Id: I4b2321b7856414d7b1cfd5e6b1405a633c6bb878
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
It's the QScopedPointer test, so we want to test deprecated APIs.
Change-Id: I029103b3150c576cba9b395aafc571b9fccc914a
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
A few formats were not treating the input QColor correctly. Fixed and
added more exhaustive test.
Pick-to: 6.1 6.0 5.15
Change-Id: I872aeeb45e518f9a34b4ac35642264821f9927f2
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Instead of an XFAIL, actually test what we expect will happen for the
test, namely that the milliseconds will be lost. In the process,
verify that milliseconds since epoch also matches what was expected,
change an "expecting empty" condition to check for the "invalid"
test-case to which it's actually relevant and note that this test-case
shall need amended when we update our ISODate support to the 2019
update, which extends the year range.
Task-number: QTBUG-56552
Pick-to: 6.1 6.0 5.15
Change-Id: I680aa31ee0dcc8fadabb5d4cd6c083a8afd48573
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The test verified that a LocalTime's time since Epoch changes when the
system time-zone changes. This works when the QDateTime object is in
short form and recomputes its offset from UTC every time it is needed,
but fails with a pimpled QDateTime, as this caches its offset from UTC
when it is created, saving the recomputation which - in the far more
usual case where the system time-zone does not change in the lifetime
of a QDateTime object - would normally produce the same result.
Changed the test to use a newly-created QDateTime constructed with the
same parameters, which doesn't have the cached out-of-date knowledge
of its zone offset. Removed the XFAIL. Made the test data-driven and
added test-cases: one so close to the Epoch that it should be short
even on 32-bit systems, one so far that it's pimpled even on 64-bit
systems (used in reproducing the issue in order to debug it).
This then revealed that Android 5 doesn't seem to support the POSIX
zone IDs used by this test, so it now verifies that LocalTime has the
expected offset from UTC after zone changes, QSKIP()ping if not.
Documented that the behavior of LocalTime is undefined after a change
to the system time-zone. Cleaned up the existing doc of Qt::TimeSpec
in the process.
Fixes: QTBUG-89889
Pick-to: 6.1 6.0 5.15
Change-Id: I1058f47a1ff3ee1c326f3579ac80bd8bab242e28
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The initial implementation and the commit
c00ab6f8ea was wrong:
* env->findClass() in fact returns a global reference, and in any
case we shouldn't be calling that, instead QJniObject would be
enough.
* The size param provided to env->RegisterNatives was wrong.
* A test for registerNativeMethods() is added to ensure such break
is not repeated again.
Task-number: QTBUG-89633
Pick-to: 6.1
Change-Id: I4d3a6a9270755f465c40add25521fb750dd4de0a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
The system locale of a macOS application is not affected by environment
variables like LANG. Yet, we were reporting a name determined from
environment variables as the fallbackUiLocale(), rather than one based
on the language and country of the actual system locale.
This lead, via the usual CLDR likely-subtag fallback, to claiming the
system locale's name, language, script and country were those obtained
from these environment variables, even when they were at odds with the
actual locale being used by the system, which was being used for some
queries.
Worse yet, any data not supplied by these queries was being obtained
from the same CLDR locale as the name, making for an inconsistent mix
of locale data.
While we cannot avoid the likely-subtag fallback step for fallback
data, it is more consistent to use the actual system locale's name
as start-point for that fallback.
At the same time, add support for the language, script and country
queries, so that the QLocale::system() describes itself faithfully,
instead of claiming to be the locale that results from that fallback.
If we want to support LANG or other environment variable overrides,
they should be handled by the layer above the system locale, by
changing the default locale of the Qt application, as if the user
had called QLocale::setDefault().
[ChangeLog][QtCore][QLocale] QLocale::system() on macOS no longer
pretends to support LANG or other environment variables as overrides,
as this is not a feature that the system locale on macOS supports.
To override the locale of an application, use QLocale::setDefault(),
or pass -AppleLocale en_US.
Fixes: QTBUG-90971
Change-Id: Ibdaf5ff9a2050f61233a88eabf3c29094f7757f1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Previously the only test was that it produced no warnings,
if anyone paused to read the output to notice them.
Change-Id: I225ca99c7ec316186702c0fdb355585374c014a4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Somehow QList::fill(t, newSize) introduced a regression in Qt6:
when newSize < QList::size() we should resize to the newSize.
This is aligned with QVector::fill() in 5.15 and std::vector::assign()
While 6.0 is already out, picking it to 6.0.x could save someone who
haven't migrated yet as well as fix some accidental bugs in Qt's code
[ChangeLog][QtCore][QList] Fixed QList::fill() regression introduced in
6.0: calling fill() with size < current list size wouldn't truncate the
list
Fixes: QTBUG-91042
Pick-to: 6.0 6.1
Change-Id: Ic166e2c5e42390b61df1030f7c705e344433f7f2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
gcc 9 consumed enourmous amounts of memory building the test, regularly
dying on a VM with 4GB RAM. Splitting it up helps.
As a drive-by, use inline static variables, and rename the header used by
other tests to tst_qmetatype_common.h.
Change-Id: Ib716d8e3506aac6c87845e57b04cb1a4f6c68387
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The text of QPlainTextEdit might change when it is invisible, so an
adjustment of scroll bars is needed when the QPlainTextEdit showing
up, otherwise the range of scroll bars might be incorrect.
Fixes: QTBUG-77937
Pick-to: 5.15 6.0 6.1
Change-Id: I45c686c7e09ca7b2944c36122e9157de0ec4f0e0
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
It fails on 10.15 and 11, preventing those from being significant,
and the test is already marked as expect-fail based on QTBUG-20984.
Task-number: QTBUG-20984
Change-Id: I6911166a1c3e9173d6d36f2a3a68b37778fd3406
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Calculate the effective width of the hyphen better, and compare with
ceiled sizes.
Pick-to: 6.1 6.0
Fixes: QTBUG-90698
Change-Id: I7ed2eb44c54240ecb2f8a38e5acf1f32608b2bfb
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>