Commit Graph

939 Commits

Author SHA1 Message Date
Toby Tomkins
e881f4f5fd Fixed Qtbase OSX specific namespace compilation.
Change-Id: Idacfa679df7aa6417f8017f80928907830d15df2
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-29 03:44:58 +01:00
Olivier Goffart
3ad7ddf265 Fix crash in tst_qatomicpointer test
if given char*, QCOMPARE will try to compare the strings pointed by the
char*

In this case, the char* just point to garbage, we just want to compare
the addresses.

(Was changed in commit 6fcfae99d3)

Change-Id: I9edb2b676aedf67a252aea6a41d56cd1eef7befc
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2011-11-29 00:07:02 +01:00
Rohan McGovern
ab79c7c092 Improved failure messages from tst_qlibrary
Use QVERIFY2 to include errorString() in the failure message.

Change-Id: Iecb4e7694c3d71bfb786908a6a6c26b187d60c8f
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
2011-11-28 08:13:41 +01:00
Jason McDonald
e15548d3e4 Fix sanity check of network test server
Some of Qt's autotests depend on access to a test server.  For each test
that used the test server, tests/auto/network-settings.h created a
global object to verify at startup that host lookups to the test server
will succeed (and abort the test otherwise).

There are two problems with that approach:

First, the sanity check happens before main(), and thus before the test
framework has started logging test results.  This means that if the
sanity check aborts the test, the failure message will not be visible in
the test output if logging to a file or will cause the output to be
malformed if logging to the console in XML format.

Second, since Qt 4.7, the host lookup uses a class that connects to the
QCoreApplication instance, which doesn't exist before main(), and this
caused all tests that included network-settings.h to output an error
message from QObject::connect() at the beginning of the test.

Both of these problems are solved by removing the global object from
network-settings.h and instead performing the sanity check in the
initTestCase() function of each test.

Task-number: QTBUG-22876
Change-Id: Id49c1826906327bf571686cc11527f0265e5af44
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-28 08:13:41 +01:00
Jason McDonald
cbcdb5f4cf Correct usage of network-settings.h.
Four of the modified files only use functions from network-settings.h
on Windows, and the other three files don't use anything from that
header.

Change-Id: Ifa4b0319d14367735b859e538921fa0eeeccce1a
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-28 08:13:41 +01:00
Glenn Watson
de9d845441 Add support to moc for registering non-local enums via Q_ENUMS.
When using the Q_ENUMS macro to register an enumeration in a class
with moc, it's now possible to provide a scoped enumeration that
exists in another class. This adds the enum class scope to
a metaobject's list of related classes stored in the extradata
field.

This allows the declarative code to handle non-local enums in
signal and slot functions that are exposed to QML.

Task-number: QTBUG-20639
Change-Id: I94f5292818095fda75762bd1508ba5c69de19503
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2011-11-27 22:51:39 +01:00
Olivier Goffart
e1147dcb4b Test QAtomicPointer<const T>
Commit f4b6628083 fixed it on windows.
Now test it work within QAtomicPtr

Change-Id: Ibf5c31a133d6d544a78ce626fac9085b73c97fd5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2011-11-26 13:10:09 +01:00
Stephen Kelly
c1007112c8 Be specific about what part of the model is being re-layouted.
Change-Id: I6b6fe98929543447f945a335c33960823c0d1a4a
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2011-11-25 14:37:02 +01:00
Jason McDonald
e08410ab8d Cleanup corelib autotests
Bug trackers come and go, so using bug identifiers in function and test
case names will ensure that those names eventually become meaningless.
It is better to choose a meaningful name and provide explanatory
comments where appropriate.

Change-Id: I67c27782ef21b5d4eaab4854079a043c8ef6957b
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-25 07:56:16 +01:00
Olivier Goffart
489a39aacc More tests for the new connection syntax.
Those tests are the one from Thiago's C++0X implementation
The rvalue references ones are commented out because moc do not
understand them yet
But supporting them may come later.

Change-Id: I6b0720e7f2992be9f7e34770960fa58fa456a54b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2011-11-25 01:12:14 +01:00
Olivier Goffart
66b659c8a4 Add support for QueuedConnection when connecting using the new syntax
QMetaCallEvent now can handle a pointer to QSlotObjectBase

