Commit e6c1ba85 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Don't enable button when we have not email (when we use just space)

parent 92835446
......@@ -209,6 +209,8 @@ target_link_libraries(mailcommon
incidenceeditorsng
)
add_subdirectory(widgets/tests/)
set_target_properties(mailcommon PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION})
install(TARGETS mailcommon ${INSTALL_TARGETS_DEFAULT_ARGS})
......
......@@ -194,7 +194,7 @@ void RedirectDialog::Private::slotUser2()
void RedirectDialog::Private::slotAddressChanged( const QString &text )
{
const bool textIsNotEmpty(!text.isEmpty());
const bool textIsNotEmpty(!text.trimmed().isEmpty());
q->enableButton( KDialog::User1, textIsNotEmpty );
q->enableButton( KDialog::User2, textIsNotEmpty );
}
......
include_directories(${CMAKE_SOURCE_DIR}/mailcommon
)
macro(add_mailcommon_widget_unittest _source)
set(_test ${_source} )
get_filename_component(_name ${_source} NAME_WE)
kde4_add_unit_test(${_name} TESTNAME mailcommon-widget-${_name} ${_test} )
target_link_libraries( ${_name}
mailcommon
${QT_QTTEST_LIBRARY}
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
${KDE4_KDECORE_LIBS}
${KDE4_KDEUI_LIBS}
)
endmacro ()
add_mailcommon_widget_unittest(redirectdialogtest.cpp)
/*
Copyright (c) 2014 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
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 "redirectdialogtest.h"
#include "widgets/redirectdialog.h"
#include <qtest_kde.h>
RedirectDialogTest::RedirectDialogTest(QObject *parent)
: QObject(parent)
{
}
RedirectDialogTest::~RedirectDialogTest()
{
}
void RedirectDialogTest::shouldHaveDefaultValue()
{
//MailCommon::RedirectDialog dialog;
//QCOMPARE(dialog.defaultButton(), KDialog::User1);
}
void RedirectDialogTest::shouldEnableButtonWhenWeHaveEmailForTo()
{
//TODO
}
QTEST_KDEMAIN(RedirectDialogTest, GUI)
/*
Copyright (c) 2014 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
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 REDIRECTDIALOGTEST_H
#define REDIRECTDIALOGTEST_H
#include <QObject>
class RedirectDialogTest : public QObject
{
Q_OBJECT
public:
explicit RedirectDialogTest(QObject *parent=0);
~RedirectDialogTest();
private Q_SLOTS:
void shouldHaveDefaultValue();
void shouldEnableButtonWhenWeHaveEmailForTo();
};
#endif // REDIRECTDIALOGTEST_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