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

0001 /*
0002    SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "createnewserverwidgettest.h"
0008 #include "common/authenticationloginwidget.h"
0009 #include "common/authenticationoauthwidget.h"
0010 #include "createnewserver/createnewserverwidget.h"
0011 #include <QFormLayout>
0012 #include <QTest>
0013 QTEST_MAIN(CreateNewServerWidgetTest)
0014 CreateNewServerWidgetTest::CreateNewServerWidgetTest(QObject *parent)
0015     : QObject(parent)
0016 {
0017 }
0018 
0019 void CreateNewServerWidgetTest::shouldHaveDefaultValues()
0020 {
0021     CreateNewServerWidget w;
0022 
0023     auto mainLayout = w.findChild<QFormLayout *>(QStringLiteral("mainLayout"));
0024     QVERIFY(mainLayout);
0025     QCOMPARE(mainLayout->contentsMargins(), QMargins{});
0026 
0027     QVERIFY(w.accountInfo().userName.isEmpty());
0028     QVERIFY(w.accountInfo().serverUrl.isEmpty());
0029     QVERIFY(w.accountInfo().accountName.isEmpty());
0030 
0031     auto mAuthenticationWidget = w.findChild<AuthenticationOauthWidget *>(QStringLiteral("mAuthenticationWidget"));
0032     QVERIFY(mAuthenticationWidget);
0033 
0034     auto mAuthenticationLoginWidget = w.findChild<AuthenticationLoginWidget *>(QStringLiteral("mAuthenticationLoginWidget"));
0035     QVERIFY(mAuthenticationLoginWidget);
0036 }
0037 
0038 #include "moc_createnewserverwidgettest.cpp"