Commit Graph

48 Commits

Author SHA1 Message Date
David Faure
92243bc346 tst_QDBusXmlParser: more reliable solution for setting the seed
As recommended by Giuseppe, don't rely on the env var, but use the
internal but exported seed atomic int. This way, the compiler will
detect breakages, rather than runtime.

Change-Id: Iec2bc88c53532d3463d2dc5c73631fc9bc34747b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-12-20 21:16:53 +01:00
David Faure
aa434bc908 tst_QDBusXmlParser: make XML attribute order deterministic
Avoid QHash randomization so that the order of the XML attributes is stable
This was causing intermittent failures.

Change-Id: I4cc0dba4b0c2ec36601f3b06fb17ff80005cc9fb
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2012-12-14 11:02:47 +01:00
Kevin Ottens
5b3e7c8dfa Generate the introspection string during parsing
Commit 0696071316 moved away from QDom but
also lost the ability to fill the introspection field of the created
QDBusIntrospection::Interface instances. This commit now generate the
string again as we proceed with the QXmlStreamReader based parsing.

Task-number: QTBUG-26668
Change-Id: I8f406e1f4e9d3e667a8557db69da36cac369ba4f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-12-11 07:41:49 +01:00
Marc Mutz
b5b165ffb3 normalise signal/slot signatures [QtDBus tests]
Change-Id: I4a0441d37e455dce28072ee3650b2062bec65759
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-10-19 00:44:54 +02:00
Caroline Chao
ceb5474d5f Test: remove QSKIP in tst_QDBusMarshall::receiveUnknownType
Omit the whole test and relative types if DBUS_TYPE_UNIX_FD is not defined
since the test is not relevant in that case (D-Bus library too old).

Change-Id: I167622f485c0f34d64984c4fa96be974e54f56bc
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
2012-10-17 21:05:57 +02:00
Iikka Eklund
be15856f61 Change copyrights from Nokia to Digia
Change copyrights and license headers from Nokia to Digia

Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
2012-09-22 19:20:11 +02:00
Jan Arne Petersen
a386194f99 Fix QDBusServer with more than one connection
Create a new QDBusConnectionPrivate for every new connection in
qDBusNewConnection instead of creating a single QDBusConnectionPrivate
in the QDBusServer constructor which gets assigned the latest connected
DBusConnection in qDBusNewConnection (and loses track on all previous
DBusConnections).

Also extend tst_QDBusConnection::registerObjectPeer() test with multiple
connections to the server.

Task-Number: 24921
Change-Id: I4341e8d48d464f3fe0a314a6ab14f848545d65a0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-09-14 01:02:06 +02:00
Marc Mutz
ecf7f0d954 Use QStringList::join(QChar) overload where applicable [QtDBus]
This is an automated change performing the following replacements:
                    join\("(.)"\) -> join('\1')
  join\(QLatin1String\("(.)"\)\)  -> join(QLatin1Char('\1'))
  join\(QStringLiteral\("(.)"\)\) -> join(QLatin1Char('\1'))

Change-Id: I807b0e88ac71a0cb367fb4170cca8f2cb0ad43f3
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2012-09-10 00:27:13 +02:00
Thiago Macieira
672b5b7ab6 Set the Qt API level to compatibility mode in all tests.
Qt 5.0 beta requires changing the default to the 5.0 API, disabling
the deprecated code. However, tests should test (and often do) the
compatibility API too, so turn it back on.

Task-number: QTBUG-25053
Change-Id: I8129c3ef3cb58541c95a32d083850d9e7f768927
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-08-01 15:37:46 +02:00
Harald Fernengel
62d481757c Make test work on Mac OS X
Change-Id: I0c2d9bc7500972144d44060f38bc7a5da65ed30f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-06-23 16:25:47 +02:00
David Faure
9724642621 Fix unit confusion in ccf3b9e48b2d773999a9a88e249f79380618cde6
I wrote nonsense in that commit. The older methods that take a timeout
all take milliseconds, and the comments in the unit test really meant
milliseconds, not seconds. 1s is not shorter than 100ms....

Change-Id: Ic18899bb0462d89575dc5a9a311478adc4dea1cb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-05-02 22:49:26 +02:00
Debao Zhang
ade8888603 Don't use obsolete qVariantValue, qVariantCanConvert, etc.
qVariantValue and qVariantCanConvert are Compatibility members, while in
Qt4.8 they are marked as Qt 3 Support Members.

qVariantFromValue and qVariantSetValue are Obsolete members.

Change-Id: Ie8505cad1e0950e40c6f6710fde9f6fb2ac670fd
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-05-02 08:30:59 +02:00
Thiago Macieira
e02a144a3c Finish cleaning up com.trolltech -> org.qtproject in QtDBus
Lots of uses of the annotations and error names, plus a bunch of local
unit test names (including one file that had to be renamed).

