Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit fe4d0840 authored by Agata Cacko's avatar Agata Cacko

Add small test for KoZoomAction

Before this commit, KoZoomAction class didn't have any tests for itself.
This commit adds a very small, easy test.
(I `just needed it to check something, it should be expanded to be a real
test, for now it checks very basic functionality).
parent c2ffbc6b
......@@ -12,5 +12,6 @@ ecm_add_tests(
zoomhandler_test.cpp
zoomcontroller_test.cpp
KoAnchorSelectionWidgetTest.cpp
TestKoZoomAction.cpp
NAME_PREFIX "libs-widgets-"
LINK_LIBRARIES kritawidgets Qt5::Test)
/*
* Copyright (c) 2020 Agata Cacko <cacko.azh@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "TestKoZoomAction.h"
#include <QTest>
#include <QDialog>
#include <QVBoxLayout>
#include "kis_debug.h"
#include "KoZoomMode.h"
void TestKoZoomAction::test()
{
KoZoomAction* action = new KoZoomAction(KoZoomMode::ZOOM_CONSTANT, "zoom", 0);
qreal prev, after;
do {
prev = action->effectiveZoom();
action->zoomIn();
after = action->effectiveZoom();
//qDebug() << prev << after;
} while (after != prev);
//qDebug() << action->maximumZoom();
//qDebug() << action->effectiveZoom();
//qDebug() << action->nextZoomLevel();
QVERIFY(action->nextZoomLevel() == action->effectiveZoom());
delete action;
}
QTEST_MAIN(TestKoZoomAction)
/*
* Copyright (c) 2020 Agata Cacko <cacko.azh@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __TEST_KO_ZOOM_ACTION_H
#define __TEST_KO_ZOOM_ACTION_H
#include <QtTest>
#include <KoZoomAction.h>
class TestKoZoomAction : public QObject
{
Q_OBJECT
private Q_SLOTS:
void test();
private Q_SLOTS:
//void slotValueChanged(KoFlake::AnchorPosition id);
};
#endif /* __TEST_KO_ZOOM_ACTION_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment