summaryrefslogtreecommitdiff
path: root/net-libs/accounts-qt/files/0001-Port-away-from-deprecated-QList-toSet.patch
blob: 190178cc3030160193c0787435535895e8155a4b (plain)
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
https://gitlab.com/accounts-sso/libaccounts-qt/-/merge_requests/21

From 3107822e036300684c2bdf587838a110eea8ba30 Mon Sep 17 00:00:00 2001
From: Nicolas Fella <nicolas.fella@gmx.de>
Date: Mon, 1 Aug 2022 20:35:03 +0200
Subject: [PATCH 1/5] Port away from deprecated QList::toSet

---
 tests/tst_libaccounts.cpp | 44 +++++++++++++++++++++++++++++----------
 1 file changed, 33 insertions(+), 11 deletions(-)

diff --git a/tests/tst_libaccounts.cpp b/tests/tst_libaccounts.cpp
index 471e3d5..efede91 100644
--- a/tests/tst_libaccounts.cpp
+++ b/tests/tst_libaccounts.cpp
@@ -326,11 +326,11 @@ void AccountsTest::testService()
     QCOMPARE(service.description(), QStringLiteral("Test description"));
     QCOMPARE(service.iconName(), QString("general_myservice"));
     QCOMPARE(service.trCatalog(), QString("accounts"));
-    QStringList tags;
+    QSet<QString> tags;
     tags << "email" << "e-mail";
-    QCOMPARE(service.tags(), tags.toSet());
+    QCOMPARE(service.tags(), tags);
     // Called twice, because the second time it returns a cached result
-    QCOMPARE(service.tags(), tags.toSet());
+    QCOMPARE(service.tags(), tags);
     QVERIFY(service.hasTag("email"));
     QVERIFY(!service.hasTag("chat"));
 
@@ -687,10 +687,15 @@ void AccountsTest::testAccountService()
     spyChanged.clear();
     spyEnabled.clear();
 
-    QStringList expectedChanges;
+    QSet<QString> expectedChanges;
     expectedChanges << "parameters/server";
     expectedChanges << "enabled";
-    QCOMPARE(m_accountServiceChangedFields.toSet(), expectedChanges.toSet());
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+    QSet<QString> changedFields(m_accountServiceChangedFields.begin(), m_accountServiceChangedFields.end());
+#else
+    QSet<QString> changedFields = m_accountServiceChangedFields.toSet();
+#endif
+    QCOMPARE(changedFields, expectedChanges);
 
     QCOMPARE(accountService->value("server").toString(),
              UTF8("www.example.com"));
@@ -727,17 +732,34 @@ void AccountsTest::testAccountService()
 
 
     /* test some more APIs */
-    QStringList expectedList;
+    QSet<QString> expectedList;
     expectedList << "server" << "fallback-conference-server" <<
         "port" << "old-ssl";
-    QCOMPARE(accountService->childKeys().toSet(), expectedList.toSet());
-    QCOMPARE(accountService->childGroups().toSet(), QSet<QString>());
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+    QStringList childKeysList = accountService->childKeys();
+    QSet<QString> childKeys(childKeysList.begin(), childKeysList.end());
+
+    QStringList childGroupsList = accountService->childGroups();
+    QSet<QString> childGroups(childGroupsList.begin(), childGroupsList.end());
+#else
+    QSet<QString> childKeys = accountService->childKeys().toSet();
+    QSet<QString> childGroups = accountService->childGroups().toSet();
+#endif
+
+    QCOMPARE(childKeys, expectedList);
+    QCOMPARE(childGroups, QSet<QString>());
     QCOMPARE(accountService->contains("port"), true);
     accountService->endGroup();
 
-    expectedList.clear();
-    expectedList << "parameters";
-    QCOMPARE(accountService->childGroups().toSet(), expectedList.toSet());
+    QSet<QString> expectedList2;
+    expectedList2 << "parameters";
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+    QStringList childGroupsList2 = accountService->childGroups();
+    QSet<QString> childGroups2(childGroupsList2.begin(), childGroupsList2.end());
+#else
+    QSet<QString> childGroups2 = accountService->childGroups().toSet();
+#endif
+    QCOMPARE(childGroups2, expectedList2);
 
     /* Remove one key */
     accountService->remove("parameters/port");
-- 
2.43.0