Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Akonadi
Commits
786fbc6c
Commit
786fbc6c
authored
Nov 08, 2020
by
Laurent Montel
😁
Browse files
Use auto where is possible (using clang-tidy)
parent
ff5f8b1a
Pipeline
#40183
passed with stage
in 12 minutes and 45 seconds
Changes
149
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
autotests/libs/attributefactorytest.cpp
View file @
786fbc6c
...
...
@@ -36,7 +36,7 @@ void AttributeFactoryTest::testUnknownAttribute()
Item
item
;
item
.
setMimeType
(
QStringLiteral
(
"text/directory"
));
item
.
setPayload
<
QByteArray
>
(
"payload"
);
TestAttrib
ut
e
*
ta
=
new
TestAttribute
;
a
ut
o
*
ta
=
new
TestAttribute
;
{
auto
*
created
=
AttributeFactory
::
createAttribute
(
ta
->
type
());
// DefaultAttribute
QVERIFY
(
created
!=
nullptr
);
...
...
@@ -44,11 +44,11 @@ void AttributeFactoryTest::testUnknownAttribute()
}
ta
->
data
=
"lalala"
;
item
.
addAttribute
(
ta
);
ItemCreateJob
*
cjob
=
new
ItemCreateJob
(
item
,
res1
);
auto
*
cjob
=
new
ItemCreateJob
(
item
,
res1
);
AKVERIFYEXEC
(
cjob
);
int
id
=
cjob
->
item
().
id
();
item
=
Item
(
id
);
ItemFetchJob
*
fjob
=
new
ItemFetchJob
(
item
);
auto
*
fjob
=
new
ItemFetchJob
(
item
);
fjob
->
fetchScope
().
fetchFullPayload
();
fjob
->
fetchScope
().
fetchAllAttributes
();
AKVERIFYEXEC
(
fjob
);
...
...
@@ -66,7 +66,7 @@ void AttributeFactoryTest::testRegisteredAttribute()
Item
item
;
item
.
setMimeType
(
QStringLiteral
(
"text/directory"
));
item
.
setPayload
<
QByteArray
>
(
"payload"
);
TestAttrib
ut
e
*
ta
=
new
TestAttribute
;
a
ut
o
*
ta
=
new
TestAttribute
;
{
auto
*
created
=
AttributeFactory
::
createAttribute
(
ta
->
type
());
QVERIFY
(
created
!=
nullptr
);
...
...
@@ -74,11 +74,11 @@ void AttributeFactoryTest::testRegisteredAttribute()
}
ta
->
data
=
"lalala"
;
item
.
addAttribute
(
ta
);
ItemCreateJob
*
cjob
=
new
ItemCreateJob
(
item
,
res1
);
auto
*
cjob
=
new
ItemCreateJob
(
item
,
res1
);
AKVERIFYEXEC
(
cjob
);
int
id
=
cjob
->
item
().
id
();
item
=
Item
(
id
);
ItemFetchJob
*
fjob
=
new
ItemFetchJob
(
item
);
auto
*
fjob
=
new
ItemFetchJob
(
item
);
fjob
->
fetchScope
().
fetchFullPayload
();
fjob
->
fetchScope
().
fetchAllAttributes
();
AKVERIFYEXEC
(
fjob
);
...
...
autotests/libs/autoincrementtest.cpp
View file @
786fbc6c
...
...
@@ -67,7 +67,7 @@ void AutoIncrementTest::testItemAutoIncrement()
// Delete the 20 items
for
(
const
Item
&
item
:
qAsConst
(
itemsToDelete
))
{
ItemDeleteJob
*
job
=
new
ItemDeleteJob
(
item
);
auto
*
job
=
new
ItemDeleteJob
(
item
);
AKVERIFYEXEC
(
job
);
}
...
...
@@ -98,7 +98,7 @@ void AutoIncrementTest::testCollectionAutoIncrement()
// Delete the 20 collections
foreach
(
const
Collection
&
collection
,
collectionsToDelete
)
{
CollectionDeleteJob
*
job
=
new
CollectionDeleteJob
(
collection
);
auto
*
job
=
new
CollectionDeleteJob
(
collection
);
AKVERIFYEXEC
(
job
);
}
...
...
autotests/libs/cachetest.cpp
View file @
786fbc6c
...
...
@@ -44,7 +44,7 @@ private Q_SLOTS:
enableAgent
(
QStringLiteral
(
"akonadi_knut_resource_0"
),
false
);
ItemFetchJob
*
fetch
=
new
ItemFetchJob
(
col
,
this
);
auto
*
fetch
=
new
ItemFetchJob
(
col
,
this
);
fetch
->
fetchScope
().
fetchFullPayload
(
true
);
QVERIFY
(
!
fetch
->
exec
());
}
...
...
@@ -63,7 +63,7 @@ private Q_SLOTS:
QFETCH
(
Item
,
item
);
QFETCH
(
bool
,
resourceEnabled
);
ItemFetchJob
*
fetch
=
new
ItemFetchJob
(
item
,
this
);
auto
*
fetch
=
new
ItemFetchJob
(
item
,
this
);
fetch
->
fetchScope
().
fetchFullPayload
();
fetch
->
fetchScope
().
setCacheOnly
(
true
);
AKVERIFYEXEC
(
fetch
);
...
...
@@ -109,7 +109,7 @@ private Q_SLOTS:
QFETCH
(
Item
,
item
);
QFETCH
(
bool
,
resourceEnabled
);
ItemFetchJob
*
fetch
=
new
ItemFetchJob
(
item
,
this
);
auto
*
fetch
=
new
ItemFetchJob
(
item
,
this
);
fetch
->
fetchScope
().
fetchFullPayload
();
fetch
->
fetchScope
().
setCacheOnly
(
true
);
AKVERIFYEXEC
(
fetch
);
...
...
@@ -123,7 +123,7 @@ private Q_SLOTS:
Collection
dest
(
AkonadiTest
::
collectionIdFromPath
(
QStringLiteral
(
"res3"
)));
QVERIFY
(
dest
.
isValid
());
ItemCopyJob
*
copy
=
new
ItemCopyJob
(
item
,
dest
,
this
);
auto
*
copy
=
new
ItemCopyJob
(
item
,
dest
,
this
);
QCOMPARE
(
copy
->
exec
(),
resourceEnabled
);
fetch
=
new
ItemFetchJob
(
item
,
this
);
...
...
autotests/libs/changerecordertest.cpp
View file @
786fbc6c
...
...
@@ -102,9 +102,9 @@ private:
{
static
int
s_num
=
0
;
Item
item
(
uid
);
TestAttrib
ut
e
*
attr
=
item
.
attribute
<
TestAttribute
>
(
Item
::
AddIfMissing
);
a
ut
o
*
attr
=
item
.
attribute
<
TestAttribute
>
(
Item
::
AddIfMissing
);
attr
->
data
=
QByteArray
::
number
(
++
s_num
);
ItemModifyJob
*
job
=
new
ItemModifyJob
(
item
);
auto
*
job
=
new
ItemModifyJob
(
item
);
job
->
disableRevisionCheck
();
AKVERIFYEXEC
(
job
);
}
...
...
@@ -112,7 +112,7 @@ private:
void
triggerDelete
(
Akonadi
::
Item
::
Id
uid
)
{
Item
item
(
uid
);
ItemDeleteJob
*
job
=
new
ItemDeleteJob
(
item
);
auto
*
job
=
new
ItemDeleteJob
(
item
);
AKVERIFYEXEC
(
job
);
}
...
...
@@ -158,7 +158,7 @@ private:
rec
->
itemFetchScope
().
setCacheOnly
(
true
);
// Ensure we listen to a signal, otherwise MonitorPrivate::isLazilyIgnored will ignore notifications
QSignalSpy
*
spy
=
new
QSignalSpy
(
rec
.
get
(),
&
Monitor
::
itemChanged
);
auto
*
spy
=
new
QSignalSpy
(
rec
.
get
(),
&
Monitor
::
itemChanged
);
spy
->
setParent
(
rec
.
get
());
QSignalSpy
readySpy
(
rec
.
get
(),
&
Monitor
::
monitorReady
);
...
...
autotests/libs/collectionattributetest.cpp
View file @
786fbc6c
...
...
@@ -94,20 +94,20 @@ void CollectionAttributeTest::testAttributes()
explicit
Cleanup
(
const
Collection
&
col
)
:
m_col
(
col
)
{}
~
Cleanup
()
{
// cleanup
CollectionDeleteJob
*
del
=
new
CollectionDeleteJob
(
m_col
);
auto
*
del
=
new
CollectionDeleteJob
(
m_col
);
AKVERIFYEXEC
(
del
);
}
Collection
m_col
;
};
// add a custom attribute
TestAttrib
ut
e
*
attr
=
new
TestAttribute
();
a
ut
o
*
attr
=
new
TestAttribute
();
attr
->
deserialize
(
attr1
);
Collection
col
;
col
.
setName
(
QStringLiteral
(
"attribute test"
));
col
.
setParentCollection
(
Collection
(
parentColId
));
col
.
addAttribute
(
attr
);
CollectionCreateJob
*
create
=
new
CollectionCreateJob
(
col
,
this
);
auto
*
create
=
new
CollectionCreateJob
(
col
,
this
);
AKVERIFYEXEC
(
create
);
col
=
create
->
collection
();
QVERIFY
(
col
.
isValid
());
...
...
@@ -117,7 +117,7 @@ void CollectionAttributeTest::testAttributes()
QVERIFY
(
attr
!=
nullptr
);
QCOMPARE
(
attr
->
serialized
(),
QByteArray
(
attr1
));
CollectionFetchJob
*
list
=
new
CollectionFetchJob
(
col
,
CollectionFetchJob
::
Base
,
this
);
auto
*
list
=
new
CollectionFetchJob
(
col
,
CollectionFetchJob
::
Base
,
this
);
AKVERIFYEXEC
(
list
);
QCOMPARE
(
list
->
collections
().
count
(),
1
);
col
=
list
->
collections
().
at
(
0
);
...
...
@@ -127,7 +127,7 @@ void CollectionAttributeTest::testAttributes()
QVERIFY
(
attr
!=
nullptr
);
QCOMPARE
(
attr
->
serialized
(),
QByteArray
(
attr1
));
TestAttrib
ut
e
*
attrB
=
new
TestAttribute
();
a
ut
o
*
attrB
=
new
TestAttribute
();
attrB
->
deserialize
(
attr2
);
col
.
addAttribute
(
attrB
);
attrB
=
col
.
attribute
<
TestAttribute
>
();
...
...
@@ -145,7 +145,7 @@ void CollectionAttributeTest::testAttributes()
// modify a custom attribute
col
.
attribute
<
TestAttribute
>
(
Collection
::
AddIfMissing
)
->
deserialize
(
attr2
);
CollectionModifyJob
*
modify
=
new
CollectionModifyJob
(
col
,
this
);
auto
*
modify
=
new
CollectionModifyJob
(
col
,
this
);
AKVERIFYEXEC
(
modify
);
list
=
new
CollectionFetchJob
(
col
,
CollectionFetchJob
::
Base
,
this
);
...
...
@@ -237,8 +237,8 @@ void CollectionAttributeTest::testDetach()
Collection
col2
=
col
;
// and a copy, so that non-const access detaches
// WHEN
TestAttrib
ut
e
*
attr
=
col2
.
attribute
<
TestAttribute
>
(
Akonadi
::
Collection
::
AddIfMissing
);
TestAttrib
ut
e
*
attr2
=
col2
.
attribute
<
TestAttribute
>
();
a
ut
o
*
attr
=
col2
.
attribute
<
TestAttribute
>
(
Akonadi
::
Collection
::
AddIfMissing
);
a
ut
o
*
attr2
=
col2
.
attribute
<
TestAttribute
>
();
// THEN
QCOMPARE
(
attr
,
attr2
);
...
...
autotests/libs/collectioncolorattributetest.cpp
View file @
786fbc6c
...
...
@@ -37,7 +37,7 @@ private Q_SLOTS:
QFETCH
(
QColor
,
color
);
QFETCH
(
QByteArray
,
output
);
CollectionColorAttrib
ut
e
*
attr
=
new
CollectionColorAttribute
();
a
ut
o
*
attr
=
new
CollectionColorAttribute
();
attr
->
deserialize
(
input
);
QCOMPARE
(
attr
->
color
(),
color
);
...
...
autotests/libs/collectioncopytest.cpp
View file @
786fbc6c
...
...
@@ -43,7 +43,7 @@ private Q_SLOTS:
QVERIFY
(
source
.
isValid
());
// obtain reference listing
CollectionFetchJob
*
fetch
=
new
CollectionFetchJob
(
source
,
CollectionFetchJob
::
Base
);
auto
*
fetch
=
new
CollectionFetchJob
(
source
,
CollectionFetchJob
::
Base
);
AKVERIFYEXEC
(
fetch
);
QCOMPARE
(
fetch
->
collections
().
count
(),
1
);
source
=
fetch
->
collections
().
first
();
...
...
@@ -55,17 +55,17 @@ private Q_SLOTS:
Collection
::
List
cols
=
fetch
->
collections
();
cols
<<
source
;
for
(
const
Collection
&
c
:
qAsConst
(
cols
))
{
ItemFetchJob
*
job
=
new
ItemFetchJob
(
c
,
this
);
auto
*
job
=
new
ItemFetchJob
(
c
,
this
);
AKVERIFYEXEC
(
job
);
referenceData
.
insert
(
c
,
job
->
items
());
}
// actually copy the collection
CollectionCopyJob
*
copy
=
new
CollectionCopyJob
(
source
,
target
);
auto
*
copy
=
new
CollectionCopyJob
(
source
,
target
);
AKVERIFYEXEC
(
copy
);
// list destination and check if everything has arrived
CollectionFetchJob
*
list
=
new
CollectionFetchJob
(
target
,
CollectionFetchJob
::
Recursive
);
auto
*
list
=
new
CollectionFetchJob
(
target
,
CollectionFetchJob
::
Recursive
);
AKVERIFYEXEC
(
list
);
cols
=
list
->
collections
();
QCOMPARE
(
cols
.
count
(),
referenceData
.
count
());
...
...
@@ -81,7 +81,7 @@ private Q_SLOTS:
QVERIFY
(
col
.
isValid
());
QCOMPARE
(
col
.
resource
(),
QStringLiteral
(
"akonadi_knut_resource_2"
));
QVERIFY
(
col
.
remoteId
().
isEmpty
());
ItemFetchJob
*
job
=
new
ItemFetchJob
(
col
,
this
);
auto
*
job
=
new
ItemFetchJob
(
col
,
this
);
job
->
fetchScope
().
fetchFullPayload
();
job
->
fetchScope
().
setCacheOnly
(
true
);
AKVERIFYEXEC
(
job
);
...
...
autotests/libs/collectioncreatetest.cpp
View file @
786fbc6c
...
...
@@ -34,7 +34,7 @@ private Q_SLOTS:
col
.
setParentCollection
(
Collection
(
AkonadiTest
::
collectionIdFromPath
(
QLatin1String
(
"res1"
))));
col
.
setRights
(
Collection
::
AllRights
);
CollectionCreateJob
*
cj
=
new
CollectionCreateJob
(
col
,
this
);
auto
*
cj
=
new
CollectionCreateJob
(
col
,
this
);
AKVERIFYEXEC
(
cj
);
col
=
cj
->
collection
();
QVERIFY
(
col
.
isValid
());
...
...
@@ -43,7 +43,7 @@ private Q_SLOTS:
auto
ntfCol
=
spy
.
at
(
0
).
at
(
0
).
value
<
Collection
>
();
QCOMPARE
(
col
,
ntfCol
);
CollectionDeleteJob
*
dj
=
new
CollectionDeleteJob
(
col
,
this
);
auto
*
dj
=
new
CollectionDeleteJob
(
col
,
this
);
AKVERIFYEXEC
(
dj
);
}
};
...
...
autotests/libs/collectionjobtest.cpp
View file @
786fbc6c
...
...
@@ -127,7 +127,7 @@ void CollectionJobTest::testFolderList()
int
count
=
0
;
for
(
int
i
=
0
;
i
<
spy
.
count
();
++
i
)
{
Collection
::
List
l
=
spy
[
i
][
0
].
value
<
Akonadi
::
Collection
::
List
>
();
auto
l
=
spy
[
i
][
0
].
value
<
Akonadi
::
Collection
::
List
>
();
for
(
int
j
=
0
;
j
<
l
.
count
();
++
j
)
{
QVERIFY
(
list
.
count
()
>
count
+
j
);
QCOMPARE
(
list
[
count
+
j
].
id
(),
l
[
j
].
id
());
...
...
@@ -176,7 +176,7 @@ void CollectionJobTest::testSignalOrder()
Akonadi
::
Collection
::
List
toFetch
;
toFetch
<<
Collection
(
res1ColId
);
toFetch
<<
Collection
(
res2ColId
);
CollectionFetchJob
*
job
=
new
CollectionFetchJob
(
toFetch
,
CollectionFetchJob
::
Recursive
);
auto
*
job
=
new
CollectionFetchJob
(
toFetch
,
CollectionFetchJob
::
Recursive
);
ResultSignalTester
spy
;
connect
(
job
,
&
CollectionFetchJob
::
collectionsReceived
,
&
spy
,
&
ResultSignalTester
::
onCollectionsReceived
);
connect
(
job
,
&
KJob
::
result
,
&
spy
,
&
ResultSignalTester
::
onCollectionRetrievalDone
);
...
...
@@ -339,7 +339,7 @@ void CollectionJobTest::testCreateDeleteFolder()
QFETCH
(
Collection
,
collection
);
QFETCH
(
bool
,
creatable
);
CollectionCreateJob
*
createJob
=
new
CollectionCreateJob
(
collection
,
this
);
auto
*
createJob
=
new
CollectionCreateJob
(
collection
,
this
);
QCOMPARE
(
createJob
->
exec
(),
creatable
);
if
(
!
creatable
)
{
return
;
...
...
@@ -352,7 +352,7 @@ void CollectionJobTest::testCreateDeleteFolder()
QCOMPARE
(
createdCol
.
remoteId
(),
collection
.
remoteId
());
QCOMPARE
(
createdCol
.
cachePolicy
(),
collection
.
cachePolicy
());
CollectionFetchJob
*
listJob
=
new
CollectionFetchJob
(
collection
.
parentCollection
(),
CollectionFetchJob
::
FirstLevel
,
this
);
auto
*
listJob
=
new
CollectionFetchJob
(
collection
.
parentCollection
(),
CollectionFetchJob
::
FirstLevel
,
this
);
AKVERIFYEXEC
(
listJob
);
Collection
listedCol
=
findCol
(
listJob
->
collections
(),
collection
.
name
());
QCOMPARE
(
listedCol
,
createdCol
);
...
...
@@ -362,7 +362,7 @@ void CollectionJobTest::testCreateDeleteFolder()
// fetch parent to compare inherited collection properties
Collection
parentCol
=
Collection
::
root
();
if
(
collection
.
parentCollection
().
isValid
())
{
CollectionFetchJob
*
listJob
=
new
CollectionFetchJob
(
collection
.
parentCollection
(),
CollectionFetchJob
::
Base
,
this
);
auto
*
listJob
=
new
CollectionFetchJob
(
collection
.
parentCollection
(),
CollectionFetchJob
::
Base
,
this
);
AKVERIFYEXEC
(
listJob
);
QCOMPARE
(
listJob
->
collections
().
count
(),
1
);
parentCol
=
listJob
->
collections
().
first
();
...
...
@@ -380,7 +380,7 @@ void CollectionJobTest::testCreateDeleteFolder()
QCOMPARE
(
listedCol
.
resource
(),
collection
.
resource
());
}
CollectionDeleteJob
*
delJob
=
new
CollectionDeleteJob
(
createdCol
,
this
);
auto
*
delJob
=
new
CollectionDeleteJob
(
createdCol
,
this
);
AKVERIFYEXEC
(
delJob
);
listJob
=
new
CollectionFetchJob
(
collection
.
parentCollection
(),
CollectionFetchJob
::
FirstLevel
,
this
);
...
...
@@ -452,10 +452,10 @@ void CollectionJobTest::testModify()
RESET_COLLECTION_ID
;
// test noop modify
CollectionModifyJob
*
mod
=
new
CollectionModifyJob
(
col
,
this
);
auto
*
mod
=
new
CollectionModifyJob
(
col
,
this
);
AKVERIFYEXEC
(
mod
);
CollectionFetchJob
*
ljob
=
new
CollectionFetchJob
(
col
,
CollectionFetchJob
::
Base
,
this
);
auto
*
ljob
=
new
CollectionFetchJob
(
col
,
CollectionFetchJob
::
Base
,
this
);
AKVERIFYEXEC
(
ljob
);
QCOMPARE
(
ljob
->
collections
().
count
(),
1
);
col
=
ljob
->
collections
().
first
();
...
...
@@ -532,7 +532,7 @@ void CollectionJobTest::testIllegalModify()
// non-existing collection
Collection
col
(
INT_MAX
);
col
.
parentCollection
().
setId
(
res1ColId
);
CollectionModifyJob
*
mod
=
new
CollectionModifyJob
(
col
,
this
);
auto
*
mod
=
new
CollectionModifyJob
(
col
,
this
);
QVERIFY
(
!
mod
->
exec
());
// rename to already existing name
...
...
@@ -559,7 +559,7 @@ void CollectionJobTest::testUtf8CollectionName()
Collection
col
;
col
.
parentCollection
().
setId
(
res3ColId
);
col
.
setName
(
folderName
);
CollectionCreateJob
*
create
=
new
CollectionCreateJob
(
col
,
this
);
auto
*
create
=
new
CollectionCreateJob
(
col
,
this
);
AKVERIFYEXEC
(
create
);
col
=
create
->
collection
();
QVERIFY
(
col
.
isValid
());
...
...
@@ -574,18 +574,18 @@ void CollectionJobTest::testUtf8CollectionName()
// modify collection
col
.
setContentMimeTypes
(
{
QStringLiteral
(
"message/rfc822"
)
}
);
CollectionModifyJob
*
modify
=
new
CollectionModifyJob
(
col
,
this
);
auto
*
modify
=
new
CollectionModifyJob
(
col
,
this
);
AKVERIFYEXEC
(
modify
);
// collection statistics
CollectionStatisticsJob
*
statistics
=
new
CollectionStatisticsJob
(
col
,
this
);
auto
*
statistics
=
new
CollectionStatisticsJob
(
col
,
this
);
AKVERIFYEXEC
(
statistics
);
CollectionStatistics
s
=
statistics
->
statistics
();
QCOMPARE
(
s
.
count
(),
0LL
);
QCOMPARE
(
s
.
unreadCount
(),
0LL
);
// delete collection
CollectionDeleteJob
*
del
=
new
CollectionDeleteJob
(
col
,
this
);
auto
*
del
=
new
CollectionDeleteJob
(
col
,
this
);
AKVERIFYEXEC
(
del
);
}
...
...
@@ -593,7 +593,7 @@ void CollectionJobTest::testMultiList()
{
Collection
::
List
req
;
req
<<
Collection
(
res1ColId
)
<<
Collection
(
res2ColId
);
CollectionFetchJob
*
job
=
new
CollectionFetchJob
(
req
,
this
);
auto
*
job
=
new
CollectionFetchJob
(
req
,
this
);
AKVERIFYEXEC
(
job
);
Collection
::
List
res
;
...
...
@@ -605,7 +605,7 @@ void CollectionJobTest::testMultiListInvalid()
{
Collection
::
List
req
;
req
<<
Collection
(
res1ColId
)
<<
Collection
(
1234567
)
<<
Collection
(
res2ColId
);
CollectionFetchJob
*
job
=
new
CollectionFetchJob
(
req
,
this
);
auto
*
job
=
new
CollectionFetchJob
(
req
,
this
);
QVERIFY
(
!
job
->
exec
());
// not all available collections are fetched
QVERIFY
(
job
->
collections
().
count
()
!=
2
);
...
...
@@ -624,7 +624,7 @@ void CollectionJobTest::testRecursiveMultiList()
Akonadi
::
Collection
::
List
toFetch
;
toFetch
<<
Collection
(
res1ColId
);
toFetch
<<
Collection
(
res2ColId
);
CollectionFetchJob
*
job
=
new
CollectionFetchJob
(
toFetch
,
CollectionFetchJob
::
Recursive
);
auto
*
job
=
new
CollectionFetchJob
(
toFetch
,
CollectionFetchJob
::
Recursive
);
QSignalSpy
spy
(
job
,
&
CollectionFetchJob
::
collectionsReceived
);
QVERIFY
(
spy
.
isValid
());
AKVERIFYEXEC
(
job
);
...
...
@@ -633,7 +633,7 @@ void CollectionJobTest::testRecursiveMultiList()
int
count
=
0
;
for
(
int
i
=
0
;
i
<
spy
.
count
();
++
i
)
{
Collection
::
List
l
=
spy
[
i
][
0
].
value
<
Akonadi
::
Collection
::
List
>
();
auto
l
=
spy
[
i
][
0
].
value
<
Akonadi
::
Collection
::
List
>
();
for
(
int
j
=
0
;
j
<
l
.
count
();
++
j
)
{
QVERIFY
(
list
.
count
()
>
count
+
j
);
QCOMPARE
(
list
[
count
+
j
].
id
(),
l
[
j
].
id
());
...
...
@@ -656,7 +656,7 @@ void CollectionJobTest::testNonOverlappingRootList()
Akonadi
::
Collection
::
List
toFetch
;
toFetch
<<
Collection
(
res1ColId
);
toFetch
<<
Collection
(
res2ColId
);
CollectionFetchJob
*
job
=
new
CollectionFetchJob
(
toFetch
,
CollectionFetchJob
::
NonOverlappingRoots
);
auto
*
job
=
new
CollectionFetchJob
(
toFetch
,
CollectionFetchJob
::
NonOverlappingRoots
);
QSignalSpy
spy
(
job
,
&
CollectionFetchJob
::
collectionsReceived
);
QVERIFY
(
spy
.
isValid
());
AKVERIFYEXEC
(
job
);
...
...
@@ -665,7 +665,7 @@ void CollectionJobTest::testNonOverlappingRootList()
int
count
=
0
;
for
(
int
i
=
0
;
i
<
spy
.
count
();
++
i
)
{
Collection
::
List
l
=
spy
[
i
][
0
].
value
<
Akonadi
::
Collection
::
List
>
();
auto
l
=
spy
[
i
][
0
].
value
<
Akonadi
::
Collection
::
List
>
();
for
(
int
j
=
0
;
j
<
l
.
count
();
++
j
)
{
QVERIFY
(
list
.
count
()
>
count
+
j
);
QCOMPARE
(
list
[
count
+
j
].
id
(),
l
[
j
].
id
());
...
...
@@ -685,7 +685,7 @@ void CollectionJobTest::testRidFetch()
Collection
col
;
col
.
setRemoteId
(
QStringLiteral
(
"10"
));
CollectionFetchJob
*
job
=
new
CollectionFetchJob
(
col
,
CollectionFetchJob
::
Base
,
this
);
auto
*
job
=
new
CollectionFetchJob
(
col
,
CollectionFetchJob
::
Base
,
this
);
job
->
fetchScope
().
setResource
(
QStringLiteral
(
"akonadi_knut_resource_0"
));
AKVERIFYEXEC
(
job
);
QCOMPARE
(
job
->
collections
().
count
(),
1
);
...
...
@@ -713,7 +713,7 @@ void CollectionJobTest::testRidCreateDelete()
ResourceSelectJob
*
resSel
=
new
ResourceSelectJob
(
QStringLiteral
(
"akonadi_knut_resource_2"
));
AKVERIFYEXEC
(
resSel
);
CollectionCreateJob
*
createJob
=
new
CollectionCreateJob
(
collection
,
this
);
auto
*
createJob
=
new
CollectionCreateJob
(
collection
,
this
);
AKVERIFYEXEC
(
createJob
);
Collection
createdCol
=
createJob
->
collection
();
...
...
@@ -727,7 +727,7 @@ void CollectionJobTest::testRidCreateDelete()
QCOMPARE
(
listedCol
.
name
(),
collection
.
name
());
QVERIFY
(
!
collection
.
isValid
());
CollectionDeleteJob
*
delJob
=
new
CollectionDeleteJob
(
collection
,
this
);
auto
*
delJob
=
new
CollectionDeleteJob
(
collection
,
this
);
AKVERIFYEXEC
(
delJob
);
listJob
=
new
CollectionFetchJob
(
Collection
(
res3ColId
),
CollectionFetchJob
::
FirstLevel
,
this
);
...
...
@@ -740,7 +740,7 @@ void CollectionJobTest::testAncestorRetrieval()
Collection
col
;
col
.
setRemoteId
(
QStringLiteral
(
"10"
));
CollectionFetchJob
*
job
=
new
CollectionFetchJob
(
col
,
CollectionFetchJob
::
Base
,
this
);
auto
*
job
=
new
CollectionFetchJob
(
col
,
CollectionFetchJob
::
Base
,
this
);
job
->
fetchScope
().
setResource
(
QStringLiteral
(
"akonadi_knut_resource_0"
));
job
->
fetchScope
().
setAncestorRetrieval
(
CollectionFetchScope
::
All
);
AKVERIFYEXEC
(
job
);
...
...
@@ -770,7 +770,7 @@ void CollectionJobTest::testAncestorAttributeRetrieval()
baseCol
.
setParentCollection
(
Akonadi
::
Collection
(
res1ColId
));
baseCol
.
setName
(
QStringLiteral
(
"base"
));
baseCol
.
attribute
<
TestAttribute
>
(
Collection
::
AddIfMissing
)
->
data
=
"new"
;
Akonadi
::
CollectionCreateJob
*
create
=
new
Akonadi
::
CollectionCreateJob
(
baseCol
);
auto
*
create
=
new
Akonadi
::
CollectionCreateJob
(
baseCol
);
AKVERIFYEXEC
(
create
);
baseCol
=
create
->
collection
();
}
...
...
@@ -778,7 +778,7 @@ void CollectionJobTest::testAncestorAttributeRetrieval()
Akonadi
::
Collection
col
;
col
.
setParentCollection
(
baseCol
);
col
.
setName
(
QStringLiteral
(
"enabled"
));
Akonadi
::
CollectionCreateJob
*
create
=
new
Akonadi
::
CollectionCreateJob
(
col
);
auto
*
create
=
new
Akonadi
::
CollectionCreateJob
(
col
);
AKVERIFYEXEC
(
create
);
CollectionFetchJob
*
job
=
new
CollectionFetchJob
(
create
->
collection
(),
CollectionFetchJob
::
Base
);
...
...
@@ -791,7 +791,7 @@ void CollectionJobTest::testAncestorAttributeRetrieval()
}
//Cleanup
CollectionDeleteJob
*
deleteJob
=
new
CollectionDeleteJob
(
baseCol
);
auto
*
deleteJob
=
new
CollectionDeleteJob
(
baseCol
);
AKVERIFYEXEC
(
deleteJob
);
}
...
...
@@ -801,7 +801,7 @@ void CollectionJobTest::testListPreference()
{
baseCol
.
setParentCollection
(
Akonadi
::
Collection
(
res1ColId
));
baseCol
.
setName
(
QStringLiteral
(
"base"
));
Akonadi
::
CollectionCreateJob
*
create
=
new
Akonadi
::
CollectionCreateJob
(
baseCol
);
auto
*
create
=
new
Akonadi
::
CollectionCreateJob
(
baseCol
);
AKVERIFYEXEC
(
create
);
baseCol
=
create
->
collection
();
}
...
...
@@ -810,7 +810,7 @@ void CollectionJobTest::testListPreference()
col
.
setParentCollection
(
baseCol
);
col
.
setEnabled
(
true
);
col
.
setName
(
QStringLiteral
(
"enabled"
));
Akonadi
::
CollectionCreateJob
*
create
=
new
Akonadi
::
CollectionCreateJob
(
col
);
auto
*
create
=
new
Akonadi
::
CollectionCreateJob
(
col
);
AKVERIFYEXEC
(
create
);
CollectionFetchJob
*
job
=
new
CollectionFetchJob
(
create
->
collection
(),
CollectionFetchJob
::
Base
);
...
...
@@ -829,7 +829,7 @@ void CollectionJobTest::testListPreference()
col
.
setLocalListPreference
(
Collection
::
ListDisplay
,
Collection
::
ListDisabled
);
col
.
setLocalListPreference
(
Collection
::
ListSync
,
Collection
::
ListDisabled
);
col
.
setLocalListPreference
(
Collection
::
ListIndex
,
Collection
::
ListDisabled
);
Akonadi
::
CollectionCreateJob
*
create
=
new
Akonadi
::
CollectionCreateJob
(
col
);
auto
*
create
=
new
Akonadi
::
CollectionCreateJob
(
col
);
AKVERIFYEXEC
(
create
);
CollectionFetchJob
*
job
=
new
CollectionFetchJob
(
create
->
collection
(),
CollectionFetchJob
::
Base
);
AKVERIFYEXEC
(
job
);
...
...
@@ -847,7 +847,7 @@ void CollectionJobTest::testListPreference()
col
.
setLocalListPreference
(
Collection
::
ListDisplay
,
Collection
::
ListEnabled
);
col
.
setLocalListPreference
(
Collection
::
ListSync
,
Collection
::
ListEnabled
);
col
.
setLocalListPreference
(
Collection
::
ListIndex
,
Collection
::
ListEnabled
);
Akonadi
::
CollectionCreateJob
*
create
=
new
Akonadi
::
CollectionCreateJob
(
col
);
auto
*
create
=
new
Akonadi
::
CollectionCreateJob
(
col
);
AKVERIFYEXEC
(
create
);
CollectionFetchJob
*
job
=
new
CollectionFetchJob
(
create
->
collection
(),
CollectionFetchJob
::
Base
);
AKVERIFYEXEC
(
job
);
...
...
@@ -860,32 +860,32 @@ void CollectionJobTest::testListPreference()
//Check list filter
{
CollectionFetchJob
*
job
=
new
CollectionFetchJob
(
baseCol
,
CollectionFetchJob
::
FirstLevel
);
auto
*
job
=
new
CollectionFetchJob
(
baseCol
,
CollectionFetchJob
::
FirstLevel
);
job
->
fetchScope
().
setListFilter
(
CollectionFetchScope
::
Display
);
AKVERIFYEXEC
(
job
);
QCOMPARE
(
job
->
collections
().
size
(),
2
);
}
{
CollectionFetchJob
*
job
=
new
CollectionFetchJob
(
baseCol
,
CollectionFetchJob
::
FirstLevel
);
auto
*
job
=
new
CollectionFetchJob
(
baseCol
,
CollectionFetchJob
::
FirstLevel
);
job
->
fetchScope
().
setListFilter
(
CollectionFetchScope
::
Sync
);
AKVERIFYEXEC
(
job
);
QCOMPARE
(
job
->
collections
().
size
(),
2
);
}
{
CollectionFetchJob
*
job
=
new
CollectionFetchJob
(
baseCol
,
CollectionFetchJob
::
FirstLevel
);
auto
*
job
=
new
CollectionFetchJob
(
baseCol
,
CollectionFetchJob
::
FirstLevel
);
job
->
fetchScope
().
setListFilter
(
CollectionFetchScope
::
Index
);
AKVERIFYEXEC
(
job
);
QCOMPARE
(
job
->
collections
().
size
(),
2
);
}
{
CollectionFetchJob
*
job
=
new
CollectionFetchJob
(
baseCol
,
CollectionFetchJob
::
FirstLevel
);
auto
*
job
=
new
CollectionFetchJob
(
baseCol
,
CollectionFetchJob
::
FirstLevel
);
job
->
fetchScope
().
setListFilter
(
CollectionFetchScope
::
Enabled
);
AKVERIFYEXEC
(
job
);
QCOMPARE
(
job
->
collections
().
size
(),
2
);
}
//Cleanup
CollectionDeleteJob
*
deleteJob
=
new
CollectionDeleteJob
(
baseCol
);
auto
*
deleteJob
=
new
CollectionDeleteJob
(
baseCol
);
AKVERIFYEXEC
(
deleteJob
);
}
...
...
autotests/libs/collectionmodifytest.cpp
View file @
786fbc6c
...
...
@@ -32,7 +32,7 @@ private Q_SLOTS:
col
.
setParentCollection
(
Collection
(
AkonadiTest
::
collectionIdFromPath
(
QLatin1String
(
"res1"
))));
col
.
setRights
(
Collection
::
AllRights
);
CollectionCreateJob
*
cj
=
new
CollectionCreateJob
(
col
,
this
);
auto
*
cj
=
new
CollectionCreateJob
(
col
,
this
);
AKVERIFYEXEC
(
cj
);
col
=
cj
->
collection
();
QVERIFY
(
col
.
isValid
());
...
...
@@ -41,10 +41,10 @@ private Q_SLOTS:
attr
->
setDisplayName
(
QStringLiteral
(
"Test Collection"
));
col
.
setContentMimeTypes
({
Collection
::
mimeType
(),
QLatin1String
(
"application/octet-stream"
)
});
CollectionModifyJob
*
mj
=
new
CollectionModifyJob
(
col
,
this
);
auto
*
mj
=
new
CollectionModifyJob
(
col
,
this
);
AKVERIFYEXEC
(
mj
);
CollectionFetchJob
*
fj
=
new
CollectionFetchJob
(
col
,
CollectionFetchJob
::
Base
);
auto
*
fj
=
new
CollectionFetchJob
(
col
,
CollectionFetchJob
::
Base
);
AKVERIFYEXEC
(
fj
);
QCOMPARE
(
fj
->
collections
().
count
(),
1
);
const
Collection
actual
=
fj
->
collections
().
at
(
0
);
...
...
@@ -56,7 +56,7 @@ private Q_SLOTS:
QCOMPARE
(
actual
.
parentCollection
(),
col
.
parentCollection
());
QCOMPARE
(
actual
.
rights
(),
col
.
rights
());
CollectionDeleteJob
*
dj
=
new
CollectionDeleteJob
(
col
,
this
);
auto
*
dj
=
new
CollectionDeleteJob
(
col
,
this
);
AKVERIFYEXEC
(
dj
);
}
};
...
...
autotests/libs/collectionmovetest.cpp
View file @
786fbc6c
...
...
@@ -47,7 +47,7 @@ private Q_SLOTS:
QVERIFY
(
source
.
isValid
());
QVERIFY
(
destination
.
isValid
());
CollectionMoveJob
*
mod
=
new
CollectionMoveJob
(
source
,
destination
,
this
);
auto
*
mod
=
new
CollectionMoveJob
(
source
,
destination
,
this
);
QVERIFY
(
!
mod
->
exec
());
}
...
...
@@ -74,7 +74,7 @@ private Q_SLOTS:
QVERIFY
(
source
.
isValid
());
QVERIFY
(
destination
.
isValid
());
CollectionFetchJob
*
fetch
=
new
CollectionFetchJob
(
source
,
CollectionFetchJob
::
Base
,
this
);
auto
*
fetch
=
new
CollectionFetchJob
(
source
,
CollectionFetchJob
::
Base
,
this
);
AKVERIFYEXEC
(
fetch
);
QCOMPARE
(
fetch
->
collections
().
count
(),
1
);