summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
Commit message (Collapse)AuthorAgeFilesLines
* Re-add missing test to kernel.proJędrzej Nowacki2014-04-021-0/+1
| | | | | | | | | Patch 9a08483d763dacfca6029f7a8970846e83df0e2a introduced a regression, tst_qmetatype test was not meant to be removed. Change-Id: I5456ffbbd9d9f8e461f828c6183e46dabf67952b Reviewed-by: Sergio Ahumada <sahumada@blackberry.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* OS X QSettings auto test/writing check updateSamuel Gaist2014-03-311-3/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch aims to provide an updated test that follows changes started in 10.7: new rule is that only root can access SystemScope settings. It also disables the sync() workaround code path which is at least not executed during the tst_QSettings execution and returns wrong value to the test. From Apple's documentation: "Note that modification of some preferences domains (those not belonging to the “Current User”) requires root privileges (or Admin privileges prior to OS X v10.6)—see Authorization Services Programming Guide for information on how to gain suitable privileges" https://developer.apple.com/library/mac/documentation/CoreFoundation/Reference/CFPreferencesUtils/Reference/reference.html [ChangeLog][QtCore][QSettings] QSettings now returns the correct value for isWritable() when using SystemScope settings. Task-number: QTBUG-9824 Task-number: QTBUG-21062 Task-number: QTBUG-22745 Change-Id: Ib6a1490ec596b99d189ec4de9a0f28ecfd684172 Reviewed-by: Liang Qi <liang.qi@digia.com>
* Mac: make FSEvents-based QFileSystemWatcherEngine more robust.Erik Verbruggen2014-03-271-0/+3
| | | | | | | | | | | | | | | | | | | - Record the last event ID with every callback. This event ID is passed to FSEventStreamCreate when restarting the stream, so the watcher will receive all events that occurred since invalidating the previous stream. - Never start with kFSEventStreamEventIdSinceNow, because this will generate a (bogus) soft-assert in FSEventStreamFlushSync in CarbonCore when no event occurred since stream creation. The last globally generated event ID is used instead to simulate the "now". - Do not dispose and recreate the stream in the callback, but use a queued signal-slot connection to schedule this on thread that owns the watcher. Change-Id: I02f5a845d9e27f9853ed97925ab9c7a5bc0dede1 Reviewed-by: Eike Ziller <eike.ziller@digia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Check for administrative rights in tst_qsettings.Friedemann Kleint2014-03-271-41/+97
| | | | | | | | | | Introduce function checking whether the system settings in native format can be written to. If not, default to user scope or skip the respective tests instead of failing. Task-number: QTBUG-37822 Change-Id: I330aff9b79bb22254216f022af807e010bc8e8ba Reviewed-by: Andrew Knight <andrew.knight@digia.com>
* Stabilize tst_QProcess::softExitInSlots()Sergio Ahumada2014-03-271-1/+1
| | | | | | | | | | | | This test takes more than 5000ms to finish some times, so waiting for 10000ms should be enough to make it more stable on all platforms. ../tst_qprocess.cpp:1072 :: [gui app] QTestLib: This test case check ("proc.waitedForFinished") failed because the requested timeout (5000 ms) was too short, 6150 ms would have been sufficient this time. Change-Id: I266ad0e65bf3c84e73b7ca6543dc15335dad4c99 Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
* Mark some tests as XFAIL on QNXSergio Ahumada2014-03-272-6/+6
| | | | | | | | | | | | | | | Extending this to stock QNX as well since it is not BlackBerry 10 specific. - tst_QNumeric::floatDistance() - tst_QNumeric::floatDistance_double() - tst_QtJson::testNumbers_2() - tst_QtJson::toJsonLargeNumericValues() - tst_QtJson::parseNumbers() Task-number: QTBUG-37066 Change-Id: If0e5d4fbefac5e8a0efed8ef8b1b7655ff6e7766 Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
* Reuse one QCollator instance for QString::localeAwareCompareLars Knoll2014-03-271-4/+2
| | | | | | | | | | | | | Constructing a QCollator is somewhat expensive, and made localeAwareCompare really slow. As QCollator (at least with the ICU implementation) is not thread safe, use one collator per thread. This speeds up collation of a long list of strings by a factor of 250 for the test case in the bug below. Task-number: QTBUG-36149 Change-Id: I645cdc3546347d1dcc7a03b7563b628c7f756944 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Logging: Remove PatternFlag::Invalid from QLoggingRuleKai Koehne2014-03-201-1/+1
| | | | | | | | | | | The flag is not orthogonal to the rest, and e.g. checking with flags & Invalid will fail. Rather make it explicit by comparing with 0. Change-Id: I428d5e71f5ecd05f61d543aaa78532548ef93d5a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Print when logging rule is invalid.Kai Koehne2014-03-201-0/+10
| | | | | | | Print a warning when an invalid logging rule is parsed. Change-Id: I3bf9a6df4053d36b3803652b2faa86168d5222bc Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Fix Q_DECLARE_METATYPE macroJędrzej Nowacki2014-03-171-1/+7
| | | | | | | | | The macro should stringify value of the given token not the token itself. Task-number: QTBUG-37547 Change-Id: I90f4fa613bd13d5a581828ab13f620b40dfd3593 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Introduce GENERATED_TESTDATA variable and fix qresourceengine test.Janne Anttila2014-03-141-8/+1
| | | | | | | | | | | testcase.prf cannot be loaded from pro file for various reasons, see qtbase commit history for details. Moved runtime testdata logic from pro file to testdata.prf, and thus made is reusable in other test cases as well. Change-Id: I500d08dc4951e4eda862071e4ddd3e0f6de8c3d2 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Fix tst_qthreadpool under high load.David Faure2014-03-141-0/+1
| | | | | | | | | | The tasks might not have run yet at the time of the QCOMPARE, so we need to acquire on the semaphore in order to ensure that this is the case, just like in the previous testcase. Change-Id: I1da72bb07c2f53760b3bf912fc26aaf10ed18d48 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Fix qchar testdata installation.Janne Anttila2014-03-141-1/+1
| | | | | | | | | | | | | | | | | | | | NormalizationTest.txt does not exist in the project root, but under 'data' directory. TESTDATA is converted to INSTALLS rules in testcase.prf. INSTALLS rules generated in testcase.prf does not set 'no_check_exist' CONFIG variable. Thus qmake will not install NormalizationTest.txt since it cannot find it from defined location. Even TESTDATA has been incorrectly defined, NormalizationTest.txt has been found in majority of the platforms thanks to QFINDTESTDATA flexibility. However it causes problems on sand-boxed platforms such as WinRT. Fixed by defining the relative path to NormalizationTest.txt in TESTDATA so that qmake can find the file when processing INSTALLS variable. Change-Id: Id9a28db2a00b17d2c0136e6ff32f421b21137898 Reviewed-by: Andrew Knight <andrew.knight@digia.com> Reviewed-by: Liang Qi <liang.qi@digia.com>
* Disable UNC tests on WinRT.Janne Anttila2014-03-142-8/+8
| | | | | | | | Based on file system implementation for WinRT, the UNC paths are not supported on WinRT, so lets disable corresponding tests as well. Change-Id: Ib45ae618f39d5da39a822160096599b30204cf71 Reviewed-by: Andrew Knight <andrew.knight@digia.com>
* Removed unnecessary TESTDATA statement from qmessageauthenticationcode.Janne Anttila2014-03-141-1/+0
| | | | | | | | | | | QMessageAuthenticationCode autotest does not have data folder for TESTDATA. It seems that pro file is copy/pasted from another one which actually have data. Removed the unnecessary statement since it caused problems for https://codereview.qt-project.org/77981. Change-Id: Ide753e5692bd2f469217760173a9b60f2f646770 Reviewed-by: Andrew Knight <andrew.knight@digia.com> Reviewed-by: Liang Qi <liang.qi@digia.com>
* Logging: Let user configure rules via QT_LOGGING_RULESKai Koehne2014-03-131-0/+8
| | | | | | | | | | | | Check also for rules set in an environment variable QT_LOGGING_RULES. This makes it even more convenient to set rules e.g. for just one run of an application, without having to create a logging configuration file. It is also more in place with the current way we enable/disable debugging of parts of Qt via environment variables. Change-Id: I4d05976f2b6c12bca472552ffa22345475cd01de Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com> Reviewed-by: Tomasz Olszak <olszak.tomasz@gmail.com>
* Use QStringRef for parsing of logging rulesKai Koehne2014-03-131-1/+1
| | | | | | | | Use QStringRef to speed up the parsing of the left side of logging rules. Change-Id: Idd4d75496e3865d092f2802c45928a414c14c615 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make parsing of categories in logging rules more strictKai Koehne2014-03-131-0/+8
| | | | | | | Do not accept rules with wildcards in the middle. Change-Id: If6fa71629c46bc4127aa8bd475643bc0e8a9f57c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make parsing of categories in logging rules consistent.Kai Koehne2014-03-131-0/+114
| | | | | | | | | | | | | | | | | | | | | | | The documentation says that the left side of a logging rule has the syntax <category>[.<type>] with optional wildcard '*' as the first or the last character (or at both positions. However, so far we didn't allow qt.*.debug But what we did allow is implicit dropping of trailing '.', e.g. qt.* matched also 'qt' Fix these by splitting up the '.type' in advance, and then do string matching only on the 'real' category names. Change-Id: Iab50ad0fc673464e870f5ab8dfb3245d829b3107 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDebug: Allow text stream formatting for 64 bit numbersKai Koehne2014-03-131-0/+13
| | | | | | | | | | | | | | | Use the QTextStream stream operator for formatting 64 bit numbers, just like we do for other numbers, too. This ensures all numbers in a QDebug stream e.g. respect the hex and showbase modifiers. The original reason for formatting qin64, quint64 with QString::number is unclear (pre-dates the original qt4 git import). Maybe QTextStream did lack proper support for 64 bit numbers back then. Task-number: QTBUG-36841 Change-Id: I049516c2a8394c9c1a708f86c3d950418a20a957 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Revert the QByteArrayList addition to Qt 5.3Thiago Macieira2014-03-083-228/+0
| | | | | | | | | | | | | | | | This reverts commits f12b0f9a38c792abb13f3e6ecff4542986a6f96b ("QByteArrayList: optimize op+"), f96f2fe3670bc8a32389795dc21b9839407465a1 ("Enable QByteArrayList tests"), and 4f23f0530a9c59400a7f3821cd2c9355801ed8cd ("new QByteArrayList class"). This class is coming back in Qt 5.4. [ChangeLog][CHANGELOG FIX] Remove the line about QByteArrayList being added. Change-Id: I890ab2b34a9b3e575512eb306d0f241143a867cf Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Add Objective-C specific type converters to QByteArraySamuel Gaist2014-03-083-0/+131
| | | | | | | | | | | | | | This patch adds the Objective-C NSData/CDataRef converters to QByteArray This will replace the current converters offered in QMacExtras [ChangeLog][QtCore][Objective-C] Added NSData/CDataRef converters for QByteArray Change-Id: I7a0f14bee4271798db345f3c5efd26ac671a3ea4 Reviewed-by: Jake Petroules <jake.petroules@petroules.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Try to speedup tst_qmetatype.cpp compilation with clang.Jędrzej Nowacki2014-03-062-4/+15
| | | | | | | | | | | | | The test instantiates enormous amounts of templates in one compilation unit. All clang versions, that I tested, suffers from performance issues while compiling the test, the cost depends on the version. The most affected are shipped by Apple. Task-number: QTBUG-37237 Change-Id: I0959c1a4a6faee448ae1dae5c1e70ee06cefbd9c Reviewed-by: Simo Fält <simo.falt@digia.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Reduce clang compilation time of tst_qmetatype by ~50%Jędrzej Nowacki2014-03-061-13/+1
| | | | | | | | | We do not need to check all possible basic type combinations in the autoregistration test. Change-Id: Ibfb97a93d9d1862e669d843988976690bbc83c74 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Simplify tst_QMetaType::automaticTemplateRegistrationJędrzej Nowacki2014-03-061-55/+62
| | | | | | | | | | Redundant and unused variadic macro arguments were removed. For macros with known count of arguments, named arguments are preferred. Common code was moved out from macros so it is not generated over and over. Change-Id: Ib5106555d0d3c6cadfbdbdbd614831240b6d762f Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Complete QJsonValue::fromVariant()Sze Howe Koh2014-03-061-0/+57
| | | | | | | | | | | | | | - QVariant can store (U)Int, (U)LongLong, Float and Double numbers. Previously, QJsonValue::fromVariant() converted Floats into Strings while converting the others to Doubles. - Add unit tests for QJsonValue::fromVariant() [ChangeLog][QtCore][JSON] QJsonValue::fromVariant() will now convert single-precision Floats into Doubles instead of Strings Change-Id: I457adbe29c37ada611d1c6d711c42866d63d4024 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Disable the qmetatype test on Clang + ARM, it's causing OOM during buildTor Arne Vestbø2014-03-041-1/+4
| | | | | | | | And takes a very long time to build if it doesn't run out of memory. Task-number: QTBUG-37237 Change-Id: I8c7fae4d2d99ad59c6d6306da2df554a05955446 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Revert path() behavior to not expand a current path on a driveAndy Shaw2014-03-041-1/+1
| | | | | | | | | | | | | | | | | In the original change - cfb44c6528b2518274bf157388832d1d610ce0e4 - when querying for the path of a file that did not contain a slash after the drive indicator it would get the current path and return that as the path that the file resided on. However this meant that it would take the current path at that time which may not be the actual path that was expected. So it was decided that it should revert back to the original behavior which was to just return the drive letter followed by the colon which would thus indicate still that it represented whatever the current path was on that drive. Change-Id: Ic57ae9227882a66e9a4c4d6537d7f2cae829165a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Remove duplicated testsSze Howe Koh2014-03-041-14/+0
| | | | | | | tst_QtJson::testValueSimple() tested bool and double values twice Change-Id: Ie6e58aab729c6ee20cb53d3b85746a05f7571f5e Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Remove use of templates in tst_qatomicinteger.Friedemann Kleint2014-03-041-2/+2
| | | | | | | | | | | | | | | | | | | | MSVC 2008 is confused by TypeInStruct being a template, resulting in \tst_qatomicinteger.cpp(189) : error C2027: use of undefined type 'QStaticAssertFailure<Test>' with [ Test=false ] for int (and thus for all unsupported types). This appears to be a real Heisenbug-nature compiler bug as it can also be fixed by adding qDebug() << Q_ALIGNOF(TypeInStruct<T>) before the static assert. Task-number: QTBUG-37195 Change-Id: Ib2b60f3c1ffeb0b8bdeb1fb0c659655ce4ab10d8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Turn off compiler optimization in tst_qtendian for MSVC2008.Friedemann Kleint2014-03-041-0/+4
| | | | | | | | | | | | | This causes frequent compiler errors on Windows CE. tests\auto\corelib\global\qtendian\tst_qtendian.cpp(140) : fatal error C1001: An internal error has occurred in the compiler. (compiler file 'd:\orcas\compiler\utc\src\P2\main.c[0xCCCCCCCC:0xCCCCCCCC]', line 243) Task-number: QTBUG-37194 Change-Id: I2adbc1e3b1896fbe86780aa26a15e918333a09f2 Reviewed-by: Oliver Wolff <oliver.wolff@digia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* tests: Remove superfluous gui additions to QTSergio Ahumada2014-02-281-1/+1
| | | | | | | by default QT contains both core and gui already Change-Id: I6f5b551104e40a024468e7cb62e302134e9472ec Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* tst_qnumeric: Mark some tests as XFAIL on BlackBerry 10Sergio Ahumada2014-02-281-0/+6
| | | | | | | | | | | | These tests seem to fail because denormalized numbers are not supported on QNX yet, so marking them as expected failures. - floatDistance(denormal) - floatDistance_double(denormal) Task-number: QTBUG-37094 Change-Id: I79dbc78da6e9bef8466264fd2cab4af0ee8b868f Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
* tst_qtjson: Mark some test as XFAIL on BlackBerry 10Sergio Ahumada2014-02-281-0/+14
| | | | | | | | | | | | | These tests seem to fail because denormalized numbers are not supported on QNX yet, so marking them as expected failures. - testNumbers_2() - toJsonLargeNumericValues() - parseNumbers() Task-number: QTBUG-37066 Change-Id: Ifec95b936fb70253395dee4d1ca18e85870486a3 Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
* Logging: Change 'rules' section name to 'Rules'Kai Koehne2014-02-262-6/+6
| | | | | | | | | This is more consistent with e.g. qt.conf, where section names also start with an upper case character. Change-Id: I9ddaf72baeb9334d081807412512242d5d46cbbf Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Remove qSort usages from core testsSergio Ahumada2014-02-224-5/+13
| | | | | | | | | QtAlgorithms is getting deprecated, see http://www.mail-archive.com/development@qt-project.org/msg01603.html Change-Id: I355558fe6a51d00e9aa1f8b1221c6ec0c1e6bb77 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Make sure all containers compile in strict-iterator modeThiago Macieira2014-02-2214-15/+33
| | | | | | | | | | | | | | | | | | Unit-test this by making the QList, QVector, QHash and QMap unit tests be duplicated under strict-iterator mode. There's no test for QLinkedList. The tst_Collections test does not compile under strict-iterator mode. It generated over 15000 errors when I tried. The strict iterators required a small change: the difference_type typedef needs to match the operators that get distances (operator-(iterator)) and move the iterator around (+, -, +=, -=, etc.). Task-number: QTBUG-29608 Change-Id: I834873934c51d0f139a994cd395818da4ec997e2 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: Jason McDonald <macadder1@gmail.com>
* QMarginsF - Add new QMarginsF classJohn Layt2014-02-212-0/+126
| | | | | | | | | | | | Add a new QMarginsF class to complement QMargins in the style of QSize/QSizeF and QRect/QRectF. [ChangeLog][QtCore] Added class QMarginsF to support handling margins with floating-point values. Change-Id: Iaaa95ec85f5d126d9d864fc4b607241a8c8a8f3a Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* QRect - Add missing QMargins subtraction operatorJohn Layt2014-02-211-0/+4
| | | | | | | | [ChangeLog][QtCore][QRect] Added QMargins subtraction operator. Change-Id: I64d449e2bae81a34df2cd019cff3fb186f8aaaae Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* QMargins - Add missing operatorsJohn Layt2014-02-211-0/+7
| | | | | | | | | | | Add missing standard operators. [ChangeLog][QtCore][QMargins] Added missing addition and subtraction operators. Change-Id: I6aeed39531a736c12d378a817a9431279da79bc4 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Loosen checks for Q_COMPILER_VARIADIC_MACROSKai Koehne2014-02-201-0/+5
| | | | | | | | | | | | | | | | | | | | So far we did bind the definition of Q_COMPILER_VARIADIC_MACROS to C++11 (so gcc, clang will not define it in default gnu++98 standard). However, variadic macros are a feature of the gcc preprocessor since version 2.97, and are enabled in the default configurations on gcc, clang, icc. This might cause warnings and errors though if one enables additional warnings in gcc, clang (e.g. by -pedantic). Anyhow, as a precedent qglobal.h already relies on 'long long' ... The warning can be disabled by adding '-Wno-variadic-macros'. [ChangeLog][Compiler Specific Changes] Variadic macros are now enabled more liberally for gcc, clang, icc. If you have warnings (because you e.g. compile with -pedantic), disable them by -Wno-variadic-macros. Change-Id: Ie979b85809508ad70cab75e6981f20496429f463 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-02-181-10/+42
|\ | | | | | | | | | | | | Conflicts: src/plugins/platforms/android/qandroidplatformtheme.h Change-Id: I541bd3069df3ab54c7942d5f4a9e155e3b6566a0
| * Make a URL with absent authority be different from one with an empty oneThiago Macieira2014-02-171-10/+42
| | | | | | | | | | | | | | | | | | | | | | | | This partially reverts 5764f5e6eaf149116a818658883cf4fae9830f30 and fixes the problem differently. After this commit, "file:///foo" is still equal to "file:/foo", but "foo:///foo" becomes different from "foo:/foo", as it should be. Task-number: QTBUG-36151 Change-Id: Ia38638b0f30a7dcf110aa89aa427254c007fc107 Reviewed-by: David Faure <david.faure@kdab.com>
* | Remove a not required whitespace when writing JSON in compact formatLars Knoll2014-02-161-4/+4
| | | | | | | | | | | | | | Task-number: QTBUG-36682 Change-Id: I0c1c0de850504c8dff20a5ae724cc868d9f983f8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Add a testAndSet overload to the atomics that returns the current valueThiago Macieira2014-02-163-1/+525
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is extremely useful, since the most common action after a failed compare-and-swap is to loop around, trying again with the current value as found in memory. Code currently written as: do { Type value = atomic.load(); ... } while (!atomic.testAndSetRelaxed(value, desired)); Becomes: Type value = atomic.load(); do { ... } while (!atomic.testAndSetRelaxed(value, desired, value)); In most CPU architectures, the value that was found in memory is known to the compare-and-swap code, so this is more efficient than the previous code. In architectures where the value is not known, the new code is no worse than before. The implementation sometimes modified an existing function, sometimes it added a new one, depending on whether more registers were needed in the assembly (like ARMv6-7), the code became more complex (ARMv5), the optimizer failed (C++11), or it was just plain equivalent (MIPS). Change-Id: I7d6d200ea9746ec8978a0c1e1969dbc3580b9285 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Add qHash() overloads for floating-point typesMarc Mutz2014-02-161-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implementation is based on GCC's implementation of std::hash<FP>, but only to the extent of checking for zero before hashing the bits. The bit hasher is the Qt one; I didn't even look what GCC uses. The check against 0.0 is mandated by the requirement to have \forall x,y: x == y => qHash(x) == qHash(y) which would be violated for x = 0.0 and y = -0.0 if we only hashed the bits. Implemented out-of-line to avoid potential FP-comparison warnings, as well as to be able to use the file-static hash() functions, which gets inlined unlike qHashBits(), which cannot be. [ChangeLog][QtCore][QHash/QSet] Allowed to use float, double and long double as QHash/QSet keys. Change-Id: I38cec4afb860f17e9f8be7b67544e58b330f8fff Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* | tst_qsignalblocker: simplify testMarc Mutz2014-02-161-138/+13
| | | | | | | | | | | | | | | | | | This test can assume that the QObject::signalsBlocked property works as advertized, so just check signalsBlocked() in repsonse to QSignalBlocker manipulations. Change-Id: I99e4ef9c4ed05c3840233d92a587636d2d78f59a Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Add const overload for QLoggingCategory::operator()()Kai Koehne2014-02-151-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change 85e57653 caused a compile error for code that does Q_DECLARE_LOGGING_CATEGORY(cat); //.. qCDebug(cat()) << // ... error: C3848: expression having type 'const QLoggingCategory' would lose some const-volatile qualifiers in order to call 'QLoggingCategory &QLoggingCategory::operator ()(void)' This is a regression from Qt 5.2. Fix the error by adding a const version of operator()(). Change-Id: I2fb04f2e155962adee0f98089fc5a159000bef56 Reviewed-by: Alex Blasche <alexander.blasche@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | WinRT: Added socket engine implementationOliver Wolff2014-02-151-0/+4
| | | | | | | | | | | | | | | | | | | | Added basic functionality to socket for WinRT. Even though not all auto tests pass yet, this patch can be seen as a foundation for upcoming work in this area. Reading from and writing to TCP socket works and one can listen for tcp connections. Change-Id: Id4c25ba1c7187ed92b6368c785c4f62837faded7 Reviewed-by: Andrew Knight <andrew.knight@digia.com>
* | Enable QByteArrayList testsJędrzej Nowacki2014-02-141-0/+1
| | | | | | | | | | Change-Id: Id7e0550e857bf4221f49d08539a0b5c70d8386d3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>