File indexing completed on 2024-11-24 04:39:30

0001 /*
0002     This file is part of Contact Editor.
0003 
0004     SPDX-FileCopyrightText: 2018-2024 Laurent Montel <montel@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #include "blogfeedwidgettest.h"
0010 #include "editor/generalinfoeditor/blogfeedwidget.h"
0011 
0012 #include <QLabel>
0013 #include <QTest>
0014 #include <QVBoxLayout>
0015 
0016 #include <KLineEdit>
0017 
0018 BlogfeedWidgetTest::BlogfeedWidgetTest(QObject *parent)
0019     : QObject(parent)
0020 {
0021 }
0022 
0023 void BlogfeedWidgetTest::shouldHaveDefaultValue()
0024 {
0025     Akonadi::BlogfeedWidget editor;
0026 
0027     auto topLayout = editor.findChild<QVBoxLayout *>(QStringLiteral("mainlayout"));
0028     QVERIFY(topLayout);
0029     QCOMPARE(topLayout->contentsMargins(), QMargins(0, 0, 0, 0));
0030 
0031     auto blogFeedLabel = editor.findChild<QLabel *>(QStringLiteral("blogFeedLabel"));
0032     QVERIFY(blogFeedLabel);
0033     QVERIFY(!blogFeedLabel->text().isEmpty());
0034 
0035     auto mBlogFeed = editor.findChild<KLineEdit *>(QStringLiteral("blogfeed"));
0036     QVERIFY(mBlogFeed);
0037     QVERIFY(mBlogFeed->trapReturnKey());
0038     QVERIFY(!mBlogFeed->placeholderText().isEmpty());
0039 }
0040 
0041 QTEST_MAIN(BlogfeedWidgetTest)
0042 
0043 #include "moc_blogfeedwidgettest.cpp"