The meta object generator is updated to support both the old and new
names. That means some references to com.trolltech *must* remain in the
source code.

Task-number: QTBUG-23274
Change-Id: Icc38ae040232f07c437e7546ee744a4703f41726
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Reviewed-by: Lorn Potter <lorn.potter@nokia.com>
2012-04-16 00:07:39 +02:00
Thiago Macieira
65e75acd05 Update the error codes in QtDBus
Change the old com.trolltech ones to org.qtproject and introduce Use
the alternate domain name for the Qt Project because the dash
character is not valid in interface and error names.

Task-number: QTBUG-23274
Change-Id: Iac1699e70525d67f983c10560932acff6b2ecde6
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
2012-04-16 00:07:25 +02:00
Oswald Buddenhagen
143c4d3e13 Merge remote-tracking branch 'origin/master' into api_changes
Conflicts:
	configure
	src/widgets/styles/qwindowsxpstyle.cpp
	tests/auto/gui/kernel/qwindow/qwindow.pro
	tests/auto/gui/kernel/qwindow/tst_qwindow.cpp

Change-Id: I624b6d26abce9874c610c04954c1c45bc074bef3
2012-04-10 15:31:45 +02:00
Thiago Macieira
bc4f74f586 Don't hardcode the order of elements in QHashes
Instead use QMap if we want a stable order.

Task-number: QTBUG-24995
Change-Id: I93f643df236f5078768f539615fa47163e5262e8
Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-03-28 04:07:16 +02:00
Stephen Kelly
32068cb707 Remove comment about QVariantList and QVariantMap.
They predate Qt 4.5, but it looks like the comments are indicating
that QVariantList and QVariantMap types will use the basic template,
but that is not the case. Instead they will use the compare
specializations for QList<T> and QMap<T> respectively.

Change-Id: Iebf7e9b8aaa8a699ea720090fbf641dfecde0ff7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-28 03:18:56 +02:00
Marc Mutz
6c2695d677 QtDBus: make some constructors explicit
This is a semi-automatic search, so I'm
reasonably sure that all the exported ones
have been caught.

Change-Id: I314d341ad0db4e9d4bbf353a9537c9422ad8a54b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-12 15:22:30 +01:00
João Abecasis
79f2480c86 Merge remote-tracking branch 'origin/api_changes' into containters
Conflicts:
	src/corelib/kernel/qmetaobject.cpp
	src/corelib/kernel/qvariant.cpp
	src/tools/moc/moc.h

Change-Id: I2cd3d95b41d2636738c6b98064864941e3b0b4e6
2012-03-08 12:02:41 +01:00
Jason McDonald
d423fd0975 Avoid using internal testlib API in QDbusConnection autotest.
QCOMPARE should only be used in a test function because it makes the
test function return if the compare fails.  The test wants to compare
without returning on failure because the compare is inside a helper
function called by many test functions, so the test was calling
testlib's internal QTest::compare_helper() functions instead of
QCOMPARE.

This commit makes this code slightly less objectionable by calling the
public QTest::qCompare() instead.

Change-Id: Ida17a641e89f8a297d6a036449f44b33aa266368
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-05 03:44:01 +01:00
Kent Hansen
3b844c16e0 Port QDBusMetaObject to Qt5 meta-property/method descriptor format
Adapts QDBusMetaObject to be in sync with the moc/meta-object
changes for property and method descriptors (storing the name and
argument count of methods, and more elaborate type information).

Now that the method name is stored in the standard method
descriptor, QtDBus doesn't need to store it separately anymore,
and the QMetaObjectPrivate::rawStringData() function can be
removed.

Change-Id: I04efdbe05b52bbd85405e1713509e55308ac42da
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-02-29 12:50:14 +01:00
Kent Hansen
96f2365cf4 Rename QMetaMethod::signature() to methodSignature()
In Qt5 the meta-data format will be changed to not store the
method signature string explicitly; the signature will be
reconstructed on demand from the method name and parameter type
information.

The QMetaMethod::signature() method returns a const char pointer.
Changing the return type to QByteArray can lead to silent bugs due to
the implicit conversion to char *. Even though it's a source-
incompatible change, it's therefore better to introduce a new
function, methodSignature(), and remove the old signature().

Task-number: QTBUG-24154
Change-Id: Ib3579dedd27a3c7c8914d5f1b231947be2cf4027
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2012-02-29 12:50:14 +01:00
Jędrzej Nowacki
51f2a0c331 Cleanup usage of QVariant::Type.
QVariant::Type is marked as obsolete. It is not possible to get rid of
it completely, in a source compatible way, but at least we can remove it
safely from a method arguments list.

Change-Id: I26b58099bfa6d32f3a583a8ae0047f0bb36bcd0d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-02-27 12:47:52 +01:00
Rohan McGovern
e88f9a92b7 Stabilize tst_qdbusabstractinterface and make it XFAIL
This test was written incorrectly in a way which happened to allow it to
pass most of the time (but not all the time).

