File indexing completed on 2024-12-22 04:28:24

0001 /*
0002   SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org>
0003 
0004   SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "speechtotextselectdevicewidgettest.h"
0008 #include "speechtotext/widgets/speechtotextselectdevicewidget.h"
0009 #include <QComboBox>
0010 #include <QHBoxLayout>
0011 #include <QLabel>
0012 #include <QStandardPaths>
0013 #include <QTest>
0014 
0015 QTEST_MAIN(SpeechToTextSelectDeviceWidgetTest)
0016 SpeechToTextSelectDeviceWidgetTest::SpeechToTextSelectDeviceWidgetTest(QObject *parent)
0017     : QObject{parent}
0018 {
0019     QStandardPaths::setTestModeEnabled(true);
0020 }
0021 
0022 void SpeechToTextSelectDeviceWidgetTest::shouldHaveDefaultValues()
0023 {
0024     TextSpeechToText::SpeechToTextSelectDeviceWidget w;
0025 
0026     auto mainLayout = w.findChild<QHBoxLayout *>(QStringLiteral("mainLayout"));
0027     QVERIFY(mainLayout);
0028     QCOMPARE(mainLayout->contentsMargins(), QMargins{});
0029 
0030     auto label = w.findChild<QLabel *>(QStringLiteral("label"));
0031     QVERIFY(label);
0032     QVERIFY(!label->text().isEmpty());
0033 
0034     auto mDeviceComboBox = w.findChild<QComboBox *>(QStringLiteral("mDeviceComboBox"));
0035     QVERIFY(mDeviceComboBox);
0036 }
0037 
0038 #include "moc_speechtotextselectdevicewidgettest.cpp"