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

0001 /*
0002     This file is part of Contact Editor.
0003 
0004     SPDX-FileCopyrightText: 2017-2024 Laurent Montel <montel@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #include "nicknamewidgettest.h"
0010 #include "editor/generalinfoeditor/nicknamewidget.h"
0011 
0012 #include <QLabel>
0013 #include <QTest>
0014 #include <QVBoxLayout>
0015 
0016 #include <KLineEdit>
0017 
0018 NicknameWidgetTest::NicknameWidgetTest(QObject *parent)
0019     : QObject(parent)
0020 {
0021 }
0022 
0023 void NicknameWidgetTest::shouldHaveDefaultValue()
0024 {
0025     Akonadi::NicknameWidget 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 nickNameLabel = editor.findChild<QLabel *>(QStringLiteral("nicknamelabel"));
0032     QVERIFY(nickNameLabel);
0033     QVERIFY(!nickNameLabel->text().isEmpty());
0034 
0035     auto mNickName = editor.findChild<KLineEdit *>(QStringLiteral("nickname"));
0036     QVERIFY(mNickName);
0037     QVERIFY(mNickName->trapReturnKey());
0038     QVERIFY(!mNickName->placeholderText().isEmpty());
0039 }
0040 
0041 QTEST_MAIN(NicknameWidgetTest)
0042 
0043 #include "moc_nicknamewidgettest.cpp"