File indexing completed on 2025-01-05 04:49:45
0001 /* 0002 SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "viewerplugintranslatortest.h" 0008 #include "../common/translatorplugin/viewerplugintranslator.h" 0009 #include <KActionCollection> 0010 #include <MessageViewer/ViewerPluginInterface> 0011 #include <QHBoxLayout> 0012 #include <QTest> 0013 0014 ViewerPluginTranslatorTest::ViewerPluginTranslatorTest(QObject *parent) 0015 : QObject(parent) 0016 { 0017 } 0018 0019 ViewerPluginTranslatorTest::~ViewerPluginTranslatorTest() = default; 0020 0021 void ViewerPluginTranslatorTest::shouldHaveDefaultValue() 0022 { 0023 auto translator = new MessageViewer::ViewerPluginTranslator(this); 0024 QVERIFY(!translator->viewerPluginName().isEmpty()); 0025 auto parent = new QWidget(nullptr); 0026 parent->setLayout(new QHBoxLayout); 0027 0028 QVERIFY(translator->createView(parent, new KActionCollection(this))); 0029 } 0030 0031 void ViewerPluginTranslatorTest::shouldCreateAction() 0032 { 0033 auto translator = new MessageViewer::ViewerPluginTranslator(this); 0034 QVERIFY(!translator->viewerPluginName().isEmpty()); 0035 auto parent = new QWidget(nullptr); 0036 parent->setLayout(new QHBoxLayout); 0037 0038 MessageViewer::ViewerPluginInterface *interface = translator->createView(parent, new KActionCollection(this)); 0039 QVERIFY(!interface->actions().isEmpty()); 0040 } 0041 0042 QTEST_MAIN(ViewerPluginTranslatorTest) 0043 0044 #include "moc_viewerplugintranslatortest.cpp"