diff --git a/editor/potentialphishingemail/autotests/CMakeLists.txt b/editor/potentialphishingemail/autotests/CMakeLists.txt index 70ce6723d..3a8d9819e 100644 --- a/editor/potentialphishingemail/autotests/CMakeLists.txt +++ b/editor/potentialphishingemail/autotests/CMakeLists.txt @@ -14,3 +14,7 @@ ecm_mark_as_test(kmail_potentialphishingdetaildialogtest) target_link_libraries( kmail_potentialphishingdetaildialogtest Qt5::Test KF5::KDELibs4Support ) +set( kmail_potentialphishingemailwarningtest_SRCS potentialphishingemailwarningtest.cpp ../potentialphishingemailwarning.cpp ../potentialphishingdetaildialog.cpp) +kde4_add_unit_test( kmail_potentialphishingemailwarningtest ${kmail_potentialphishingemailwarningtest_SRCS}) +target_link_libraries( kmail_potentialphishingemailwarningtest ${QT_QTTEST_LIBRARY} ${KDE4_KDEUI_LIBS} ) + diff --git a/editor/potentialphishingemail/autotests/potentialphishingemailwarningtest.cpp b/editor/potentialphishingemail/autotests/potentialphishingemailwarningtest.cpp new file mode 100644 index 000000000..667a034e1 --- /dev/null +++ b/editor/potentialphishingemail/autotests/potentialphishingemailwarningtest.cpp @@ -0,0 +1,46 @@ +/* + Copyright (c) 2015 Montel Laurent + + 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 "potentialphishingemailwarningtest.h" +#include "../potentialphishingemailwarning.h" +#include +#include + +PotentialPhishingEmailWarningTest::PotentialPhishingEmailWarningTest(QObject *parent) + : QObject(parent) +{ + +} + +PotentialPhishingEmailWarningTest::~PotentialPhishingEmailWarningTest() +{ + +} + +void PotentialPhishingEmailWarningTest::shouldHaveDefaultValue() +{ + PotentialPhishingEmailWarning w; + QVERIFY(!w.isVisible()); + //Verify QVERIFY(w.isCloseButtonVisible()); + QAction *act = qFindChild(&w, QLatin1String("sendnow")); + QVERIFY(act); +} + +QTEST_MAIN(PotentialPhishingEmailWarningTest) diff --git a/editor/potentialphishingemail/autotests/potentialphishingemailwarningtest.h b/editor/potentialphishingemail/autotests/potentialphishingemailwarningtest.h new file mode 100644 index 000000000..d4e61a12e --- /dev/null +++ b/editor/potentialphishingemail/autotests/potentialphishingemailwarningtest.h @@ -0,0 +1,36 @@ +/* + Copyright (c) 2015 Montel Laurent + + 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 POTENTIALPHISHINGEMAILWARNINGTEST_H +#define POTENTIALPHISHINGEMAILWARNINGTEST_H + +#include + +class PotentialPhishingEmailWarningTest : public QObject +{ + Q_OBJECT +public: + explicit PotentialPhishingEmailWarningTest(QObject *parent = 0); + ~PotentialPhishingEmailWarningTest(); +private Q_SLOTS: + void shouldHaveDefaultValue(); +}; + +#endif // POTENTIALPHISHINGEMAILWARNINGTEST_H diff --git a/editor/potentialphishingemail/potentialphishingemailwarning.cpp b/editor/potentialphishingemail/potentialphishingemailwarning.cpp index a04366403..45f46f6c1 100644 --- a/editor/potentialphishingemail/potentialphishingemailwarning.cpp +++ b/editor/potentialphishingemail/potentialphishingemailwarning.cpp @@ -36,6 +36,7 @@ PotentialPhishingEmailWarning::PotentialPhishingEmailWarning(QWidget *parent) connect(this, SIGNAL(linkActivated(QString)), SLOT(slotShowDetails(QString))); QAction *action = new QAction(i18n("Send Now"), this); + action->setObjectName(QLatin1String("sendnow")); connect(action, &QAction::triggered, this, &PotentialPhishingEmailWarning::sendNow); addAction(action); }