Commit ac549cb7 authored by Laurent Montel's avatar Laurent Montel 😁

Add autotest

parent 55af3801
......@@ -22,6 +22,7 @@ if(BUILD_TESTING)
add_subdirectory(sievescriptdebugger/tests)
add_subdirectory(autocreatescripts/autotests/)
add_subdirectory(editor/webengine/findbar/autotests/)
add_subdirectory(editor/webengine/autotests/)
endif()
set(ksieveui_vacation_LIB_SRCS
......
set( libksieveui_sieveeditorhelphtmlwidgettest_source sieveeditorhelphtmlwidgettest.cpp
../sieveeditorhelphtmlwidget.cpp
../sieveeditorwebengineview.cpp
../sieveeditorhelphtmlwidget.cpp
../sieveeditorloadprogressindicator.cpp
../findbar/findbarbase.cpp
../findbar/findbarwebengineview.cpp
)
add_executable( sieveeditorhelphtmlwidgettest ${libksieveui_sieveeditorhelphtmlwidgettest_source})
add_test(sieveeditorhelphtmlwidgettest sieveeditorhelphtmlwidgettest)
ecm_mark_as_test(sieveeditorhelphtmlwidgettest)
target_link_libraries( sieveeditorhelphtmlwidgettest Qt5::Test KF5::Completion KF5::PimCommon KF5::IconThemes Qt5::Gui Qt5::Widgets KF5::ConfigWidgets KF5::I18n KF5::PimTextEdit Qt5::WebEngineWidgets)
set_property(TARGET sieveeditorhelphtmlwidgettest PROPERTY INCLUDE_DIRECTORIES ${CMAKE_SOURCE_DIR}/src/ksieveui/editor/webengine/ ${CMAKE_SOURCE_DIR}/src/ksieveui/editor/webengine/findbar ${CMAKE_BINARY_DIR}/src/ksieveui/)
/*
Copyright (C) 2016 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "sieveeditorhelphtmlwidgettest.h"
#include "../sieveeditorhelphtmlwidget.h"
#include <QTest>
#include "../findbar/findbarwebengineview.h"
#include "../sieveeditorloadprogressindicator.h"
#include "../sieveeditorwebengineview.h"
#include <kpimtextedit/slidecontainer.h>
SieveEditorHelpHtmlWidgetTest::SieveEditorHelpHtmlWidgetTest(QObject *parent)
: QObject(parent)
{
}
SieveEditorHelpHtmlWidgetTest::~SieveEditorHelpHtmlWidgetTest()
{
}
void SieveEditorHelpHtmlWidgetTest::shouldHaveDefaultValue()
{
KSieveUi::SieveEditorHelpHtmlWidget w;
KSieveUi::SieveEditorLoadProgressIndicator *mProgressIndicator = w.findChild<KSieveUi::SieveEditorLoadProgressIndicator *>(QStringLiteral("progressindicator"));
QVERIFY(mProgressIndicator);
KSieveUi::SieveEditorWebEngineView *mWebView = w.findChild<KSieveUi::SieveEditorWebEngineView *>(QStringLiteral("webview"));
QVERIFY(mWebView);
KPIMTextEdit::SlideContainer *mSliderContainer = w.findChild<KPIMTextEdit::SlideContainer *>(QStringLiteral("slidercontainer"));
QVERIFY(mSliderContainer);
KSieveUi::FindBarWebEngineView *mFindBar = w.findChild<KSieveUi::FindBarWebEngineView *>(QStringLiteral("findbar"));
QVERIFY(mFindBar);
}
QTEST_MAIN(SieveEditorHelpHtmlWidgetTest)
/*
Copyright (C) 2016 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef SIEVEEDITORHELPHTMLWIDGETTEST_H
#define SIEVEEDITORHELPHTMLWIDGETTEST_H
#include <QObject>
class SieveEditorHelpHtmlWidgetTest : public QObject
{
Q_OBJECT
public:
explicit SieveEditorHelpHtmlWidgetTest(QObject *parent = Q_NULLPTR);
~SieveEditorHelpHtmlWidgetTest();
private Q_SLOTS:
void shouldHaveDefaultValue();
};
#endif // SIEVEEDITORHELPHTMLWIDGETTEST_H
......@@ -39,25 +39,26 @@ SieveEditorHelpHtmlWidget::SieveEditorHelpHtmlWidget(QWidget *parent)
: QWidget(parent),
mZoomFactor(100)
{
QVBoxLayout *lay = new QVBoxLayout(this);
mProgressIndicator = new SieveEditorLoadProgressIndicator(this);
mProgressIndicator->setObjectName(QStringLiteral("progressindicator"));
connect(mProgressIndicator, &SieveEditorLoadProgressIndicator::pixmapChanged, this, &SieveEditorHelpHtmlWidget::slotPixmapChanged);
connect(mProgressIndicator, &SieveEditorLoadProgressIndicator::loadFinished, this, &SieveEditorHelpHtmlWidget::slotLoadFinished);
mWebView = new SieveEditorWebEngineView;
mWebView->setObjectName(QStringLiteral("webview"));
connect(mWebView, &SieveEditorWebEngineView::titleChanged, this, &SieveEditorHelpHtmlWidget::slotTitleChanged);
connect(mWebView, &SieveEditorWebEngineView::loadStarted, this, &SieveEditorHelpHtmlWidget::slotLoadStarted);
connect(mWebView, &SieveEditorWebEngineView::loadFinished, this, &SieveEditorHelpHtmlWidget::slotFinished);
connect(mWebView, &SieveEditorWebEngineView::selectionChanged, this, &SieveEditorHelpHtmlWidget::slotSelectionChanged);
QVBoxLayout *lay = new QVBoxLayout;
lay->addWidget(mWebView);
mSliderContainer = new KPIMTextEdit::SlideContainer(this);
mSliderContainer->setObjectName(QStringLiteral("slidercontainer"));
lay->addWidget(mSliderContainer);
mFindBar = new KSieveUi::FindBarWebEngineView(mWebView, this);
mFindBar->setObjectName(QStringLiteral("findbar"));
connect(mFindBar, &KSieveUi::FindBarWebEngineView::hideFindBar, mSliderContainer, &KPIMTextEdit::SlideContainer::slideOut);
mSliderContainer->setContent(mFindBar);
setLayout(lay);
}
SieveEditorHelpHtmlWidget::~SieveEditorHelpHtmlWidget()
......
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