Commit c61aadb9 authored by Laurent Montel's avatar Laurent Montel 😁

improve autotests

parent f7b1dc1e
......@@ -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),
......
......@@ -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;
......
......@@ -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()
......
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