File indexing completed on 2024-12-15 04:44:00

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 "akonadisearchdebugsearchpathcomboboxtest.h"
0008 #include "../akonadisearchdebugsearchpathcombobox.h"
0009 #include <QTest>
0010 
0011 AkonadiSearchDebugSearchPathComboBoxTest::AkonadiSearchDebugSearchPathComboBoxTest(QObject *parent)
0012     : QObject(parent)
0013 {
0014 }
0015 
0016 AkonadiSearchDebugSearchPathComboBoxTest::~AkonadiSearchDebugSearchPathComboBoxTest() = default;
0017 
0018 void AkonadiSearchDebugSearchPathComboBoxTest::shouldHaveDefaultValue()
0019 {
0020     Akonadi::Search::AkonadiSearchDebugSearchPathComboBox combox;
0021     QVERIFY(combox.count() > 0);
0022 }
0023 
0024 void AkonadiSearchDebugSearchPathComboBoxTest::shouldReturnPath()
0025 {
0026     Akonadi::Search::AkonadiSearchDebugSearchPathComboBox combox;
0027     QVERIFY(!combox.searchPath().isEmpty());
0028 }
0029 
0030 void AkonadiSearchDebugSearchPathComboBoxTest::shouldReturnCorrectSearchPath()
0031 {
0032     Akonadi::Search::AkonadiSearchDebugSearchPathComboBox combox;
0033     QString path = combox.pathFromEnum(Akonadi::Search::AkonadiSearchDebugSearchPathComboBox::Contacts);
0034     QCOMPARE(combox.searchPath(), path);
0035 }
0036 
0037 void AkonadiSearchDebugSearchPathComboBoxTest::shouldSelectCorrectType()
0038 {
0039     Akonadi::Search::AkonadiSearchDebugSearchPathComboBox combox;
0040     QString path = combox.pathFromEnum(Akonadi::Search::AkonadiSearchDebugSearchPathComboBox::ContactCompleter);
0041     combox.setSearchType(Akonadi::Search::AkonadiSearchDebugSearchPathComboBox::ContactCompleter);
0042     QCOMPARE(combox.searchPath(), path);
0043     path = combox.pathFromEnum(Akonadi::Search::AkonadiSearchDebugSearchPathComboBox::Emails);
0044     combox.setSearchType(Akonadi::Search::AkonadiSearchDebugSearchPathComboBox::Emails);
0045     QCOMPARE(combox.searchPath(), path);
0046 }
0047 
0048 QTEST_MAIN(AkonadiSearchDebugSearchPathComboBoxTest)
0049 
0050 #include "moc_akonadisearchdebugsearchpathcomboboxtest.cpp"