[graphics/drawy/gsoc2026] src/widgets: test: add autotest for liststylewidget

Abdelhadi Wael <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 93b1da14ea48e5e76c3ceb7249c3ea91799ba4a2 by Abdelhadi Wael.
Committed on 26/07/2026 at 23:51.
Pushed by mlaurent into branch 'gsoc2026'.

test: add autotest for liststylewidget

M  +1    -0    src/widgets/autotests/CMakeLists.txt
A  +43   -0    src/widgets/autotests/liststylewidgettest.cpp     [License: LGPL(v2.0+)]
A  +19   -0    src/widgets/autotests/liststylewidgettest.hpp     [License: LGPL(v2.0+)]
M  +3    -0    src/widgets/properties/widgets/liststylewidget.cpp

https://invent.kde.org/graphics/drawy/-/commit/93b1da14ea48e5e76c3ceb7249c3ea91799ba4a2

diff --git a/src/widgets/autotests/CMakeLists.txt b/src/widgets/autotests/CMakeLists.txt
index cf7200a1..aa82b157 100644
--- a/src/widgets/autotests/CMakeLists.txt
+++ b/src/widgets/autotests/CMakeLists.txt
@@ -60,6 +60,7 @@ add_drawy_unittest(linetooltest.cpp)
 add_drawy_unittest(diamondtooltest.cpp)
 add_drawy_unittest(alignmentwidgettest.cpp)
 add_drawy_unittest(textalignmentwidgettest.cpp)
+add_drawy_unittest(liststylewidgettest.cpp)
 add_drawy_unittest(autosavejobutiltest.cpp)
 add_drawy_unittest(fontstylewidgettest.cpp)
 add_drawy_unittest(restoreautosavejobtest.cpp)
diff --git a/src/widgets/autotests/liststylewidgettest.cpp b/src/widgets/autotests/liststylewidgettest.cpp
new file mode 100644
index 00000000..1c1fc03c
--- /dev/null
+++ b/src/widgets/autotests/liststylewidgettest.cpp
@@ -0,0 +1,43 @@
+/*
+ * SPDX-FileCopyrightText: 2026 Abdelhadi Wael <[email protected]>
+ *
+ * SPDX-License-Identifier: LGPL-2.0-or-later
+ */
+#include "liststylewidgettest.hpp"
+#include "properties/widgets/liststylewidget.hpp"
+#include <QComboBox>
+#include <QHBoxLayout>
+#include <QTest>
+
+using namespace Qt::Literals::StringLiterals;
+
+QTEST_MAIN(ListStyleWidgetTest)
+
+ListStyleWidgetTest::ListStyleWidgetTest(QObject *parent)
+    : QObject{parent}
+{
+}
+
+void ListStyleWidgetTest::shouldHaveDefaultValues()
+{
+    const auto parent = new QWidget();
+    ListStyleWidget w(parent);
+
+    QVERIFY(!w.name().isEmpty());
+    QVERIFY(w.widget());
+    QCOMPARE(w.widget()->objectName(), u"m_widget"_s);
+
+    auto m_widget = parent->findChild<QWidget *>(u"m_widget"_s);
+    QVERIFY(m_widget);
+
+    auto layout = m_widget->findChild<QHBoxLayout *>(u"layout"_s);
+    QVERIFY(layout);
+    QCOMPARE(layout->contentsMargins(), {});
+
+    auto comboBox = m_widget->findChild<QComboBox *>(u"m_comboBox"_s);
+    QVERIFY(comboBox);
+    QCOMPARE(comboBox->count(), 9);
+    QCOMPARE(comboBox->currentData().toString(), u"None"_s);
+}
+
+#include "moc_liststylewidgettest.cpp"
diff --git a/src/widgets/autotests/liststylewidgettest.hpp b/src/widgets/autotests/liststylewidgettest.hpp
new file mode 100644
index 00000000..35cd0b58
--- /dev/null
+++ b/src/widgets/autotests/liststylewidgettest.hpp
@@ -0,0 +1,19 @@
+/*
+ * SPDX-FileCopyrightText: 2026 Abdelhadi Wael <[email protected]>
+ *
+ * SPDX-License-Identifier: LGPL-2.0-or-later
+ */
+#pragma once
+
+#include <QObject>
+
+class ListStyleWidgetTest : public QObject
+{
+    Q_OBJECT
+public:
+    explicit ListStyleWidgetTest(QObject *parent = nullptr);
+    ~ListStyleWidgetTest() override = default;
+
+private Q_SLOTS:
+    void shouldHaveDefaultValues();
+};
diff --git a/src/widgets/properties/widgets/liststylewidget.cpp b/src/widgets/properties/widgets/liststylewidget.cpp
index a575b322..627b8530 100644
--- a/src/widgets/properties/widgets/liststylewidget.cpp
+++ b/src/widgets/properties/widgets/liststylewidget.cpp
@@ -17,9 +17,12 @@ ListStyleWidget::ListStyleWidget(QWidget *parent)
     , m_comboBox{new QComboBox}
 {
     m_widget = new QWidget(parent);
+    m_widget->setObjectName(u"m_widget"_s);
     const auto layout = new QHBoxLayout(m_widget);
+    layout->setObjectName(u"layout"_s);
     layout->setContentsMargins({});
 
+    m_comboBox->setObjectName(u"m_comboBox"_s);
     m_comboBox->addItem(i18n("None"), u"None"_s);
     m_comboBox->addItem(i18n("Bullet (Disc)"), u"ListDisc"_s);
     m_comboBox->addItem(i18n("Bullet (Circle)"), u"ListCircle"_s);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.