File indexing completed on 2024-06-09 04:59:02

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 "createnewserverdialogtest.h"
0008 #include "createnewserver/createnewserverdialog.h"
0009 #include "createnewserver/createnewserverstackwidget.h"
0010 #include <QDialogButtonBox>
0011 #include <QStandardPaths>
0012 #include <QTest>
0013 #include <QVBoxLayout>
0014 QTEST_MAIN(CreateNewServerDialogTest)
0015 CreateNewServerDialogTest::CreateNewServerDialogTest(QObject *parent)
0016     : QObject(parent)
0017 {
0018     QStandardPaths::setTestModeEnabled(true);
0019 }
0020 
0021 void CreateNewServerDialogTest::shouldHaveDefaultValues()
0022 {
0023     CreateNewServerDialog w;
0024     QVERIFY(!w.windowTitle().isEmpty());
0025     auto mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainLayout"));
0026     QVERIFY(mainLayout);
0027 
0028     auto mCreateNewServerStackWidget = w.findChild<CreateNewServerStackWidget *>(QStringLiteral("mCreateNewServerStackWidget"));
0029     QVERIFY(mCreateNewServerStackWidget);
0030 
0031     auto buttonBox = w.findChild<QDialogButtonBox *>(QStringLiteral("button"));
0032     QVERIFY(buttonBox);
0033 
0034     const AccountManager::AccountManagerInfo info = w.accountInfo();
0035     QVERIFY(info.accountName.isEmpty());
0036     QVERIFY(info.userName.isEmpty());
0037     QVERIFY(info.serverUrl.isEmpty());
0038 }
0039 
0040 #include "moc_createnewserverdialogtest.cpp"