File indexing completed on 2024-11-10 04:40:10

0001 /*
0002     SPDX-FileCopyrightText: 2017-2024 Laurent Montel <montel@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "conflictresolvedialogtest.h"
0008 #include "../src/widgets/conflictresolvedialog_p.h"
0009 
0010 #include <QLabel>
0011 #include <QPushButton>
0012 #include <QTest>
0013 #include <QTextBrowser>
0014 
0015 QTEST_MAIN(ConflictResolveDialogTest)
0016 
0017 ConflictResolveDialogTest::ConflictResolveDialogTest(QObject *parent)
0018     : QObject(parent)
0019 {
0020 }
0021 
0022 void ConflictResolveDialogTest::shouldHaveDefaultValues()
0023 {
0024     Akonadi::ConflictResolveDialog dlg;
0025 
0026     QVERIFY(!dlg.windowTitle().isEmpty());
0027 
0028     auto takeLeftButton = dlg.findChild<QPushButton *>(QStringLiteral("takeLeftButton"));
0029     QVERIFY(takeLeftButton);
0030     QVERIFY(!takeLeftButton->text().isEmpty());
0031 
0032     auto takeRightButton = dlg.findChild<QPushButton *>(QStringLiteral("takeRightButton"));
0033     QVERIFY(takeRightButton);
0034     QVERIFY(!takeRightButton->text().isEmpty());
0035 
0036     auto keepBothButton = dlg.findChild<QPushButton *>(QStringLiteral("keepBothButton"));
0037     QVERIFY(keepBothButton);
0038     QVERIFY(!keepBothButton->text().isEmpty());
0039     QVERIFY(keepBothButton->isDefault());
0040 
0041     auto mView = dlg.findChild<QTextBrowser *>(QStringLiteral("view"));
0042     QVERIFY(mView);
0043     QVERIFY(mView->toPlainText().isEmpty());
0044 
0045     auto docuLabel = dlg.findChild<QLabel *>(QStringLiteral("doculabel"));
0046     QVERIFY(docuLabel);
0047     QVERIFY(!docuLabel->text().isEmpty());
0048     QVERIFY(docuLabel->wordWrap());
0049     QCOMPARE(docuLabel->contextMenuPolicy(), Qt::NoContextMenu);
0050 }
0051 
0052 #include "moc_conflictresolvedialogtest.cpp"