Commit Graph

221 Commits

Author SHA1 Message Date
João Abecasis
3fad9a846f Retire the generic Q_REFCOUNT_INITIALIZER macro
This was only being used to initialize static read-only RefCount
instances, where the value is hard-wired to -1. Instead of allowing
initialization with arbitrary values (which for a reference count can be
error prone) the intent of the macro is made explicit with its
replacement Q_REFCOUNT_INITIALIZE_STATIC.

Change-Id: I5b0f3f1eb58c3d010e49e9259ff4d06cbab2fd35
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-01-04 23:38:06 +01:00
João Abecasis
7d16ea4033 Introducing QArrayDataPointer
This class provides RAII functionality for handling QArrayData pointers.

Together with QArrayDataHeader and QArrayDataOps, this offers common
boilerplate code for implementing a container which, itself, defines its
own interface.

Change-Id: If38eba22fbe8f69038a06fff4acb50af434d229e
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2011-12-14 17:35:40 +01:00
João Abecasis
9c04f721a6 QArrayDataOps::insert
Inserting elements anywhere in the array requires moving the elements
that follow out of the way and writing in the new ones. Trivial for PODs
and almost as much for movable types.

For "complex" types, we start by extending the array with placement new
and copy constructing elements. Then, copy assignment resets the
elements that were previously part of the array.

QPodArrayOps uses non-throwing operations. QMovableArrayOps provides
full rollback in the face of exceptions (strong guarantee).
QGenericArrayOps enforces that no data is leaked (all destructors
called) and invariants are maintained on exceptions -- the basic
guarantee.

With 3 different implementations, 2 of which are non-trivial, this
operation is a good showcase for QArrayOpsSelector and the different
implementations. As such, it warrants its own commit.

Change-Id: I21d9b4cb8e810db82623bcd1d78f583ebf3b6cb7
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2011-12-14 15:55:47 +01:00
João Abecasis
4da0b5fc02 QArrayDataOps: generic array operations
This class, the selector and underlying implementations provide
specialized operations on QArrayData, while allowing for optimized
implementations that benefit from type-specific information.

Currently, offering a generic implementation and specializations for
PODs (trivial ctor, dtor and move operations) and movable types (can be
trivially moved in memory).

Change-Id: I2c5829b66c2aea79f12f21debe5c01f7104c7ea3
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2011-12-14 14:09:53 +01:00
João Abecasis
bd0b49efe0 Add test for GCC bug #43247
A bug has been reported against GCC 4.4.3 (present in other version as
well), where the use of an array of size 1 to implement dynamic arrays
(such as QVector) leads to incorrect results in optimized builds as the
compiler assumes the index to be 0.

This test tries to ensure QArrayDataHeader is not affected by this bug,
as QVector currently is.

Change-Id: Id701496bae4d74170de43399c1062da40eb078e7

Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2011-12-11 12:07:21 +01:00
João Abecasis
390eec325b template<class T> struct QTypedArrayData
QTypedArrayData is a typed overlay for QArrayData, providing convenience
and type-safety. It adds no data members to QArrayData, thus avoiding
compiler-generated warnings for aliasing issues when casting back and
forth.

Change-Id: I969342a30989c4c14b3d03d0602e3d60a4cc0e9d
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2011-12-11 12:07:13 +01:00
João Abecasis
0806bc2d1b Allocate/free support in QArrayData
Centralizing QArrayData memory management decisions in one place will
allow us to be smarter in how we allocate header and data.

At the moment, these are allocated as a single block. In the future we
may decide to allocate them separately for "large" data or specific
alignment requirements.

For users of QArrayData this remains transparent and not part of the
ABI. The offset field in QArrayDataHeader enables this.

This also hard-wires allocation of empty arrays to return shared_empty.
Allocating detached headers (e.g., to support fromRawData) will thus
require explicit support.

