// Check that we are not missing a separator
if (i < decpt_idx
&& (decpt_idx - i) % 4 == 0
- && !(i == 0 && c == '-')) // check for negative sign at start of string
+ && !(i == 0 && (c == '-' || c == '+'))) // check for negative or positive sign at start of string
return false;
++i;
}
void listPatterns();
void measurementSystems();
+ void QTBUG_26035_positivesign();
private:
QString m_decimal, m_thousand, m_sdate, m_ldate, m_time;
QCOMPARE(locale.measurementSystem(), QLocale::MetricSystem);
}
+void tst_QLocale::QTBUG_26035_positivesign()
+{
+ QLocale locale(QLocale::C);
+ bool ok (false);
+ QCOMPARE(locale.toInt(QString("+100,000"), &ok), 100000);
+ QVERIFY(ok);
+ ok = false;
+ QCOMPARE(locale.toInt(QString("+100,000,000"), &ok), 100000000);
+ QVERIFY(ok);
+ ok = false;
+ QCOMPARE(locale.toLongLong(QString("+100,000"), &ok), (qlonglong)100000);
+ QVERIFY(ok);
+ ok = false;
+ QCOMPARE(locale.toLongLong(QString("+100,000,000"), &ok), (qlonglong)100000000);
+ QVERIFY(ok);
+}
+
QTEST_MAIN(tst_QLocale)
#include "tst_qlocale.moc"