File: 0045_Adds-a-mock-icon-cache-watcher-for-testing.patch

package info (click to toggle)
lomiri 0.5.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 24,088 kB
  • sloc: cpp: 39,498; python: 2,559; javascript: 1,426; ansic: 1,012; sh: 289; xml: 252; makefile: 69
file content (115 lines) | stat: -rw-r--r-- 3,995 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
From 76b554ed4fb2f03469da5d275911fa75090c66f1 Mon Sep 17 00:00:00 2001
From: Capsia <cmsuser3754@zoho.eu>
Date: Mon, 18 Aug 2025 22:06:29 +0200
Subject: [PATCH 5/7] Adds a mock icon cache watcher for testing

Introduces a mock icon cache watcher to fix test failures.

Signed-off-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
---
 tests/plugins/Lomiri/Launcher/CMakeLists.txt  |  1 +
 .../Lomiri/Launcher/iconcachewatcher.cpp      | 36 +++++++++++++++++++
 .../Lomiri/Launcher/iconcachewatcher.h        | 35 ++++++++++++++++++
 3 files changed, 72 insertions(+)
 create mode 100644 tests/plugins/Lomiri/Launcher/iconcachewatcher.cpp
 create mode 100644 tests/plugins/Lomiri/Launcher/iconcachewatcher.h

diff --git a/tests/plugins/Lomiri/Launcher/CMakeLists.txt b/tests/plugins/Lomiri/Launcher/CMakeLists.txt
index 6466cef7b..50ba4a6b4 100644
--- a/tests/plugins/Lomiri/Launcher/CMakeLists.txt
+++ b/tests/plugins/Lomiri/Launcher/CMakeLists.txt
@@ -66,6 +66,7 @@ add_executable(appdrawermodeltestExec
     appdrawermodeltest.cpp
     ualwrapper.cpp
     xdgwatcher.cpp
+    iconcachewatcher.cpp
     ${CMAKE_SOURCE_DIR}/plugins/Lomiri/Launcher/appdrawermodel.cpp
     ${LAUNCHER_API_INCLUDEDIR}/lomiri/shell/launcher/AppDrawerModelInterface.h
     ${CMAKE_SOURCE_DIR}/plugins/Lomiri/Launcher/launcheritem.cpp
diff --git a/tests/plugins/Lomiri/Launcher/iconcachewatcher.cpp b/tests/plugins/Lomiri/Launcher/iconcachewatcher.cpp
new file mode 100644
index 000000000..a3355e0ee
--- /dev/null
+++ b/tests/plugins/Lomiri/Launcher/iconcachewatcher.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2025 UBports Foundation
+ * Author(s): Riccardo Riccio <riccardo.riccio@ubports.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 3.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "iconcachewatcher.h"
+
+IconCacheWatcher* IconCacheWatcher::s_instance = nullptr;
+
+IconCacheWatcher::IconCacheWatcher(QObject* parent)
+    : QObject(parent)
+{
+    s_instance = this;
+}
+
+IconCacheWatcher* IconCacheWatcher::instance()
+{
+    return s_instance;
+}
+
+void IconCacheWatcher::triggerMockIconCacheChanged()
+{
+    Q_EMIT iconCacheChanged();
+}
\ No newline at end of file
diff --git a/tests/plugins/Lomiri/Launcher/iconcachewatcher.h b/tests/plugins/Lomiri/Launcher/iconcachewatcher.h
new file mode 100644
index 000000000..641acd9df
--- /dev/null
+++ b/tests/plugins/Lomiri/Launcher/iconcachewatcher.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2025 UBports Foundation
+ * Author(s): Riccardo Riccio <riccardo.riccio@ubports.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 3.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <QObject>
+
+class IconCacheWatcher: public QObject
+{
+    Q_OBJECT
+public:
+    IconCacheWatcher(QObject* parent = nullptr);
+
+    // testing
+    static IconCacheWatcher* instance();
+    void triggerMockIconCacheChanged();
+
+    Q_SIGNALS:
+    void iconCacheChanged();
+
+private:
+    static IconCacheWatcher *s_instance;
+};
-- 
2.47.2