Change-Id: I94da1e68ce9bb1fd96a9ae013a389552eb625faa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2011-11-25 01:12:14 +01:00
Olivier Goffart
583c55b243 New QObject connection syntax
In addition to the old connection syntax, you can now connect using function pointers.

    connect(sender, &Sender::valueChanged,
            receiver, &Receiver::updateValue );

You can connect also to functor or C++11 lambdas

The connections are now type safe (no more problems with namespaces
or typedefs).  Implicit type conversion is also supported.

The new syntax forces us to change the meaning of signal form
protected to public, in order to be able to access the signal's
address everywhere

The way it works is by introducing new overload of QObject::connect
that take function pointer as parametter. Those new overload are template
function, that are implemented inline. The actual implementation is
in QObject::connectImpl which take a QObject::QSlotObject* as parametter
for the slot.  That slot object contains a virtual function which call
the slot which has to be implemented in the header as it depends on the
template parametter.  So the internals of QObjectPrivate::Connection
will store this QObjectSlot* in order to be able to make the call.

You can read a full description here:
http://developer.qt.nokia.com/wiki/New_Signal_Slot_Syntax

History of commits before it was imported on gerrit:
https://qt.gitorious.org/~ogoffart/qt/ogoffarts-qtbase/commits/qobject_connect_ptr

Thread on the mailing list:
http://lists.qt.nokia.com/pipermail/qt5-feedback/2011-August/000796.html
http://lists.qt.nokia.com/pipermail/qt5-feedback/2011-September/001248.html
(The discussions on the mailing list were about trying to find a
solution that do not need making signals public, but no user friendly
solution was found)

Note: support for QueuedConnection, and the symetric QObject::disconnect is
added in another commit.
Qt::UniqueConnection is not supported yet in the new overload.

Change-Id: I67d08436b0720e7f2992be9f7e34770960fa58fa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2011-11-25 01:12:14 +01:00
Olivier Goffart
79f675a1e0 Change the return value of QObject::connect
From a bool to a handle to to connection.

Also added a new overload of disconnect that disconnect a handle

This is required because with the new syntax taking lambda or functors,
it is the only way to disconnect a connection (as it is impossible to
compare functors)

The new return value is QMetaObject::Connection, it is a wrapper around
the internal QObjectPrivate::Connection.
QObjectPrivate::Connection is now reference counted.

tst_qglobal.cpp:
   This test set up an internal callback, and the callback do not set any
   proper connection handle (and tbh,  it would be hard for it to do so).
   So the returned QMetaObject::Connection is invalid, and ok is false
   (Internal callbacks are only used for jambi and should probably be removed)

Change-Id: I111626fb4f47efc4db5e2ea5bff9da15f08fea7b
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2011-11-25 01:12:14 +01:00
Stephen Kelly
8f1868e7c3 Add a parents parameter to layoutChange signals.
This allows for more focussed notification of what part of the
model has changed layout.

The slots in the proxy models can be more optimized later.

Change-Id: I1bd17465b4be6f8efdc107036db897c557fcb519
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2011-11-24 16:46:15 +01:00
Jason McDonald
170b9a82ba Improve QVector autotest
Ensure that data row names are unique.

Change-Id: Ia6cf6e440d631928ae3352d7305c6cf2ee5b2a0c
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-24 10:38:15 +01:00
Jason McDonald
d34c8b55f3 Only use QVERIFY in test functions.
The modified test was using QVERIFY in the destructor of a local class,
but QVERIFY should only be used directly in a test function.  This
commit changes the local class to record the result of the test and
verifies that result in the test function.

Change-Id: Ie68ac6aa880368c961ebfa67cd452f0fbf26db89
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-24 05:56:48 +01:00
Jason McDonald
f32452e948 Add missing indentation to QFuture test.
Change-Id: Iaceaa79237d5ef6e81d1d16dc5e3fd3d97631f3a
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-24 05:56:42 +01:00
Samuel Rødal
5116a25a55 Fixed regression in tst_qscreen.
The ScreenOrientation enum was changed so that the values are power of
twos, angleBetween() needed to be fixed in order to reflect this.

