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>
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 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>
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>
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>
mkdtemp(10*X) replaces all 10 chars on Mac, while on linux it only
replaces the last 6. Adjusted the too-strict tests to allow for
both possibilities.
Change-Id: Ie6d57bd4947254ad7a39e75ac0e8881cebeaa428
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
When using clang, the forward-declaration test fails to link, unlike
with other compilers. The standard says that deleting a forward-declared
pointer is undefined behavior, so the link failure is a valid result of
trying to do so.
Change-Id: I527b91c15b7d51d9522d95af0630e7dacd26bb30
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
These comments were mostly empty or inaccurate. Appropriate naming of
tests and appropriate placement of tests within the directory tree
provide more reliable indicators of what is being tested.
Change-Id: Ib6bf373d9e79917e4ab1417ee5c1264a2c2d7027
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
As discussed on qt5-feedback / development lists.
Change-Id: If1733369d12daa29054776ec2cbd78e63679768e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
After commit 79f675a1e0, the connect and
disconnect callback API effectively becomes useless. Now that these
callbacks cannot/do not, it makes little sense to keep the backdoors
added for Qt Jambi support.
Remove them for now. Should the Qt Jambi team want/need to port to Qt 5,
we can re-add them, possibly designing a better API for doing so as
well.
Change-Id: I6209a1d647d683c979d5294b632b8c12c0f9f91c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This is a source incompatible change. There is concern that the
convenience of the implicit cast and assignment operators can lead to
misuse. Several commits have already been done that remove excess use
of the implicit cast, which is a *volatile* read every time it's used.
Users of the QAtomic* API should have to think about when they are
loading the value, and if they do or don't need the acquire memory
barrier on load. The code that people would write using this API is
meant to be multi-threaded, concurrent, and correct. The API should not
allow them to inadvertently, possibly unknowingly, shoot themselves
in the foot.
SC-break-rubber-stamped-by: Lars Knoll
Change-Id: I88fbc26d9db7b5ec80a58ad6271ffa13bbfd191f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The test fails if the repository is checked out with
Windows line endings. Try to work around.
Basically, ensure that common developers can conveniently
run the test.
Change-Id: I91f31b830ba7ba305deea782737d4e07a89420eb
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
This is sent when the object's name changes.
tst_moc must be updated since the method count of QObject has changed.
The test assumed that there were 4 invokable methods in QObject. The
new signal is the 5th, which breaks the test's assumptions. Fix this
as well.
tst_QObject must be updated since the
QObjectPrivate::isSignalConnected() method only supports the first 64
signals. With the addition of this new signal, sig61() in the test
becomes the 65th signal, and will always appear connected now.
Task-number: QTBUG-13999 (related)
Change-Id: Ie87893c71a231fafa7ccf2f16102238a7be8327a
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
By adding anonymous namespace and static linkage we are reducing
visibility of implementation of these macros.
This patch also fixes warning about a declared but unused variable which
was issued by gcc 4.6 for Q_CONSTRUCTOR_FUNCTION.
Change-Id: I2cb70ad4c93f6f77e5518420abcce6fd4cadccfa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
On Windows (only), this test depends on some Q_AUTOTEST_EXPORT symbols.
Change-Id: I3b2ef8dcd56b8860f02fc28f45823b889e794909
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
In .pro files, removed wince/symbian-specific DEPLOYMENT cases and
replaced them with TESTDATA where appropriate.
In .cpp files, removed SRCDIR and relative paths to testdata and
replaced them with the QFINDTESTDATA macro where appropriate.
Modified test helper apps/libs to install themselves under the test
they relate to.
This change allows corelib tests to be correctly installed, along with
their testdata, via `make install'.
Change-Id: I5e202e2f3b577af7e39072d5c9fe13e0ca125304
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
The QString autotest shares test data between the remove() and replace()
tests because those functions are very similar. Unfortunately, when an
integer overflow bug was found in remove() the regression test was not
shared with replace(), which prevented the same integer overflow bug
from being discovered in replace().
This commit improves the test by sharing the overflow test data between
both functions, thus demonstrating the remaining bug.
Task-number: QTBUG-22967
Change-Id: I2778249800f74799d890eefa9227ca8ddd8fbaa3
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Rename the qUncompress test to make clear that the test only deals with
uncompressing corrupted data and add a message making it clear that this
test will produce some warning messages.
Don't skip creating the test data, as that prevents the test output
reporting exactly what is skipped.
The expected output is the same for every row (an empty QByteArray), so
don't bother storing that in the data table.
Change-Id: I59f1cc91a941bcaadacb2a613dd5eca2564961c1
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
QWinEventNotifier is an essential class if you're using native Windows
Overlapped IO and need to convert it to Qt signals. However the header
is marked private.
Task-number: QTBUG-68
Change-Id: I22e9a84da97f969ddb82e9ba15e604a01abd80d0
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
For compilations without variadic template support
Change-Id: I78af4f6022ad7a0923e5c5788a34eb7d834f50f3
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Currently there seems to be no precise definition of what
an integrationtest is in the context of Qt testing.
To avoid confusion, the tests under integrationtests/ are
moved into other/ (which is effectively where we keep
tests that don't clearly fit into any other category).
Tests can be moved back into an integrationtests/ directory
at a later point, should an unambiguous definition be established.
Change-Id: I3bb289be2dc2aca11b51a8ce8fcc5942f06d6c5c
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Remove references to the old bug tracker. The data from the old bug
tracker is no longer accessible, so these markers are meaningless.
Change-Id: Ib9d029d52b70fd0a512b9532d65f03763eabfe57
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
For queued connections, the args[0] is set to null as it make no sens to
forward the return value to the signal.
So we need to check in the operator, that the pointer is not null.
(container.data is args[0])
Change-Id: I80bde66f1ec19de0f4962c80e5b2797d2819075c
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
This commit also improves the related documentation a bit.
The test is copied from the test with the old syntax, but all the
connection statement are changed to use the new syntax
Change-Id: Ia5630ca4335b9f8ca6d724ae3c8750d6f0804d8e
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Before, the constructor was called for complex objects, but
POD were left unitinialized. Now, they are zero-initialized.
Also add test for return values
Change-Id: Iff9bf6687589d7b7395a71fb6f650ab8aa2b6bd1
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
This add an overload to disconnect which is symetrical to the new
syntax of connect.
It is possible to diconnect connection like this:
QObject::connect( sender, &Sender::valueChanged,
receiver, &Receiver::updateValue );
QObject::disconnect( sender, &Sender::valueChanged,
receiver, &Receiver::updateValue );
This overload only work with pointer to member function, and not static
functions or functors.
The test is copied from tst_QObject::disconnect(), just
changed the syntax of the connection and disconnection
Change-Id: Ia8f819100cb12098e32877522b97b732b1e676a8
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Partial revert of 94fc875079. All dependent
modules need to be specified in the QT variable, except core and gui, which
are there by default.
Change-Id: Ie8ffed56de03a37da191772fa321ed162e44a50d
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
MSVC cannot decide on an overload for pow().
Change-Id: Ied3fbc0de403774d9f85738852cf671ce42cd1c1
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Don't name test functions using task identifiers from obsolete bug
trackers.
Change-Id: Iba6ae8ad3b39e365c5510ed5c86749a167572829
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
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>
Use QVERIFY2 to include errorString() in the failure message.
Change-Id: Iecb4e7694c3d71bfb786908a6a6c26b187d60c8f
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
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>
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>
Commit f4b6628083 fixed it on windows.
Now test it work within QAtomicPtr
Change-Id: Ibf5c31a133d6d544a78ce626fac9085b73c97fd5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
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>
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>
QMetaCallEvent now can handle a pointer to QSlotObjectBase
Change-Id: I94da1e68ce9bb1fd96a9ae013a389552eb625faa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
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.htmlhttp://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>