File indexing completed on 2025-01-19 04:46:44
0001 /* 0002 SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "akonadidatabasetoolsplugininterfacetest.h" 0008 #include "../akonadidatabasetoolsplugininterface.h" 0009 #include <KActionCollection> 0010 #include <QSignalSpy> 0011 #include <QTest> 0012 0013 QTEST_MAIN(AkonadiDatabaseToolsPluginInterfaceTest) 0014 AkonadiDatabaseToolsPluginInterfaceTest::AkonadiDatabaseToolsPluginInterfaceTest(QObject *parent) 0015 : QObject(parent) 0016 { 0017 } 0018 0019 AkonadiDatabaseToolsPluginInterfaceTest::~AkonadiDatabaseToolsPluginInterfaceTest() = default; 0020 0021 void AkonadiDatabaseToolsPluginInterfaceTest::shouldHaveDefaultValue() 0022 { 0023 AkonadiDatabaseToolsPluginInterface interface; 0024 QVERIFY(!interface.parentWidget()); 0025 QCOMPARE(interface.actionTypes().count(), 0); 0026 } 0027 0028 void AkonadiDatabaseToolsPluginInterfaceTest::shouldCreateAction() 0029 { 0030 AkonadiDatabaseToolsPluginInterface interface; 0031 interface.createAction(new KActionCollection(this)); 0032 QCOMPARE(interface.actionTypes().count(), 2); 0033 QVERIFY(interface.actionTypes().at(0).action()); 0034 QVERIFY(interface.actionTypes().at(1).action()); 0035 } 0036 0037 #if 0 // We have some kmessagebox 0038 void AkonadiDatabaseToolsPluginInterfaceTest::shouldEmitActivatedSignal() 0039 { 0040 AkonadiDatabaseToolsPluginInterface interface; 0041 interface.createAction(new KActionCollection(this)); 0042 0043 QSignalSpy spy1(&interface, &PimCommon::AbstractGenericPluginInterface::emitPluginActivated); 0044 interface.actionTypes().at(0).action()->trigger(); 0045 QCOMPARE(spy1.count(), 1); 0046 } 0047 #endif 0048 0049 #include "moc_akonadidatabasetoolsplugininterfacetest.cpp"