Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KDE PIM Add-ons
Commits
93b9ea7b
Commit
93b9ea7b
authored
Oct 10, 2022
by
Laurent Montel
Browse files
Port to QRegularExpression
parent
074e9fbc
Pipeline
#245103
passed with stage
in 35 minutes and 15 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
plugins/messageviewer/bodypartformatter/autotests/rendertest-common.cpp
View file @
93b9ea7b
...
...
@@ -7,6 +7,7 @@
#include
<QFile>
#include
<QProcess>
#include
<QRegularExpression>
#include
<QTest>
static
void
compareFile
(
const
QString
&
outFile
,
const
QString
&
referenceFile
)
...
...
@@ -20,11 +21,11 @@ static void compareFile(const QString &outFile, const QString &referenceFile)
QVERIFY
(
f
.
open
(
QIODevice
::
ReadOnly
));
QString
content
=
QString
::
fromUtf8
(
f
.
readAll
());
f
.
close
();
content
.
replace
(
QReg
Exp
(
QStringLiteral
(
"[
\t
]+"
)),
QStringLiteral
(
" "
));
content
.
replace
(
QReg
Exp
(
QStringLiteral
(
"[
\t
]*
\n
+[
\t
]*"
)),
QStringLiteral
(
"
\n
"
));
content
.
replace
(
QReg
Exp
(
QStringLiteral
(
"([
\n\t
])
\\
1+"
)),
QStringLiteral
(
"
\\
1"
));
content
.
replace
(
QReg
Exp
(
QStringLiteral
(
">
\n
+[
\t
]*"
)),
QStringLiteral
(
">"
));
content
.
replace
(
QReg
Exp
(
QStringLiteral
(
"[
\t
]*
\n
+[
\t
]*<"
)),
QStringLiteral
(
"<"
));
content
.
replace
(
QReg
ularExpression
(
QStringLiteral
(
"[
\t
]+"
)),
QStringLiteral
(
" "
));
content
.
replace
(
QReg
ularExpression
(
QStringLiteral
(
"[
\t
]*
\n
+[
\t
]*"
)),
QStringLiteral
(
"
\n
"
));
content
.
replace
(
QReg
ularExpression
(
QStringLiteral
(
"([
\n\t
])
\\
1+"
)),
QStringLiteral
(
"
\\
1"
));
content
.
replace
(
QReg
ularExpression
(
QStringLiteral
(
">
\n
+[
\t
]*"
)),
QStringLiteral
(
">"
));
content
.
replace
(
QReg
ularExpression
(
QStringLiteral
(
"[
\t
]*
\n
+[
\t
]*<"
)),
QStringLiteral
(
"<"
));
content
.
replace
(
QLatin1String
(
" "
),
QLatin1String
(
"NBSP_ENTITY_PLACEHOLDER"
));
// xmlling chokes on
QVERIFY
(
f
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Truncate
));
f
.
write
(
content
.
toUtf8
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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