Change-Id: Icac5a1f51ee7e468c76b4493d29debc18780e5dc
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2011-12-09 22:49:08 +01:00
Oswald Buddenhagen
4714f86c54 Merge remote-tracking branch 'gerrit/master' into containers
Change-Id: I01f94564c17d68872839be5396c24b661e53d571
2011-12-09 17:11:20 +01:00
João Abecasis
d8374aebc6 Fixes for tst_QTemporary(File|Dir)::nonWritableCurrentDir
- 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>
2011-12-09 14:15:37 +01:00
Friedemann Kleint
e8efad1b22 QProcess-test: Fix executable location on Windows.
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>
2011-12-09 12:25:14 +01:00
João Abecasis
12dffdae75 Promote openStandardStreams sub-tests to top level
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>
2011-12-09 10:17:55 +01:00
Friedemann Kleint
2509a5b5a4 QFile-test: Do not fail when run with redirected stdout/stderr.
Check whether stdout/stderr is sequential.

Change-Id: Ia6311e265f0da03dce5b05d78a2058e0c2098bbf
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2011-12-09 08:23:53 +01:00
Friedemann Kleint
04cac41e58 QProcess-Test: Improve error handling.
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>
2011-12-09 08:23:27 +01:00
Joerg Bornemann
f7d11b216a testProcessSpacesArgs fixed
Target names with spaces must be quoted.

Change-Id: I913ef386353fc75991c8db4e3205ab511fc1f1a9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2011-12-09 01:01:01 +01:00
David Faure
5cb05091d2 Improve/cleanup qtemporarydir (and qtemporaryfile) unit tests
To follow the comments in the review by João Abecasis.

Change-Id: Ie566705d3b4071b8628d269246aadcde4866f34f
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2011-12-08 21:12:57 +01:00
David Faure
ca1af75fb2 Fix QTemporaryDir unittest on Mac OS X
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>
2011-12-08 16:00:53 +01:00
David Faure
c44a67e6f3 Port externaltests.cpp to QTemporaryDir
Change-Id: I6097ea92dd4b300cb562510e0ea27cee3c01b466
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2011-12-07 18:58:43 +01:00
João Abecasis
d5d073f874 SimpleVector as a test case for QArrayData
SimpleVector is meant solely as a test case and reference container
implementation based on QArrayData functionality.

It shall not replace QVector or friends.

Change-Id: I5c66777c720f252c8e073a2884c6d5f1ac836d0e
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2011-12-07 02:01:42 +01:00
Bradley T. Hughes
b6e9ff22a3 Fix tst_QSharedPointer invalidConstructs:forward-declaration failure
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>
2011-12-06 18:37:54 +01:00
João Abecasis
bce08ba220 Introducing QArrayData
Modeled on QByteArrayData/QStringData/QVectorData, the intent is to
unify book-keeping structs for array-like data and enable sharing of
code among them.

As in those structures, size (and alloc) data member(s) specify the
number of *typed* elements the array does (and can) hold.  The size or
alignment requirements of those objects is not tracked in this data
structure and needs to be maintained by its users.

Contrary to QByteArrayData and QStringData, QArrayData's offset member
keeps a *byte* offset to the actual data array and is computed from the
beginning of the struct.

Shared-null and -empty functionality is provided by QArrayData and
shared among all users.

Planned features include setSharable (force deep copies), fromRawData
(detached header and data allocations) and literals a la QStringLiteral
(static immutable instances), thus covering the functionality needed for
QByteArray, QString and QVector.

Change-Id: I9aa709dbb675442e6d06965efb8138ab84602bbd
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2011-12-06 16:57:17 +01:00
Jason McDonald
e3640d1bdd Remove TESTED_CLASS/TESTED_FILES comments from tests.
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>
2011-12-06 02:19:25 +01:00
Jędrzej Nowacki
d242d78339 Make tst_QVariant::canConvertMetaTypeToInt more verbose.
Change-Id: If17cbd1154c4fd3c006648b28e91a009de5b373b
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2011-12-05 17:23:00 +01:00
David Faure
e999c543a0 New class QTemporaryDir.
As discussed on qt5-feedback / development lists.

Change-Id: If1733369d12daa29054776ec2cbd78e63679768e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2011-12-02 21:04:34 +01:00
Bradley T. Hughes
ad8edac53c Remove QInternal callbacks and internal functions
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>
2011-12-02 15:59:58 +01:00
David Faure
1bb51cb8b1 Implement QDir::removeRecursively
Task-number: QTBUG-4592
Change-Id: I363e2c24d1c0ada975b8b927d7c6e776b8aae579
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2011-12-02 15:59:58 +01:00
Bradley T. Hughes
409b3b42a2 Remove cast and assignment operators from QAtomicInt and QAtomicPointer
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>
2011-12-02 13:21:32 +01:00
Friedemann Kleint
b0b22e8d49 Windows: Stabilize qpauseanimation test.
Change-Id: I93b470d89009d4573cbe3ec5018cddc40f4a4623
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2011-12-02 08:24:57 +01:00
Martin Jones
9b17557f3b Revert "Add QObject::objectNameChanged(const QString &objectName) signal"
This reverts commit ba635d7e74.

Breaks tests in declarative:
tst_qdeclarativeecmascript::deleteLater
tst_qquickvisualdatamodel::objectListModel

Change-Id: I467b45109332e66fc62f3de00f376b1b88ab19ca
Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
2011-12-02 06:03:12 +01:00
Friedemann Kleint
f0942bd8cb Windows: Fix qabstractfilenengine-test.
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>
2011-12-01 22:37:31 +01:00
Bradley T. Hughes
ba635d7e74 Add QObject::objectNameChanged(const QString &objectName) signal
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>
2011-12-01 17:46:57 +01:00
Friedemann Kleint
5abf5b1f7c Windows: Fix compilation of qdir test.
Introduced by 3385fb91e1.

Change-Id: If47a9874cccb7b64840e77b1f654ba8e1cf372e0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2011-12-01 14:45:45 +01:00
Jędrzej Nowacki
e650859dc9 Improve Q_CONSTRUCTOR_FUNCTION and Q_DESTRUCTOR_FUNCTION macros.
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>
2011-12-01 14:35:42 +01:00
Rohan McGovern
4eedb335c6 Mark tst_qfilesystementry as private test on Windows.
On Windows (only), this test depends on some Q_AUTOTEST_EXPORT symbols.

Change-Id: I3b2ef8dcd56b8860f02fc28f45823b889e794909
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
2011-12-01 09:18:57 +01:00
Rohan McGovern
3385fb91e1 Fixed installation of corelib tests
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>
2011-12-01 09:12:52 +01:00
Jason McDonald
d8492599f1 Improve QString autotest.
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>
2011-12-01 06:12:34 +01:00
Jason McDonald
d7fb773727 Minor improvement to QByteArray autotest
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>
2011-12-01 04:22:01 +01:00
Debao Zhang
7f64c3ddc8 Make QWinEventNotifier part of the public API
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>
2011-12-01 02:01:44 +01:00
Olivier Goffart
cc9c85ecd6 Support for up to 6 arguments in the new connection syntax
For compilations without variadic template support

Change-Id: I78af4f6022ad7a0923e5c5788a34eb7d834f50f3
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2011-11-30 17:19:07 +01:00
Jo Asplin
9acec431c3 Moved integrationtests/* into other/
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>
2011-11-30 09:30:22 +01:00
Jason McDonald
75b66dc8b0 Cleanup corelib autotests
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>
2011-11-30 07:49:32 +01:00
Olivier Goffart
55b974faa1 Fix Qt::QueuedConnection when signal has a return value
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>
2011-11-30 01:04:12 +01:00
Olivier Goffart
0dec6250f7 Support Qt::UniqueConnection in the new connection syntax
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>
2011-11-29 17:11:59 +01:00
Olivier Goffart
1c5db1aff3 Initialize the return value of signals
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>
2011-11-29 17:08:39 +01:00
Olivier Goffart
ed0b262de9 QObject::disconnect with new syntax
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>
2011-11-29 17:08:39 +01:00
Friedemann Kleint
ae768911ee Fix linking of autotests on Windows.
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>
2011-11-29 12:28:30 +01:00
Friedemann Kleint
ec43408d44 Fix compilation of qeasingcurve autotest on Windows.
MSVC cannot decide on an overload for pow().

Change-Id: Ied3fbc0de403774d9f85738852cf671ce42cd1c1
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
2011-11-29 12:28:06 +01:00
Jason McDonald
c5b55d4403 Cleanup corelib autotests
Don't name test functions using task identifiers from obsolete bug
trackers.

Change-Id: Iba6ae8ad3b39e365c5510ed5c86749a167572829
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-29 05:16:52 +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