Task-number: QTBUG-22554
Change-Id: Ia45dd6643b40b14204abf967b00c0d04834736a3
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2011-11-23 22:23:55 +01:00
Sami Rosendahl
b851c764a6 Fix stack overwrite in QDBusDemarshaller
QDBusArgument extraction operators and QDBusDemarshaller that implements
the extraction do not check the type of the extracted value.
Helper function template qIterGet in qdbusdemarshaller.cpp that is used
for extracting basic data types only reserves space from the stack for
the expected type as specified by client.
If the actual type in the DBus parameter is larger stack will be
overwritten in the helper function by at most 7 bytes (expected one byte,
received dbus_uint_64_t of size 8 bytes).

The fix always reserves space for the largest basic type dbus_uint64_t
readable by dbus_message_iter_get_basic API.

See also http://dbus.freedesktop.org/doc/api/html/group__DBusMessage.html#ga41c23a05e552d0574d04

Task-number: QTBUG-22735
Change-Id: I9aa25b279852ac8acc40199a39910ea4002042d7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2011-11-23 19:14:12 +01:00
Frederik Gladhorn
beb72b2fbf Remove virtual child integers.
This makes the accessibility apis much
simpler and less error prone.

Disable the itemviews implementation that is in complex widgets.
The itemviews will use the new code from itemviews.h/cpp everywhere now.

QToolBox was broken before, now at least it simply exposes all its children.
The children are the buttons (tabs of the toolbox) and their contents.

Change-Id: I45e218f49f02aebbd678ddfe29f94c2a112a2125
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
2011-11-23 14:54:01 +01:00
Honglei Zhang
1d3cfdbfa1 SQLite support only one statement at a time
SQLite driver support only one statement at a time. This fix makes the
exec and prepare call failed if more than one statements are given.
This is bug fix for QTBUG-21884. Also the behaviour is documented in
the API specification.

Task-number: QTBUG-21884
Change-Id: If1e25a0dd9f9ee38961ef478fc7909f6b05e360a
Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
2011-11-23 08:36:14 +01:00
Jason McDonald
d1e7294cd2 Remove misleading comment.
In the QProcess test, QHostInfo is used as a quick and easy way to
create a background thread, and so is not (entirely) unnecessary.

Change-Id: I7204f113e7bc8a4b312d5a20f0a6ee076c56b35d
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-23 07:06:24 +01:00
Rohan McGovern
9ffd7a339f Added build system support for installing tests.
Tests will install under $$[QT_INSTALL_TESTS].

TESTDATA may be used to install additional testdata required by the
test.

The default install rule may be disabled by
CONFIG+=no_testcase_installs.

Change-Id: I204de60c8e844775906ffd016ca50bffbb414142
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2011-11-23 00:13:46 +01:00
Holger Hans Peter Freyther
01c795bcd1 uclibc: fenv.h does not define the necessary things.
libstdc++ provides the fenv.h found and for uclibc default toolchains
the bits/c++config.h has _GLIBCXX_HAVE_FENV_H undefined leading to
no import of the uclibc fenv.h

Change-Id: I53173b099f3d8791f527f1ccb60991de57cd19db
Filed: https://bugs.busybox.net/show_bug.cgi?id=4484
Reviewed-by: Harald Fernengel <harald.fernengel@nokia.com>
2011-11-22 15:17:08 +01:00
Holger Hans Peter Freyther
c226021600 uclibc: Make the oomsimulator compile with uclibc
In the infinite wisdom uclibc defines __GLIBC__ but is not a
full drop-in replacement for the GLIBC. Check for !UCLIBC. Make sure
there is a disableHooks in case the GLIBC code is not compiled

Change-Id: I246d3ee7c1d3f48f7f6445daa01a4f001b9a3cb0
Reviewed-by: Harald Fernengel <harald.fernengel@nokia.com>
2011-11-22 10:54:57 +01:00
Toby Tomkins
ece8f9cd51 Revert 3a0f5d04fc
The removal of plugin cache in qt5 (8ed47d961d)
means that only the original loading error (from QElfParser) is reported.
In Qt4 this was previously two different strings depending on if the library
had been previously cached.

Task-number: QTBUG-22834

Change-Id: I15a4adc7d0f8f23f16bb2aa8ba8b968db770f074
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-22 08:57:08 +01:00
Jason McDonald
bd3477eebc Remove reset test from QTimeLine.
QTimeLine::reset() never made it into the public API. Instead
QTimeLine::start() always starts from the beginning.

