File indexing completed on 2024-12-22 04:45:56
0001 /* 0002 SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "directorywidgettest.h" 0008 #include "directory/directorywidget.h" 0009 #include "misc/searchwithdelaylineedit.h" 0010 #include <QHeaderView> 0011 #include <QLabel> 0012 #include <QTest> 0013 #include <QTreeView> 0014 #include <QVBoxLayout> 0015 QTEST_MAIN(DirectoryWidgetTest) 0016 DirectoryWidgetTest::DirectoryWidgetTest(QObject *parent) 0017 : QObject(parent) 0018 { 0019 } 0020 0021 void DirectoryWidgetTest::shouldHaveDefaultValues() 0022 { 0023 DirectoryWidget w(nullptr, DirectoryWidget::Unknown); 0024 auto mLabelResultSearch = w.findChild<QLabel *>(QStringLiteral("mLabelResultSearch")); 0025 QVERIFY(mLabelResultSearch); 0026 QVERIFY(mLabelResultSearch->text().isEmpty()); 0027 0028 auto mSearchLineEdit = w.findChild<SearchWithDelayLineEdit *>(QStringLiteral("mSearchLineEdit")); 0029 QVERIFY(mSearchLineEdit); 0030 QVERIFY(mSearchLineEdit->text().isEmpty()); 0031 auto mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainLayout")); 0032 QVERIFY(mainLayout); 0033 QCOMPARE(mainLayout->contentsMargins(), QMargins{}); 0034 0035 auto mTreeView = w.findChild<QTreeView *>(QStringLiteral("mTreeView")); 0036 QVERIFY(mTreeView); 0037 QVERIFY(!mTreeView->rootIsDecorated()); 0038 QVERIFY(mTreeView->isSortingEnabled()); 0039 QCOMPARE(mTreeView->contextMenuPolicy(), Qt::CustomContextMenu); 0040 QVERIFY(mTreeView->header()->sectionsClickable()); 0041 } 0042 0043 #include "moc_directorywidgettest.cpp"