File indexing completed on 2024-12-29 04:54:49

0001 /*
0002    SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "sievescriptdebuggerwidgettest.h"
0008 #include "../sievescriptdebuggerwidget.h"
0009 #include <QStackedWidget>
0010 #include <QTest>
0011 
0012 SieveScriptDebuggerWidgetTest::SieveScriptDebuggerWidgetTest(QObject *parent)
0013     : QObject(parent)
0014 {
0015 }
0016 
0017 SieveScriptDebuggerWidgetTest::~SieveScriptDebuggerWidgetTest() = default;
0018 
0019 void SieveScriptDebuggerWidgetTest::shouldHaveDefaultValue()
0020 {
0021     KSieveUi::SieveScriptDebuggerWidget w;
0022     auto stackedwidget = w.findChild<QStackedWidget *>(QStringLiteral("stackedwidget"));
0023     QVERIFY(stackedwidget);
0024 
0025     const int numberOfStackWidget(2);
0026     QCOMPARE(stackedwidget->count(), numberOfStackWidget);
0027     for (int i = 0; i < numberOfStackWidget; ++i) {
0028         QWidget *widget = stackedwidget->widget(i);
0029         QVERIFY((widget->objectName() == QLatin1StringView("sievescriptfrontend")) || (widget->objectName() == QLatin1StringView("sievenoexistingfrontend")));
0030     }
0031 }
0032 
0033 QTEST_MAIN(SieveScriptDebuggerWidgetTest)
0034 
0035 #include "moc_sievescriptdebuggerwidgettest.cpp"