Remove the commented-out test for reset() and related remnants in other
tests.  Restarting a timeline using QTimeLine::start() is already tested
by the restart() test function.

Change-Id: Ia5c767ddae0781d645a407fbea76e80672895aab
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-22 00:33:53 +01:00
Jason McDonald
36ee00c9f5 Add test for QTimeLine::toggleDirection()
Before QTimeLine made it into the public API, the toggle() function
became toggleDirection() and isReversed() became the more generic
direction().  This commit uncomments the old toggle() test and uses the
final function names.

Change-Id: Ie3379f32ff0c78436f33c2733232d795ca88152b
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-22 00:33:44 +01:00
Jason McDonald
cf1de2f072 Restore commented-out data in QString test.
The restored test data was commented-out before the tests were imported
into the Qt repository in 2006, but appears to be valid and passes on
Linux.

Change-Id: I75795bf2b0b45fc2331bca6ac8d89f57cf12ed3d
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-22 00:33:38 +01:00
Jason McDonald
e026cbefc6 Remove obsolete data from QStringRef test.
The removed data was copied from the QString test (from which it has
since been removed) and wasn't valid, as comments indicated.

Change-Id: I44f066e41d28333326ad97f652c0a6813a173f15
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-22 00:33:27 +01:00
Jason McDonald
f9111355f2 Remove obsolete code from QRegExp test.
The removed test functions were all empty and have been commented-out
since the tests were imported into the Qt repository in 2006.

Change-Id: I4ce86440aed355352a26ebefeafc95eeda1efbdd
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-22 00:33:12 +01:00
Joona Petrell
0c8f471c96 Remove handlesInputPanelVisibility() deprecation mechanism
Task-number: QTBUG-21964
Change-Id: I508ba690c90369d31ca33390d3001064857fb62e
Reviewed-by: Pekka Vuorela <pekka.ta.vuorela@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2011-11-21 22:46:11 +01:00
Jason McDonald
0097d2daba Removed commented test data from QUrl test.
The removed test data is invalid for the toString() test function --
QUrl::toString() won't eliminate relative paths from URL's, you need to
call QUrl::resolved() to do that.  Add this test data to the test for
QUrl::resolved(), as the existing tests don't seem to cover the case of
a complete URL containing a relative path.

Change-Id: Idb0f4eac9cc75258a8e17f10fa95ddb75f01d470
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2011-11-21 18:47:58 +01:00
Frederik Gladhorn
6e7f08182e Accessibility: Clean up usage of navigate.
Prefer to use parent/child functions instead.

Change-Id: Ic92165b9439eb750c9d762ddf5dcd2a5ccf0277d
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
2011-11-21 15:53:16 +01:00
Stephen Kelly
100908e400 Add a roles argument to the dataChanged signal.
This allows more granular reporting of what has changed.

This change is binary incompatible and source compatible.

Change-Id: I7c5beaee651a24780cc94e41383f7a80210bc603
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2011-11-21 14:24:36 +01:00
Bradley T. Hughes
448e1e620c Re-enable the opengl autotests on Mac OS X
All tests pass.

Change-Id: I6fde0da3900292b66f80730f08d3f0afdb0bead8
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2011-11-21 14:24:36 +01:00
Bradley T. Hughes
cd5048a469 Re-enable the v8 autotest on Mac OS X
This tests passes.

Change-Id: Ia1f420c0a241d1259fbb972957b20c37f5f9dfdc
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2011-11-21 14:24:36 +01:00
Bradley T. Hughes
9de3d3621a Re-enable the sql autotests on Mac OS X
The QSql test currently crashes, which can destabilize the CI system
when attempting to re-enable the autotest. Skip this test for now by
disabling the check target for it.

Change-Id: I598f8ca7bce6b6f46daf6a053da5571b62486463
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2011-11-21 14:24:36 +01:00
Bradley T. Hughes
bb493899cc Re-enable the xml autotests on Mac OS X
All tests pass.

