File: snippetattachmentwidgettest.cpp

package info (click to toggle)
mailcommon 4%3A24.12.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,412 kB
  • sloc: cpp: 30,581; xml: 340; makefile: 17; ansic: 12; sh: 3
file content (40 lines) | stat: -rw-r--r-- 1,204 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
   SPDX-FileCopyrightText: 2019-2024 Laurent Montel <montel@kde.org>

   SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/

#include "snippetattachmentwidgettest.h"
#include "snippets/snippetattachmentwidget.h"
#include <QHBoxLayout>
#include <QLineEdit>
#include <QTest>
#include <QToolButton>
QTEST_MAIN(SnippetAttachmentWidgetTest)

SnippetAttachmentWidgetTest::SnippetAttachmentWidgetTest(QObject *parent)
    : QObject(parent)
{
}

void SnippetAttachmentWidgetTest::shouldHaveDefaultValues()
{
    MailCommon::SnippetAttachmentWidget w;

    auto layout = w.findChild<QHBoxLayout *>(QStringLiteral("layout"));
    QVERIFY(layout);
    QCOMPARE(layout->contentsMargins(), QMargins(0, 0, 0, 0));

    auto mLineEdit = w.findChild<QLineEdit *>(QStringLiteral("lineedit"));
    QVERIFY(mLineEdit);
    QVERIFY(mLineEdit->text().isEmpty());
    QVERIFY(mLineEdit->isReadOnly());
    QVERIFY(!mLineEdit->placeholderText().isEmpty());

    auto button = w.findChild<QToolButton *>(QStringLiteral("button"));
    QVERIFY(button);
    QVERIFY(!button->text().isEmpty());
    QVERIFY(!button->toolTip().isEmpty());
}

#include "moc_snippetattachmentwidgettest.cpp"