QTest::pixmapsAreEqual() was left in the Qt4 API for compatibility with
some old tests written for Qt3. QCOMPARE() is the preferred way to
compare QPixmaps and provides superior diagnostic output when a
comparison fails.
This commit removes QTest::pixmapsAreEqual() from the testlib API and
replaces the last few remaining calls with QCOMPARE.
Change-Id: I051c0e7d3bda072855fcd262d82e8e540619233b
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Critical bug... Good thing I had backups of my $HOME.
Change-Id: I43b3a80786c946b0aec797036c1164d436d521f8
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
The "happy eyeballs" connection code means that IPv4 and IPv6 connections
are both attempted for a http request.
For a normal http server, this is no problem, but the MiniHttpServer in
the test code is very simplistic and cannot cope with more than one
client connected at the same time.
On windows this causes all these tests to fail with timeouts.
Changed the MiniHttpServer to listen on IPv4 only instead of Any address.
Change-Id: I81e249997d894d266001da474a351b1f5642599e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This is a regression introduced in Qt 4.8
When QApplication::processEvents is called from a destructor, it is
possible that pending events would still be called on the already
destroyed subclass.
Prevent that by using the same pattern as in QMetaObject::activate
Change-Id: Ida50db07ae089264402dafcde7a41a066479d08b
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
childAt used to return an integer.
Return an interface instead.
Not requiring a direct child to be returned allows optimizing
by bypassing iterating through the hierarchy of accessibles.
For QtQuick this is the only sensible way of implementing this.
The bridges are still responsible for finding the top-most element.
The default implementation in QAccessibleObject is sufficient
to return direct children. The implementation in
QAccessibleApplication is therfore no longer needed.
Change-Id: Id7100dd5bcc3a98de516a7f4a12eaaa41cb46d26
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Required for launching the sub-processes. The test worked only
when launched locally, not from 'make check'.
Change-Id: I42c9202a7726c3135f94445fb336b2b8241535a4
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
For some strange reason "Object::method ..." was printed, without
the leading Q.
Change-Id: I10b99e8aa8730e4020d15b3e04a01004bade76c3
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Use QFINDTESTDATA to set the working directory
and change the profiles accordingly (as in
the qprocess-test).
Change-Id: I332038728c64214f73ced448e1466ad96c11b3b3
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
The duplicated hash tables in QGuiApplicationPrivate and
QApplicationPrivate are now unified into one single hash table in
QGuiApplicationPrivate. This also reduced the number of lookups.
The extra processing needed to keep the touch points' first/lastPos
values in sync is now done only once, in QGuiApplication. This
eliminates the performance penalty (for widget-based apps) that was
introduced during the QPA migration.
As an added bonus the patch adds support for touch events arriving
simultaenously from multiple devices. This was broken before: As there
is no guarantee that two devices/drivers will not send touch points
with the same ID, using structures with only the ID as key is
wrong. The proper key is composed of the device ID (that is, a
QTouchDevice pointer) and the touch point ID.
The exported internal function qt_translateRawTouchEvent() has been
removed. This function cannot work properly in the QPA world: It
injected touches into the widget subsystem (QApplication) only which
is wrong, and would result in half-filled touch events due to not
routing the injected data through QGuiApplication. Autotests using
this function are migrated to
QWindowSystemInterface::handleTouchEvent().
Change-Id: I7632781d77f9e0ac4626fd7c9933511c94492156
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Changed to use QT_INSTALL_TESTS to install subtests.
Change-Id: I4a2a7bd2d3e7d6da34dbb922bf377bee98cdedb0
Reviewed-by: Kurt Korbatits <kurt.korbatits@nokia.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
On Windows, the signalbug.exe could not be launched since it is
not next to tst_qobject.exe, which is in one of the
'release', 'debug' subfolders.
Introduce a subdirectory structure similar to that of
the QProcess test and use QFINDTESTDATA to locate it.
Change-Id: Ie8f2ede8cb76f22a908cb77517a74076be11fbb7
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
The old test only verified the behaviour of QCOMPARE when comparing
lists that were different. Add data rows for comparing empty lists and
non-empty lists that are equal.
Note that testlib currently does not report passing data rows (only
failing rows and completely passing test functions), so the new data
rows do not cause any change in the expected test output.
Change-Id: I137650ce0ca6250cee36bd9cb74b01f8abd4e89c
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
The (disabled) alive selftest contained a test for the QStringList
specialization of the QTest::qCompare template. This test is unrelated
to the rest of the alive selftest, so move it to the cmptest selftest,
where QCOMPARE is tested.
Change-Id: Ic6f0e491dd3b3ce8b4ca1d49666a099815575eaa
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
When starting new animations with existing animations running, ensure
we force an update to the timer first, so that the new animations can't
mistakenly start with a very large delta.
This fixes tst_qdeclarativeanimations::alwaysRunToEndRestartBug failure
on slow machines.
Change-Id: Ida4e5dcf0ff792e6bfe0d244b6e969d04d0b20fa
Reviewed-by: Martin Jones <martin.jones@nokia.com>
- Add some QVERIFY to check for isNull().
- Use QTemporaryDir to avoid spurious failures in the format
extension-ignore test (cannot copy to '/tmp/black.jpg').
Change-Id: Ia57ea4daa6b8686d1111c9c27a47666265fa9781
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
The test that was failing was the readFromDevice one - where the
extension is not known.
Looks as though image detection is required in a positive way, that is
it is not enough to say I think I can read this file, and then fail if
the format is "corrupt", you must be certain that the file was intended
to be that format.
In the case of TGA the original format has no magic byte header, and no
consistent way to check if it really is a TGA file. With 2.0 the footer
was added at the end, so that can be checked for confirming the file is
TGA. However rejecting files which do not have this means that old TGA
files will not be read.
On a quick survey TGA files that have been used in applications so far
all seem to be 2.0 TrueVision, so for now, lets just reject earlier
files and see how it goes.
Also add reading the tga test file to the readFromDevice test.
(cherry picked from commit 665bc3951709f0d726cb82501a5bca684f3347a5)
Change-Id: I665bc3951709f0d726cb82501a5bca684f3347a5
Reviewed-by: Sarah Jane Smith <sarah.j.smith@nokia.com>
Updated three instances were not using QFINDTESTDATA.
Change-Id: Ibd0f6734791fc5d98ebeb65ac3bd80aa1c076414
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
If both a stop and start happen within an event loop, ensure they are
processed in order.
Based on a patch from Charles Yin.
Task-number: QTBUG-22865
Change-Id: I6131bd43a6ba5ad4fa37c863a9f4598bf2ac0e01
Reviewed-by: Leonardo Sobral Cunha <leo.cunha@nokia.com>
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Unlike keyPressEvent(), mousePressEvent(), etc. the touch events had
no equivalent so one had to fall back to reimplementing event() or
using an event filter. This is now corrected by introducing
touchEvent(). Touch events are finally becoming a first-class citizen
in Qt 5.
Change-Id: Ia2044030154fd5b1b5384f08a3cb1749b798435f
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
This also adds a unit test for length()/count()/size(), since there wasn't one
testing it explicitly.
Change-Id: Ifb7f113aa97beef5f76e5fb246eb38495344b0ad
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Marco Schmidt <Marco.Schmidt@Taugamma.de>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
The test generates the runtime_resource.rcc data file at build time. Add
this to .gitignore.
Change-Id: Ief4057072b28499049147b86f166523b71afe269
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Even though it is stated in the documentation that the SQL driver must
remain valid during the life time of QSqlQuery, there are users who don't
follow the rule. It's common that the destructor of QSqlQuery is called
after the driver is already deleted. This fix checks the validity of
the SQLite driver before QSqliteResult uses it in destructor.
Task-number: QTBUG-16967
Change-Id: If0f52113f12e14102da1671cd6e12bdaa267114f
Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
The overload is used in Qt Creator
(see src/libs/extensionsystem/pluginmanager.cpp).
The use case here is an application whose internal
QObjects can be tested by passing a command line parameter.
For this use case, it is inconvenient to have to allocate
memory and create a char argv[]- array.
This reverts commit ad80d42f8e.
Change-Id: I2a2f91e2840100fd62743f6d03b33005d67b18f8
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
QWeakPointer is superior and preferred.
Remove QMetaObject::addGuard(), QMetaObject::changeGuard(),
QMetaObject::removeGuard(), and QObjectPrivate::clearGuards().
Implement QPointer using QWeakPointer<T> instead. This changes the
behavior of QPointer in 2 ways:
- During destruction of a QWidget. Previously, the destructor of QWidget
would reset all QPointers so that they would return zero when destroying
children. Update tst_QPointer to account for this change.
- When constructing a QSharedPointer to take ownership of an object
after a QPointer is already tracking the object. Previously, the shared
pointer construction would not be affected by the QPointer, but now
that QPointer is implemented using QWeakPoiner, constructing the
QSharedPointer will cause an abort(). Fix tst_QSharedPointer by
removing the use of QPointer in the objectCast() test.
These behavior changes are documented in the QPointer class
documentation and in the changes file.
Change-Id: I92d0276219c076ece7bcb60f6e1b9120ce4f5747
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
- Check path/fileName is empty upon failure, variable was unused
- Use /home instead of /, as / is writable by admins on Mac
Change-Id: I705471fda8b73843e98b30eb52aa0a73634ec075
Reviewed-by: David Faure <faure@kde.org>
The capability flags indicate which information is valid in the touch
points. Previously there was no way to tell if e.g. the value returned
by pressure() is actually the value provided by the driver/device or
it is just something bogus due to pressure not being supported.
The points' flags return information about the individual touch
points. One use case is to differentiate between touches made by
finger and pen.
Velocity, if available, is now also exposed.
Each touch point can now contain an additional list of "raw"
positions. These points are not reported individually but are taken
into account in some way by the underlying device and drivers to
generate the final, "accurate" touch point. In case the underlying
drivers expose these additional positions, they are made available in
the lists returned by the touch points' rawScreenPosition().
The raw positions are only available in screen coordinates to prevent
wasting time with mapping from global positions in applications that
do not use this data. Instead, apps can query the QWindow to which the
touch event was sent via QTouchEvent::window() and can call
mapFromGlobal() manually if they need local raw positions.
The capability and device type information is now held in a new
QTouchDevice class. Each touch event will contain only a pointer to
one of the global QTouchDevice instances. On top of type and
capability, the new class also contains a name which can be used to
differentiate between multiple touch input devices (i.e. to tell from
which one a given QTouchEvent originates from).
The introduction of QTouchDevice has three implications: The
QTouchEvent constructor and QWindowSystemInterface::handleTouchEvent
need to be changed (to pass a QTouchDevice pointer instead of merely a
device type value), and each platform or generic plug-in is now
responsible for registering one or more devices using the new API
QWindowSystemInterface::registerTouchDevice.
Change-Id: Ic1468d3e43933d8b5691d75aa67c43e1bc7ffe3e
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
QMessageBox was being used to test nested event loops. This has been
changed to use QEventLoop directly.
Also, there was an unnecessary use of QPushButton to trigger a test
case, which has been removed.
As a result, 3 test cases can be run on VXWORKS, and one more test case
on Windows that were previously skipped.
Change-Id: Ic65ed441cd37d242f89df3ef3b8638a1458d9cf3
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
tst_QTcpSocket::disconnectWhileLookingUp required the host lookup +
connect + disconnect procedure to complete in <50ms, which is not always
true.
When disconnecting (rather than aborting with close()), wait for the
disconnection to complete with a timeout of 5 seconds.
Task-number: QTBUG-21043
Change-Id: I3b59abf9a8eb2c6d99416e1a8ec6b528885b656e
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
The executable needs to be in the test directory
as it expects it sub-executables from there.
Breakage introduced by 3385fb91e1
Change-Id: Ic1f3db70851f65e2f12041c3a16cb8f0b7bdf35e
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
Commit a72468e820c2922540737c053eef27d033c2e77b split the test into two
functions, but kept them combined in a single slot for QTest to invoke.
That being the case, we might as well have them as test functions of
their own right. Should work nicer with test failures, skips and such.
Change-Id: I62c1fc7777c08b3e87a5903632d73dc1e1d97e1a
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
- QPixmap::to/fromWinHICON/BITMAP() became free internal
functions (see b8d330904b)
- Improve QImage check function similar to
11732d133b
Change-Id: I80ff066964ce6c339a6b9bfa5a0e10421dca162a
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
- Use correct overload for QTranslator::translate()
- Fix LTR source text
- Use QDir::TempDir correctly (check for slash).
- Do not copy executable on Windows (which is locked), use
arbitrary data instead.
- Use Q_OS_MAC
Task-number: QTBUG-21402
Change-Id: I6ba1c7c764d4c847278eaff9a96c8cd312ac204d
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
In case a subprocess fails to start.
Change-Id: I1372c07de8f3580a8e7aadd6874da15bf273ac53
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Failing tests are marked with CONFIG+=insignificant_test.
tst_QTextLayout currently asserts, so it has been disabled to prevent
destabilization of the CI system.
Change-Id: I7bd836ee14085689c8a0f0ce8e3c80d81a55eb94
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
setSocketDescriptor fails because socket is in the wrong state.
This is timing dependent, if qt-test-server is still in the DNS cache
then the test failed.
- clear the DNS cache to avoid the host lookup state being skipped.
Change-Id: If159d514b1aa9b62a4834f6352d5e7b0a00a5724
Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
Target names with spaces must be quoted.
Change-Id: I913ef386353fc75991c8db4e3205ab511fc1f1a9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
To follow the comments in the review by João Abecasis.
Change-Id: Ie566705d3b4071b8628d269246aadcde4866f34f
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>