File: 0005-tests-document_find.cpp-Don-t-include-Tui-Utils_p.h.patch

package info (click to toggle)
tuiwidgets 0.2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,852 kB
  • sloc: cpp: 70,959; python: 655; sh: 39; makefile: 24
file content (39 lines) | stat: -rw-r--r-- 1,197 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
From: Martin Hostettler <textshell@uchuujin.de>
Date: Tue, 4 Nov 2025 21:57:27 +0100
Subject: tests: document_find.cpp: Don't include Tui/Utils_p.h

Use a local copy of size2int.

This should make "as-installed" tests work again.

Origin: upstream, https://github.com/tuiwidgets/tuiwidgets/commit/31ccc7af4ff47ec209e8e7b3508988fec5d2e2e9
---
 src/tests/document/document_find.cpp | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/tests/document/document_find.cpp b/src/tests/document/document_find.cpp
index dd7486c..905f7dd 100644
--- a/src/tests/document/document_find.cpp
+++ b/src/tests/document/document_find.cpp
@@ -13,7 +13,20 @@
 #include "../eventrecorder.h"
 #include "../Testhelper.h"
 
-#include <Tui/Utils_p.h>
+
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+    static int size2int(qsizetype input) {
+        if (input < std::numeric_limits<int>::min() || input > std::numeric_limits<int>::max()) {
+            qFatal("Out of range size does not fit into int");
+            abort();
+        }
+        return static_cast<int>(input);
+    }
+#else
+    static int size2int(int input) {
+        return input;
+    }
+#endif
 
 
 namespace {