Commit 51d738bc authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Improve autotest

parent 5eb9f68c
......@@ -3,13 +3,13 @@ add_test(synchronizeresourcedialogtest synchronizeresourcedialogtest)
ecm_mark_as_test(synchronizeresourcedialogtest)
target_link_libraries(synchronizeresourcedialogtest Qt5::Test Qt5::Widgets KF5::I18n KF5::ItemViews KF5::ConfigCore)
add_executable( pimsettingexporterconfiguredialogtest pimsettingexporterconfiguredialogtest.cpp)
add_executable( pimsettingexporterconfiguredialogtest pimsettingexporterconfiguredialogtest.cpp ../dialog/pimsettingexporterconfiguredialog.cpp ../widgets/pimsettingexporterconfigurewidget.cpp)
add_test(pimsettingexporterconfiguredialogtest pimsettingexporterconfiguredialogtest)
ecm_mark_as_test(pimsettingexporterconfiguredialogtest)
target_link_libraries(pimsettingexporterconfiguredialogtest Qt5::Test Qt5::Widgets KF5::I18n KF5::ItemViews KF5::ConfigCore)
add_executable( pimsettingexporterconfigurewidgettest pimsettingexporterconfigurewidgettest.cpp)
add_executable( pimsettingexporterconfigurewidgettest pimsettingexporterconfigurewidgettest.cpp ../widgets/pimsettingexporterconfigurewidget.cpp)
add_test(pimsettingexporterconfigurewidgettest pimsettingexporterconfigurewidgettest)
ecm_mark_as_test(pimsettingexporterconfigurewidgettest)
target_link_libraries(pimsettingexporterconfigurewidgettest Qt5::Test Qt5::Widgets KF5::I18n KF5::ItemViews KF5::ConfigCore)
......@@ -16,7 +16,11 @@
*/
#include "pimsettingexporterconfiguredialogtest.h"
#include "../dialog/pimsettingexporterconfiguredialog.h"
#include <QDialogButtonBox>
#include <QTest>
#include "../widgets/pimsettingexporterconfigurewidget.h"
PimSettingExporterConfigureDialogTest::PimSettingExporterConfigureDialogTest(QObject *parent)
: QObject(parent)
{
......@@ -28,4 +32,14 @@ PimSettingExporterConfigureDialogTest::~PimSettingExporterConfigureDialogTest()
}
void PimSettingExporterConfigureDialogTest::shouldHaveDefaultValue()
{
PimSettingExporterConfigureDialog dlg;
QDialogButtonBox *buttonBox = dlg.findChild<QDialogButtonBox *>(QStringLiteral("buttonbox"));
QVERIFY(buttonBox);
PimSettingExporterConfigureWidget *configureWidget = dlg.findChild<PimSettingExporterConfigureWidget *>(QStringLiteral("configurewidget"));
QVERIFY(configureWidget);
}
QTEST_MAIN(PimSettingExporterConfigureDialogTest)
......@@ -25,6 +25,8 @@ class PimSettingExporterConfigureDialogTest : public QObject
public:
explicit PimSettingExporterConfigureDialogTest(QObject *parent = Q_NULLPTR);
~PimSettingExporterConfigureDialogTest();
private Q_SLOTS:
void shouldHaveDefaultValue();
};
#endif // PIMSETTINGEXPORTERCONFIGUREDIALOGTEST_H
......@@ -16,14 +16,34 @@
*/
#include "pimsettingexporterconfiguredialog.h"
#include <QVBoxLayout>
#include <KLocalizedString>
#include <QDialogButtonBox>
#include "../widgets/pimsettingexporterconfigurewidget.h"
PimSettingExporterConfigureDialog::PimSettingExporterConfigureDialog(QWidget *parent)
: QDialog(parent)
{
QVBoxLayout *layout = new QVBoxLayout;
setLayout(layout);
mConfigureWidget = new PimSettingExporterConfigureWidget(this);
mConfigureWidget->setObjectName(QStringLiteral("configurewidget"));
layout->addWidget(mConfigureWidget);
QDialogButtonBox *button = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
button->setObjectName(QStringLiteral("buttonbox"));
connect(button, &QDialogButtonBox::accepted, this, &PimSettingExporterConfigureDialog::slotAccepted);
connect(button, &QDialogButtonBox::rejected, this, &PimSettingExporterConfigureDialog::reject);
layout->addWidget(button);
}
PimSettingExporterConfigureDialog::~PimSettingExporterConfigureDialog()
{
}
void PimSettingExporterConfigureDialog::slotAccepted()
{
mConfigureWidget->save();
accept();
}
......@@ -19,13 +19,19 @@
#define PIMSETTINGEXPORTERCONFIGUREDIALOG_H
#include <QDialog>
class PimSettingExporterConfigureWidget;
class PimSettingExporterConfigureDialog : public QDialog
{
Q_OBJECT
public:
explicit PimSettingExporterConfigureDialog(QWidget *parent = Q_NULLPTR);
~PimSettingExporterConfigureDialog();
private Q_SLOTS:
void slotAccepted();
private:
PimSettingExporterConfigureWidget *mConfigureWidget;
};
#endif // PIMSETTINGEXPORTERCONFIGUREDIALOG_H
......@@ -27,3 +27,8 @@ PimSettingExporterConfigureWidget::~PimSettingExporterConfigureWidget()
{
}
void PimSettingExporterConfigureWidget::save()
{
//TODO
}
......@@ -26,6 +26,8 @@ class PimSettingExporterConfigureWidget : public QWidget
public:
explicit PimSettingExporterConfigureWidget(QWidget *parent = Q_NULLPTR);
~PimSettingExporterConfigureWidget();
void save();
};
#endif // PIMSETTINGEXPORTERCONFIGUREWIDGET_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