Fix the idempotent recoding tests in tst_QUrlInternal
This was trying all the possibilities by brute force, but it turns out that some combinations are not valid so they should not be tested. What's more, it was using old values of the flags, so this was actually testing nothing. Change-Id: I6c2f5230d240fc23418df2d3a1ca905dbc47dd10 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: David Faure <faure@kde.org> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
This commit is contained in:
parent
6049f67eb4
commit
4793356ce7
@ -834,9 +834,34 @@ void tst_QUrlInternal::encodingRecode_data()
|
||||
QTest::addColumn<QString>("expected");
|
||||
|
||||
// -- idempotent tests --
|
||||
for (int i = 0; i < 0x10; ++i) {
|
||||
QByteArray code = QByteArray::number(i, 16);
|
||||
F mode = QUrl::ComponentFormattingOption(i << 12);
|
||||
static int modes[] = { QUrl::PrettyDecoded,
|
||||
QUrl::EncodeSpaces,
|
||||
QUrl::EncodeSpaces | QUrl::EncodeUnicode,
|
||||
QUrl::EncodeSpaces | QUrl::EncodeUnicode | QUrl::EncodeDelimiters,
|
||||
QUrl::EncodeSpaces | QUrl::EncodeUnicode | QUrl::EncodeDelimiters | QUrl::EncodeReserved,
|
||||
QUrl::EncodeSpaces | QUrl::EncodeUnicode | QUrl::EncodeDelimiters | QUrl::DecodeReserved,
|
||||
QUrl::EncodeSpaces | QUrl::EncodeUnicode | QUrl::EncodeReserved,
|
||||
QUrl::EncodeSpaces | QUrl::EncodeUnicode | QUrl::DecodeReserved,
|
||||
QUrl::EncodeSpaces | QUrl::EncodeDelimiters,
|
||||
QUrl::EncodeSpaces | QUrl::EncodeDelimiters | QUrl::EncodeReserved,
|
||||
QUrl::EncodeSpaces | QUrl::EncodeDelimiters | QUrl::DecodeReserved,
|
||||
QUrl::EncodeSpaces | QUrl::EncodeReserved,
|
||||
QUrl::EncodeSpaces | QUrl::DecodeReserved,
|
||||
|
||||
QUrl::EncodeUnicode,
|
||||
QUrl::EncodeUnicode | QUrl::EncodeDelimiters,
|
||||
QUrl::EncodeUnicode | QUrl::EncodeDelimiters | QUrl::EncodeReserved,
|
||||
QUrl::EncodeUnicode | QUrl::EncodeDelimiters | QUrl::DecodeReserved,
|
||||
QUrl::EncodeUnicode | QUrl::EncodeReserved,
|
||||
|
||||
QUrl::EncodeDelimiters,
|
||||
QUrl::EncodeDelimiters | QUrl::EncodeReserved,
|
||||
QUrl::EncodeDelimiters | QUrl::DecodeReserved,
|
||||
QUrl::EncodeReserved,
|
||||
QUrl::DecodeReserved };
|
||||
for (uint i = 0; i < sizeof(modes)/sizeof(modes[0]); ++i) {
|
||||
QByteArray code = QByteArray::number(modes[i], 16);
|
||||
F mode = QUrl::ComponentFormattingOption(modes[i]);
|
||||
|
||||
QTest::newRow("null-0x" + code) << QString() << mode << QString();
|
||||
QTest::newRow("empty-0x" + code) << "" << mode << "";
|
||||
|
Loading…
Reference in New Issue
Block a user