File indexing completed on 2025-01-05 04:58:19

0001 /*
0002   SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org>
0003 
0004   SPDX-License-Identifier: LGPL-2.0-or-later
0005 
0006 */
0007 
0008 #include "completionorderwidgettest.h"
0009 #include "addressline/completionorder/completionorderwidget.h"
0010 #include <QPushButton>
0011 #include <QTest>
0012 #include <QTreeWidget>
0013 
0014 CompletionOrderWidgetTest::CompletionOrderWidgetTest(QObject *parent)
0015     : QObject(parent)
0016 {
0017 }
0018 
0019 CompletionOrderWidgetTest::~CompletionOrderWidgetTest() = default;
0020 
0021 void CompletionOrderWidgetTest::shouldHaveDefaultValue()
0022 {
0023     PimCommon::CompletionOrderWidget w;
0024     auto treewidget = w.findChild<QTreeWidget *>(QStringLiteral("listview"));
0025     QVERIFY(treewidget);
0026     QVERIFY(treewidget->isHeaderHidden());
0027     QVERIFY(treewidget->isSortingEnabled());
0028     QCOMPARE(treewidget->topLevelItemCount(), 0);
0029 
0030     auto up = w.findChild<QPushButton *>(QStringLiteral("mUpButton"));
0031     QVERIFY(up);
0032     QVERIFY(up->autoRepeat());
0033 
0034     auto down = w.findChild<QPushButton *>(QStringLiteral("mDownButton"));
0035     QVERIFY(down);
0036     QVERIFY(down->autoRepeat());
0037 }
0038 
0039 QTEST_MAIN(CompletionOrderWidgetTest)
0040 
0041 #include "moc_completionorderwidgettest.cpp"