diff --git a/src/widgets/room/autotests/roomheaderwidgettest.cpp b/src/widgets/room/autotests/roomheaderwidgettest.cpp index 22ea7833..6f581223 100644 --- a/src/widgets/room/autotests/roomheaderwidgettest.cpp +++ b/src/widgets/room/autotests/roomheaderwidgettest.cpp @@ -1,27 +1,58 @@ /* 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 "roomheaderwidgettest.h" +#include "room/roomheaderwidget.h" +#include #include +#include QTEST_MAIN(RoomHeaderWidgetTest) RoomHeaderWidgetTest::RoomHeaderWidgetTest(QObject *parent) : QObject(parent) { } + +void RoomHeaderWidgetTest::shouldHaveDefaultValues() +{ + RoomHeaderWidget w; + QVBoxLayout *mainLayout = w.findChild(QStringLiteral("mainLayout")); + QVERIFY(mainLayout); + QCOMPARE(mainLayout->contentsMargins(), QMargins(0, 0, 0, 0)); + + QLabel *mRoomName = w.findChild(QStringLiteral("mRoomName")); + QVERIFY(mRoomName); + QVERIFY(mRoomName->text().isEmpty()); + QVERIFY(!mRoomName->isVisible()); + + QLabel *mTopic = w.findChild(QStringLiteral("mTopic")); + QVERIFY(mTopic); + QVERIFY(mTopic->text().isEmpty()); + QVERIFY(!mTopic->isVisible()); + + QLabel *mAnnouncement = w.findChild(QStringLiteral("mAnnouncement")); + QVERIFY(mAnnouncement); + QVERIFY(mAnnouncement->text().isEmpty()); + QVERIFY(!mAnnouncement->isVisible()); + + QLabel *mDescription = w.findChild(QStringLiteral("mDescription")); + QVERIFY(mDescription); + QVERIFY(mDescription->text().isEmpty()); + QVERIFY(!mDescription->isVisible()); +} diff --git a/src/widgets/room/autotests/roomheaderwidgettest.h b/src/widgets/room/autotests/roomheaderwidgettest.h index fb0faa54..b3c4041a 100644 --- a/src/widgets/room/autotests/roomheaderwidgettest.h +++ b/src/widgets/room/autotests/roomheaderwidgettest.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 ROOMHEADERWIDGETTEST_H #define ROOMHEADERWIDGETTEST_H #include class RoomHeaderWidgetTest : public QObject { Q_OBJECT public: explicit RoomHeaderWidgetTest(QObject *parent = nullptr); ~RoomHeaderWidgetTest() = default; +private Q_SLOTS: + void shouldHaveDefaultValues(); }; #endif // ROOMHEADERWIDGETTEST_H