File indexing completed on 2024-12-22 05:00:49
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 "formatcomboboxtest.h" 0008 #include "../widgets/formatcombobox.h" 0009 #include <QTest> 0010 0011 FormatComboBoxTest::FormatComboBoxTest(QObject *parent) 0012 : QObject(parent) 0013 { 0014 } 0015 0016 FormatComboBoxTest::~FormatComboBoxTest() = default; 0017 0018 void FormatComboBoxTest::shouldHaveDefaultValue() 0019 { 0020 FormatComboBox combo; 0021 QCOMPARE(combo.count(), 4); 0022 } 0023 0024 void FormatComboBoxTest::changeCurrentItem_data() 0025 { 0026 QTest::addColumn<int>("input"); 0027 QTest::addColumn<int>("output"); 0028 QTest::newRow("first") << 0 << 0; 0029 QTest::newRow("second") << 1 << 1; 0030 QTest::newRow("third") << 2 << 2; 0031 QTest::newRow("fourth") << 3 << 3; 0032 QTest::newRow("invalid") << 5 << 0; 0033 } 0034 0035 void FormatComboBoxTest::changeCurrentItem() 0036 { 0037 QFETCH(int, input); 0038 QFETCH(int, output); 0039 FormatComboBox combo; 0040 combo.setFormat(static_cast<MailCommon::BackupJob::ArchiveType>(input)); 0041 QCOMPARE(combo.format(), static_cast<MailCommon::BackupJob::ArchiveType>(output)); 0042 } 0043 0044 QTEST_MAIN(FormatComboBoxTest) 0045 0046 #include "moc_formatcomboboxtest.cpp"