filternamewidgettest.cpp 930 Bytes
Newer Older
Laurent Montel's avatar
Laurent Montel committed
1
2
3
4
5
6
7
8
/*
  SPDX-FileCopyrightText: 2021 Laurent Montel <montel@kde.org>

  SPDX-License-Identifier: GPL-2.0-or-later
*/

#include "filternamewidgettest.h"
#include "core/widgets/filternamewidget.h"
Laurent Montel's avatar
Laurent Montel committed
9
10
11
#include <KIconButton>
#include <QHBoxLayout>
#include <QLineEdit>
Laurent Montel's avatar
Laurent Montel committed
12
13
14
15
16
17
18
19
20
21
#include <QTest>
QTEST_MAIN(FilterNameWidgetTest)
FilterNameWidgetTest::FilterNameWidgetTest(QObject *parent)
    : QObject(parent)
{
}

void FilterNameWidgetTest::shouldHaveDefaultValues()
{
    MessageList::Core::FilterNameWidget w;
Laurent Montel's avatar
Laurent Montel committed
22
23
24
25
26
27
28
    auto mainLayout = w.findChild<QHBoxLayout *>(QStringLiteral("mainLayout"));
    QVERIFY(mainLayout);
    QCOMPARE(mainLayout->contentsMargins(), {});

    auto mName = w.findChild<QLineEdit *>(QStringLiteral("mName"));
    QVERIFY(mName);
    QVERIFY(mName->text().isEmpty());
Laurent Montel's avatar
Laurent Montel committed
29
    QVERIFY(mName->isClearButtonEnabled());
Laurent Montel's avatar
Laurent Montel committed
30
31
32

    auto mIconButton = w.findChild<KIconButton *>(QStringLiteral("mIconButton"));
    QVERIFY(mIconButton);
Laurent Montel's avatar
Laurent Montel committed
33
}