Clang-Tidy and Clazy fixes
This commit is contained in:
@@ -37,6 +37,8 @@
|
||||
#include "collection/collectionbackend.h"
|
||||
#include "collection/collection.h"
|
||||
|
||||
// clazy:excludeall=non-pod-global-static,returning-void-expression
|
||||
|
||||
namespace {
|
||||
|
||||
class CollectionBackendTest : public ::testing::Test {
|
||||
@@ -58,8 +60,8 @@ class CollectionBackendTest : public ::testing::Test {
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::shared_ptr<Database> database_;
|
||||
std::unique_ptr<CollectionBackend> backend_;
|
||||
std::shared_ptr<Database> database_; // NOLINT(cppcoreguidelines-non-private-member-variables-in-classes)
|
||||
std::unique_ptr<CollectionBackend> backend_; // NOLINT(cppcoreguidelines-non-private-member-variables-in-classes)
|
||||
};
|
||||
|
||||
TEST_F(CollectionBackendTest, EmptyDatabase) {
|
||||
@@ -180,7 +182,7 @@ class SingleSong : public CollectionBackendTest {
|
||||
EXPECT_EQ(1, list[0].directory_id());
|
||||
}
|
||||
|
||||
Song song_;
|
||||
Song song_; // NOLINT(cppcoreguidelines-non-private-member-variables-in-classes)
|
||||
|
||||
};
|
||||
|
||||
@@ -190,7 +192,7 @@ TEST_F(SingleSong, GetSongWithNoAlbum) {
|
||||
AddDummySong(); if (HasFatalFailure()) return;
|
||||
|
||||
EXPECT_EQ(1, backend_->GetAllArtists().size());
|
||||
CollectionBackend::AlbumList albums = backend_->GetAllAlbums();
|
||||
//CollectionBackend::AlbumList albums = backend_->GetAllAlbums();
|
||||
//EXPECT_EQ(1, albums.size());
|
||||
//EXPECT_EQ("Artist", albums[0].artist);
|
||||
//EXPECT_EQ("", albums[0].album);
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
#include "collection/collectionbackend.h"
|
||||
#include "collection/collection.h"
|
||||
|
||||
// clazy:excludeall=non-pod-global-static,returning-void-expression
|
||||
|
||||
namespace {
|
||||
|
||||
class CollectionModelTest : public ::testing::Test {
|
||||
@@ -83,12 +85,12 @@ class CollectionModelTest : public ::testing::Test {
|
||||
return AddSong(song);
|
||||
}
|
||||
|
||||
std::shared_ptr<Database> database_;
|
||||
std::unique_ptr<CollectionBackend> backend_;
|
||||
std::unique_ptr<CollectionModel> model_;
|
||||
std::unique_ptr<QSortFilterProxyModel> model_sorted_;
|
||||
std::shared_ptr<Database> database_; // NOLINT(cppcoreguidelines-non-private-member-variables-in-classes)
|
||||
std::unique_ptr<CollectionBackend> backend_; // NOLINT(cppcoreguidelines-non-private-member-variables-in-classes)
|
||||
std::unique_ptr<CollectionModel> model_; // NOLINT(cppcoreguidelines-non-private-member-variables-in-classes)
|
||||
std::unique_ptr<QSortFilterProxyModel> model_sorted_; // NOLINT(cppcoreguidelines-non-private-member-variables-in-classes)
|
||||
|
||||
bool added_dir_;
|
||||
bool added_dir_; // NOLINT(cppcoreguidelines-non-private-member-variables-in-classes)
|
||||
};
|
||||
|
||||
TEST_F(CollectionModelTest, Initialization) {
|
||||
@@ -209,7 +211,7 @@ TEST_F(CollectionModelTest, VariousArtistSongs) {
|
||||
song.Init("Title " + n, "Artist " + n, "Album", 0);
|
||||
song.set_mtime(0);
|
||||
song.set_ctime(0);
|
||||
songs << song;
|
||||
songs << song; // clazy:exclude=reserve-candidates
|
||||
}
|
||||
|
||||
// Different ways of putting songs in "Various Artist". Make sure they all work
|
||||
@@ -218,7 +220,7 @@ TEST_F(CollectionModelTest, VariousArtistSongs) {
|
||||
songs[2].set_compilation_on(true);
|
||||
songs[3].set_compilation_detected(true); songs[3].set_artist("Various Artists");
|
||||
|
||||
for (int i=0 ; i<4 ; ++i)
|
||||
for (int i=0 ; i < 4 ; ++i)
|
||||
AddSong(songs[i]);
|
||||
model_->Init(false);
|
||||
|
||||
|
||||
@@ -26,11 +26,14 @@
|
||||
#include "core/logging.h"
|
||||
|
||||
class LoggingEnvironment : public ::testing::Environment {
|
||||
public:
|
||||
public:
|
||||
LoggingEnvironment() = default;
|
||||
void SetUp() override {
|
||||
logging::Init();
|
||||
logging::SetLevels("*:4");
|
||||
}
|
||||
private:
|
||||
Q_DISABLE_COPY(LoggingEnvironment)
|
||||
};
|
||||
|
||||
#endif // LOGGING_ENV_H
|
||||
|
||||
@@ -26,14 +26,16 @@
|
||||
#include <QStandardItemModel>
|
||||
#include <QSignalSpy>
|
||||
|
||||
// clazy:excludeall=non-pod-global-static,returning-void-expression,function-args-by-value
|
||||
|
||||
class MergedProxyModelTest : public ::testing::Test {
|
||||
protected:
|
||||
void SetUp() override {
|
||||
merged_.setSourceModel(&source_);
|
||||
}
|
||||
|
||||
QStandardItemModel source_;
|
||||
MergedProxyModel merged_;
|
||||
QStandardItemModel source_; // NOLINT(cppcoreguidelines-non-private-member-variables-in-classes)
|
||||
MergedProxyModel merged_; // NOLINT(cppcoreguidelines-non-private-member-variables-in-classes)
|
||||
|
||||
};
|
||||
|
||||
@@ -105,10 +107,10 @@ TEST_F(MergedProxyModelTest, SourceInsert) {
|
||||
|
||||
ASSERT_EQ(1, before_spy.count());
|
||||
ASSERT_EQ(1, after_spy.count());
|
||||
EXPECT_FALSE(before_spy[0][0].value<QModelIndex>().isValid());
|
||||
EXPECT_FALSE(before_spy[0][0].toModelIndex().isValid());
|
||||
EXPECT_EQ(0, before_spy[0][1].toInt());
|
||||
EXPECT_EQ(0, before_spy[0][2].toInt());
|
||||
EXPECT_FALSE(after_spy[0][0].value<QModelIndex>().isValid());
|
||||
EXPECT_FALSE(after_spy[0][0].toModelIndex().isValid());
|
||||
EXPECT_EQ(0, after_spy[0][1].toInt());
|
||||
EXPECT_EQ(0, after_spy[0][2].toInt());
|
||||
|
||||
@@ -125,10 +127,10 @@ TEST_F(MergedProxyModelTest, SourceRemove) {
|
||||
|
||||
ASSERT_EQ(1, before_spy.count());
|
||||
ASSERT_EQ(1, after_spy.count());
|
||||
EXPECT_FALSE(before_spy[0][0].value<QModelIndex>().isValid());
|
||||
EXPECT_FALSE(before_spy[0][0].toModelIndex().isValid());
|
||||
EXPECT_EQ(0, before_spy[0][1].toInt());
|
||||
EXPECT_EQ(0, before_spy[0][2].toInt());
|
||||
EXPECT_FALSE(after_spy[0][0].value<QModelIndex>().isValid());
|
||||
EXPECT_FALSE(after_spy[0][0].toModelIndex().isValid());
|
||||
EXPECT_EQ(0, after_spy[0][1].toInt());
|
||||
EXPECT_EQ(0, after_spy[0][2].toInt());
|
||||
|
||||
@@ -147,10 +149,10 @@ TEST_F(MergedProxyModelTest, SubInsert) {
|
||||
|
||||
ASSERT_EQ(1, before_spy.count());
|
||||
ASSERT_EQ(1, after_spy.count());
|
||||
EXPECT_EQ("one", before_spy[0][0].value<QModelIndex>().data());
|
||||
EXPECT_EQ("one", before_spy[0][0].toModelIndex().data());
|
||||
EXPECT_EQ(0, before_spy[0][1].toInt());
|
||||
EXPECT_EQ(0, before_spy[0][2].toInt());
|
||||
EXPECT_EQ("one", after_spy[0][0].value<QModelIndex>().data());
|
||||
EXPECT_EQ("one", after_spy[0][0].toModelIndex().data());
|
||||
EXPECT_EQ(0, after_spy[0][1].toInt());
|
||||
EXPECT_EQ(0, after_spy[0][2].toInt());
|
||||
|
||||
@@ -171,10 +173,10 @@ TEST_F(MergedProxyModelTest, SubRemove) {
|
||||
|
||||
ASSERT_EQ(1, before_spy.count());
|
||||
ASSERT_EQ(1, after_spy.count());
|
||||
EXPECT_EQ("one", before_spy[0][0].value<QModelIndex>().data());
|
||||
EXPECT_EQ("one", before_spy[0][0].toModelIndex().data());
|
||||
EXPECT_EQ(0, before_spy[0][1].toInt());
|
||||
EXPECT_EQ(0, before_spy[0][2].toInt());
|
||||
EXPECT_EQ("one", after_spy[0][0].value<QModelIndex>().data());
|
||||
EXPECT_EQ("one", after_spy[0][0].toModelIndex().data());
|
||||
EXPECT_EQ(0, after_spy[0][1].toInt());
|
||||
EXPECT_EQ(0, after_spy[0][2].toInt());
|
||||
|
||||
|
||||
@@ -31,7 +31,8 @@
|
||||
#include "collection/directory.h"
|
||||
|
||||
class MetatypesEnvironment : public ::testing::Environment {
|
||||
public:
|
||||
public:
|
||||
MetatypesEnvironment() = default;
|
||||
void SetUp() override {
|
||||
qRegisterMetaType<Directory>("Directory");
|
||||
qRegisterMetaType<DirectoryList>("DirectoryList");
|
||||
@@ -41,6 +42,8 @@ public:
|
||||
qRegisterMetaType<QModelIndex>("QModelIndex");
|
||||
qRegisterMetaType<SongLoader::Result>("SongLoader::Result");
|
||||
}
|
||||
private:
|
||||
Q_DISABLE_COPY(MetatypesEnvironment)
|
||||
};
|
||||
|
||||
#endif // RESOURCES_ENV_H
|
||||
|
||||
@@ -41,7 +41,7 @@ using ::testing::Return;
|
||||
|
||||
class RequestForUrlMatcher : public MatcherInterface<const QNetworkRequest&> {
|
||||
public:
|
||||
RequestForUrlMatcher(const QString& contains, const QMap<QString, QString>& expected_params)
|
||||
RequestForUrlMatcher(const QString& contains, const QMap<QString, QString> &expected_params)
|
||||
: contains_(contains), expected_params_(expected_params) {}
|
||||
|
||||
~RequestForUrlMatcher() override {}
|
||||
@@ -75,13 +75,15 @@ class RequestForUrlMatcher : public MatcherInterface<const QNetworkRequest&> {
|
||||
QString contains_;
|
||||
QMap<QString, QString> expected_params_;
|
||||
|
||||
Q_DISABLE_COPY(RequestForUrlMatcher)
|
||||
|
||||
};
|
||||
|
||||
inline Matcher<const QNetworkRequest&> RequestForUrl(const QString& contains, const QMap<QString, QString>& params) {
|
||||
inline Matcher<const QNetworkRequest&> RequestForUrl(const QString &contains, const QMap<QString, QString> ¶ms) {
|
||||
return MakeMatcher(new RequestForUrlMatcher(contains, params));
|
||||
}
|
||||
|
||||
MockNetworkReply* MockNetworkAccessManager::ExpectGet(const QString& contains, const QMap<QString, QString>& expected_params, int status, const QByteArray& data) {
|
||||
MockNetworkReply* MockNetworkAccessManager::ExpectGet(const QString &contains, const QMap<QString, QString> &expected_params, int status, const QByteArray &data) {
|
||||
|
||||
MockNetworkReply* reply = new MockNetworkReply(data);
|
||||
reply->setAttribute(QNetworkRequest::HttpStatusCodeAttribute, status);
|
||||
@@ -92,21 +94,22 @@ MockNetworkReply* MockNetworkAccessManager::ExpectGet(const QString& contains, c
|
||||
|
||||
}
|
||||
|
||||
MockNetworkReply::MockNetworkReply()
|
||||
: data_(nullptr) {
|
||||
MockNetworkReply::MockNetworkReply(QObject *parent)
|
||||
: QNetworkReply(parent), data_(nullptr), pos_(0) {
|
||||
}
|
||||
|
||||
MockNetworkReply::MockNetworkReply(const QByteArray& data)
|
||||
: data_(data),
|
||||
MockNetworkReply::MockNetworkReply(const QByteArray &data, QObject *parent)
|
||||
: QNetworkReply(parent),
|
||||
data_(data),
|
||||
pos_(0) {
|
||||
}
|
||||
|
||||
void MockNetworkReply::SetData(const QByteArray& data) {
|
||||
void MockNetworkReply::SetData(const QByteArray &data) {
|
||||
data_ = data;
|
||||
pos_ = 0;
|
||||
}
|
||||
|
||||
qint64 MockNetworkReply::readData(char* data, qint64 size) {
|
||||
qint64 MockNetworkReply::readData(char *data, qint64 size) {
|
||||
|
||||
if (data_.size() == pos_) {
|
||||
return -1;
|
||||
@@ -132,6 +135,6 @@ void MockNetworkReply::Done() {
|
||||
|
||||
}
|
||||
|
||||
void MockNetworkReply::setAttribute(QNetworkRequest::Attribute code, const QVariant& value) {
|
||||
void MockNetworkReply::setAttribute(QNetworkRequest::Attribute code, const QVariant &value) {
|
||||
QNetworkReply::setAttribute(code, value);
|
||||
}
|
||||
|
||||
@@ -38,19 +38,20 @@
|
||||
|
||||
class MockNetworkReply : public QNetworkReply {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MockNetworkReply();
|
||||
explicit MockNetworkReply(const QByteArray& data);
|
||||
MockNetworkReply(QObject *parent = nullptr);
|
||||
explicit MockNetworkReply(const QByteArray &data, QObject *parent = nullptr);
|
||||
|
||||
// Use these to set expectations.
|
||||
void SetData(const QByteArray& data);
|
||||
virtual void setAttribute(QNetworkRequest::Attribute code, const QVariant& value);
|
||||
void SetData(const QByteArray &data);
|
||||
virtual void setAttribute(QNetworkRequest::Attribute code, const QVariant &value);
|
||||
|
||||
// Call this when you are ready for the finished() signal.
|
||||
void Done();
|
||||
|
||||
protected:
|
||||
MOCK_METHOD0(abort, void());
|
||||
MOCK_METHOD0(abort, void()); // clazy:exclude=returning-void-expression,function-args-by-value
|
||||
qint64 readData(char* data, qint64) override;
|
||||
qint64 writeData(const char* data, qint64) override;
|
||||
|
||||
@@ -68,7 +69,7 @@ class MockNetworkAccessManager : public QNetworkAccessManager {
|
||||
int status, // Returned HTTP status code.
|
||||
const QByteArray& ret_data); // Returned data.
|
||||
protected:
|
||||
MOCK_METHOD3(createRequest, QNetworkReply*(Operation, const QNetworkRequest&, QIODevice*));
|
||||
MOCK_METHOD3(createRequest, QNetworkReply*(Operation, const QNetworkRequest&, QIODevice*)); // clazy:exclude=function-args-by-value
|
||||
};
|
||||
|
||||
#endif // MOCK_NETWORKACCESSMANAGER_H
|
||||
|
||||
@@ -22,7 +22,4 @@
|
||||
|
||||
#include "mock_playlistitem.h"
|
||||
|
||||
using ::testing::_;
|
||||
using ::testing::Return;
|
||||
|
||||
MockPlaylistItem::MockPlaylistItem() : PlaylistItem(Song::Source_LocalFile) {}
|
||||
|
||||
@@ -31,16 +31,18 @@
|
||||
#include "collection/sqlrow.h"
|
||||
#include "playlist/playlistitem.h"
|
||||
|
||||
// clazy:excludeall=returning-void-expression,function-args-by-value
|
||||
|
||||
class MockPlaylistItem : public PlaylistItem {
|
||||
public:
|
||||
MockPlaylistItem();
|
||||
MOCK_CONST_METHOD0(options, Options());
|
||||
MOCK_METHOD1(InitFromQuery, bool(const SqlRow& settings));
|
||||
MOCK_METHOD1(InitFromQuery, bool(const SqlRow &settings));
|
||||
MOCK_METHOD0(Reload, void());
|
||||
MOCK_CONST_METHOD0(Metadata, Song());
|
||||
MOCK_CONST_METHOD0(OriginalMetadata, Song());
|
||||
MOCK_CONST_METHOD0(Url, QUrl());
|
||||
MOCK_METHOD1(SetTemporaryMetadata, void(const Song& metadata));
|
||||
MOCK_METHOD1(SetTemporaryMetadata, void(const Song &metadata));
|
||||
MOCK_METHOD0(ClearTemporaryMetadata, void());
|
||||
MOCK_METHOD1(SetArtManual, void(const QUrl &cover_url));
|
||||
MOCK_CONST_METHOD1(DatabaseValue, QVariant(DatabaseColumn));
|
||||
|
||||
@@ -25,15 +25,17 @@
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
// clazy:excludeall=function-args-by-value
|
||||
|
||||
class MockSettingsProvider : public SettingsProvider {
|
||||
public:
|
||||
MOCK_METHOD1(set_group, void(const char* group));
|
||||
MOCK_CONST_METHOD2(value, QVariant(const QString& key, const QVariant& default_value));
|
||||
MOCK_METHOD2(setValue, void(const QString& key, const QVariant& value));
|
||||
MOCK_METHOD1(beginReadArray, int(const QString& prefix));
|
||||
MOCK_METHOD2(beginWriteArray, void(const QString& prefix, int size));
|
||||
MOCK_METHOD1(set_group, void(const char *group));
|
||||
MOCK_CONST_METHOD2(value, QVariant(const QString &key, const QVariant &default_value));
|
||||
MOCK_METHOD2(setValue, void(const QString &key, const QVariant &value));
|
||||
MOCK_METHOD1(beginReadArray, int(const QString &prefix));
|
||||
MOCK_METHOD2(beginWriteArray, void(const QString &prefix, int size));
|
||||
MOCK_METHOD1(setArrayIndex, void(int i));
|
||||
MOCK_METHOD0(endArray, void());
|
||||
MOCK_METHOD0(endArray, void()); // clazy:exclude=returning-void-expression
|
||||
};
|
||||
|
||||
class DummySettingsProvider : public SettingsProvider {
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
|
||||
#include <QUrl>
|
||||
|
||||
// clazy:excludeall=returning-void-expression
|
||||
|
||||
class OrganizeFormatTest : public ::testing::Test {
|
||||
protected:
|
||||
OrganizeFormat format_;
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
|
||||
using ::testing::Return;
|
||||
|
||||
// clazy:excludeall=non-pod-global-static,returning-void-expression
|
||||
|
||||
namespace {
|
||||
|
||||
class PlaylistTest : public ::testing::Test {
|
||||
@@ -45,11 +47,11 @@ class PlaylistTest : public ::testing::Test {
|
||||
{
|
||||
}
|
||||
|
||||
void SetUp() {
|
||||
void SetUp() override {
|
||||
playlist_.set_sequence(&sequence_);
|
||||
}
|
||||
|
||||
MockPlaylistItem* MakeMockItem(const QString& title, const QString& artist = QString(), const QString& album = QString(), int length = 123) const {
|
||||
MockPlaylistItem* MakeMockItem(const QString &title, const QString &artist = QString(), const QString &album = QString(), int length = 123) const {
|
||||
Song metadata;
|
||||
metadata.Init(title, artist, album, length);
|
||||
|
||||
@@ -59,12 +61,12 @@ class PlaylistTest : public ::testing::Test {
|
||||
return ret;
|
||||
}
|
||||
|
||||
PlaylistItemPtr MakeMockItemP(const QString& title, const QString& artist = QString(), const QString& album = QString(), int length = 123) const {
|
||||
PlaylistItemPtr MakeMockItemP(const QString &title, const QString &artist = QString(), const QString &album = QString(), int length = 123) const {
|
||||
return PlaylistItemPtr(MakeMockItem(title, artist, album, length));
|
||||
}
|
||||
|
||||
Playlist playlist_;
|
||||
PlaylistSequence sequence_;
|
||||
Playlist playlist_; // NOLINT(cppcoreguidelines-non-private-member-variables-in-classes)
|
||||
PlaylistSequence sequence_; // NOLINT(cppcoreguidelines-non-private-member-variables-in-classes)
|
||||
|
||||
};
|
||||
|
||||
@@ -436,6 +438,7 @@ TEST_F(PlaylistTest, ShuffleThenNext) {
|
||||
|
||||
// Add 100 items
|
||||
PlaylistItemList items;
|
||||
items.reserve(100);
|
||||
for (int i=0 ; i<100 ; ++i)
|
||||
items << MakeMockItemP("Item " + QString::number(i));
|
||||
playlist_.InsertItems(items);
|
||||
@@ -484,7 +487,7 @@ TEST_F(PlaylistTest, CollectionIdMapSingle) {
|
||||
EXPECT_EQ(0, playlist_.collection_items_by_id(0).count());
|
||||
EXPECT_EQ(0, playlist_.collection_items_by_id(2).count());
|
||||
ASSERT_EQ(1, playlist_.collection_items_by_id(1).count());
|
||||
EXPECT_EQ(song.title(), playlist_.collection_items_by_id(1)[0]->Metadata().title());
|
||||
EXPECT_EQ(song.title(), playlist_.collection_items_by_id(1)[0]->Metadata().title()); // clazy:exclude=detaching-temporary
|
||||
|
||||
playlist_.Clear();
|
||||
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
#include <QResource>
|
||||
|
||||
class ResourcesEnvironment : public ::testing::Environment {
|
||||
public:
|
||||
public:
|
||||
ResourcesEnvironment() = default;
|
||||
void SetUp() override {
|
||||
Q_INIT_RESOURCE(data);
|
||||
Q_INIT_RESOURCE(testdata);
|
||||
@@ -36,6 +37,8 @@ public:
|
||||
Q_INIT_RESOURCE(translations);
|
||||
#endif
|
||||
}
|
||||
private:
|
||||
Q_DISABLE_COPY(ResourcesEnvironment)
|
||||
};
|
||||
|
||||
#endif // RESOURCES_ENV_H
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
|
||||
#include "playlist/songplaylistitem.h"
|
||||
|
||||
// clazy:excludeall=non-pod-global-static
|
||||
|
||||
namespace {
|
||||
|
||||
class SongPlaylistItemTest : public ::testing::TestWithParam<const char*> {
|
||||
@@ -53,13 +55,13 @@ class SongPlaylistItemTest : public ::testing::TestWithParam<const char*> {
|
||||
absolute_file_name_.prepend('/');
|
||||
}
|
||||
|
||||
Song song_;
|
||||
QTemporaryFile temp_file_;
|
||||
QString absolute_file_name_;
|
||||
std::unique_ptr<SongPlaylistItem> item_;
|
||||
Song song_; // NOLINT(cppcoreguidelines-non-private-member-variables-in-classes)
|
||||
QTemporaryFile temp_file_; // NOLINT(cppcoreguidelines-non-private-member-variables-in-classes)
|
||||
QString absolute_file_name_; // NOLINT(cppcoreguidelines-non-private-member-variables-in-classes)
|
||||
std::unique_ptr<SongPlaylistItem> item_; // NOLINT(cppcoreguidelines-non-private-member-variables-in-classes)
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(RealFiles, SongPlaylistItemTest, testing::Values(
|
||||
INSTANTIATE_TEST_CASE_P(RealFiles, SongPlaylistItemTest, testing::Values( // clazy:exclude=function-args-by-value,clazy-non-pod-global-static
|
||||
"normalfile.flac",
|
||||
"file with spaces.flac",
|
||||
"file with # hash.flac",
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <sqlite3.h>
|
||||
|
||||
// clazy:excludeall=returning-void-expression
|
||||
|
||||
TEST(SqliteTest, FTS5SupportEnabled) {
|
||||
|
||||
sqlite3* db = nullptr;
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
#include "tagreader.h"
|
||||
#include "test_utils.h"
|
||||
|
||||
// clazy:excludeall=non-pod-global-static
|
||||
|
||||
namespace {
|
||||
|
||||
class TagReaderTest : public ::testing::Test {
|
||||
|
||||
@@ -28,39 +28,39 @@
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
|
||||
std::ostream& operator<<(std::ostream& stream, const QString& str) {
|
||||
std::ostream &operator<<(std::ostream &stream, const QString &str) {
|
||||
stream << str.toStdString();
|
||||
return stream;
|
||||
}
|
||||
|
||||
std::ostream& operator <<(std::ostream& stream, const QUrl& url) {
|
||||
std::ostream &operator <<(std::ostream &stream, const QUrl &url) {
|
||||
stream << url.toString().toStdString();
|
||||
return stream;
|
||||
}
|
||||
|
||||
std::ostream& operator <<(std::ostream& stream, const QNetworkRequest& req) {
|
||||
std::ostream &operator <<(std::ostream &stream, const QNetworkRequest &req) {
|
||||
stream << req.url().toString().toStdString();
|
||||
return stream;
|
||||
}
|
||||
|
||||
std::ostream& operator <<(std::ostream& stream, const QVariant& var) {
|
||||
std::ostream &operator <<(std::ostream &stream, const QVariant &var) {
|
||||
stream << var.toString().toStdString();
|
||||
return stream;
|
||||
}
|
||||
|
||||
void PrintTo(const ::QString& str, std::ostream& os) {
|
||||
void PrintTo(const ::QString &str, std::ostream &os) {
|
||||
os << str.toStdString();
|
||||
}
|
||||
|
||||
void PrintTo(const ::QVariant& var, std::ostream& os) {
|
||||
void PrintTo(const ::QVariant &var, std::ostream &os) {
|
||||
os << var.toString().toStdString();
|
||||
}
|
||||
|
||||
void PrintTo(const ::QUrl& url, std::ostream& os) {
|
||||
void PrintTo(const ::QUrl &url, std::ostream &os) {
|
||||
os << url.toString().toStdString();
|
||||
}
|
||||
|
||||
TemporaryResource::TemporaryResource(const QString& filename) {
|
||||
TemporaryResource::TemporaryResource(const QString &filename, QObject *parent) : QTemporaryFile(parent) {
|
||||
|
||||
setFileTemplate(QDir::tempPath() + "/strawberry_test-XXXXXX." + filename.section('.', -1, -1));
|
||||
open();
|
||||
@@ -73,7 +73,7 @@ TemporaryResource::TemporaryResource(const QString& filename) {
|
||||
|
||||
}
|
||||
|
||||
TestQObject::TestQObject(QObject* parent)
|
||||
TestQObject::TestQObject(QObject *parent)
|
||||
: QObject(parent),
|
||||
invoked_(0) {
|
||||
}
|
||||
|
||||
@@ -61,14 +61,17 @@ void PrintTo(const ::QUrl& url, std::ostream& os);
|
||||
Q_DECLARE_METATYPE(QModelIndex)
|
||||
|
||||
class TemporaryResource : public QTemporaryFile {
|
||||
public:
|
||||
explicit TemporaryResource(const QString& filename);
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TemporaryResource(const QString &filename, QObject *parent = nullptr);
|
||||
};
|
||||
|
||||
class TestQObject : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TestQObject(QObject* parent = nullptr);
|
||||
explicit TestQObject(QObject *parent = nullptr);
|
||||
|
||||
void Emit();
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include "testobjectdecorators.h"
|
||||
|
||||
|
||||
void TestObjectDecorators::initStyleOption(QProgressBar* self, QStyleOptionProgressBar* opt) {
|
||||
void TestObjectDecorators::initStyleOption(QProgressBar *self, QStyleOptionProgressBar *opt) {
|
||||
self->initStyleOption(opt);
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ class QStyleOptionProgressBar;
|
||||
class TestObjectDecorators : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public slots:
|
||||
void initStyleOption(QProgressBar* self, QStyleOptionProgressBar* opt);
|
||||
public slots:
|
||||
void initStyleOption(QProgressBar *self, QStyleOptionProgressBar *opt);
|
||||
};
|
||||
|
||||
#endif // TESTOBJECTDECORATORS_H
|
||||
|
||||
Reference in New Issue
Block a user