Add some %-encoding round-trip tests that use % in the plain-text

This was not previously tested.

Change-Id: Icd287b519f6bc5d450f4490990ac78b0d06774f6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Edward Welbourne 2022-03-03 14:22:00 +01:00
parent 1ea73bc29b
commit 84984cfce2

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Copyright (C) 2022 The Qt Company Ltd.
** Copyright (C) 2016 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
@ -1678,6 +1678,14 @@ void tst_QByteArray::toFromPercentEncoding()
QVERIFY(arr.toPercentEncoding().isNull());
QVERIFY(QByteArray::fromPercentEncoding(QByteArray()).isEmpty());
QVERIFY(QByteArray::fromPercentEncoding(QByteArray()).isNull());
// Verify that literal % in the string to be encoded does round-trip:
arr = "Qt%20is%20great%21";
data = arr.toPercentEncoding();
QCOMPARE(QByteArray::fromPercentEncoding(data), arr);
arr = "87% of all statistics are made up!";
data = arr.toPercentEncoding();
QCOMPARE(QByteArray::fromPercentEncoding(data), arr);
}
void tst_QByteArray::fromPercentEncoding_data()