@@ -77,7 +77,8 @@ void TestQgsJsonUtils::testJsonArray()
77
77
QCOMPARE ( QgsJsonUtils::parseArray ( R"( [1.234567,2.00003e+4,-3.01234e-02])" ), QVariantList () << 1.234567 << 2.00003e+4 << -3.01234e-2 );
78
78
// Strings
79
79
QCOMPARE ( QgsJsonUtils::parseArray ( R"( ["one", "two", "three"])" ), QVariantList () << " one" << " two" << " three" );
80
- QCOMPARE ( QgsJsonUtils::parseArray ( R"( ["one,comma", "two[]brackets", "three\"escaped"])" ), QVariantList () << " one,comma" << " two[]brackets" << " three\" escaped" );
80
+ // VC++ doesn't like \" in raw strings
81
+ QCOMPARE ( QgsJsonUtils::parseArray ( " [\" one,comma\" , \" two[]brackets\" , \" three\\\" escaped\" ]" ), QVariantList () << " one,comma" << " two[]brackets" << " three\" escaped" );
81
82
// Nested (not implemented: discard deeper levels)
82
83
// QCOMPARE( QgsJsonUtils::parseArray( R"([1.0,[2.0,5.0],3.0])" ), QVariantList() << 1.0 << 3.0 );
83
84
// Mixed types
@@ -183,10 +184,10 @@ void TestQgsJsonUtils::testExportFeatureJson()
183
184
QgsJsonExporter exporter { &vl };
184
185
185
186
const auto expectedJson { QStringLiteral ( " {\" bbox\" :[[1.12,1.12,5.45,5.33]],\" geometry\" :{\" coordinates\" :"
186
- " [[[1.12,1.34],[5.45,1.12],[5.34,5.33],[1.56,5.2],[1.12,1.34]],"
187
- " [[2.0,2.0],[3.0,2.0],[3.0,3.0],[2.0,3.0],[2.0,2.0]]],\" type\" :\" Polygon\" }"
188
- " ,\" id\" :0,\" properties\" :{\" flddbl\" :2.0,\" fldint\" :1,\" fldtxt\" :\" a value\" }"
189
- " ,\" type\" :\" Feature\" }" ) };
187
+ " [[[1.12,1.34],[5.45,1.12],[5.34,5.33],[1.56,5.2],[1.12,1.34]],"
188
+ " [[2.0,2.0],[3.0,2.0],[3.0,3.0],[2.0,3.0],[2.0,2.0]]],\" type\" :\" Polygon\" }"
189
+ " ,\" id\" :0,\" properties\" :{\" flddbl\" :2.0,\" fldint\" :1,\" fldtxt\" :\" a value\" }"
190
+ " ,\" type\" :\" Feature\" }" ) };
190
191
191
192
const auto j ( exporter.exportFeatureToJsonObject ( feature ) );
192
193
QCOMPARE ( QString::fromStdString ( j.dump () ), expectedJson );
0 commit comments