Commit Graph

1264 Commits

Author SHA1 Message Date
Friedemann Kleint
77833b90c8 Fix crashes when invoking toVariant() on empty QJsonValue objects.
Change-Id: I51cd114e862c6fad564484e990348f324ad56ab9
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2013-07-24 10:56:07 +02:00
Thiago Macieira
b02eb3b436 Ensure that the user codecs are listed in QTextCodec::availableCodecs
Codecs registered by creating new QTextCodec instances should be listed
there.

Task-number: QTBUG-32500
Change-Id: I56c00e0d6bbfef55a6cbd571bcf9aa2cf333ef3a
Reviewed-by: David Faure <david.faure@kdab.com>
2013-07-21 07:30:48 +02:00
Simo Fält
bd1dc60d65 Expect tst_QEasingCurve::setCustomType() failing on 32 bit Ubuntu 11.10
Currently tst_QEasingCurve::setCustomType() is always failing on CI
when ran on 32 bit 11.10 Ubuntu.

Task-number: QTBUG-32432
Change-Id: Iaf346c14985f14716692fe996714b7040fb70930
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
2013-07-20 11:21:51 +02:00
Thiago Macieira
674e79416f Fix incomplete override of QIODevice::open in QProcess and QLocalSocket
The rule for a new override is that it must still work if the old
implementation is called. The catch is that any class that derives from
QProcess and isn't recompiled will still have QIODevice::open in its
virtual table. That is equivalent to overriding open() and calling
QIODevice::open() (like the tests).

In Qt 5.0, QProcess::start() called QIODevice::open directly, not the
virtual open(), so there's no expectation that a user-overridden open()
be called. With that in mind, simply fix QProcess::start to not call the
virtual open at all.

Similarly with QLocalSocket, the calls to open were always non-virtual.

Task-number: QTBUG-32284
Change-Id: I88925f0ba08bc23c849658b54582744997e69a4c
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2013-07-20 00:22:03 +02:00
Olivier Goffart
d6d9edd7c4 Fix dead lock in the Qt event handling
The deadlock is caused because the QEvent is destroyed while holding the
event list mutex. And the QEvent may have a custom destructor that will
re-enter the event handlng code.

The QScopedPointer that should destroy the event must be created after
the MutexUnlocker.

Regression introduced by commit f9035587b9

Task-number: QTBUG-31606
Change-Id: I6b2cbc2656eacdec61b641886953f00bf5b3ff36
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2013-07-10 17:57:10 +02:00
Joerg Bornemann
3f605c8b45 bail out early in QWinOverlappedIoNotifier::waitForNotified
Calling waitForNotified on an uninitialized notifier will print a
warning and return false. The autotest has been adjusted.

Change-Id: I85e18d6d0a8a5462e1a5d451613add941d89b5fb
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2013-07-05 13:37:22 +02:00
Liang Qi
94c8efff8a QtCore: fix the number precision in QJsonDocument.toJson() again
Need to store 17 decimal digits for binary64, IEEE 754 double formats.

Autotest is included. Test cases from TC39 test suite for ECMAScript.

Task-number: QTBUG-31926
Change-Id: I546398f21ea7ff5e40e89fc9de8703f628f55df9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2013-07-04 16:50:57 +02:00
Friedemann Kleint
6e8dddadd8 Use case insensitive matching for hashes QFileSystemWatcher/Win.
Do not lower case file names to generate hash keys since
QString::toLower() converts some characters with context
which the Windows file system will not.

Task-number: QTBUG-31341

Change-Id: I285bfedef3c1ca9d59083229e61974dd378c72ae
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2013-07-04 12:54:58 +02:00
Joerg Bornemann
5cfac290ca remove wait calls in tst_QProcess::simpleStart
Instead of calling different wait functions on different platforms,
we use QTRY_COMPARE to check the process state.

Change-Id: I6489cabce9e63f9c8b1036f3cccbf35b52df72e7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
2013-07-02 16:33:08 +02:00
Thiago Macieira
7becb8b807 QUrl test: ensure that hostnames with bad non-IDN domains are caught too
Leading and double dots are bad, but trailing dots are fine. The ASCII
part of a hostname is supposed to be LDH (letters, digits, hyphen) only,
but we accept '_' (underscore) as an exception too.

Change-Id: I79957ddec4da78a0e2357fe50c8687db03e1c99e
Reviewed-by: David Faure (KDE) <faure@kde.org>
2013-07-02 02:56:27 +02:00
Frederik Gladhorn
533820320c Merge remote-tracking branch 'origin/release' into stable
Change-Id: I94bb158562ae6b80a87b40139d7302ea7b9b9aa8
2013-06-20 16:13:38 +02:00
Konstantin Ritt
e3dadce470 Ensure we don't repeat QTBUG-30931 in Qt5
The issue is already fixed in 5.0 but let's be nice and ensure the issue
won't be reintroduced later.

Task-number: QTBUG-30931

Change-Id: Ia6944acaf6e7217f8d0f1fa75d0e9977db11d892
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-06-18 13:36:23 +02:00
Shawn Rutledge
3e2cd8ef6f fix QFileSystemEngine::createDirectory race condition
During a call to QDir::mkpath(), the same path could be created
by another process, in which case the OS mkdir will fail with EEXIST.
But the docs for mkpath() state that it's not an error if it
already exists, whereas for mkdir() it is an error.  So
QFileSystemEngine::createDirectory should accept the EEXIST error
silently if it occurs while creating the sequence of parent directories
and the final leaf directory, but should fail if EEXIST happens when
it was called from QDir::mkdir(), which is when the createParents
parameter is false.  We assume the operating system mkdir() and
CreateDirectory() are atomic, so there should be no race condition
in QDir::mkdir().  It's not necessary for mkpath() to call stat()
at each level, only to check whether an existing entry is a directory
or a file.  Also added to the autotest to verify that if the
path is an existing file, creating a dir with the same name will
fail in either mkdir or mkpath.

Task-number: QTBUG-30046
Change-Id: I926352f10654fdf3b322c8685bb85ad8b8844874
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2013-06-14 16:57:57 +02:00
Jędrzej Nowacki
d57d184b6d Add basic conversion functions from QVariant(QJsonValue).
There is a mismatch how QML and C++ converts QJsonValue. This patch
unifies conversions by adding QJsonValue support in QVariant::convert().

Change-Id: I8a1db3d77c517945ef48064b4b66ba03aa4f2fd0
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
2013-06-14 15:50:49 +02:00
Friedemann Kleint
443253cf11 Let QTemporaryDir::stressTest() run in temporary directory.
Task-number: QTBUG-31618

Change-Id: I60aaa4f57710816cd0e22ea9b097c7e85466fd0c
Reviewed-by: David Faure (KDE) <faure@kde.org>
2013-06-12 14:12:05 +02:00
Frederik Gladhorn
75067b56fa Merge "Merge remote-tracking branch 'origin/release' into stable" into refs/staging/stable 2013-06-10 19:54:53 +02:00
Rafael Roquetto
e554ab4585 BlackBerry: fix tst_QLocale::emptyCtor()
BlackBerry OS does not allow for explicitly controlling the locale through the
"LANG" environment variable. Locale is controlled by the underlying PPS
Service instead.

Change-Id: I22154e39f81a9467ad7fdb90a042396390398b1b
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Mehdi Fekari <mfekari@blackberry.com>
2013-06-10 16:32:57 +02:00
Frederik Gladhorn
0eff16611f Merge remote-tracking branch 'origin/release' into stable
Change-Id: I89c251999ae2a82522b40471fd13f2e06b00ece8
2013-06-10 10:00:34 +02:00
Thiago Macieira
ebea15cb33 QEventLoop: Remove the test that checked throwing from an event handler
In Qt 5, we declared that throwing from event handlers is undefined
behavior. So stop testing this.

We will try our best to capture and pass along std::bad_alloc, but even
that might not work, depending on compiler settings. In particular,
after the upgrade to MinGW/GCC 4.8 with DW2, this test stopped working.

Task-number: QTBUG-31615
Change-Id: Ibf5fb2ce0c48b983549096bf7aac434b6ed3ac2e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-06-08 23:00:50 +02:00
Thiago Macieira
9095210c0b tst_QUrl: check that prohibited characters in hostnames are not valid
qt_nameprep is tested by tst_qurlinternal. We just need to be sure that
QUrl handles them correctly.

Change-Id: Ic563004870d2cf2fa7a31ce49fff7280d5ffb5f3
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2013-06-08 15:20:44 +02:00
Friedemann Kleint
a730b5fabf tst_qmessageauthenticationcode: Fix warning about character conversion.
warning C4309: 'argument' : truncation of constant value.

Change-Id: I54e9b515d065c1a89bf790fb214c335e852ce5ac
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
2013-06-08 10:29:34 +02:00
Friedemann Kleint
876202ddf2 tst_qjson: Fix MSVC C4293 warning about shift operation.
warning C4293: '<<' : shift count negative or too big,
undefined behavior.

Change-Id: I858dd08f16ea0e00f2384491fc735b7367c6925d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-06-08 10:29:34 +02:00
Thiago Macieira
4d93393a6d QUrl stringprep: fix handling of U+0080: it's prohibited
Edge case: a > that should have been >=. Without it, we never ran the
rest of the IDN nameprepping.

Change-Id: I2276d660de3a70d0c561bb18816820d9a0f47e77
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2013-06-08 05:06:57 +02:00
Thiago Macieira
736a052d93 QUrl stringprep: fix handling of prohibited characters
RFC 3454 says about prohibited characters (section 2, "Preparation
Overview"):

   3) Prohibit -- Check for any characters that are not allowed in the
      output.  If any are found, return an error.  This is described in
      section 5.

In other words, we mustn't simply strip the output of prohibited
characters. We must generate an error if they are present. We do that by
clearing the data.

We already had tests for prohibited output, but they were
indistinguishable from being stripped. So instead add some extra
characters so that we can tell whether the label was cleared.

Change-Id: I2d95217c27be5e2d54deed0036cb009e3b7f4886
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2013-06-08 05:06:47 +02:00
Rafael Roquetto
d4dba8a5c4 Unix: fix tst_QFile when run as root
Because tests are usually run as root on some setups, it does not
make sense to test for the right permissions of a readonly file.

Change-Id: I484f88722d3a9ce7123edc0fb57acae528fa194e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2013-06-07 22:18:42 +02:00
Lars Knoll
7878eb6ba3 Fix parsing of long latin strings in the json parser
Latin1 strings are usually stored as 8 bit data in the json binary
format. But that data structure has a size limitation of 16bit, so
we need to fall back to storing the string as 16 bit data if it is
too long.

Task-number: QTBUG-30946
Change-Id: I0069b1367030b0b2f819fd1f04e34c9e2534a2a3
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2013-05-23 22:00:46 +02:00
Mitch Curtis
964be00403 Fix regression when pasting into QTextEdit from Firefox.
Return the codec if one was found by QTextCodec::codecForUtfText,
instead of returning the default (UTF-8).

Task-number: QTBUG-31293

Change-Id: I95e3260376c00537006b7fbfdc3df5850e1ba657
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2013-05-23 16:55:30 +02:00
Thiago Macieira
6c98035c99 QThreadPool: Fix regression from Qt 4 in dealing with priority starts
The optimisation done in cbaf52b099 for Qt
5.0 got the order wrong of the comparison. The queue must be sorted in
decreasing priority order. But since higher numbers mean higher
priority, that means the queue must be sorted in decreasing priority
number order.

Task-number: QTBUG-29163
Change-Id: Iaf3424b9bb445bf5c71518927f37253cead454f3
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2013-05-20 12:06:48 +02:00
Liang Qi
57acf1b46c QtCore: fix the number precision in QJsonDocument.toJson()
In JSON, any number is stored in double. We need to make sure we
keep the maximum possible number precision for integer number. In
IEEE 754 double format, the significand precision is 53 bits(52
explicityly stored).

Autotest is included. qint64 and double work fine.

Task-number: QTBUG-28467
Change-Id: I7f857671c50e4334e9329c778f9b4f090f490540
Reviewed-by: Sune Vuorela <sune@vuorela.dk>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2013-05-20 12:06:48 +02:00
Albert Astals Cid
95cab90b10 Make QFlags enum flags (C++11 strict enums) friendly
Change-Id: I9ccb3e4d281a545ca1845db4f6aa7ac6c04e8621
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2013-05-09 12:17:59 +02:00
Olivier Goffart
9cc106d9d7 Fix a case of connect()ing to signals declared in a base class
Fix connection to pointer to member signal that belongs to the base
class, but whose type is a pointer to a member of the derived class.

The current code only use the QMetaObject of the type coming from the
function type to look up the signal id. But if the signal was casted
to a pointer to member function of a derived type, then we also need to
look in the base classes

Change-Id: Ib98fc38f63942946acb34d9f83c100991d58e4e5
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2013-05-09 08:23:48 +02:00
Mitch Curtis
83315ce8b2 Revert QDateTime serialisation to pre-Qt 5 behaviour.
In Qt 5, I managed to break the guarantee that a deserialised local
datetime is the same time of day (potentially different UTC time),
regardless of which timezone it was serialised in. This happened after
I fixed QTBUG-4057 with If650e7960dca7b6ab44b8233410a6369c41df73a,
which serialised datetimes as UTC.

This patch reverts QDateTime serialisation to pre-Qt 5 behaviour to
restore the guarantee and consequently re-opens QTBUG-4057.

Change-Id: Iea877f7ed886f530b928067789b53534e89fe8cb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2013-05-08 10:00:29 +02:00
El Mehdi Fekari
02679d93c4 QLocale: add autotest for French_Morocco locale
Change-Id: Ie489557342bf9ea571ba4070e8982b1a13fc7021
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-05-08 01:14:40 +02:00
Giuseppe D'Angelo
66ff3f7fa4 Add qt_hash(QStringRef) overload
This enables fixing a performance regression compared to Qt 4.
Also, add some qt_hash tests.

Change-Id: Id830e17dec99fb67e5930c80029ac2233b2f427e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2013-05-07 22:43:14 +02:00
Joerg Bornemann
28ee554b37 QProcess/Win: drain output pipes on process finish
If a process dies before all output is read into the internal buffer
of QProcess, we might lose data. Therefore we must drain the output
pipes like we already do in the synchronous wait functions.

Task-number: QTBUG-30843

Change-Id: I8bbc5265275c9ebd33218ba600267ae87d93ed61
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2013-05-07 15:02:34 +02:00
Thiago Macieira
586fb6d632 Add some extra tests for QString::arg
Test locale-based formatting of numbers when we pass field width, base
and fill characters. This now tests the fact that we replace a '0' for
the locale's zero character.

Change-Id: Ib872a592fd9a754e3ef11495a9497a6947056631
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2013-04-29 16:56:58 +02:00
J-P Nurmi
a7dc708eb5 Fix QAbstractItemModel::moveColumn()
Task-number: QTBUG-30346
Change-Id: I3d6dbe1e88bb5e2748eadabb2663f30be16f8d18
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
2013-04-23 13:35:31 +02:00
Janne Anttila
0775f88c66 Reduce qmetatype autotest build time for Windows CE.
qmetatype autotest build for WEC7 took several hours [1] See timestamps
03:51:13 and 07:44:52. The timestamped Jenkins log is only available
in Digia network. The corresponding log without timestamps is available
from [2].

Use same workaround for all Windows CE / WEC7 builds as currently
used for desktop MSVC2012.

[1]: http://qt-ci.digia.com/job/QtBase_stable_Integration/cfg=wince70embedded-armv4i-msvc2008_Windows_7/940/consoleFull
[2]: http://testresults.qt-project.org/ci/QtBase_stable_Integration/build_00940/

Change-Id: Ia21be8972d82c8d37073c9097b8d4094261e4126
Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2013-04-17 19:48:38 +02:00
Janne Anttila
428efd2ebe Fix tst_qfile build for WEC7.
Windows Embedded Compact does not have drive letters like desktop
Windows => do not try to build drive letter related test code for WEC7.

Change-Id: I2c3659220a001510c0555e2dd773b4dd68e9c2cc
Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2013-04-17 19:48:32 +02:00
Thiago Macieira
b4ce49287f Make QBuffer::bytesAvailable() work
We don't need to keep an internal QBuffer position, we can just use the
one from QIODevice::pos(). It will keep track of goings ahead and
backwards for us, plus it will make the default bytesAvailable() work
out-of-the-box too.

This error was reported on IRC.

Change-Id: I8559e8ee56edaa01ca8732c1f1012082ebe3a3f2
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
2013-04-16 19:45:11 +02:00
unknown
7d56edebc9 QDateTime - Fix auto tests on Windows before 1980
Auto tests using CET expect there to be no Daylight Time before 1980,
but Windows does apply Daylight Time.  Fix expected test results to
match.

Task-number: QTBUG-30420

Change-Id: I7080598fa0a20c1cd5680782606ab983e714e546
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2013-04-12 11:46:01 +02:00
Debao Zhang
6a50270013 tst_qtranslator: Remove QT_DISABLE_DEPRECATED_BEFORE=0
Change-Id: Iefd8ce56b7102b5a6a656df7dbea2cd344bb9b5d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2013-04-12 07:20:05 +02:00
Debao Zhang
5c2a8899e1 tst_qcoreapplication: Remove QT_DISABLE_DEPRECATED_BEFORE=0
Change-Id: I6d5098ff57293171b5ddd3a58c53718cbbc8e4bf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2013-04-12 07:19:53 +02:00
Debao Zhang
4bb76df7f7 tst_qdataurl: Remove QT_DISABLE_DEPRECATED_BEFORE=0
Change-Id: I6f2e45bbc6d31cac4d9b8c735650f7985865109c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2013-04-12 07:19:45 +02:00
Volker Krause
96e3c2bcbf Don't bypass overwritten [set]data() methods in the proxy.
By calling itemData() of the source model directly, the result cannot
contain data provided by the proxy model itself. The base class
implementation however will call data() on the proxy instead.

Change-Id: Ib0ef5f5621457adbfa4bd896a756dfcb98d0ae54
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2013-04-08 14:17:27 +02:00
Stephen Kelly
722798a359 Don't call virtual methods after the source model is destroyed.
Calling clear_mapping causes the persistent indexes to be queried, and
mapped using map_to_source, so that they can be restored later. That
is not the appropriate response to the source model being deleted
because there won't be anything to restore.

Simply clear the stored mapping information instead so that the source model
actually exists when mapToSource is called by the framework.

Change-Id: I99692ee7aa9c6714aec45c68fe4a2d62be189d60
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2013-04-05 16:26:06 +02:00
David Faure
b3a505dc92 QSaveFile: allow saving to a writable file in a non-writable directory
The only way to make this possible is to disable the
atomic-rename-from-temp-file behavior. This is not done by default,
but only if the application allows this to happen.
https://bugs.kde.org/show_bug.cgi?id=312415

Change-Id: I71ce54ae1f7f50ab5e8379f04c0ede74ebe3136d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2013-04-05 11:04:35 +02:00
Giuseppe D'Angelo
bb5552a229 Upgrade the bundled PCRE to 8.32
Changelog: http://pcre.org/changelog.txt

Amongst other things, the Unicode tables were upgraded to 6.2.0
and case folding support was added, which also fixes a QString
autotest (marked as XFAIL).

Qt still requires 8.30, not 8.32.

Change-Id: I4056c1dc1d949d33443bb8ca280de4c8c363ac74
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-04-01 21:33:29 +02:00
Konstantin Ritt
f0af3ed4e5 Update QLocale data to CLDRv23
Say hello to Interlingua and Mongolian once again.

Change-Id: I735fbc5793f34620be1f6932a251224b9ded02e3
Reviewed-by: Denis Dzyubenko <denis@ddenis.info>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-04-01 12:03:55 +02:00
Konstantin Ritt
bc4dcb6994 QLocale: Report textDirection() by looking to the locale script
Change-Id: Ic562b0301271ba414d5d3ff75a308d84bd288f56
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2013-03-30 08:23:04 +01:00