File indexing completed on 2024-11-24 04:50:41
0001 // SPDX-FileCopyrightText: (C) 2020 Carl Schwan <carl@carlschwan.eu> 0002 // SPDX-License-Identifier: BSD-2-Clause 0003 0004 #include "../imppmodel.h" 0005 #include <KContacts/Impp> 0006 #include <KLocalizedString> 0007 #include <QObject> 0008 #include <QTest> 0009 0010 class ImppModelTest : public QObject 0011 { 0012 Q_OBJECT 0013 0014 private Q_SLOTS: 0015 void initTestCase() 0016 { 0017 } 0018 0019 void testReading() 0020 { 0021 KContacts::Addressee addressee; 0022 KContacts::Impp::List impps; 0023 impps.append(KContacts::Impp(QUrl{QStringLiteral("matrix:@carl:kde.org")})); 0024 impps.append(KContacts::Impp(QUrl{QStringLiteral("matrix:@carl2:kde.org")})); 0025 addressee.setImppList(impps); 0026 ImppModel imppModel; 0027 imppModel.loadContact(addressee); 0028 0029 QCOMPARE(imppModel.rowCount(), 2); 0030 QCOMPARE(imppModel.data(imppModel.index(1, 0), ImppModel::UrlRole).toString(), QStringLiteral("matrix:@carl2:kde.org")); 0031 } 0032 }; 0033 0034 QTEST_MAIN(ImppModelTest) 0035 #include "imppmodeltest.moc"