summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2016-07-12 07:49:18 +0200
committerMontel Laurent <[email protected]>2016-07-12 07:49:18 +0200
commitc61aadb9c982135c61cb9846d25016d530d76e8a (patch)
treeef5e603440f580d77c0c0cb3fb27282f049cd492
parentf7b1dc1e798bb7000622a450ffb3b9457c299081 (diff)
improve autotests
-rw-r--r--kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsconfigurewidget.cpp7
-rw-r--r--kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsconfigurewidget.h4
-rw-r--r--kmail/editorsendcheckplugins/automaticaddcontacts/autotests/automaticaddcontactswidgettest.cpp9
3 files changed, 15 insertions, 5 deletions
diff --git a/kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsconfigurewidget.cpp b/kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsconfigurewidget.cpp
index 8711932..498bc70 100644
--- a/kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsconfigurewidget.cpp
+++ b/kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsconfigurewidget.cpp
@@ -28,7 +28,7 @@
#include <KConfigGroup>
#include <KSharedConfig>
-AutomaticAddContactsWidget::AutomaticAddContactsWidget(QWidget *parent)
+AutomaticAddContactsWidget::AutomaticAddContactsWidget(QWidget *parent, QAbstractItemModel *model)
: MessageComposer::PluginEditorCheckBeforeSendConfigureWidget(parent)
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
@@ -45,14 +45,15 @@ AutomaticAddContactsWidget::AutomaticAddContactsWidget(QWidget *parent)
QLabel *lab = new QLabel(i18n("Select the addressbook to store contacts:"), this);
lab->setObjectName(QStringLiteral("labelfolder"));
- mainLayout->addWidget(lab);
+ hlay->addWidget(lab);
- mCollectionCombobox = new Akonadi::CollectionComboBox;
+ mCollectionCombobox = new Akonadi::CollectionComboBox(model);
mCollectionCombobox->setAccessRightsFilter(Akonadi::Collection::CanCreateItem);
mCollectionCombobox->setMinimumWidth(250);
mCollectionCombobox->setMimeTypeFilter(QStringList() << KContacts::Addressee::mimeType());
mCollectionCombobox->setObjectName(QStringLiteral("akonadicombobox"));
+ hlay->addWidget(mCollectionCombobox);
connect(mCollectionCombobox, static_cast<void (Akonadi::CollectionComboBox::*)(int)>(&Akonadi::CollectionComboBox::currentIndexChanged),
this, &AutomaticAddContactsWidget::configureChanged);
connect(mCollectionCombobox, static_cast<void (Akonadi::CollectionComboBox::*)(int)>(&Akonadi::CollectionComboBox::activated),
diff --git a/kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsconfigurewidget.h b/kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsconfigurewidget.h
index 9b9e179..30e0e2c 100644
--- a/kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsconfigurewidget.h
+++ b/kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsconfigurewidget.h
@@ -27,12 +27,12 @@ class QCheckBox;
namespace Akonadi {
class CollectionComboBox;
}
-
+class QAbstractItemModel;
class AutomaticAddContactsWidget : public MessageComposer::PluginEditorCheckBeforeSendConfigureWidget
{
Q_OBJECT
public:
- explicit AutomaticAddContactsWidget(QWidget *parent = Q_NULLPTR);
+ explicit AutomaticAddContactsWidget(QWidget *parent = Q_NULLPTR, QAbstractItemModel *model = Q_NULLPTR);
~AutomaticAddContactsWidget();
void loadSettings() Q_DECL_OVERRIDE;
diff --git a/kmail/editorsendcheckplugins/automaticaddcontacts/autotests/automaticaddcontactswidgettest.cpp b/kmail/editorsendcheckplugins/automaticaddcontacts/autotests/automaticaddcontactswidgettest.cpp
index 62a93e6..d71ecab 100644
--- a/kmail/editorsendcheckplugins/automaticaddcontacts/autotests/automaticaddcontactswidgettest.cpp
+++ b/kmail/editorsendcheckplugins/automaticaddcontacts/autotests/automaticaddcontactswidgettest.cpp
@@ -24,6 +24,8 @@
#include <QTest>
#include <QVBoxLayout>
#include <QStandardPaths>
+#include <QLabel>
+#include <AkonadiWidgets/CollectionComboBox>
AutomaticAddContactsWidgetTest::AutomaticAddContactsWidgetTest(QObject *parent)
: QObject(parent)
@@ -51,6 +53,13 @@ void AutomaticAddContactsWidgetTest::shouldHaveDefaultValue()
QVERIFY(hlay);
QCOMPARE(hlay->margin(), 0);
+ QLabel *lab = w.findChild<QLabel *>(QStringLiteral("labelfolder"));
+ QVERIFY(lab);
+ QVERIFY(!lab->text().isEmpty());
+
+
+ Akonadi::CollectionComboBox *mCollectionCombobox = w.findChild<Akonadi::CollectionComboBox *>(QStringLiteral("akonadicombobox"));
+ QVERIFY(mCollectionCombobox);
}
void AutomaticAddContactsWidgetTest::shouldResetValue()