Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
Discover
Commits
5824f18c
Commit
5824f18c
authored
Apr 01, 2022
by
Aleix Pol Gonzalez
🐧
Browse files
flatpak: fix test
parent
815582c0
Changes
1
Hide whitespace changes
Inline
Side-by-side
libdiscover/backends/FlatpakBackend/tests/FlatpakTest.cpp
View file @
5824f18c
...
...
@@ -42,7 +42,7 @@ public:
}
private
Q_SLOTS
:
void
init
()
void
init
TestCase
()
{
QDir
(
QStandardPaths
::
writableLocation
(
QStandardPaths
::
TempLocation
)
+
QLatin1String
(
"/discover-flatpak-test"
)).
removeRecursively
();
...
...
@@ -65,9 +65,9 @@ private Q_SLOTS:
if
(
m
->
rowCount
()
==
1
)
{
QSignalSpy
spy
(
m
,
&
SourcesModel
::
rowsInserted
);
qobject_cast
<
DiscoverAction
*>
(
bk
->
actions
().
constFirst
().
value
<
QObject
*>
())
->
trigger
();
QVERIFY
(
spy
.
count
()
||
spy
.
wait
(
20000
));
QVERIFY
(
spy
.
count
()
||
spy
.
wait
(
20000
0
));
}
QVERIFY
(
initializedSpy
.
count
()
||
initializedSpy
.
wait
(
20000
));
QVERIFY
(
initializedSpy
.
count
()
||
initializedSpy
.
wait
(
20000
0
));
auto
resFlathub
=
getAllResources
(
m_appBackend
);
QVERIFY
(
resFlathub
.
count
()
>
0
);
}
...
...
@@ -85,7 +85,7 @@ private Q_SLOTS:
AbstractResourcesBackend
::
Filters
f
;
f
.
resourceUrl
=
QUrl
(
QStringLiteral
(
"appstream://com.github.rssguard.desktop"
));
const
auto
res
=
getResources
(
m_appBackend
->
search
(
f
));
Q
VERIFY
(
res
.
count
()
==
1
);
Q
COMPARE
(
res
.
count
()
,
1
);
const
auto
resRssguard
=
res
.
constFirst
();
QCOMPARE
(
resRssguard
->
state
(),
AbstractResource
::
None
);
...
...
@@ -94,23 +94,24 @@ private Q_SLOTS:
QCOMPARE
(
waitTransaction
(
m_appBackend
->
removeApplication
(
resRssguard
)),
Transaction
::
DoneStatus
);
QCOMPARE
(
resRssguard
->
state
(),
AbstractResource
::
None
);
}
void
testCancelInstallation
()
{
AbstractResourcesBackend
::
Filters
f
;
f
.
resourceUrl
=
QUrl
(
QStringLiteral
(
"appstream://com.github.rssguard.desktop"
));
const
auto
res
=
getResources
(
m_appBackend
->
search
(
f
));
QVERIFY
(
res
.
count
()
==
1
);
const
auto
resRssguard
=
res
.
constFirst
();
QCOMPARE
(
resRssguard
->
state
(),
AbstractResource
::
None
);
auto
t
=
m_appBackend
->
installApplication
(
resRssguard
);
QSignalSpy
spy
(
t
,
&
Transaction
::
statusChanged
);
QVERIFY
(
spy
.
wait
());
QCOMPARE
(
t
->
status
(),
Transaction
::
CommittingStatus
);
t
->
cancel
();
QCOMPARE
(
t
->
status
(),
Transaction
::
CancelledStatus
);
}
/*
void testCancelInstallation()
{
AbstractResourcesBackend::Filters f;
f.resourceUrl = QUrl(QStringLiteral("appstream://com.github.rssguard.desktop"));
const auto res = getResources(m_appBackend->search(f));
QCOMPARE(res.count(), 1);
const auto resRssguard = res.constFirst();
QCOMPARE(resRssguard->state(), AbstractResource::None);
auto t = m_appBackend->installApplication(resRssguard);
QSignalSpy spy(t, &Transaction::statusChanged);
QVERIFY(spy.wait());
QCOMPARE(t->status(), Transaction::CommittingStatus);
t->cancel();
QVERIFY(spy.wait());
QCOMPARE(t->status(), Transaction::CancelledStatus);
}*/
private:
Transaction
::
Status
waitTransaction
(
Transaction
*
t
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment