summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/kernel/qvariant
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/dev' into 5.11Liang Qi2018-02-102-2/+43
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qvarlengtharray.qdoc src/corelib/tools/qvector.qdoc Resolved documentation changes in favor of 017569f702b6dd0, which keeps the move overloads along with its const-ref sibling. Change-Id: I0835b0b3211a418e5e50defc4cf315f0964fab79
| * Add support for converting from std::variantAllan Sandfeld Jensen2018-01-252-2/+43
| | | | | | | | | | | | | | | | Adds inline handling of the C++17 type std::variant, so the type will be resolved if converted into a QVariant. Change-Id: I31809d70d7f347277389d42a3695836ec7a32d02 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QVariant: convert QDateTime and QTime to string with millisecondsThiago Macieira2018-02-051-2/+8
|/ | | | | | | | | | | | | | This way, it's lossless. This commit is a cherry-pick of ab1e50757454b5afda2f6dec52d2eb16a32d4798, which was reverted. [ChangeLog][QtCore][QVariant] Conversions of QDateTime to strings now contain the millisecond components. Change-Id: I5e421e32396d44e4b39efffd150b744e40fff3a1 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
* Replace Q_NULLPTR with nullptr where possibleKevin Funk2017-09-191-1/+1
| | | | | | | | | | | | | Remaining uses of Q_NULLPTR are in: src/corelib/global/qcompilerdetection.h (definition and documentation of Q_NULLPTR) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Implement conversion from nullptr QVariant to QString and QByteArrayAllan Sandfeld Jensen2017-08-041-0/+14
| | | | | | | | | A nullptr QVariant should become a null QString or QByteArray, since null strings have previous in our APIs represented the null value in the absence of a dedicated null metatype. Change-Id: I3b8f6386ece314d7c196959fbcf042c4fe0508a0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVariants of null pointers should be nullAllan Sandfeld Jensen2017-08-041-2/+18
| | | | | | | | | | | Changes the QVariant::isNull() implementation for pointer types so they return true if null. [ChangeLog][QVariant] QVariants containing pointers will now return true on isNull() if the contained pointer is null. Change-Id: I8aa0dab482403837073fb2f376a46126cc3bc6b2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Allow conversion of QVariants with real null valuesAllan Sandfeld Jensen2017-08-021-1/+29
| | | | | | | | | Update documentation to be clearer on the special null variant state with no value as opposed to a variant with a null value, and only block conversions of the former. Change-Id: I24fd50285414e049de87de54a63700a89bd5adf1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.9' into devGabriel de Dietrich2017-07-131-0/+8
|\ | | | | | | | | | | | | Conflicts: src/widgets/widgets/qmainwindowlayout.cpp Change-Id: I306b4f5ad11bceb336c9091241b468d455fe6bb6
| * Handle conversion and comparison between qvarianthash and qvariantmapAllan Sandfeld Jensen2017-07-111-0/+8
| | | | | | | | | | | | | | | | | | QVariant claims to be able to QVariantHash and QVariantMap, but the actual conversion implementation is missing. Task-number: QTBUG-61471 Change-Id: I0cba74642aa77dc423effed289bc7619922a89eb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-07-041-2/+2
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qprocess_unix.cpp src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/widgets/util/util.pri tests/auto/corelib/thread/qthread/qthread.pro tests/auto/corelib/thread/qthread/tst_qthread.cpp Change-Id: I5c45ab54d46d3c75a5c6c116777ebf5bc47a871b
| * Fix some MSVC warnings in testsFriedemann Kleint2017-06-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | tst_qvariant.cpp(80): warning C4309: 'initializing': truncation of constant value tst_qvariant.cpp(4635): warning C4309: 'initializing': truncation of constant value tst_qbytearray.cpp(1438): warning C4267: 'argument': conversion from 'size_t' to 'uint', possible loss of data tst_qbytearray.cpp(1440): warning C4267: 'argument': conversion from 'size_t' to 'uint', possible loss of data http2srv.cpp(64): warning C4018: '<=': signed/unsigned mismatch tst_qinputdialog.cpp(352): warning C4804: '<=': unsafe use of type 'bool' in operation Change-Id: Id012d88b7b20c5c9f128f2ef53753cc1d479f358 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QVariant: fix the testGiuseppe D'Angelo2017-04-201-15/+14
|/ | | | | | | | | | | | 8a375341cf7a7cf38ef427bc0c9f1abde05a471d added swap() to QJson* classes and marked them shared-not-movable-until-qt6. That unveiled a broken test in QVariant which was relying on QJsonDocument being not relocatable. So fix the test by using a proper datatype for the task. Change-Id: Ic35f09f936b00dfaeb368ccb42aecf35cc506029 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
* QVariant: implement QByteArray ↔ QUuid conversionv5.9.0-beta2Marc Mutz2017-04-141-1/+2
| | | | | | | | | | Seems like an obvious omission. [ChangeLog][QtCore][QVariant] Can now convert QUuid to and from QByteArray, not just QString. Change-Id: Ib56ae86ca0c27adaf1e095b6b85e64fe64ea8d18 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-02-081-2/+13
|\ | | | | | | | | | | | | | | Conflicts: configure.json mkspecs/win32-icc/qmake.conf Change-Id: Ibf40546b024d644c7d9ed490bee15b82597f4d3f
| * QVariant: don't do fuzzy comparisons with NaN and infinitiesThiago Macieira2017-01-311-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | There was a test that tested this, but was wrong. [ChangeLog][QtCore][QVariant] Fixed a bug that caused wrong results for comparisons of QVariants containing either NaN or infinite numbers. Task-number: QTBUG-56073 Change-Id: I33dc971f005a4848bb8ffffd1475d29d00dd1b7f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | tst_qvariant: fix comparison ambiguity for QMetaEnum valueGlen Mabey2017-01-311-3/+4
|/ | | | | | | | | | | | | Under certain circumstances, VS2015 reported ambiguous options in using the operator>(Enum,int) operator. This change adds a static_cast<qint64> to remove any ambiguity. In the process of testing this change, a gap in the existing logic was identified: the handling (just in the test code) of large negative enum values. Consequently, and additional test case was added, and additional if-conditions were added to account for that case. Change-Id: Ife2c471ba4caa4b9a0107722042114e58145c4d0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVariant of nullptr should always be nullAllan Sandfeld Jensen2017-01-251-0/+11
| | | | | | | | | Implements isNull for QVariants of a nullptr so they always return true to isNull(), instead of depending on how they were constructed. Task-number: QTBUG-58296 Change-Id: Ibddec795cdadedef7e17d22c265c29e752d8f99f Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Use qtConfig throughout in qtbaseLars Knoll2016-08-191-2/+2
| | | | | | | | | | | Use the new qtConfig macro in all pro/pri files. This required adding some feature entries, and adding {private,public}Feature to every referenced already existing entry. Change-Id: I164214dad1154df6ad84e86d99ed14994ef97cf4 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-08-091-0/+55
|\ | | | | | | Change-Id: I36e6b890b65d12bf6931757540bcc9c553b5eb8f
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-051-0/+55
| |\ | | | | | | | | | | | | | | | | | | Conflicts: tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp Change-Id: I6f3878b204464313aa2f9d988d3b35121d4d9867
| | * Fixed Bug in QVariant comparison when containing QStringListsClemens Sielaff2016-08-031-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As it were, QStringLists were not handled explicitly when comparing QVariants. If both QStringLists contained only a single entry, they were treated as QStrings - if both QStringLists were empty, there were equal (correctly so) - but if one of the QStringLists had more than one entry, the compare function fell through to returning always 1. As discussed here: https://stackoverflow.com/a/38492467/3444217 Added rich comparison tests for all non-numerical, non-recursive QVariants that support them (except QModelIndex and QPersistentModelIndex) Task-number: QTBUG-54893 Change-Id: Icc5480d9ba056ee5efe83da566c5829caa1509d7 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* | | Fix invalid QDataStream data for QDateTimeThiago Macieira2016-05-261-0/+0
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | The stream in question is from prior to Qt 5.0 release, before commit 718a2251be2d32f96befef1ec23912c1a2ce3e34 changed QDateTime serialization format to store Qt::TimeSpec instead of the private flag. The last byte was 0xff meaning LocalUnknown, but 0xff is not valid in Qt 5.0. It was just garbage that Qt up to now just accepted. With the upcoming short QDateTime optimization, the results are worse. Change-Id: I25d85d86649448d5b2b3fffd1450f57df17e7794 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-05-191-0/+10
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp src/network/access/qnetworkaccessmanager.cpp src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.h src/widgets/widgets/qlineedit_p.cpp src/widgets/widgets/qlineedit_p.h src/winmain/winmain.pro tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h tests/auto/testlib/selftests/expected_cmptest.teamcity tests/auto/testlib/selftests/expected_cmptest.txt tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp tools/configure/configureapp.cpp Change-Id: Ib9997b0d0f91946e4081d36c0c6b696c5c983b2a
| * Fix QVariant conversion to an enum type.Olivier Goffart2016-05-161-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QVariant::canConvert<Enum> was returning true for everything can can be converted to integer, but not for integer itself. That's because in QVariant::canConvert we set the targetType to Int of it's an enum, but the Int->Int case was not on the conversion matrix. So this commits adds it to the conversion matrix and now QVariant::canConvert<Enum> returns consistently true for int itself. But even tough canConvert returned true, it did not actualy do any conversion to the enum type itself. Fix that by handling the case properlt in 'convert' [ChangeLog][QtCore][QVariant] Fixed QVariant::canConvert and conversion from integer types to enumeration types. Task-number: QTBUG-53384 Change-Id: I6ac066f3900e31bfcea7af77836ddfc7730bd60b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-04-041-0/+27
|\| | | | | | | Change-Id: I35ca979395620e104e50b06366d0869433a4ffc2
| * QVariant: Fix flags for type-erased associative iterator keyStephen Kelly2016-04-031-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The flags here are passed to a private QVariant constructor, and they really represent a boolean - IsPointer or not. Because the flag for the key_type was incorrectly populated with the flag for the value_type, memory would be corrupted when using a mapping type whose value_type is a pointer, but whose key type was not, such as QMap<QString, int*> This typo has been there since the concept was introduced in commit v5.2.0-alpha1~807 (Add container access functionality for associative containers in QVariant., 2013-04-05). Task-number: QTBUG-52246 Change-Id: I9ecb13c603015eed2dc2ca43947fa0ecd6be8b5a Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Updated license headersJani Heikkinen2016-01-211-19/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some exceptions, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one (in those files which will be under GPL 3 with exceptions) Change-Id: I42a473ddc97101492a60b9287d90979d9eb35ae1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devSimon Hausmann2016-01-121-0/+7
|\| | | | | | | Change-Id: I5839bded07e23af65ced9491c4f50242f964dd31
| * QVariant: make sure two floating points compare equal if they are equalThiago Macieira2016-01-111-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | Not just fuzzily equal. The fuzzy comparison fails for infinities, since the expression p1 - p2 where p1 = p2 = infinity is NaN. And NaN comparisons are always false. As a nice side-effect, we don't do the more expensive computation of a multiplication if the two numbers really are equal. Task-number: QTBUG-50036 Change-Id: I11f559ef75544c50b3f8ffff1420cec7c7273295 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-12-181-0/+41
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/painting/painting.pri src/plugins/platforms/xcb/qxcbconnection.cpp tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro tests/auto/corelib/tools/qlocale/test/test.pro tests/auto/gui/kernel/qwindow/tst_qwindow.cpp tools/configure/environment.cpp Change-Id: I9c40f458b89b2c206de2d2c24e90b5f679c93495
| * QVariant: retain duplicate keys when convertingThiago Macieira2015-12-081-0/+41
| | | | | | | | | | | | | | Task-number: QTBUG-49520 Change-Id: I3e15a26e0e424169ac2bffff1417e3f4398c2277 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* | Interpret precision == -128 as "shortest" double conversionUlf Hermann2015-11-232-9/+47
| | | | | | | | | | | | | | | | | | | | | | | | Also use this for converting doubles with QVariant. We generally want exact results there, rather than adding rounding errors whenever we convert. [ChangeLog][QtCore][QLocale] Added special value for double conversion precision to get shortest accurate representation. Change-Id: I905b8a103f39adf31d24b6ce2c8a283cf271b597 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Tests: Remove CONFIG += parallel_test.Friedemann Kleint2015-09-051-1/+0
| | | | | | | | | | | | | | The keyword no longer has a meaning for the new CI. Change-Id: Ibcea4c7a82fb7f982cf4569fdff19f82066543d1 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | tests/corelib: Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b).Friedemann Kleint2015-08-191-22/+22
|/ | | | | | | | | | | | | | - Replace Q[TRY]_VERIFY(pointer == 0) by Q[TRY]_VERIFY(!pointer). - Replace Q[TRY]_VERIFY(smartPointer == 0) by Q[TRY]_VERIFY(smartPointer.isNull()). - Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b) and add casts where necessary. The values will then be logged should a test fail. Tests from corelib/tools were omitted in this change. Change-Id: I4c8786d33fcf429d11b2b624c7cd89c28cadb518 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.5' into devSimon Hausmann2015-03-161-2/+3
|\ | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/xcb/qxcbnativeinterface.cpp src/plugins/platforms/xcb/qxcbnativeinterface.h Change-Id: I31b38ba439b9341d51a01c0fd54bea33f7410076
| * Fix building tests on QNXAllan Sandfeld Jensen2015-03-091-2/+3
| | | | | | | | | | | | | | Use qmath and cmath methods instead of math.h methods. Change-Id: I86ee2465c999822bf00a7cefee1642c4c30590a6 Reviewed-by: Tony Sarajärvi <tony.sarajarvi@digia.com>
* | tst_qvariant: Remove an obsolete QSKIPOlivier Goffart2015-03-111-3/+0
|/ | | | | | | | | | The QSkip was there because of a bug in QList. Since commit 8153386397087ce4f5c8997992edf5c1fd38b8db, the test is no longer using QList. We can remove the QSKIP Task-number: QTBUG-8959 Change-Id: Icc18d341d734d0605dcddaf925586f3bd603d6a0 Reviewed-by: Jocelyn Turcotte (Woboq GmbH) <jturcotte@woboq.com>
* Make QPersistentModelIndex an internal meta-typeGabriel de Dietrich2015-03-061-0/+13
| | | | | | | | | | | It was already a user meta-type, so it only gets promoted to internal. [ChangeLog][QtCore] QPersistentModel index becomes an built-in meta-type, including QVariant support. Change-Id: I63d733d1eb66aa61691e7afce27fe7372a83ac00 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QVariant: fix converting enum to stringOlivier Goffart2015-02-251-1/+1
| | | | | | | Use QMetaEnum::valueToKey instead of valueToKeys. Change-Id: I270f0820a03aaebde94c37c011c5e9b81421b50f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* Add conversion between Q_ENUMs and strings in QVariantOlivier Goffart2015-02-151-2/+77
| | | | | Change-Id: I9264a68d162cf20db0167dd3f976a007477786d1 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* Improve conversion of QVariants with QJsonValuesAllan Sandfeld Jensen2015-02-121-7/+20
| | | | | | | | Adds conversion from QJsonArray and QJsonObject, and report missing conversion failures for other QJsonValues. Change-Id: Ic0c3a952657912401db877b068f7fcc3c08c94c2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* QAssociativeIterable: add find()Marc Mutz2015-01-211-1/+4
| | | | | | | | | | This is like value(), but returns an iterator instead of the value(). [ChangeLog][QtCore][QAssociativeIterable] Added find(). Change-Id: I029fc8f91cef78f718d419587a2a50ffd2bf7632 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* Implement proper C++ type numeric promotion for QVariant comparisonsThiago Macieira2014-12-031-1/+322
| | | | | | | | | | | | | | | | | | | | | | Previously, QVariant would try to convert one operand to the other's type, which would produce unexpected results: the results would depend in the order of the operands and whether there was data loss in the conversion. In addition, ordering comparisons were only done with signed values, yielding other unexpected results, like QVariant(LLONG_MAX / 2) < QVariant(Q_UINT64_C(0)). Instead, try to obey the C++ standard rules for type promotion in expressions. Our code is a little simpler than the standard would seem to require since we know some more details from the ABI. [ChangeLog][Important Behavior Changes][QVariant] QVariant now obeys the C++ type promotion rules when comparing numeric types (integrals, float and double), including the fact that unsigned comparisons are preferred for types of the same rank (that is, now QVariant(-1) > QVariant(0U)). Task-number: QTBUG-42722 Change-Id: Ie7b19073dcb45485354710975e561bcdb1a753f1 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-11-242-6/+7
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qiodevice.cpp src/plugins/bearer/linux_common/qofonoservice_linux.cpp src/plugins/bearer/linux_common/qofonoservice_linux_p.h src/plugins/platforms/android/qandroidplatformtheme.cpp src/tools/bootstrap/bootstrap.pro src/widgets/styles/qmacstyle_mac.mm Change-Id: Ia02aab6c4598ce74e9c30bb4666d5e2ef000f99b
| * Add C++11 if available for QVariant autotestJørgen Lind2014-11-131-0/+1
| | | | | | | | | | | | | | | | | | gcc 4.9 has the __has_include feature which enables the TEST_FORWARD_LIST and includes the forward_list header. This in turn checks that the c++11 flags are enabled, or throws an error. Change-Id: I44aa58e47c2f9ba6f14cb5a68d24da4a76698e5f Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
| * tst_qvariant: automate testing of forward_listMarc Mutz2014-10-291-6/+6
| | | | | | | | | | | | | | ...using the SD-6 __has_include macro. Change-Id: I629e2ad1c8090aba9e86ab9febf6d09a504219f9 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Fix asymmetry in QVariant::cmp when A converts to B but not the oppositeThiago Macieira2014-11-201-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This would result in (a == b) != (b == a). The == operation should be commutative as much as possible. Now, there's still an asymmetry in that b is forced to a type and the conversion may fail. QVariant should have an idea of what conversions are "promotion" and which ones are "demotion" (subject to loss of data and/or can fail), so it can do the promotion first Task-number: QTBUG-42254 Change-Id: I9fa4496bbbf0f8719ff8456cc24247290beac608 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* | Enhance precision of the FP conversion to strings in QVariantThiago Macieira2014-11-201-38/+73
|/ | | | | | | | | | | | | | | | | | | | | | This now guarantees that doing a round-trip from an FP number to string and back to number results in the same number. This change is required because DBL_DIG and FLT_DIG don't have the meaning that we were expecting them to, here: they mean the minimum number of digits of precision in decimal (i.e., changing the last decimal will always cause the FP number to change). We need the maximum number: there is one change in the last decimal place that causes the FP number to change. IEEE 754 single-precision has 24 binary digits and double precision has 53 binary digits in their mantissa. To convert that to decimal, multiply by the number of decimal digits a binary digit represents (log2(10) = 0.3), then add one for the rounding and one more digit for the actual precision we want. That is, for floats we now ask for 9 digits and for double, 17 decimal digits. Task-number: QTBUG-42574 Change-Id: Ic78beb60a218f75322f832d33d63fd84e7a65b65 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Fix QVariant associative container conversion from built-in types.Jędrzej Nowacki2014-10-241-0/+45
| | | | | | Task-number: QTBUG-41403 Change-Id: I9dab0f9450cac11678eb6d20abd2dd08e86e0900 Reviewed-by: Stephen Kelly <steveire@gmail.com>