qt6-bb10/tests/auto/corelib/kernel/qvariant
Thiago Macieira cf475b91ae Implement proper C++ type numeric promotion for QVariant comparisons
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>
2014-12-03 18:09:00 +01:00
..
stream Split the QGuiVariant test from the Core one. 2012-07-25 00:48:33 +02:00
.gitignore Moving relevant tests to corelib/kernel 2011-09-01 12:42:14 +02:00
qvariant.pro Add C++11 if available for QVariant autotest 2014-11-13 15:21:07 +01:00
qvariant.qrc Cleanup mess in public type ids. 2012-01-25 21:08:08 +01:00
tst_qvariant.cpp Implement proper C++ type numeric promotion for QVariant comparisons 2014-12-03 18:09:00 +01:00