Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
PIM Messagelib
Commits
4d7662bf
Commit
4d7662bf
authored
Oct 01, 2020
by
Laurent Montel
😁
Browse files
Use QByteArray directly
parent
638cfeb7
Changes
1
Hide whitespace changes
Inline
Side-by-side
messagecore/autotests/stringutiltest.cpp
View file @
4d7662bf
...
...
@@ -414,8 +414,8 @@ void StringUtilTest::test_parseMailToWithUtf8QuotedEncoded()
void
StringUtilTest
::
test_parseMailToBug366981
()
{
const
Q
String
ba
(
QString
Literal
(
"mailto:test@test.com?subject=test&body=line1%0D%0Aline2"
));
QUrl
urlDecoded
(
QUrl
::
fromPercentEncoding
(
ba
.
toUtf8
()
));
const
Q
ByteArray
ba
(
QByteArray
Literal
(
"mailto:test@test.com?subject=test&body=line1%0D%0Aline2"
));
QUrl
urlDecoded
(
QUrl
::
fromPercentEncoding
(
ba
));
QVector
<
QPair
<
QString
,
QString
>
>
data
=
StringUtil
::
parseMailtoUrl
(
urlDecoded
);
QCOMPARE
(
data
.
size
(),
3
);
for
(
int
i
=
0
;
i
<
3
;
++
i
)
{
...
...
@@ -434,8 +434,8 @@ void StringUtilTest::test_parseMailToBug366981()
void
StringUtilTest
::
test_parseDuplicateQueryItems
()
{
const
Q
String
ba
(
QString
Literal
(
"mailto:test@test.com?subject=test&body=line1%0D%0Aline2&cc=someone_else@example.com&cc=someone_else2@example.com"
));
QUrl
urlDecoded
(
QUrl
::
fromPercentEncoding
(
ba
.
toUtf8
()
));
const
Q
ByteArray
ba
(
QByteArray
Literal
(
"mailto:test@test.com?subject=test&body=line1%0D%0Aline2&cc=someone_else@example.com&cc=someone_else2@example.com"
));
QUrl
urlDecoded
(
QUrl
::
fromPercentEncoding
(
ba
));
QVector
<
QPair
<
QString
,
QString
>
>
values
=
StringUtil
::
parseMailtoUrl
(
urlDecoded
);
QCOMPARE
(
values
.
size
(),
5
);
int
valueCC
=
0
;
...
...
@@ -459,9 +459,9 @@ void StringUtilTest::test_parseDuplicateQueryItems()
void
StringUtilTest
::
test_parseMAilToBug402378
()
{
const
Q
String
ba
(
QString
Literal
(
const
Q
ByteArray
ba
(
QByteArray
Literal
(
"mailto:?body=infotbm.com https://www.infotbm.com/fr/routes/id=-0.624162|44.849958&type=address/datetime=20181226T143038&id=stop_area:TBT:SA:HTLEV&time_type=arrival&type=stop_area/0&subject=Votre itineraire avec TBM"
));
QUrl
urlDecoded
(
QUrl
::
fromPercentEncoding
(
ba
.
toUtf8
()
));
QUrl
urlDecoded
(
QUrl
::
fromPercentEncoding
(
ba
));
QVector
<
QPair
<
QString
,
QString
>
>
data
=
StringUtil
::
parseMailtoUrl
(
urlDecoded
);
QCOMPARE
(
data
.
size
(),
6
);
QCOMPARE
(
data
.
at
(
0
).
first
,
QLatin1String
(
"body"
));
...
...
@@ -482,9 +482,9 @@ void StringUtilTest::test_parseMAilToBug402378()
void
StringUtilTest
::
test_parseMailToBug406208
()
{
{
QString
ba
(
QString
Literal
(
const
QByteArray
ba
(
QByteArray
Literal
(
"mailto:?body=http%3A%2F%2Fwww.lecourrierdelarchitecte.com%2Farticle_8428&subject=Le%20Courrier%20l'effet%20%23metoo%20%3F"
));
QUrl
urlDecoded
(
QUrl
::
fromPercentEncoding
(
ba
.
toUtf8
()
));
QUrl
urlDecoded
(
QUrl
::
fromPercentEncoding
(
ba
));
//qDebug() << " urlDecoded" << urlDecoded.authority(QUrl::FullyDecoded);
QVector
<
QPair
<
QString
,
QString
>
>
data
=
StringUtil
::
parseMailtoUrl
(
urlDecoded
);
QCOMPARE
(
data
.
size
(),
2
);
...
...
@@ -495,9 +495,9 @@ void StringUtilTest::test_parseMailToBug406208()
QCOMPARE
(
data
.
at
(
1
).
second
,
QLatin1String
(
"Le Courrier l'effet #metoo ?"
));
}
{
QString
ba
(
QString
Literal
(
const
QByteArray
ba
(
QByteArray
Literal
(
"mailto:?body=http%3A%2F%2Fwww.lecourrierdelarchitecte.com%2Farticle_8428%20%23%23bla&subject=Le%20Courrier%20l'effet%20%23metoo%20%3F"
));
QUrl
urlDecoded
(
QUrl
::
fromPercentEncoding
(
ba
.
toUtf8
()
));
QUrl
urlDecoded
(
QUrl
::
fromPercentEncoding
(
ba
));
//qDebug() << " urlDecoded" << urlDecoded.authority(QUrl::FullyDecoded);
QVector
<
QPair
<
QString
,
QString
>
>
data
=
StringUtil
::
parseMailtoUrl
(
urlDecoded
);
QCOMPARE
(
data
.
size
(),
2
);
...
...
@@ -511,9 +511,9 @@ void StringUtilTest::test_parseMailToBug406208()
void
StringUtilTest
::
test_parseMailToBug832795
()
{
const
Q
String
ba
(
QString
Literal
(
const
Q
ByteArray
ba
(
QByteArray
Literal
(
"mailto:832795@bugs.debian.org?In-Reply-To=%3C146974194340.26747.4814466130640572267.reportbug%40portux.lan.naturalnet.de%3E&subject=Re%3A%20kmail%3A%20unescaping%20mailto%3A%20links%20broken&body=On%20Thu%2C%2028%20Jul%202016References=%3C146974194340.26747.4814466130640572267.reportbug%40portux.lan.naturalnet.de%3Ebody=On%20Thu%2C%2028%20Jul%202016%2023%3A39%3A03%20%2B0200%20Dominik%20George%20%3Cnik%40naturalnet.de%3E%20wrote%3A%0A%3E%20Package%3A%20kmail%0A%3E%20Version%3A%204%3A16.04.3-1%0A"
));
QUrl
urlDecoded
(
QUrl
::
fromPercentEncoding
(
ba
.
toUtf8
()
));
QUrl
urlDecoded
(
QUrl
::
fromPercentEncoding
(
ba
));
QVector
<
QPair
<
QString
,
QString
>
>
data
=
StringUtil
::
parseMailtoUrl
(
urlDecoded
);
QCOMPARE
(
data
.
size
(),
4
);
QCOMPARE
(
data
.
at
(
0
).
first
,
QLatin1String
(
"to"
));
...
...
@@ -529,8 +529,8 @@ void StringUtilTest::test_parseMailToBug832795()
void
StringUtilTest
::
test_crashXdgemail
()
{
const
Q
String
ba
(
QString
Literal
(
"mailto:foo@kde.org?to=bar@kde.org&to=baz@kde.org"
));
QUrl
urlDecoded
(
QUrl
::
fromPercentEncoding
(
ba
.
toUtf8
()
));
const
Q
ByteArray
ba
(
QByteArray
Literal
(
"mailto:foo@kde.org?to=bar@kde.org&to=baz@kde.org"
));
QUrl
urlDecoded
(
QUrl
::
fromPercentEncoding
(
ba
));
QVector
<
QPair
<
QString
,
QString
>
>
values
=
StringUtil
::
parseMailtoUrl
(
urlDecoded
);
QCOMPARE
(
values
.
size
(),
1
);
QCOMPARE
(
values
.
at
(
0
).
first
,
QLatin1String
(
"to"
));
...
...
@@ -540,8 +540,8 @@ void StringUtilTest::test_crashXdgemail()
void
StringUtilTest
::
test_xdgemail
()
{
{
const
Q
String
ba
(
QString
Literal
(
"mailto:foo@kde.org?to=bar@kde.org&to=baz@kde.org&cc=bli@kde.org"
));
QUrl
urlDecoded
(
QUrl
::
fromPercentEncoding
(
ba
.
toUtf8
()
));
const
Q
ByteArray
ba
(
QByteArray
Literal
(
"mailto:foo@kde.org?to=bar@kde.org&to=baz@kde.org&cc=bli@kde.org"
));
QUrl
urlDecoded
(
QUrl
::
fromPercentEncoding
(
ba
));
QVector
<
QPair
<
QString
,
QString
>
>
values
=
StringUtil
::
parseMailtoUrl
(
urlDecoded
);
QCOMPARE
(
values
.
size
(),
2
);
QCOMPARE
(
values
.
at
(
0
).
first
,
QLatin1String
(
"to"
));
...
...
@@ -550,8 +550,8 @@ void StringUtilTest::test_xdgemail()
QCOMPARE
(
values
.
at
(
1
).
second
,
QLatin1String
(
"bli@kde.org"
));
}
{
const
Q
String
ba
(
QString
Literal
(
"mailto:foo@kde.org?to=bar@kde.org&to=baz@kde.org&cc=ss@kde.org&bcc=ccs@kde.org"
));
QUrl
urlDecoded
(
QUrl
::
fromPercentEncoding
(
ba
.
toUtf8
()
));
const
Q
ByteArray
ba
(
QByteArray
Literal
(
"mailto:foo@kde.org?to=bar@kde.org&to=baz@kde.org&cc=ss@kde.org&bcc=ccs@kde.org"
));
QUrl
urlDecoded
(
QUrl
::
fromPercentEncoding
(
ba
));
QVector
<
QPair
<
QString
,
QString
>
>
values
=
StringUtil
::
parseMailtoUrl
(
urlDecoded
);
QCOMPARE
(
values
.
size
(),
3
);
QCOMPARE
(
values
.
at
(
0
).
first
,
QLatin1String
(
"to"
));
...
...
@@ -562,8 +562,8 @@ void StringUtilTest::test_xdgemail()
QCOMPARE
(
values
.
at
(
2
).
second
,
QLatin1String
(
"ccs@kde.org"
));
}
{
const
Q
String
ba
(
QString
Literal
(
"mailto:foo@kde.org?to=bar@kde.org&to=baz@kde.org&cc=ss@kde.org&bcc=ccs@kde.org&to=ff@kde.org"
));
QUrl
urlDecoded
(
QUrl
::
fromPercentEncoding
(
ba
.
toUtf8
()
));
const
Q
ByteArray
ba
(
QByteArray
Literal
(
"mailto:foo@kde.org?to=bar@kde.org&to=baz@kde.org&cc=ss@kde.org&bcc=ccs@kde.org&to=ff@kde.org"
));
QUrl
urlDecoded
(
QUrl
::
fromPercentEncoding
(
ba
));
QVector
<
QPair
<
QString
,
QString
>
>
values
=
StringUtil
::
parseMailtoUrl
(
urlDecoded
);
QCOMPARE
(
values
.
size
(),
3
);
QCOMPARE
(
values
.
at
(
0
).
first
,
QLatin1String
(
"cc"
));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment