File: 1003_adapt_to_json_parser_change.patch

package info (click to toggle)
qtpim-opensource-src 5.0~git20201102.f9a8f0fc%2Bdfsg1-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,236 kB
  • sloc: cpp: 82,965; xml: 91; makefile: 81; javascript: 67
file content (50 lines) | stat: -rw-r--r-- 1,833 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Description: adapt to JSON parser behavior change in Qt 5.15
 QJsonValue will expose input like "2.0" as an integral type as
 the value can be perfectly expressed as an integral.
 .
 See the discussion in https://bugreports.qt.io/browse/QTBUG-87443.
Origin: https://codereview.qt-project.org/c/qt/qtpim/+/317682
Last-Update: 2020-10-31

--- a/tests/auto/versit/qversitcontactimporter/tst_qversitcontactimporter.cpp
+++ b/tests/auto/versit/qversitcontactimporter/tst_qversitcontactimporter.cpp
@@ -1525,20 +1525,33 @@
     }
 
     {
-        QTest::newRow("double data")
+        QTest::newRow("integral data")
                 << QString("name")
-                << QVariant((double)2.0)
+                << QVariant((qlonglong)2)
                 << jsonArrayWith.arg("2")
                 << true;
+        QTest::newRow("integral data - perfectly representable") // QTBUG-87443
+                << QString("name")
+                << QVariant((qlonglong)2)
+                << jsonArrayWith.arg("2.0")
+                << true;
+    }
+
+    {
+        QTest::newRow("double data")
+                << QString("name")
+                << QVariant((double)2.1)
+                << jsonArrayWith.arg("2.1")
+                << true;
         QTest::newRow("double data, negative")
                 << QString("name")
-                << QVariant((double)-1.0)
-                << jsonArrayWith.arg("-1")
+                << QVariant((double)-1.2)
+                << jsonArrayWith.arg("-1.2")
                 << true;
         QTest::newRow("double data, multiple digits")
                 << QString("name")
-                << QVariant((double)10.2)
-                << jsonArrayWith.arg("10.2")
+                << QVariant((double)10.23456)
+                << jsonArrayWith.arg("10.23456")
                 << true;
     }