mirror of
https://github.com/Bionus/imgbrd-grabber.git
synced 2025-01-08 11:47:33 +08:00
Code style fixes in tests project
This commit is contained in:
parent
80e41662e5
commit
c6fb4dc86b
@ -2,8 +2,8 @@
|
||||
|
||||
set -e
|
||||
|
||||
# "src/gui/src/" "src/tests/src/"
|
||||
find "src/lib/src/" "src/cli/src/" "src/e2e/src/" -name '*.cpp' -o -name '*.h' \
|
||||
# "src/gui/src/"
|
||||
find "src/lib/src/" "src/cli/src/" "src/e2e/src/" "src/tests/src/" -name '*.cpp' -o -name '*.h' \
|
||||
| grep -v "vendor" \
|
||||
| grep -v "crashhandler" \
|
||||
| grep -v "backports" \
|
||||
|
@ -44,7 +44,7 @@ SearchSyntaxHighlighter::SearchSyntaxHighlighter(QTextDocument *parent)
|
||||
|
||||
void SearchSyntaxHighlighter::highlightBlock(const QString &text)
|
||||
{
|
||||
foreach(const HighlightingRule &rule, highlightingRules) {
|
||||
for (const HighlightingRule &rule : highlightingRules) {
|
||||
QRegularExpressionMatchIterator matchIterator = rule.pattern.globalMatch(text);
|
||||
while (matchIterator.hasNext()) {
|
||||
QRegularExpressionMatch match = matchIterator.next();
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace Catch
|
||||
{
|
||||
template<>
|
||||
template <>
|
||||
struct StringMaker<QLatin1String>
|
||||
{
|
||||
static std::string convert(QLatin1String const& value)
|
||||
@ -18,7 +18,7 @@ namespace Catch
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
template <>
|
||||
struct StringMaker<QString>
|
||||
{
|
||||
static std::string convert(QString const& value)
|
||||
@ -27,7 +27,7 @@ namespace Catch
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
template <>
|
||||
struct StringMaker<QChar>
|
||||
{
|
||||
static std::string convert(QChar const& value)
|
||||
@ -36,7 +36,7 @@ namespace Catch
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
template <>
|
||||
struct StringMaker<QUrl>
|
||||
{
|
||||
static std::string convert(QUrl const &value)
|
||||
@ -45,24 +45,26 @@ namespace Catch
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
template <>
|
||||
struct StringMaker<QSize>
|
||||
{
|
||||
static std::string convert(QSize const &value)
|
||||
{
|
||||
if (!value.isValid())
|
||||
if (!value.isValid()) {
|
||||
return "{invalid size}";
|
||||
}
|
||||
return QString("(%1 x %2)").arg(value.width()).arg(value.height()).toStdString();
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
template <>
|
||||
struct StringMaker<QDateTime>
|
||||
{
|
||||
static std::string convert(QDateTime const &value)
|
||||
{
|
||||
if (!value.isValid())
|
||||
if (!value.isValid()) {
|
||||
return "{invalid date}";
|
||||
}
|
||||
return value.toString(Qt::ISODate).toStdString();
|
||||
}
|
||||
};
|
||||
|
@ -65,8 +65,9 @@ TEST_CASE("BatchDownloader")
|
||||
SECTION("Image not found")
|
||||
{
|
||||
// More than once because of the extension rotator
|
||||
for (int i = 0; i < 7; ++i)
|
||||
for (int i = 0; i < 7; ++i) {
|
||||
CustomNetworkAccessManager::NextFiles.append("404");
|
||||
}
|
||||
|
||||
BatchDownloader downloader(&query, profile);
|
||||
waitForFinished(&downloader);
|
||||
|
@ -48,7 +48,9 @@ QList<QSharedPointer<Image>> getImages(const QString &source, const QString &sit
|
||||
sites.append(ste);
|
||||
|
||||
QList<QSharedPointer<Image>> result;
|
||||
Downloader downloader(profile, nullptr,
|
||||
Downloader downloader(
|
||||
profile,
|
||||
nullptr,
|
||||
tags.split(' '),
|
||||
QStringList(),
|
||||
sites,
|
||||
@ -64,7 +66,8 @@ QList<QSharedPointer<Image>> getImages(const QString &source, const QString &sit
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
false);
|
||||
false
|
||||
);
|
||||
downloader.setQuit(false);
|
||||
|
||||
// Wait for downloader
|
||||
@ -119,7 +122,9 @@ QList<Tag> getPageTags(const QString &source, const QString &site, const QString
|
||||
sites.append(ste);
|
||||
|
||||
QList<Tag> result;
|
||||
Downloader downloader(profile, nullptr,
|
||||
Downloader downloader(
|
||||
profile,
|
||||
nullptr,
|
||||
tags.split(' '),
|
||||
QStringList(),
|
||||
sites,
|
||||
@ -133,7 +138,8 @@ QList<Tag> getPageTags(const QString &source, const QString &site, const QString
|
||||
false,
|
||||
Blacklist(),
|
||||
false,
|
||||
0);
|
||||
0
|
||||
);
|
||||
downloader.setQuit(false);
|
||||
|
||||
// Wait for downloader
|
||||
|
@ -136,8 +136,9 @@ TEST_CASE("Favorite")
|
||||
SECTION("SetImageFirst")
|
||||
{
|
||||
QFile file(savePath("thumbs/tag1.png"));
|
||||
if (file.exists())
|
||||
if (file.exists()) {
|
||||
file.remove();
|
||||
}
|
||||
|
||||
QDateTime date = QDateTime::fromString("2016-07-02 16:35:12", "yyyy-MM-dd HH:mm:ss");
|
||||
Favorite fav("tag1", 50, date);
|
||||
@ -150,8 +151,9 @@ TEST_CASE("Favorite")
|
||||
SECTION("GetImageNotExists")
|
||||
{
|
||||
QFile file(savePath("thumbs/tag1.png"));
|
||||
if (file.exists())
|
||||
if (file.exists()) {
|
||||
file.remove();
|
||||
}
|
||||
|
||||
QDateTime date = QDateTime::fromString("2016-07-02 16:35:12", "yyyy-MM-dd HH:mm:ss");
|
||||
Favorite fav("tag1", 50, date);
|
||||
@ -163,8 +165,9 @@ TEST_CASE("Favorite")
|
||||
SECTION("GetImageBig")
|
||||
{
|
||||
QFile file(savePath("thumbs/tag1.png"));
|
||||
if (file.exists())
|
||||
if (file.exists()) {
|
||||
file.remove();
|
||||
}
|
||||
|
||||
QDateTime date = QDateTime::fromString("2016-07-02 16:35:12", "yyyy-MM-dd HH:mm:ss");
|
||||
Favorite fav("tag1", 50, date);
|
||||
@ -179,8 +182,9 @@ TEST_CASE("Favorite")
|
||||
SECTION("GetImageSmall")
|
||||
{
|
||||
QFile file(savePath("thumbs/tag1.png"));
|
||||
if (file.exists())
|
||||
if (file.exists()) {
|
||||
file.remove();
|
||||
}
|
||||
|
||||
QDateTime date = QDateTime::fromString("2016-07-02 16:35:12", "yyyy-MM-dd HH:mm:ss");
|
||||
Favorite fav("tag1", 50, date);
|
||||
@ -195,8 +199,9 @@ TEST_CASE("Favorite")
|
||||
SECTION("GetImageResize")
|
||||
{
|
||||
QFile file(savePath("thumbs/tag1.png"));
|
||||
if (file.exists())
|
||||
if (file.exists()) {
|
||||
file.remove();
|
||||
}
|
||||
|
||||
QDateTime date = QDateTime::fromString("2016-07-02 16:35:12", "yyyy-MM-dd HH:mm:ss");
|
||||
Favorite fav("tag1", 50, date, QDir::currentPath() + "/tests/resources/image_200x200.png");
|
||||
|
@ -47,7 +47,7 @@ TEST_CASE("TagNameFormat")
|
||||
|
||||
SECTION("Unknown")
|
||||
{
|
||||
TagNameFormat format((TagNameFormat::CaseFormat)123, " ");
|
||||
TagNameFormat format((TagNameFormat::CaseFormat) 123, " ");
|
||||
|
||||
REQUIRE(format.formatted(QStringList()) == QString(""));
|
||||
REQUIRE(format.formatted(QStringList() << "test") == QString("test"));
|
||||
|
@ -70,7 +70,7 @@ nl_while_brace = remove # "while () {" vs "while () \n {"
|
||||
nl_switch_brace = force # "switch () {" vs "switch () \n {"
|
||||
nl_brace_while = remove # "} while" vs "} \n while" - cuddle while
|
||||
nl_brace_else = remove # "} else" vs "} \n else" - cuddle else
|
||||
nl_fcall_brace = remove # "list_for_each() {" vs "list_for_each()\n{"
|
||||
nl_fcall_brace = force # "list_for_each() {" vs "list_for_each()\n{"
|
||||
nl_fdef_brace = force # "int foo() {" vs "int foo()\n{"
|
||||
|
||||
# Spaces
|
||||
@ -101,3 +101,4 @@ sp_after_comma = force
|
||||
sp_func_def_paren = remove # "int foo (){" vs "int foo(){"
|
||||
sp_func_call_paren = remove # "foo (" vs "foo("
|
||||
sp_func_proto_paren = remove # "int foo ();" vs "int foo();"
|
||||
sp_cpp_lambda_assign = remove # "[ = ]() {}" vs "[=]() {}"
|
||||
|
Loading…
Reference in New Issue
Block a user