diff --git a/src/widgets/room/autotests/messagedelegatehelperimagetest.cpp b/src/widgets/room/autotests/messagedelegatehelperimagetest.cpp --- a/src/widgets/room/autotests/messagedelegatehelperimagetest.cpp +++ b/src/widgets/room/autotests/messagedelegatehelperimagetest.cpp @@ -36,8 +36,7 @@ MessageDelegateHelperImageTest::MessageDelegateHelperImageTest(QObject *parent) : QObject(parent) { - QStandardPaths::setTestModeEnabled(true); - Ruqola::self()->rocketChatAccount()->setAccountName(QStringLiteral("accountName")); + initTestAccount(); } void MessageDelegateHelperImageTest::shouldExtractMessageData() diff --git a/src/widgets/room/autotests/messagelistdelegatetest.cpp b/src/widgets/room/autotests/messagelistdelegatetest.cpp --- a/src/widgets/room/autotests/messagelistdelegatetest.cpp +++ b/src/widgets/room/autotests/messagelistdelegatetest.cpp @@ -37,12 +37,10 @@ MessageListDelegateTest::MessageListDelegateTest(QObject *parent) : QObject(parent) { - QStandardPaths::setTestModeEnabled(true); - auto *rcAccount = Ruqola::self()->rocketChatAccount(); - rcAccount->setAccountName(QStringLiteral("accountName")); + initTestAccount(); const QString userId = QStringLiteral("dfaureUserId"); - rcAccount->insertAvatarUrl(userId, avatarLink()); + Ruqola::self()->rocketChatAccount()->insertAvatarUrl(userId, avatarLink()); } void MessageListDelegateTest::layoutChecks_data() diff --git a/src/widgets/room/autotests/testdata.h b/src/widgets/room/autotests/testdata.h --- a/src/widgets/room/autotests/testdata.h +++ b/src/widgets/room/autotests/testdata.h @@ -20,5 +20,6 @@ #include "messages/messageattachment.h" +void initTestAccount(); MessageAttachment testAttachment(); QUrl avatarLink(); diff --git a/src/widgets/room/autotests/testdata.cpp b/src/widgets/room/autotests/testdata.cpp --- a/src/widgets/room/autotests/testdata.cpp +++ b/src/widgets/room/autotests/testdata.cpp @@ -18,6 +18,7 @@ Boston, MA 02110-1301, USA. */ +#include "testdata.h" #include "managerdatapaths.h" #include "ruqola.h" #include "rocketchataccount.h" @@ -27,6 +28,12 @@ #include #include +void initTestAccount() +{ + QStandardPaths::setTestModeEnabled(true); + Ruqola::self()->rocketChatAccount()->setAccountName(QStringLiteral("accountName")); +} + MessageAttachment testAttachment() { MessageAttachment msgAttach;