File indexing completed on 2024-12-22 05:00:50
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 "unitcomboboxtest.h" 0008 #include "../widgets/unitcombobox.h" 0009 #include <QTest> 0010 0011 UnitComboBoxTest::UnitComboBoxTest(QObject *parent) 0012 : QObject(parent) 0013 { 0014 } 0015 0016 UnitComboBoxTest::~UnitComboBoxTest() = default; 0017 0018 void UnitComboBoxTest::shouldHaveDefaultValue() 0019 { 0020 UnitComboBox combo; 0021 QCOMPARE(combo.count(), 4); 0022 } 0023 0024 void UnitComboBoxTest::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 UnitComboBoxTest::changeCurrentItem() 0036 { 0037 QFETCH(int, input); 0038 QFETCH(int, output); 0039 UnitComboBox combo; 0040 combo.setUnit(static_cast<ArchiveMailInfo::ArchiveUnit>(input)); 0041 QCOMPARE(combo.unit(), static_cast<ArchiveMailInfo::ArchiveUnit>(output)); 0042 } 0043 0044 QTEST_MAIN(UnitComboBoxTest) 0045 0046 #include "moc_unitcomboboxtest.cpp"