diff options
author | Andre Hartmann <aha_1980@gmx.de> | 2018-06-17 20:09:39 +0200 |
---|---|---|
committer | André Hartmann <aha_1980@gmx.de> | 2018-07-07 19:58:18 +0000 |
commit | f98ee77cd3e9964b995d063345a895e537bc1157 (patch) | |
tree | 25b4f05d5bf44a6a74ca2b7092d50df44c55e1f9 /tests/auto/corelib/global/qgetputenv | |
parent | 85472b6b02b42ea624e1c00a5fd38c0d2889a731 (diff) |
QByteArray: toInt() and toDouble() ignore surrounding whitespaces
[ChangeLog][QtCore][QByteArray] QByteArray::toInt(),
QByteArray::toDouble() and the other number conversion functions
now ignore leading and trailing whitespaces, as their QString
counterparts already did. For consistency reasons, the same
behavior was added to qEnvironmentVariableIntValue() also.
Task-number: QTBUG-66187
Change-Id: I8b5e478ea8577b811d969286ea9e269f539c1ea4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/corelib/global/qgetputenv')
-rw-r--r-- | tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp b/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp index f02e902468..544cb1bf07 100644 --- a/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp +++ b/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp @@ -160,8 +160,10 @@ void tst_QGetPutEnv::intValue_data() // some repetition from what is tested in getSetCheck() QTest::newRow("empty") << QByteArray() << 0 << false; - QTest::newRow("spaces-heading") << QByteArray(" 1") << 1 << true; - QTest::newRow("spaces-trailing") << QByteArray("1 ") << 0 << false; + QTest::newRow("spaces-heading") << QByteArray(" \n\r\t1") << 1 << true; + QTest::newRow("spaces-trailing") << QByteArray("1 \n\r\t") << 1 << true; + QTest::newRow("junk-heading") << QByteArray("x1") << 0 << false; + QTest::newRow("junk-trailing") << QByteArray("1x") << 0 << false; #define ROW(x, i, b) \ QTest::newRow(#x) << QByteArray(#x) << (i) << (b) |