[network/ruqola] src/widgets/room/autotests: Add autotest
Laurent Montel <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 3f2e94634bfd4df3ad4ac66a6a9c25c53195be2c by Laurent Montel. Committed on 30/07/2026 at 11:45. Pushed by mlaurent into branch 'master'. Add autotest M +1 -0 src/widgets/room/autotests/CMakeLists.txt A +34 -0 src/widgets/room/autotests/newmessageindicatortest.cpp [License: LGPL(v2.0+)] A +20 -0 src/widgets/room/autotests/newmessageindicatortest.h [License: LGPL(v2.0+)] https://invent.kde.org/network/ruqola/-/commit/3f2e94634bfd4df3ad4ac66a6a9c25c53195be2c diff --git a/src/widgets/room/autotests/CMakeLists.txt b/src/widgets/room/autotests/CMakeLists.txt index 6ebbec5b5b..833f2ee1dc 100644 --- a/src/widgets/room/autotests/CMakeLists.txt +++ b/src/widgets/room/autotests/CMakeLists.txt @@ -72,3 +72,4 @@ add_ruqolaroom_test(showdebugdialogtest.cpp) add_ruqolaroom_test(showdebugwidgettest.cpp) add_ruqolaroom_test(pendingattachmentclickablewidgettest.cpp) add_ruqolaroom_test(pendingattachmentwidgettest.cpp) +add_ruqolaroom_test(newmessageindicatortest.cpp) diff --git a/src/widgets/room/autotests/newmessageindicatortest.cpp b/src/widgets/room/autotests/newmessageindicatortest.cpp new file mode 100644 index 0000000000..71a7d29309 --- /dev/null +++ b/src/widgets/room/autotests/newmessageindicatortest.cpp @@ -0,0 +1,34 @@ +/* + SPDX-FileCopyrightText: 2026 Laurent Montel <[email protected]> + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ + +#include "newmessageindicatortest.h" +#include "room/newmessageindicator.h" +#include <QSignalSpy> +#include <QTest> +#include <qtestmouse.h> +QTEST_MAIN(NewMessageIndicatorTest) + +NewMessageIndicatorTest::NewMessageIndicatorTest(QObject *parent) + : QObject{parent} +{ +} + +void NewMessageIndicatorTest::shouldHaveDefaultValues() +{ + const NewMessageIndicatorWidget w; + QVERIFY(w.hasMouseTracking()); +} + +void NewMessageIndicatorTest::shouldNewMessageIndicatorWidgetEmitSignal() +{ + NewMessageIndicatorWidget w; + + const QSignalSpy newMessageIndicatorWidgetSignal(&w, &NewMessageIndicatorWidget::clicked); + QTest::mouseClick(&w, Qt::LeftButton); + QCOMPARE(newMessageIndicatorWidgetSignal.count(), 1); +} + +#include "moc_newmessageindicatortest.cpp" diff --git a/src/widgets/room/autotests/newmessageindicatortest.h b/src/widgets/room/autotests/newmessageindicatortest.h new file mode 100644 index 0000000000..dcc2030e2a --- /dev/null +++ b/src/widgets/room/autotests/newmessageindicatortest.h @@ -0,0 +1,20 @@ +/* + SPDX-FileCopyrightText: 2026 Laurent Montel <[email protected]> + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +#pragma once + +#include <QObject> + +class NewMessageIndicatorTest : public QObject +{ + Q_OBJECT +public: + explicit NewMessageIndicatorTest(QObject *parent = nullptr); + ~NewMessageIndicatorTest() override = default; + +private Q_SLOTS: + void shouldHaveDefaultValues(); + void shouldNewMessageIndicatorWidgetEmitSignal(); +};