File indexing completed on 2024-12-22 04:45:34

0001 /*
0002    SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 #include "administratoruserswidgettest.h"
0007 #include "administratordialog/users/administratoruserswidget.h"
0008 #include <QLineEdit>
0009 #include <QTest>
0010 #include <QTreeView>
0011 #include <QVBoxLayout>
0012 QTEST_MAIN(AdministratorUsersWidgetTest)
0013 
0014 AdministratorUsersWidgetTest::AdministratorUsersWidgetTest(QObject *parent)
0015     : QObject(parent)
0016 {
0017 }
0018 
0019 void AdministratorUsersWidgetTest::shouldHaveDefaultValues()
0020 {
0021     AdministratorUsersWidget w(nullptr);
0022     auto mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainLayout"));
0023     QVERIFY(mainLayout);
0024     auto mResultTreeView = w.findChild<QTreeView *>(QStringLiteral("mTreeView"));
0025     QVERIFY(mResultTreeView);
0026     QVERIFY(!mResultTreeView->rootIsDecorated());
0027     QVERIFY(mResultTreeView->isSortingEnabled());
0028 
0029     auto mSearchLineEdit = w.findChild<QLineEdit *>(QStringLiteral("mSearchLineEdit"));
0030     QVERIFY(mSearchLineEdit);
0031     QVERIFY(mSearchLineEdit->isClearButtonEnabled());
0032     QVERIFY(!mSearchLineEdit->placeholderText().isEmpty());
0033 }
0034 
0035 #include "moc_administratoruserswidgettest.cpp"