File indexing completed on 2024-12-01 04:35:22
0001 /* 0002 SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 #include "channelusercompletertest.h" 0007 #include "channelusercompleter.h" 0008 #include <QTest> 0009 QTEST_GUILESS_MAIN(ChannelUserCompleterTest) 0010 0011 ChannelUserCompleterTest::ChannelUserCompleterTest(QObject *parent) 0012 : QObject{parent} 0013 { 0014 } 0015 0016 void ChannelUserCompleterTest::shouldHaveDefaultValues() 0017 { 0018 ChannelUserCompleter w; 0019 QVERIFY(w.description().isEmpty()); 0020 QVERIFY(w.name().isEmpty()); 0021 QVERIFY(w.userName().isEmpty()); 0022 QVERIFY(w.avatarTag().isEmpty()); 0023 QCOMPARE(w.type(), ChannelUserCompleter::ChannelUserCompleterType::Unknown); 0024 QVERIFY(w.statusIcon().isNull()); 0025 QVERIFY(!w.outsideRoom()); 0026 QVERIFY(w.identifier().isEmpty()); 0027 } 0028 0029 void ChannelUserCompleterTest::shouldReturnCompleterName() 0030 { 0031 ChannelUserCompleter w; 0032 const QString name{QStringLiteral("name")}; 0033 const QString userName{QStringLiteral("userName")}; 0034 w.setName(name); 0035 w.setUserName(userName); 0036 w.setType(ChannelUserCompleter::ChannelUserCompleterType::Notification); 0037 QCOMPARE(w.completerName(), name); 0038 w.setType(ChannelUserCompleter::ChannelUserCompleterType::DirectChannel); 0039 QCOMPARE(w.completerName(), userName); 0040 w.setType(ChannelUserCompleter::ChannelUserCompleterType::Room); 0041 QCOMPARE(w.completerName(), name); 0042 w.setType(ChannelUserCompleter::ChannelUserCompleterType::Unknown); 0043 QCOMPARE(w.completerName(), QString()); 0044 } 0045 0046 #include "moc_channelusercompletertest.cpp"