File indexing completed on 2025-01-05 04:49:34
0001 /* 0002 SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-only 0005 */ 0006 0007 #include "csvwidgettest.h" 0008 #include "../widgets/csvwidget.h" 0009 #include <KUrlRequester> 0010 #include <QLabel> 0011 #include <QTest> 0012 CsvWidgetTest::CsvWidgetTest(QObject *parent) 0013 : QObject(parent) 0014 { 0015 } 0016 0017 CsvWidgetTest::~CsvWidgetTest() = default; 0018 0019 void CsvWidgetTest::shouldHaveDefaultValue() 0020 { 0021 MailMerge::CsvWidget w; 0022 0023 auto lab = w.findChild<QLabel *>(QStringLiteral("label")); 0024 QVERIFY(lab); 0025 0026 auto urlrequester = w.findChild<KUrlRequester *>(QStringLiteral("cvsurlrequester")); 0027 QVERIFY(urlrequester); 0028 QVERIFY(urlrequester->url().isEmpty()); 0029 } 0030 0031 void CsvWidgetTest::shouldChangePath() 0032 { 0033 MailMerge::CsvWidget w; 0034 0035 auto urlrequester = w.findChild<KUrlRequester *>(QStringLiteral("cvsurlrequester")); 0036 QVERIFY(urlrequester->url().isEmpty()); 0037 QUrl url(QStringLiteral("file:///tmp/foo.txt")); 0038 urlrequester->setUrl(url); 0039 QCOMPARE(urlrequester->url(), url); 0040 } 0041 0042 QTEST_MAIN(CsvWidgetTest) 0043 0044 #include "moc_csvwidgettest.cpp"