Commit 14f32851 authored by Laurent Montel's avatar Laurent Montel 😁

Add more autotest

parent f7a742b1
......@@ -11,6 +11,7 @@ if (BUILD_TESTING)
add_subdirectory(misc/autotests)
add_subdirectory(addressline/autotests/)
add_subdirectory(progresswidget/autotests/)
add_subdirectory(progresswidget/tests/)
endif()
......
......@@ -8,3 +8,4 @@ macro(add_libkdepim_progresswidget_unittest _name)
)
endmacro()
add_libkdepim_progresswidget_unittest(statusbarprogresswidgettest statusbarprogresswidgettest.cpp)
add_libkdepim_progresswidget_unittest(progressstatusbarwidgettest progressstatusbarwidgettest.cpp)
/*
Copyright (C) 2017 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 "progressstatusbarwidgettest.h"
#include "../progressstatusbarwidget.h"
#include <QTest>
#include "../progressdialog.h"
#include "../statusbarprogresswidget.h"
QTEST_MAIN(ProgressStatusBarWidgetTest)
ProgressStatusBarWidgetTest::ProgressStatusBarWidgetTest(QObject *parent)
: QObject(parent)
{
}
void ProgressStatusBarWidgetTest::shouldHaveDefaultValue()
{
QWidget *widget = new QWidget;
KPIM::ProgressStatusBarWidget w(widget, widget);
KPIM::ProgressDialog *progressDialog = widget->findChild<KPIM::ProgressDialog *>(QStringLiteral("progressDialog"));
QVERIFY(progressDialog);
QVERIFY(progressDialog->isHidden());
KPIM::StatusbarProgressWidget *mLittleProgress = widget->findChild<KPIM::StatusbarProgressWidget *>(QStringLiteral("littleprogress"));
QVERIFY(mLittleProgress);
QVERIFY(mLittleProgress->isVisible());
}
/*
Copyright (C) 2017 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 PROGRESSSTATUSBARWIDGETTEST_H
#define PROGRESSSTATUSBARWIDGETTEST_H
#include <QObject>
class ProgressStatusBarWidgetTest : public QObject
{
Q_OBJECT
public:
explicit ProgressStatusBarWidgetTest(QObject *parent = nullptr);
~ProgressStatusBarWidgetTest() = default;
private Q_SLOTS:
void shouldHaveDefaultValue();
};
#endif // PROGRESSSTATUSBARWIDGETTEST_H
......@@ -37,10 +37,12 @@ ProgressStatusBarWidget::ProgressStatusBarWidget(QWidget *alignWidget, QWidget *
, d(new KPIM::ProgressStatusBarWidgetPrivate)
{
KPIM::ProgressDialog *progressDialog = new KPIM::ProgressDialog(alignWidget, parent);
progressDialog->setObjectName(QStringLiteral("progressDialog"));
progressDialog->setShowTypeProgressItem(showTypeProgressItem);
progressDialog->hide();
d->mLittleProgress = new KPIM::StatusbarProgressWidget(progressDialog, alignWidget);
d->mLittleProgress->setObjectName(QStringLiteral("littleprogress"));
d->mLittleProgress->setShowTypeProgressItem(showTypeProgressItem);
d->mLittleProgress->show();
}
......
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