diff --git a/src/widgets/dialogs/autotests/uploadfilewidgettest.cpp b/src/widgets/dialogs/autotests/uploadfilewidgettest.cpp index 15f00ddf..d2688ade 100644 --- a/src/widgets/dialogs/autotests/uploadfilewidgettest.cpp +++ b/src/widgets/dialogs/autotests/uploadfilewidgettest.cpp @@ -1,30 +1,48 @@ /* Copyright (c) 2020 Laurent Montel 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 ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), 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 "uploadfilewidgettest.h" #include "dialogs/uploadfilewidget.h" +#include +#include #include QTEST_MAIN(UploadFileWidgetTest) UploadFileWidgetTest::UploadFileWidgetTest(QObject *parent) : QObject(parent) { } + +void UploadFileWidgetTest::shouldHaveDefaultValues() +{ + UploadFileWidget w; + QFormLayout *layout = w.findChild(QStringLiteral("layout")); + QVERIFY(layout); + QCOMPARE(layout->contentsMargins(), QMargins(0, 0, 0, 0)); + + QLineEdit *mDescription = w.findChild(QStringLiteral("mDescription")); + QVERIFY(mDescription); + QVERIFY(mDescription->isClearButtonEnabled()); + + QLineEdit *mMessage = w.findChild(QStringLiteral("mMessage")); + QVERIFY(mMessage); + QVERIFY(mMessage->isClearButtonEnabled()); +} diff --git a/src/widgets/dialogs/autotests/uploadfilewidgettest.h b/src/widgets/dialogs/autotests/uploadfilewidgettest.h index fc5595bd..99588d9e 100644 --- a/src/widgets/dialogs/autotests/uploadfilewidgettest.h +++ b/src/widgets/dialogs/autotests/uploadfilewidgettest.h @@ -1,34 +1,36 @@ /* Copyright (c) 2020 Laurent Montel 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 ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), 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 UPLOADFILEWIDGETTEST_H #define UPLOADFILEWIDGETTEST_H #include class UploadFileWidgetTest : public QObject { Q_OBJECT public: explicit UploadFileWidgetTest(QObject *parent = nullptr); ~UploadFileWidgetTest() = default; +private Q_SLOTS: + void shouldHaveDefaultValues(); }; #endif // UPLOADFILEWIDGETTEST_H diff --git a/src/widgets/dialogs/uploadfilewidget.cpp b/src/widgets/dialogs/uploadfilewidget.cpp index f6077c60..f9eabf6f 100644 --- a/src/widgets/dialogs/uploadfilewidget.cpp +++ b/src/widgets/dialogs/uploadfilewidget.cpp @@ -1,32 +1,47 @@ /* Copyright (c) 2020 Laurent Montel 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 ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), 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 "uploadfilewidget.h" +#include +#include +#include UploadFileWidget::UploadFileWidget(QWidget *parent) : QWidget(parent) { - + QFormLayout *layout = new QFormLayout(this); + layout->setObjectName(QStringLiteral("layout")); + layout->setContentsMargins(0, 0, 0, 0); + + mDescription = new QLineEdit(this); + mDescription->setObjectName(QStringLiteral("mDescription")); + mDescription->setClearButtonEnabled(true); + layout->addRow(i18n("Description"), mDescription); + + mMessage = new QLineEdit(this); + mMessage->setObjectName(QStringLiteral("mMessage")); + mMessage->setClearButtonEnabled(true); + layout->addRow(i18n("Message"), mMessage); } UploadFileWidget::~UploadFileWidget() { } diff --git a/src/widgets/dialogs/uploadfilewidget.h b/src/widgets/dialogs/uploadfilewidget.h index 52b66eb6..b9a608ba 100644 --- a/src/widgets/dialogs/uploadfilewidget.h +++ b/src/widgets/dialogs/uploadfilewidget.h @@ -1,34 +1,39 @@ /* Copyright (c) 2020 Laurent Montel 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 ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), 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 UPLOADFILEWIDGET_H #define UPLOADFILEWIDGET_H #include - -class UploadFileWidget : public QWidget +class QLineEdit; +#include "libruqolawidgets_private_export.h" +class LIBRUQOLAWIDGETS_EXPORT UploadFileWidget : public QWidget { Q_OBJECT public: explicit UploadFileWidget(QWidget *parent = nullptr); ~UploadFileWidget(); +private: + QLineEdit *mDescription = nullptr; + QLineEdit *mMessage = nullptr; + //KUrlRequester *mSelectFile = nullptr; }; #endif // UPLOADFILEWIDGET_H