Run clang-format on all cpp/h files
NO_CHANGELOG
This commit is contained in:
parent
5df331acf2
commit
fe594e8742
@ -143,4 +143,4 @@ kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
|
||||
# Remove these 3 lines when the ECM version is bumped to 5.80
|
||||
include(KDEClangFormat)
|
||||
file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h)
|
||||
kde_clang_format()
|
||||
kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
|
||||
|
||||
@ -19,9 +19,9 @@
|
||||
*/
|
||||
|
||||
#include <QObject>
|
||||
#include <QTest>
|
||||
#include <QStandardPaths>
|
||||
#include <QProcess>
|
||||
#include <QStandardPaths>
|
||||
#include <QTest>
|
||||
|
||||
#include "testhelpers.h"
|
||||
|
||||
@ -55,8 +55,7 @@ class DupeTest : public QObject
|
||||
QString line;
|
||||
while (proc.canReadLine() || proc.waitForReadyRead()) {
|
||||
line = proc.readLine();
|
||||
failListContent(splitOnUnescapedSpace(line.simplified()),
|
||||
"The following files are duplicates but not links:\n");
|
||||
failListContent(splitOnUnescapedSpace(line.simplified()), "The following files are duplicates but not links:\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,11 +63,7 @@ class DupeTest : public QObject
|
||||
{
|
||||
QProcess proc;
|
||||
proc.setProgram(QStringLiteral("fdupes"));
|
||||
proc.setArguments(QStringList()
|
||||
<< QStringLiteral("--recurse")
|
||||
<< QStringLiteral("--sameline")
|
||||
<< QStringLiteral("--nohidden")
|
||||
<< path);
|
||||
proc.setArguments(QStringList() << QStringLiteral("--recurse") << QStringLiteral("--sameline") << QStringLiteral("--nohidden") << path);
|
||||
proc.start();
|
||||
proc.waitForStarted();
|
||||
readLines(proc);
|
||||
|
||||
@ -33,19 +33,15 @@ private Q_SLOTS:
|
||||
void test_whitespace()
|
||||
{
|
||||
QList<QString> brokenFiles;
|
||||
QDirIterator it(PROJECT_SOURCE_DIR,
|
||||
QDir::Files | QDir::System,
|
||||
QDirIterator::Subdirectories);
|
||||
QDirIterator it(PROJECT_SOURCE_DIR, QDir::Files | QDir::System, QDirIterator::Subdirectories);
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
if (it.fileName().simplified() != it.fileName()) {
|
||||
brokenFiles << it.filePath();
|
||||
}
|
||||
}
|
||||
failListContent(brokenFiles,
|
||||
QStringLiteral("Found file with bad characters (http://doc.qt.io/qt-5/qstring.html#simplified):\n"));
|
||||
failListContent(brokenFiles, QStringLiteral("Found file with bad characters (http://doc.qt.io/qt-5/qstring.html#simplified):\n"));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
QTEST_GUILESS_MAIN(NewlineTest)
|
||||
|
||||
@ -19,12 +19,12 @@
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <QDirIterator>
|
||||
#include <QObject>
|
||||
#include <QTest>
|
||||
#include <QDirIterator>
|
||||
|
||||
#include <QSettings> // parsing the ini files as desktop files
|
||||
#include "testhelpers.h"
|
||||
#include <QSettings> // parsing the ini files as desktop files
|
||||
|
||||
// lift a bit of code from KIconLoader to get the unit test running without tier 3 libraries
|
||||
class KIconLoaderDummy : public QObject
|
||||
@ -55,7 +55,6 @@ public:
|
||||
Q_ENUM(Type)
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Represents icon directory to conduct simple icon lookup within.
|
||||
*/
|
||||
@ -63,8 +62,7 @@ class Dir
|
||||
{
|
||||
public:
|
||||
Dir(const QSettings &cg, const QString &themeDir_)
|
||||
:
|
||||
themeDir(themeDir_)
|
||||
: themeDir(themeDir_)
|
||||
, path(cg.group())
|
||||
, size(cg.value("Size", 0).toInt())
|
||||
, contextString(cg.value("Context", QString()).toString())
|
||||
@ -74,7 +72,10 @@ public:
|
||||
QVERIFY2(!contextString.isEmpty(),
|
||||
QString("Missing 'Context' key in file %1, config group '[%2]'").arg(cg.fileName(), cg.group()).toLatin1().constData());
|
||||
QVERIFY2(context != -1,
|
||||
QString("Don't know how to handle 'Context=%1' in file %2, config group '[%3]'").arg(contextString, cg.fileName(), cg.group()).toLatin1().constData());
|
||||
QString("Don't know how to handle 'Context=%1' in file %2, config group '[%3]'")
|
||||
.arg(contextString, cg.fileName(), cg.group())
|
||||
.toLatin1()
|
||||
.constData());
|
||||
}
|
||||
|
||||
static QMetaEnum findEnum(const char *name)
|
||||
@ -179,8 +180,12 @@ private Q_SLOTS:
|
||||
QVERIFY(!directoryPaths.isEmpty());
|
||||
for (auto directoryPath : directoryPaths) {
|
||||
config.beginGroup(directoryPath);
|
||||
QVERIFY2(keys.contains(directoryPath+"/Size"),QString("The theme %1 has an entry 'Directories' which specifies '%2' as directory, but there's no"
|
||||
" have no associated entry '%2/Size'").arg(themeDir + "/index.theme", directoryPath).toLatin1().constData());
|
||||
QVERIFY2(keys.contains(directoryPath + "/Size"),
|
||||
QString("The theme %1 has an entry 'Directories' which specifies '%2' as directory, but there's no"
|
||||
" have no associated entry '%2/Size'")
|
||||
.arg(themeDir + "/index.theme", directoryPath)
|
||||
.toLatin1()
|
||||
.constData());
|
||||
auto dir = QSharedPointer<Dir>::create(config, themeDir);
|
||||
config.endGroup();
|
||||
contextHash[dir->context].append(dir);
|
||||
@ -261,9 +266,7 @@ private Q_SLOTS:
|
||||
return;
|
||||
}
|
||||
notScalableIcons.removeDuplicates();
|
||||
QFAIL(QString("The following icons are not available in a scalable directory:\n %1")
|
||||
.arg(notScalableIcons.join("\n "))
|
||||
.toLatin1().constData());
|
||||
QFAIL(QString("The following icons are not available in a scalable directory:\n %1").arg(notScalableIcons.join("\n ")).toLatin1().constData());
|
||||
}
|
||||
|
||||
void test_scalableDuplicates_data()
|
||||
|
||||
@ -40,9 +40,7 @@ private Q_SLOTS:
|
||||
// By default broken symlinks are not listed unless the System filter
|
||||
// is used. System may however also include pipes and the like, so we
|
||||
// still manually need to filter for symlinks afterwards.
|
||||
QDirIterator it(PROJECT_SOURCE_DIR,
|
||||
QDir::System,
|
||||
QDirIterator::Subdirectories);
|
||||
QDirIterator it(PROJECT_SOURCE_DIR, QDir::System, QDirIterator::Subdirectories);
|
||||
QList<QFileInfo> brokenSymLinks;
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
@ -57,29 +55,25 @@ private Q_SLOTS:
|
||||
}
|
||||
brokenSymLinks << info;
|
||||
}
|
||||
failSymlinkList(brokenSymLinks,
|
||||
QStringLiteral("Found broken symlinks:\n"));
|
||||
failSymlinkList(brokenSymLinks, QStringLiteral("Found broken symlinks:\n"));
|
||||
}
|
||||
|
||||
// Symlinks should never point to something outside the tree, even if valid!
|
||||
void test_outOfTree()
|
||||
{
|
||||
QDirIterator it(PROJECT_SOURCE_DIR,
|
||||
QDir::AllEntries,
|
||||
QDirIterator::Subdirectories);
|
||||
QDirIterator it(PROJECT_SOURCE_DIR, QDir::AllEntries, QDirIterator::Subdirectories);
|
||||
QList<QFileInfo> OOTSymLinks;
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
auto info = it.fileInfo();
|
||||
if (!info.isSymLink() ||
|
||||
info.symLinkTarget().startsWith(PROJECT_SOURCE_DIR)) {
|
||||
if (!info.isSymLink() || info.symLinkTarget().startsWith(PROJECT_SOURCE_DIR)) {
|
||||
continue;
|
||||
}
|
||||
OOTSymLinks << info;
|
||||
}
|
||||
failSymlinkList(OOTSymLinks,
|
||||
QStringLiteral("Found out-of-tree symlinks:\n"));
|
||||
failSymlinkList(OOTSymLinks, QStringLiteral("Found out-of-tree symlinks:\n"));
|
||||
}
|
||||
|
||||
private:
|
||||
QString m_buildDir;
|
||||
};
|
||||
|
||||
@ -16,13 +16,13 @@
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#include <QCommandLineParser>
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QString>
|
||||
#include <QRegularExpression>
|
||||
#include <QDebug>
|
||||
#include <QCommandLineParser>
|
||||
#include <QString>
|
||||
|
||||
QString link(const QString &path, const QString &fileName)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user