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
116
117
|
From dbcb28f4fe8deb5ce83d45907f97516eade74420 Mon Sep 17 00:00:00 2001
From: Heiko Becker <mail@heiko-becker.de>
Date: Tue, 6 Feb 2024 18:47:20 +0000
Subject: [PATCH] Fix building the tests with Qt 6 (#332)
* Remove usage of QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS
According to commit 641eb4a96552615d898512723e2093abcaf7fbc1 in
qtbase.git they serve no purpose anymore and were subsequently removed
in Qt6.
Closes #331.
* Replace QLatin1Literal with QStringLiteral
The former is deprecated and was removed from Qt6.
---
.../annotations/core/AnnotationPropertiesFactoryTest.cpp | 2 +-
tests/gui/annotator/tabs/AnnotationTabContextMenuTest.cpp | 6 +++---
tests/utils/TestRunner.h | 8 --------
tests/widgets/settingsPicker/StickerPickerTest.cpp | 4 ++--
4 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/tests/annotations/core/AnnotationPropertiesFactoryTest.cpp b/tests/annotations/core/AnnotationPropertiesFactoryTest.cpp
index 77b43057..ce5047ef 100644
--- a/tests/annotations/core/AnnotationPropertiesFactoryTest.cpp
+++ b/tests/annotations/core/AnnotationPropertiesFactoryTest.cpp
@@ -199,7 +199,7 @@ void AnnotationPropertiesFactoryTest::TestCreate_Should_SetToolFontBasedOnSettin
void AnnotationPropertiesFactoryTest::TestCreate_Should_StickerPathBasedOnSettings()
{
auto tool = Tools::Sticker;
- auto path = QLatin1Literal("/my/path/to/sticker");
+ auto path = QStringLiteral("/my/path/to/sticker");
MockDefaultParameters parameters;
auto settingsProvider = new MockSettingsProvider();
settingsProvider->setSticker(path);
diff --git a/tests/gui/annotator/tabs/AnnotationTabContextMenuTest.cpp b/tests/gui/annotator/tabs/AnnotationTabContextMenuTest.cpp
index 0c4904de..a5c86d7f 100644
--- a/tests/gui/annotator/tabs/AnnotationTabContextMenuTest.cpp
+++ b/tests/gui/annotator/tabs/AnnotationTabContextMenuTest.cpp
@@ -40,8 +40,8 @@ void AnnotationTabContextMenuTest::TestCustomActionTriggered_Should_CallInnerAct
void AnnotationTabContextMenuTest::TestAddCustomActions_Should_SetTextIconAndToolTipInOuterAction()
{
QAction customAction;
- customAction.setText(QLatin1Literal("LaLa"));
- customAction.setToolTip(QLatin1Literal("Hello Hello"));
+ customAction.setText(QStringLiteral("LaLa"));
+ customAction.setToolTip(QStringLiteral("Hello Hello"));
customAction.setIcon(QIcon());
QWidget parent;
AnnotationTabContextMenu menu(&parent);
@@ -68,4 +68,4 @@ void AnnotationTabContextMenuTest::TestCustomActionChanged_Should_UpdateEnabledS
QCOMPARE(customAction.isEnabled(), outerAction->isEnabled());
}
-TEST_MAIN(AnnotationTabContextMenuTest);
\ No newline at end of file
+TEST_MAIN(AnnotationTabContextMenuTest);
diff --git a/tests/utils/TestRunner.h b/tests/utils/TestRunner.h
index 214b8b02..ff742f02 100644
--- a/tests/utils/TestRunner.h
+++ b/tests/utils/TestRunner.h
@@ -69,9 +69,6 @@ class GoogleTestEventListener : public ::testing::EmptyTestEventListener {
#endif
#define TEST_MAIN(TestObject) \
-QT_BEGIN_NAMESPACE \
-QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS \
-QT_END_NAMESPACE \
int main(int argc, char *argv[]) \
{ \
INIT_GOOGLE_MOCKS (argc, argv); \
@@ -79,7 +76,6 @@ int main(int argc, char *argv[]) \
QApplication app(argc, argv); \
app.setAttribute(Qt::AA_Use96Dpi, true); \
QTEST_DISABLE_KEYPAD_NAVIGATION \
- QTEST_ADD_GPU_BLACKLIST_SUPPORT \
TestObject tc; \
QTEST_SET_MAIN_SOURCE_PATH \
return QTest::qExec(&tc, argc, argv); \
@@ -90,16 +86,12 @@ int main(int argc, char *argv[]) \
#include <QtTest/qtest_gui.h>
#define TEST_MAIN(TestObject) \
-QT_BEGIN_NAMESPACE \
-QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS \
-QT_END_NAMESPACE \
int main(int argc, char *argv[]) \
{ \
INIT_GOOGLE_MOCKS (argc, argv); \
\
QGuiApplication app(argc, argv); \
app.setAttribute(Qt::AA_Use96Dpi, true); \
- QTEST_ADD_GPU_BLACKLIST_SUPPORT \
TestObject tc; \
QTEST_SET_MAIN_SOURCE_PATH \
return QTest::qExec(&tc, argc, argv); \
diff --git a/tests/widgets/settingsPicker/StickerPickerTest.cpp b/tests/widgets/settingsPicker/StickerPickerTest.cpp
index 94c26802..7c539fcb 100644
--- a/tests/widgets/settingsPicker/StickerPickerTest.cpp
+++ b/tests/widgets/settingsPicker/StickerPickerTest.cpp
@@ -23,7 +23,7 @@ void StickerPickerTest::TestSelectSticker_Should_EmitSignal_When_StickerChanged(
{
StickerPicker stickerPicker(nullptr);
QSignalSpy spy(&stickerPicker, &StickerPicker::stickerSelected);
- auto expectedStickerPath = QLatin1Literal(":/stickers/nerd_face.svg");
+ auto expectedStickerPath = QStringLiteral(":/stickers/nerd_face.svg");
stickerPicker.setSticker(expectedStickerPath);
@@ -32,4 +32,4 @@ void StickerPickerTest::TestSelectSticker_Should_EmitSignal_When_StickerChanged(
QCOMPARE(resultSize, expectedStickerPath);
}
-TEST_MAIN(StickerPickerTest);
\ No newline at end of file
+TEST_MAIN(StickerPickerTest);
|