File indexing completed on 2025-05-04 04:59:01
0001 /* 0002 SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-only 0005 */ 0006 0007 #include "zoomactionmenutest.h" 0008 #include "../src/widgets/zoomactionmenu.h" 0009 #include <KActionCollection> 0010 #include <QTest> 0011 0012 ZoomActionMenuTest::ZoomActionMenuTest(QObject *parent) 0013 : QObject(parent) 0014 { 0015 } 0016 0017 ZoomActionMenuTest::~ZoomActionMenuTest() 0018 { 0019 } 0020 0021 void ZoomActionMenuTest::shouldHaveDefaultValue() 0022 { 0023 MessageViewer::ZoomActionMenu menu(this); 0024 menu.setActionCollection(new KActionCollection(this)); 0025 menu.createZoomActions(); 0026 0027 QVERIFY(menu.zoomInAction()); 0028 QVERIFY(menu.zoomOutAction()); 0029 QVERIFY(menu.zoomResetAction()); 0030 } 0031 0032 void ZoomActionMenuTest::shouldAssignZoomFactor() 0033 { 0034 MessageViewer::ZoomActionMenu menu(this); 0035 menu.setActionCollection(new KActionCollection(this)); 0036 menu.createZoomActions(); 0037 qreal initialValue = 50; 0038 menu.setZoomFactor(initialValue); 0039 QCOMPARE(menu.zoomFactor(), initialValue); 0040 } 0041 0042 QTEST_MAIN(ZoomActionMenuTest) 0043 0044 #include "moc_zoomactionmenutest.cpp"