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

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 "configuregeneralwidgettest.h"
0008 #include "configuredialog/configuregeneralwidget.h"
0009 #include <QCheckBox>
0010 #include <QStandardPaths>
0011 #include <QTest>
0012 #include <QVBoxLayout>
0013 QTEST_MAIN(ConfigureGeneralWidgetTest)
0014 
0015 ConfigureGeneralWidgetTest::ConfigureGeneralWidgetTest(QObject *parent)
0016     : QObject(parent)
0017 {
0018     QStandardPaths::setTestModeEnabled(true);
0019 }
0020 
0021 void ConfigureGeneralWidgetTest::shouldHaveDefaultValues()
0022 {
0023     ConfigureGeneralWidget w;
0024     // Load otherwise we can't load default settings
0025     w.load();
0026 
0027     auto mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainLayout"));
0028     QVERIFY(mainLayout);
0029 
0030     auto mSetOnlineForAllAccount = w.findChild<QCheckBox *>(QStringLiteral("mSetOnlineForAllAccount"));
0031     QVERIFY(mSetOnlineForAllAccount);
0032     QVERIFY(mSetOnlineForAllAccount->isChecked());
0033     QVERIFY(!mSetOnlineForAllAccount->text().isEmpty());
0034 
0035     auto mShowImageByDefault = w.findChild<QCheckBox *>(QStringLiteral("mShowImageByDefault"));
0036     QVERIFY(mShowImageByDefault);
0037     QVERIFY(mShowImageByDefault->isChecked());
0038     QVERIFY(!mShowImageByDefault->text().isEmpty());
0039 
0040     auto mShowPreviewUrlByDefault = w.findChild<QCheckBox *>(QStringLiteral("mShowPreviewUrlByDefault"));
0041     QVERIFY(mShowPreviewUrlByDefault);
0042     QVERIFY(mShowPreviewUrlByDefault->isChecked());
0043     QVERIFY(!mShowPreviewUrlByDefault->text().isEmpty());
0044 
0045     auto mMarkAsReadOnTextClicked = w.findChild<QCheckBox *>(QStringLiteral("mMarkAsReadOnTextClicked"));
0046     QVERIFY(mMarkAsReadOnTextClicked);
0047     QVERIFY(!mMarkAsReadOnTextClicked->isChecked());
0048     QVERIFY(!mMarkAsReadOnTextClicked->text().isEmpty());
0049 
0050     auto mEnableSystemTray = w.findChild<QCheckBox *>(QStringLiteral("mEnableSystemTray"));
0051     QVERIFY(mEnableSystemTray);
0052     QVERIFY(mEnableSystemTray->isChecked());
0053     QVERIFY(!mEnableSystemTray->text().isEmpty());
0054 
0055     auto mEnableLogging = w.findChild<QCheckBox *>(QStringLiteral("mEnableLogging"));
0056     QVERIFY(mEnableLogging);
0057     QVERIFY(mEnableLogging->isChecked());
0058     QVERIFY(!mEnableLogging->text().isEmpty());
0059 
0060     auto mShowHoverHightLights = w.findChild<QCheckBox *>(QStringLiteral("mShowHoverHightLights"));
0061     QVERIFY(mShowHoverHightLights);
0062     QVERIFY(mShowHoverHightLights->isChecked());
0063     QVERIFY(!mShowHoverHightLights->text().isEmpty());
0064 
0065     auto mAnimateGif = w.findChild<QCheckBox *>(QStringLiteral("mAnimateGif"));
0066     QVERIFY(mAnimateGif);
0067     QVERIFY(mAnimateGif->isChecked());
0068     QVERIFY(!mAnimateGif->text().isEmpty());
0069 
0070     auto mStoreMessageInDataBase = w.findChild<QCheckBox *>(QStringLiteral("mStoreMessageInDataBase"));
0071     QVERIFY(mStoreMessageInDataBase);
0072     QVERIFY(!mStoreMessageInDataBase->isChecked());
0073     QVERIFY(!mStoreMessageInDataBase->text().isEmpty());
0074 }
0075 
0076 #include "moc_configuregeneralwidgettest.cpp"