File indexing completed on 2024-11-24 04:43:02
0001 /* 0002 SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "mergecontactselectinformationtabwidgettest.h" 0008 #include "../searchduplicate/mergecontactselectinformationtabwidget.h" 0009 #include <QTest> 0010 0011 MergeContactSelectInformationTabWidgetTest::MergeContactSelectInformationTabWidgetTest(QObject *parent) 0012 : QObject(parent) 0013 { 0014 } 0015 0016 MergeContactSelectInformationTabWidgetTest::~MergeContactSelectInformationTabWidgetTest() = default; 0017 0018 void MergeContactSelectInformationTabWidgetTest::shouldHaveDefaultValue() 0019 { 0020 KABMergeContacts::MergeContactSelectInformationTabWidget w; 0021 QVERIFY(!w.tabBarVisible()); 0022 QCOMPARE(w.count(), 0); 0023 } 0024 0025 void MergeContactSelectInformationTabWidgetTest::shouldAddTab() 0026 { 0027 KABMergeContacts::MergeContactSelectInformationTabWidget w; 0028 0029 QList<KABMergeContacts::MergeConflictResult> list; 0030 KABMergeContacts::MergeConflictResult conflict; 0031 Akonadi::Item::List listItem; 0032 KContacts::Addressee address1; 0033 Akonadi::Item item1; 0034 address1.setName(QStringLiteral("foo1")); 0035 item1.setPayload<KContacts::Addressee>(address1); 0036 0037 KContacts::Addressee address2; 0038 Akonadi::Item item2; 0039 address2.setName(QStringLiteral("foo2")); 0040 item2.setPayload<KContacts::Addressee>(address2); 0041 0042 listItem << item1; 0043 listItem << item2; 0044 0045 KABMergeContacts::MergeContacts::ConflictInformations conflictInformation = KABMergeContacts::MergeContacts::Birthday; 0046 conflict.list = listItem; 0047 conflict.conflictInformation = conflictInformation; 0048 0049 list << conflict; 0050 w.setRequiresSelectInformationWidgets(list, Akonadi::Collection(42)); 0051 QVERIFY(!w.tabBarVisible()); 0052 QCOMPARE(w.count(), 1); 0053 0054 list << conflict; 0055 w.setRequiresSelectInformationWidgets(list, Akonadi::Collection(42)); 0056 QVERIFY(!w.tabBarVisible()); 0057 QCOMPARE(w.count(), 2); 0058 } 0059 0060 QTEST_MAIN(MergeContactSelectInformationTabWidgetTest) 0061 0062 #include "moc_mergecontactselectinformationtabwidgettest.cpp"