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 ff08e5f9 authored by Laurent Montel's avatar Laurent Montel 😁

Add more unittest

parent b62b5862
set(emaileditdialogtesttest_SRCS emaileditdialogtest.cpp ../emaileditwidget.cpp)
kde4_add_unit_test(emaileditdialogtest TESTNAME emaileditdialogtest ${emaileditdialogtesttest_SRCS})
set(emaileditdialogtest_SRCS emaileditdialogtest.cpp ../emaileditwidget.cpp)
kde4_add_unit_test(emaileditdialogtest TESTNAME emaileditdialogtest ${emaileditdialogtest_SRCS})
target_link_libraries(emaileditdialogtest ${QT_QTTEST_LIBRARY} ${KDE4_KDEUI_LIBS} kpimutils kabc)
set(emaileditwidgettest_SRCS emaileditwidgettest.cpp ../emaileditwidget.cpp)
kde4_add_unit_test(emaileditwidgettest TESTNAME emaileditwidgettest ${emaileditwidgettest_SRCS})
target_link_libraries(emaileditwidgettest ${QT_QTTEST_LIBRARY} ${KDE4_KDEUI_LIBS} kpimutils kabc)
/*
Copyright (c) 2015 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 "emaileditwidgettest.h"
#include "../emaileditwidget.h"
#include <KLineEdit>
#include <QToolButton>
#include <qtest_kde.h>
EmailEditWidgetTest::EmailEditWidgetTest(QObject *parent)
: QObject(parent)
{
}
EmailEditWidgetTest::~EmailEditWidgetTest()
{
}
void EmailEditWidgetTest::shouldHaveDefaultValue()
{
EmailEditWidget widget;
KLineEdit *lineedit = qFindChild<KLineEdit *>(&widget, QLatin1String("emailedit"));
QVERIFY(lineedit);
QVERIFY(lineedit->text().isEmpty());
QToolButton *toolButton = qFindChild<QToolButton *>(&widget, QLatin1String("editbutton"));
QVERIFY(toolButton);
}
void EmailEditWidgetTest::shouldReadOnly()
{
EmailEditWidget widget;
widget.setReadOnly(true);
KLineEdit *lineedit = qFindChild<KLineEdit *>(&widget, QLatin1String("emailedit"));
QToolButton *toolButton = qFindChild<QToolButton *>(&widget, QLatin1String("editbutton"));
QVERIFY(lineedit->isReadOnly());
QVERIFY(!toolButton->isEnabled());
}
QTEST_KDEMAIN(EmailEditWidgetTest, GUI)
/*
Copyright (c) 2015 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 EMAILEDITWIDGETTEST_H
#define EMAILEDITWIDGETTEST_H
#include <QObject>
class EmailEditWidgetTest : public QObject
{
Q_OBJECT
public:
explicit EmailEditWidgetTest(QObject *parent = 0);
~EmailEditWidgetTest();
private Q_SLOTS:
void shouldHaveDefaultValue();
void shouldReadOnly();
};
#endif // EMAILEDITWIDGETTEST_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