File indexing completed on 2024-12-01 04:35:22

0001 /*
0002    SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "accountroomsettingstest.h"
0008 #include "accountroomsettings.h"
0009 #include <QTest>
0010 QTEST_GUILESS_MAIN(AccountRoomSettingsTest)
0011 AccountRoomSettingsTest::AccountRoomSettingsTest(QObject *parent)
0012     : QObject(parent)
0013 {
0014 }
0015 
0016 void AccountRoomSettingsTest::shouldHaveDefaultValues()
0017 {
0018     AccountRoomSettings s;
0019     QVERIFY(s.isEmpty());
0020 
0021     AccountRoomSettings::PendingTypedInfo info;
0022     QVERIFY(info.text.isEmpty());
0023     QVERIFY(info.messageIdBeingEdited.isEmpty());
0024     QVERIFY(info.threadMessageId.isEmpty());
0025     QCOMPARE(info.scrollbarPosition, -1);
0026     QVERIFY(!info.isValid());
0027 }
0028 
0029 void AccountRoomSettingsTest::shouldChangePendingTypedInfo()
0030 {
0031     {
0032         AccountRoomSettings::PendingTypedInfo info;
0033         QVERIFY(!info.isValid());
0034         info.messageIdBeingEdited = QStringLiteral("foo");
0035         QVERIFY(info.isValid());
0036     }
0037     {
0038         AccountRoomSettings::PendingTypedInfo info;
0039         QVERIFY(!info.isValid());
0040         info.text = QStringLiteral("foo");
0041         QVERIFY(info.isValid());
0042     }
0043     {
0044         AccountRoomSettings::PendingTypedInfo info;
0045         QVERIFY(!info.isValid());
0046         info.scrollbarPosition = 2;
0047         QVERIFY(info.isValid());
0048     }
0049 }
0050 
0051 #include "moc_accountroomsettingstest.cpp"