File indexing completed on 2024-11-24 04:43:03
0001 /* 0002 SPDX-FileCopyrightText: 2014-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "mergecontactwidgetlisttest.h" 0008 #include "../manualmerge/mergecontactwidgetlist.h" 0009 #include <Akonadi/Item> 0010 #include <QTest> 0011 using namespace KContacts; 0012 0013 MergeContactWidgetListTest::MergeContactWidgetListTest(QObject *parent) 0014 : QObject(parent) 0015 { 0016 } 0017 0018 MergeContactWidgetListTest::~MergeContactWidgetListTest() = default; 0019 0020 void MergeContactWidgetListTest::shouldHaveDefaultValue() 0021 { 0022 KABMergeContacts::MergeContactWidgetList w; 0023 QCOMPARE(w.count(), 0); 0024 } 0025 0026 void MergeContactWidgetListTest::shouldCleanListWhenSetItems() 0027 { 0028 KABMergeContacts::MergeContactWidgetList w; 0029 Akonadi::Item::List lst; 0030 lst << Akonadi::Item(42); 0031 lst << Akonadi::Item(42); 0032 w.fillListContact(lst); 0033 // We don't have KABC::Address 0034 QCOMPARE(w.count(), 0); 0035 0036 Addressee address; 0037 Akonadi::Item item; 0038 address.setName(QStringLiteral("foo1")); 0039 item.setPayload<Addressee>(address); 0040 lst << item; 0041 w.fillListContact(lst); 0042 QCOMPARE(w.count(), 1); 0043 0044 // it must clear; 0045 w.fillListContact(lst); 0046 QCOMPARE(w.count(), 1); 0047 } 0048 0049 QTEST_MAIN(MergeContactWidgetListTest) 0050 0051 #include "moc_mergecontactwidgetlisttest.cpp"