File indexing completed on 2024-12-22 05:05:18
0001 // SPDX-FileCopyrightText: 2023 g10 Code GmbH 0002 // SPDX-FileContributor: Carl Schwan <carl@carlschwan.eu> 0003 // SPDX-License-Identifier: LGPL-2.0-or-later 0004 0005 #include <MimeTreeParserWidgets/MessageViewerDialog> 0006 #include <QLayout> 0007 #include <QTest> 0008 0009 using namespace MimeTreeParser::Widgets; 0010 0011 class MessageViewerDialogTest : public QObject 0012 { 0013 Q_OBJECT 0014 0015 private Q_SLOTS: 0016 void messageViewerDialogCreationMultipleTest() 0017 { 0018 MessageViewerDialog dialog(QLatin1StringView(MAIL_DATA_DIR) + QLatin1Char('/') + QLatin1StringView("combined.mbox")); 0019 QCOMPARE(dialog.messages().count(), 3); 0020 0021 QCOMPARE(dialog.layout()->count(), 2); 0022 QVERIFY(dialog.layout()->itemAt(1)->layout()); 0023 QCOMPARE(dialog.layout()->itemAt(1)->layout()->count(), 2); 0024 0025 const auto actions = dialog.layout()->menuBar()->actions(); 0026 QCOMPARE(actions.count(), 2); 0027 } 0028 0029 void messageViewerDialogCreationTest() 0030 { 0031 MessageViewerDialog dialog(QLatin1StringView(MAIL_DATA_DIR) + QLatin1Char('/') + QLatin1StringView("plaintext.mbox")); 0032 QCOMPARE(dialog.messages().count(), 1); 0033 0034 QCOMPARE(dialog.layout()->count(), 2); 0035 0036 QVERIFY(!dialog.layout()->itemAt(0)->widget()->isVisible()); 0037 0038 QVERIFY(dialog.layout()->itemAt(1)->layout()); 0039 QCOMPARE(dialog.layout()->itemAt(1)->layout()->count(), 2); 0040 } 0041 }; 0042 0043 QTEST_MAIN(MessageViewerDialogTest) 0044 #include "messageviewerdialogtest.moc"