File indexing completed on 2024-11-24 04:16:55

0001 /*
0002   SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org>
0003 
0004   SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "deeplengineconfigurewidgettest.h"
0008 #include "../deeplengineconfigurewidget.h"
0009 #include <QCheckBox>
0010 #include <QFormLayout>
0011 #include <QLineEdit>
0012 #include <QTest>
0013 QTEST_MAIN(DeeplEngineConfigureWidgetTest)
0014 DeeplEngineConfigureWidgetTest::DeeplEngineConfigureWidgetTest(QObject *parent)
0015     : QObject{parent}
0016 {
0017 }
0018 
0019 void DeeplEngineConfigureWidgetTest::shouldHaveDefaultValues()
0020 {
0021     DeeplEngineConfigureWidget w;
0022     QVERIFY(!w.useFreeLicenceKey());
0023 
0024     auto mainLayout = w.findChild<QFormLayout *>(QStringLiteral("mainLayout"));
0025     QVERIFY(mainLayout);
0026     QCOMPARE(mainLayout->contentsMargins(), QMargins{});
0027 
0028     auto mUseFreeLicense = w.findChild<QCheckBox *>(QStringLiteral("mUseFreeLicense"));
0029     QVERIFY(mUseFreeLicense);
0030     QVERIFY(!mUseFreeLicense->isChecked());
0031 
0032     auto mApiKey = w.findChild<QLineEdit *>(QStringLiteral("mApiKey"));
0033     QVERIFY(mApiKey);
0034     QVERIFY(mApiKey->isClearButtonEnabled());
0035 }
0036 
0037 #include "moc_deeplengineconfigurewidgettest.cpp"