Reset the state of test objects between each test function, and mark the
broken functions with QEXPECT_FAIL and a link to a task.

Replace the unusual WaitForPinger construct with the usual
QTRY_VERIFY/QTRY_COMPARE method of verifying asynchronous operations.

Task-number: QTBUG-24262
Change-Id: I82d09002307c0b500bf60cd5b583674321b37609
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-02-20 23:34:35 +01:00
Jason McDonald
eb64bb89cf Eliminate duplicate data row names in dbus, tools and xml autotests.
Change-Id: Ic734435f57bb4f2160ecb3bc645e642207931a99
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-02-16 02:00:52 +01:00
Jędrzej Nowacki
56265031b7 Align QVariant::UserType and QMetaType::User
There is no point in keeping separate values which should mean the
same.

QVariant::UserType was used also to construct a valid, null QVariant,
containing an instance of unknown custom type. The concept was strange
and useless as there was no operation that could be done on such
QVariant. Therefore it was dropped.

Please note that the patch slightly changes behavior of different
functions accepting a type id as parameter. Before QVariant::UserType
was an invalid type from QMetaType perspective (id 127 was not assigned
to any built-in type), but QMetaType::User points to the first registered
custom type.

Change-Id: I5c7d541a9affdcdacf53a4eda2272bdafaa87b71
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Andrew Stanley-Jones <andrew.stanley-jones@nokia.com>
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
2012-02-07 08:52:32 +01:00
Jason McDonald
5635823e17 Remove "All rights reserved" line from license headers.
As in the past, to avoid rewriting various autotests that contain
line-number information, an extra blank line has been inserted at the
end of the license text to ensure that this commit does not change the
total number of lines in the license header.

Change-Id: I311e001373776812699d6efc045b5f742890c689
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-30 03:54:59 +01:00
Jason McDonald
629d6eda5c Update contact information in license headers.
Replace Nokia contact email address with Qt Project website.

Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-23 04:04:33 +01:00
Harald Fernengel
0696071316 Remove dependency of QtDBus onto QtXml
Replace the QDom based code in qdbusxmlparser
with code using QXmlStreamReader.

Task-number: QTBUG-20856
Change-Id: I294e3ebd6faa813c20806be3ae225ac00befb622
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-01-22 22:10:02 +01:00
Jason McDonald
1fdfc2abfe Update copyright year in license headers.
Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-05 06:36:56 +01:00
Sami Rosendahl
b9acd85b2f Fix crashes and non-portable functionality in QDBusDemarshaller QByteArray extraction
QDBusArgument QByteArray extraction operator and QDBusDemarshaller that
implements the extraction do not check the type of the extracted value.
When extracting a QByteArray when the value actually is e.g. a struct of
mixed types the byte array extraction will crash as it attempts to extract
the struct data as a fixed array.

The fix adds DBus type checks to QDBusArgument byte array extraction
operator implementations.
The checks invalidate extracting arrays of other types than bytes to a
QByteArray that worked with the unchecked implementation. The rationale
for this restriction is
1) extracting a QByteArray to a variant checks already that the array
   element type is byte
2) Results of extracting arrays of types wider than a byte to a QByteArray
   are architecture-dependent making such code inherently non-portable.

Task-number: QTBUG-22840
Change-Id: Ie20f2adc06c697a68055c803215fb408568fdd90
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2011-12-25 21:58:57 +01:00
Sami Rosendahl
b4398dc4e3 Fix crash in QDBusDemarshaller QStringList extraction
QDBusArgument QStringList extraction operator and QDBusDemarshaller that
implements the extraction do not check the type of the extracted value.
When extracting a QStringList and the value actually is e.g. an array of
bytes the string list extraction will crash as it interprets the bytes as
char pointers.

The fix adds DBus type checks to QDBusArgument QStringList extraction
operator implementations.
The checks are as permissive as possible provided crashes are avoided.

Task-number: QTBUG-22840
Change-Id: I4b67d75b59c5052d939f3a69f3e92dabdb3bdd6b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2011-12-25 21:58:57 +01:00
Sami Rosendahl
8f19f14274 Fix crash in QDBusDemarshaller basic string-like type extraction
QDBusArgument string extraction operators and QDBusDemarshaller that
implements the extraction do not check the type of the extracted value.
When extracting string-like basic DBus type that actually is e.g. an
integer the string extraction will crash as it blindly attempts to use the
integer as a pointer to char.

The fix adds DBus type checks to QDBusArgument string type extraction
operator implementations.
The checks are as permissive as possible provided crashes are avoided.
Previously supported functionality of extracting an object path or type
signature to a string type is retained.