Change-Id: I864b12c1045db1b2a25bd8a22635d42d55e5f0de
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2011-11-21 14:24:36 +01:00
Bradley T. Hughes
12872b1221 Re-enable the dbus autotests on Mac OS X
These tests aren't actually enabled due to the lack of dbus, but there's
no reason to explicitly disable the check target because of it.

Change-Id: I685008060c8e8d713cd27e7684cf3d474c0cf55d
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2011-11-21 14:24:36 +01:00
Bradley T. Hughes
3df6508071 Re-enable the testlib autotests on Mac OS X
All tests pass.

Change-Id: If6fa41826299bfc9f712d66df85920f01c3bdef4
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2011-11-21 14:24:36 +01:00
Bradley T. Hughes
ad0edf0316 Re-enable the 'other' autotests on Mac OS X
All tests pass.

Change-Id: I920ef758e0b967a7ba7548e79132a1fbb3cc27c5
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2011-11-21 14:24:36 +01:00
Bradley T. Hughes
8ed7110704 Re-enable the tools autotests on Mac OS X
All tests pass.

Change-Id: I361a0a70ca2993a0ea3bf690c3c97743ec6f5831
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2011-11-21 14:24:36 +01:00
Bradley T. Hughes
74589cde9a Re-enable the integrationtests autotests on Mac OS X
The tst_MacNativeEvents, tst_QAccessibility, and tst_QFocusEvent
tests currently fail, which will block any changes that attempt to
re-enable the autotests.  Ignore the failures for now by marking the
tests as insignificant.

The tst_Lancelot for currently crashes, which can destabilize the CI
system when attempting to re-enable the autotests.  Skip this test for
now by disabling the check target for it.

Change-Id: Icc1dc77ebb9b7be746606aae04c9abf2480d0c3f
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2011-11-21 14:24:36 +01:00
Bradley T. Hughes
84f0add9b3 Re-enable the corelib autotests on Mac OS X
This is the first change to re-enable the autotests for the individual
qtbase modules. This means adding subdir.CONFIG=no_check_target for each
module (except corelib) in tests/auto/auto.pro instead of in
tests/tests.pro

QFileSystemWatcher, QIODeice, QSettings, QTextStream, QSocketNotifier,
QVariant, QPluginLoader, QLocale: These tests currently fail, which
will block any changes that attempt to re-enable the autotests. Ignore
the failures for now by marking them as insignificant.

QAbstractItemModel: This test currently crashes, which can
destabilize the CI system when attempting to re-enable the autotests.
Skip this test for now by disabling the check target for it.

Change-Id: Ie5147d5c5cfae5e7d0a495d5c4788ce92fe2e6d8
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2011-11-21 11:31:35 +01:00
Friedemann Kleint
e8b4c49efd qtbase tests: Fix some warnings
- Fix warnings about QAtomicPointer/Int usage
- Fix some gcc 4.6 warnings about assigned/unused variables

Change-Id: Ib4dbf9110f0dad93ad48e97278310f05fad3a82a
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-21 09:58:23 +01:00
Jason McDonald
ed5583048e Remove obsolete code from QRect test.
The removed code has been commented-out since Qt 4.0 and relates to
QCOORD, which was part of Qt3Support and has thus been removed from Qt5.

Change-Id: I4651738d505234abe9b79ef5045c55cbf132a88e
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-21 08:30:30 +01:00
Jason McDonald
ddefed547a Remove empty functions from QLocale test.
These functions have been commented-out and empty for more than five
years.

Change-Id: I52d6dc0366cd8eae8701b05e4c66e9911bf7e8f7
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-21 08:30:26 +01:00
Jason McDonald
d8ac62c6ec Restore commented-out code in QHash test.
The restored code verifies the following statement in the documentation
of QHash::find():

"If the hash contains no item with the key, the function returns end()."

It is not clear why the code was commented-out in the first place, as
this occurred before the tests were imported into the Qt repository in
2006.

Change-Id: I745393a8e3e728fc60009da07abd038a3d56e99c
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-21 08:30:22 +01:00
Jason McDonald
72c36332c1 Restore commented-out code in QByteArray test.
The restored code was inexplicably commented-out by commit d57aec33
(non-public history), which was only supposed to be changing upper-case
booleans to lower-case.

Change-Id: I1581fc89511f600c614871e1aec6bc030cddf40e
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-21 08:30:17 +01:00