These defines were there to aid in the commercial
licensing scheme we used long ago, and are no longer needed.
Keep a QT_MODULE(x) define so other modules continue compiling.
Change-Id: I8fd76cd5270df8f14aee746b6cf32ebf7c23fec7
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This seems to break a number of tests using the qmltest library.
Functionality will be restored in a future commit, once the breakage has been
identified.
This reverts commit fdedb49b76.
Task-number: QTBUG-23845
Change-Id: I0ca4dbd54132e4250702f06738edbad5e8fc4f36
Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
Previously, the assertation triggered was rather unhelpful:
QFATAL : tst_QHash::qhash_qt4() ASSERT: "d->dataCount <
d->parent->elementCount()" in file qtestdata.cpp, line 88"
We now try a bit harder to be user-friendly.
Change-Id: I2e3a5ae27914d44fc1dc89af2a084e3d798fe221
Reviewed-by: Jonas Gastal <jgastal@profusion.mobi>
Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Be more insistent that tests using the old two-argument version of QSKIP
should be updated. After a grace period the warning will be removed and
incorrect usage of QSKIP will revert to a compilation failure.
Change-Id: Ifa19b856d9f45738bd9d790bb65a8741f965d0f4
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This change will enable further simplification of QTestResult and
QTestLog in the future, including removing a circular dependency between
the two classes.
The "getter" functions in QTestResult are retained for now, but will be
removed in a future commit, once QtQuickTest has been changed to call
the getters that this commit adds to QTestLog.
This commit is adapted from an unfinished change by Henrik Hartz.
Change-Id: Ife7f80ac6a4310449a4712e96e0bea6c02139a5a
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
The removed function was private API and was not used anywhere in Qt.
Change-Id: Ia262d119ebba30f6968cb7145043475bf88ffa39
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
- Use qt_defaultDpiX() to obtain the resolution, which
obtains it from QScreen. This implies that for X11,
which previously used a hardcoded default of 96 DPI,
the real resolution will be used (typically 75).
- Since many tests (layouts, graphicsview) contain
test data for 96 DPI, add an attribute to
QCoreApplication making it possible to set the
resolution to 96 DPI for testing.
Change-Id: I77c8233a96b0d75de07406f58d48886a89c3de06
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Introduce QTRY_VERIFY_WITH_TIMEOUT and QTRY_COMPARE_WITH_TIMEOUT
to be able to specify a timeout value.
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Change-Id: Iaeaa4938eb14f2c431537055f626510cba183ce3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
It is mostly not used (most places in Qt use typename directly), so
is already not very useful.
For example typename is used in:
QDataStream& operator<<(QDataStream& s, const QVector<T>& v)
Change-Id: I85337ad7d8d4ebbb424bfa2ab9a356456ff3e90f
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Introduce a specialization for qCompare(QImage,QImage) that
checks isNull, size and format and outputs verbose messages.
Check isNull, size similarly for QPixmap.
Add an autotest:
- Add test to cmptest and make it a GUI application since
QImage requires QGuiApplication.
- Make testlib/selftests capable of running X11-GUI applications
by passing DISPLAY.
- Ignore stderr output for cmptest
- Add test data
Change-Id: I2b29c7822fbeedf2b22c90889739ed7ff859ce92
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
- Scan the parent directory of the executable if it is located
in a 'Debug' or 'Release' directory
- Report with native separators in the log.
- Use the QString::arg() overloads with several string parameters.
Change-Id: I5ea84411e12978f8f958a0bce3ae10da44cc4e3f
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
HAVE_TICK_COUNTER is supposed to be set (if possible) from cycle_p.h, so
guarding cycle_p.h's inclusion with HAVE_TICK_COUNTER ensures it will never be
set.
Change-Id: I6313d0a2efd47c89522623e8e7b3f505489ded90
Reviewed-by: David Faure <faure@kde.org>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
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>
The private class had two append() methods, one appending a column and
one appending a row. Use more meaningful names instead of overloading
orthogonal operations.
Change-Id: I97e0268d6cb289694557846f244fe770cf980aaf
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Use QTestLog::info() rather than qDebug() to output informational
messages from testlib. Source file and line are deliberately omitted as
they would come from testlib rather than from a test program.
Change-Id: I7b479bba4d3d553c6fa846d8d5ea2c29a8ef42b8
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Previously, if the signal dumper was switched on with the -vs
command-line switch, it would never be switched off again.
Change-Id: I192e188010471525723fad0844ff33e9482128ea
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
The removed comment refers to a task in a bug tracker that no longer
exists. The comment also mentions making (part of) testlib use Qt's
regular binary compatibility mechanisms, which is desirable in the long
term but not in scope for Qt 5.
Change-Id: I6f23a9a2c8a84e30afe2aeb5c53ea93c25ba6f11
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This was an internal function that used to act like qsnprintf() but also
filtered unprintable characters out of the test output. The filtering
has been moved somewhere more appropriate and this function is no longer
used by testlib.
Unfortunately, the function was exposed in the public API due to its
former use in the implementation of a public macro.
In the unlikely event that any code outside testlib calls this function,
the call should be replaced by calling qsnprintf(), which comes from the
QtCore/QByteArray header.
Change-Id: Iddc17b4361d16ebddd19346ae7d1064951dd7738
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Make it clear that the delay is applied before each key-click is
simulated.
Change-Id: Id100f1f2db1a5b1651c3046905719d7eb06ec1a0
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Update the docs to describe the behaviour that resulted from moving the
traditional Qt widgets into a separate library from the rest of GUI
classes.
Change-Id: Ibd0ef05cc871b8f5a6700e421aa41bdf64c1210b
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
After establishing that both lists are the same size, there is no need
to calculate the minimum of the list sizes. Also, use sizeof() instead
of hard-coded values when calling qsnprintf().
Change-Id: I2396cf3f941770229e1cef6422aeddbe549c51fc
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>
The documentation stated that QStringList objects would be compared
starting from the end of the lists. The implementation in qtest.h
actually starts at the beginning of the list, and always has done since
qtestlib became part of Qt.
Change-Id: I056f584564d46402ba23fc6a89c801cb5c3c6262
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
If passed an empty string, QAbstractTestLogger::outputString() would
crash, so add a QTEST_ASSERT to make the cause of any crashes more
obvious.
Change-Id: I00afe2e73120b87e211f858402d441f345dddd08
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
These two parameters were written in the opposite order in the
function's declaration and definition. Harmless to the compiler,
but confusing to developers and reviewers.
Change-Id: I1d4cb0a41b465b5f918daa76756677fe0cfe0a59
Reviewed-by: Jason McDonald
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
For some reason the primary bit has previously been encoded in the
touch point state, even though it has nothing to do with the regular
states like Pressed, Released, etc.
The value is now stored in the recently introduced flags member of the
touch points. This also reduces the need for error-prone internal
masking of the state value.
The structure used by QWindowSystemInterface::handleTouchEvent also
becomes cleaner because the primary status can now be set in the flags
member and the isPrimary bool can be dropped.
Change-Id: I1da2cb99154afd97e1e3a5943ab115cae3a8232f
Reviewed-by: Samuel Rødal <samuel.rodal@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>
This option does nothing -- the only function that checks if the option
has been set is never called. This appears to have been the case ever
since testlib was imported into the Qt repository in October 2005.
Change-Id: I837aa957e2d8bd47c3d1c551f1b94d4374daa25e
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
After the previous commit, QTest::qt_snprintf() is equivalent to
qsnprintf(), so just use that instead.
Change-Id: I89ad6e3749ba5efb1926b0b618a904e8baca9f52
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Remove the part of the definition that applies to gcc versions <= 2.x
as these versions are not supported by Qt5.
Change-Id: Icee6b51ffe78fa30fd7193ef96b6ce0484b8fcae
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Previously, unprintable characters were filtered out of test output
while the output strings were being formatted by either qt_snprintf() or
qt_asprintf(). Any strings not formatted by one of those functions
weren't filtered at all, and any strings passed more than once would be
filtered more than once.
This commit separates the filtering of output strings from their
formatting, leaving the filtering until just before the strings are
written to the output stream. For now, the filtering is done by a
protected method of QAbstractTestLogger, but this could easily be
changed to a virtual method in future to allow different filtering
for loggers with different output character sets.
Change-Id: Ia4bb49cd10d37c84af75d2cf58325d27f0e16d99
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Requiring platform and generic plug-ins to pass TouchBegin,
TouchUpdate, or TouchEnd is unnecessary. The type can be easily
deduced from the touch point states. In fact handleTouchEvent already
collected the combined point states, it was just not utilized until
now.
Change-Id: Icf3c787fefdebc51609a763bc4286c18a0b6aac2
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
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>
The overload of QTest::qExec() that takes a QStringList is not used
anywhere in Qt's autotests, despite having been in the qtestlib API
since Qt 4.4.
This lack of use most likely derives from the fact that none of the
QTEST_MAIN macros use the overload, and more than 99% of Qt's tests
use those macros to avoid explicitly calling QTest::qExec().
Change-Id: I264b21d7fe1a9f2d565f748cf8bbe32414a73bb0
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Previously, autotests silently ignored the -graphicssystem and -qws
parameters so that test-runners did not need to include logic to decide
whether to pass those parameters depending on whether a particular test
was a GUI test or a non-GUI test.
In Qt 5, both of those parameters have been removed from QApplication,
so tests don't need to ignore them anymore as they should no longer be
supplied to any test.
Change-Id: Ic59e38ddfa3303e760645ed1782a211340ce70f2
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Update the documentation to make it clear that regular test applications
should not call QTest::qExec() more than once. Also minor rewording of
description of return value.
Change-Id: I45bdf520ed10fd3c9232847a0ec0bc2b32d4caf3
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Automated tests often need to load some data from external files.
Currently, a wide variety of approaches for this have been used in Qt
autotests, including:
- embed the source directory into the test binary at compile time, and
find the testdata relative to that; this fails when the source tree
is no longer available (e.g. when the tests are deployed to a device).
- use a path relative to the current working directory, and trust that
the caller always sets the current working directory such that the
testdata can be found; this fails when the caller uses a different
working directory than expected.
- use a path relative to QCoreApplication::applicationDirPath();
this fails when source tree != build tree (since testdata is not
automatically copied into the build tree).
- compile the files into the binary using the Qt resource system; this
should work, but does not allow for testing of code which genuinely
needs external files.
It seems that there is not a simple method for determining the testdata
path which can be reliably used in all circumstances, so various tests
have reinvented the testdata location method in different ways.
Therefore, this is a good candidate for an addition to the testlib API.
The current implementation of QFINDTESTDATA is able to find testdata
in all three of (build tree, install tree, source tree), in that order.
Change-Id: Ib2fed860723ccf437240da3b00db22dfe1a6b56c
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Currently QTest::newRow function expects to have correct tag string for
each test data. This was enforced by a simple assert. By adding a
an assert with message we might simplify debugging of a test that
generates test cases.
Change-Id: I84ebb397264c99e7bb46d281fd38583dd2d6964c
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
To instrument a Qt application or library with the TestCocoon coverage
tool, do `CONFIG+=testcocoon' in the application .pro file.
To instrument Qt itself with testcocoon, use the `-testcocoon' configure
option.
Change-Id: Ie77109a078d11ea51f7a073621e0df9c752c44ae
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
The QTest::qWait() function does not handle DeferredDelete, in this case
all deleteLater() calls before the qWait() won't be processed during the
wait. Add an explicit sendPostedEvents(0, QEvent::DeferredDelete) to fix
this problem.
Task-number:QTBUG-22633
Change-Id: I2c5574b4e7d3c070fad6382dc36ddfd1dfac50d6
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
The QWindowSystemInterface mouse functions now have keyboard
modifiers parameter, make use of them.
Task-number: QTBUG-21743
Change-Id: I65ba1095825b81d575d314c1de2a45cef28e697a
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
(Note: This feature is ported from Qt 4.8.
See the following commits:
01575deafb7d26ca2431374e92c6d71de96547c7
4866d1ba8afbab61e102942d1ea93b81fea053d6
)
Passing the -datatags option to a QTestLib program prints the
available data tags to standard output.
For completeness, the test case name is also printed
at the start of each output line. (Although the file name
is supposed to match the lower-case version of the test case
name, this is currently not true in all cases (particularly not
under tests/benchmarks/). Even if there was a script to enforce this
convention, the -datatags option provides this information in a
reliable way.)
Data tags for each test function (f() in this case) are printed in
four different ways depending on the presence of local and global
data tags:
Case 1: No tags:
tst_MyTestCasetst_MyTestCase f
Case 2: Local tags only:
tst_MyTestCase f local tag 1
tst_MyTestCase f local tag 2
...
Case 3: Global tags only:
tst_MyTestCase f __global__ global tag 1
tst_MyTestCase f __global__ global tag 2
...
Case 4: Local and global tags:
tst_MyTestCase f local tag 1 __global__ global tag 1
tst_MyTestCase f local tag 2 __global__ global tag 1
...
tst_MyTestCase f local tag 1 __global__ global tag 2
tst_MyTestCase f local tag 2 __global__ global tag 2
...
...
Note that the string __global__ is assumed to be highly unlikely to occur
in a data tag (if it does, an ambiguity results).
Change-Id: Ib51aa0c3c32ad52e52ce519729292cf8f0ec5d50
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
The standard C getenv() returns NULL if the requested environment
variable is not found.
In Qt4 and later, qgetenv() does not return a null pointer if the
requested environment string is not defined. Instead it returns a
QByteArray containing an empty string. If using qgetenv(), there is no
way to tell the difference between an undefined environment variable
and one which is defined to be the empty string.
In testlib, all calls to qgetenv() were checking whether the returned
QByteArray's constData() returned a null pointer, but that would never
happen. These calls must instead check whether the QByteArray contains
a non-empty string.
Change-Id: I342f0e8b196896c26cccce3ff169fa1b9669b5ff
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>