Task-number: QTBUG-22840
Change-Id: I29be1ae592658ca268c65ed692e1d42619d52280
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2011-12-25 21:58:57 +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
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
Sergio Ahumada
141dbaf496 Re-enabled passing test in tst_qdbuspendingcall
tst_QDBusPendingCall::watcher_waitForFinished_threaded()
autotest was fixed by faa6113c41

Task-number: QTBUG-20859
Change-Id: I05aaebfde45862836b10700aa7d9c64e4287466f
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2011-11-04 08:36:13 +01:00
Bradley T. Hughes
faa6113c41 Fix unstable test due to a race in QThread
QThread::finished() is emitted before setting the thread's state to
finished and !running, which means it's possible to receive the
finished() signal and act on it while QThread::isRunning() still
returns true.

This test randomly fails due to this race. Fix it by using checking
the return value of QThread::wait() instead.

Change-Id: Ibf347fc9a2e8d32b328227ee6978e1129dd781f4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2011-11-03 18:43:52 +01:00
Jason McDonald
1f0f5c1691 Remove redundant #if 1 from qdbusmarshall test
Change-Id: I5342210cda1f02950667621e5e64d65d6357c6ce
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-02 05:43:40 +01:00
Jason McDonald
60f6f63c54 Remove unused code from qdbusmarshall test.
The removed functions have been unsued since at least as far back as
2006.

Change-Id: Id1ea77dbfffa319c18891968f3aa378cfb563fd4
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-02 00:53:26 +01:00
Jason McDonald
983ba6510b Remove obsolete code from qdbusmarshall test.
The removed code had been disabled since 2007 and tested functionality
that was no longer supported.

Change-Id: I49dfe58601c1cc6d41590ab2980daba27eca6bfb
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-02 00:53:26 +01:00
Jason McDonald
5b744aefa3 Remove obsolete code from qdbuspendingcall test
The tested functionality hasn't been in the public API since 2008.

Change-Id: I2898da3730fa6248eea2e19779b33ccc793b7a31
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-02 00:53:26 +01:00
Rohan McGovern
d04bf8f407 all remaining tests: eliminated usage of qttest_p4.prf
qttest_p4.prf was added as a convenience for Qt's own autotests in Qt4.
It enables various crufty undocumented magic, of dubious value.
Stop using it, and explicitly enable the things from it which we want.

Change-Id: I02fe27b2c1800f929250fa8694ca2976c9661a12
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
2011-10-25 08:42:23 +02:00
Jason McDonald
27f9f136f7 Remove SkipMode parameter from QSKIP calls.
The previous commit removed SkipMode from the testlib APi.  This commit
removes the parameter from all calls to QSKIP.

Task-number: QTBUG-21851, QTBUG-21652
Change-Id: I21c0ee6731c1bc6ac6d962590d9b31d7459dfbc5
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-10-21 01:20:29 +02:00
Jason McDonald
a165cbb1f0 Remove redundant logic from dbus test .pro files.
There was logic in .pro files for the dbus tests to omit the body of
each test if dbus was not available in the Qt build.  This was all
redundant however, because tests/auto/auto.pro already excluded all dbus
tests if dbus was not available in the Qt build.

Change-Id: Iaea06e38622e5227daec4d2e08106c2da3fb4013
Reviewed-on: http://codereview.qt-project.org/6372
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-10-11 07:02:14 +02:00
Lars Knoll
1363d5b9eb This passes just fine
Task-number: QTBUG-21424
Change-Id: Ied95373b2cf3882ec4f352ccbc285b578c66f83d
Reviewed-on: http://codereview.qt-project.org/5003
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
2011-09-20 21:57:18 +02:00
Holger Ihrig
5842e7e97e Temporarily disabled tests
Necessary to avoid CI blocking.
The tests should be enabled again as soon as possible.

Task-number: QTBUG-21424
Change-Id: Ibc54723855579095be0dea3bd3e071dd22a1fccf
Reviewed-on: http://codereview.qt-project.org/4825
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Matthew Cattell <matthew.cattell@nokia.com>
2011-09-14 05:06:23 +02:00
Gunnar Sletta
a9ac6da893 Merge branch 'master' into refactor
Conflicts:
	src/3rdparty/v8
	src/gui/text/qfont_qpa.cpp
	src/gui/widgets/qlinecontrol.cpp
	src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp
	tests/auto/gui.pro
	tests/auto/network.pro
	tests/auto/qstring/tst_qstring.cpp

Change-Id: Id118c172645303ccf06a207050d5bf1462ff57fe
2011-09-12 07:49:03 +02:00
Jo Asplin
daf24b1b64 Moved dbus autotests into new directory structure
Task-number: QTBUG-21108

Change-Id: I8cdd4af59db3716921e7392379584f349ed29136
Reviewed-on: http://codereview.qt.nokia.com/3602
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-09-01 09:37:08 +02:00