File indexing completed on 2024-12-22 04:45:46
0001 /* 0002 SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "authenticationloginwidgettest.h" 0008 #include "common/authenticationloginwidget.h" 0009 #include <KPasswordLineEdit> 0010 #include <QFormLayout> 0011 #include <QLineEdit> 0012 #include <QTest> 0013 QTEST_MAIN(AuthenticationLoginWidgetTest) 0014 0015 AuthenticationLoginWidgetTest::AuthenticationLoginWidgetTest(QObject *parent) 0016 : QObject{parent} 0017 { 0018 } 0019 0020 void AuthenticationLoginWidgetTest::shouldHaveDefaultValues() 0021 { 0022 AuthenticationLoginWidget w; 0023 0024 auto mainLayout = w.findChild<QFormLayout *>(QStringLiteral("mainLayout")); 0025 QVERIFY(mainLayout); 0026 QCOMPARE(mainLayout->contentsMargins(), QMargins{}); 0027 0028 auto mAccountName = w.findChild<QLineEdit *>(QStringLiteral("mAccountName")); 0029 QVERIFY(mAccountName); 0030 QVERIFY(mAccountName->text().isEmpty()); 0031 QVERIFY(mAccountName->isClearButtonEnabled()); 0032 0033 auto mServerUrl = w.findChild<QLineEdit *>(QStringLiteral("mServerUrl")); 0034 QVERIFY(mServerUrl); 0035 QVERIFY(mServerUrl->text().isEmpty()); 0036 0037 auto mUserName = w.findChild<QLineEdit *>(QStringLiteral("mUserName")); 0038 QVERIFY(mUserName); 0039 QVERIFY(mUserName->text().isEmpty()); 0040 QVERIFY(mUserName->isClearButtonEnabled()); 0041 0042 auto mPasswordLineEdit = w.findChild<KPasswordLineEdit *>(QStringLiteral("mPasswordLineEdit")); 0043 QVERIFY(mPasswordLineEdit); 0044 } 0045 0046 #include "moc_authenticationloginwidgettest.cpp"