Commit b0fc2ab0 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Adapt the dummy bakcend to changes

parent 6aba6908
......@@ -7,6 +7,7 @@ DiscoverTest
verify(appRoot.stack.currentItem, "has a page");
while (appRoot.stack.currentItem.title === "")
verify(waitForRendering());
compare(appRoot.stack.currentItem.title, "techie1", "same title");
compare(appRoot.stack.currentItem.title, "dummy://techie1", "same title");
compare(appRoot.stack.currentItem.count, 1);
}
}
......@@ -6,7 +6,13 @@ DiscoverTest
{
function test_openResource() {
app.openApplication("dummy://dummy.1");
verify(waitForSignal(appRoot.stack, "currentItemChanged"))
compare(appRoot.stack.currentItem.title, "dummy://dummy.1", "same title");
compare(appRoot.stack.currentItem.isBusy, true, "same title");
verify(waitForSignal(appRoot.stack.currentItem, "isBusyChanged"))
var item = appRoot.stack.currentItem.flickable.itemAt(100, 100)
verify(item)
item.clicked()
verify(appRoot.stack.currentItem, "has a page");
compare(appRoot.stack.currentItem.title, "Dummy 1", "same title");
......@@ -25,7 +31,13 @@ DiscoverTest
}
function test_cancel() {
app.openApplication("dummy://dummy.2");
verify(waitForSignal(appRoot.stack, "currentItemChanged"))
compare(appRoot.stack.currentItem.title, "dummy://dummy.2", "same title");
compare(appRoot.stack.currentItem.isBusy, true, "same title");
verify(waitForSignal(appRoot.stack.currentItem, "isBusyChanged"))
var item = appRoot.stack.currentItem.flickable.itemAt(100, 100)
verify(item)
item.clicked()
verify(appRoot.stack.currentItem, "has a page");
compare(appRoot.stack.currentItem.title, "Dummy 2", "same title");
......
......@@ -4,6 +4,7 @@ import QtTest 1.1
DiscoverTest
{
function test_open() {
compare(appRoot.stack.currentItem.title, "Home")
compare(appRoot.stack.currentItem.title, "dummy://caca")
compare(appRoot.stack.currentItem.count, 0);
}
}
......@@ -38,6 +38,7 @@ DiscoverPage {
property alias extend: appsModel.extends
property alias search: appsModel.search
property alias resourcesUrl: appsModel.resourcesUrl
property alias isBusy: appsModel.isBusy
property alias count: apps.count
property alias listHeader: apps.header
property bool compact: page.width < 500 || Helpers.isCompact
......
......@@ -116,7 +116,9 @@ int DummyBackend::updatesCount() const
ResultsStream* DummyBackend::search(const AbstractResourcesBackend::Filters& filter)
{
QVector<AbstractResource*> ret;
foreach(AbstractResource* r, m_resources) {
if (!filter.resourceUrl.isEmpty() && filter.resourceUrl.scheme() == QLatin1String("dummy"))
return findResourceByPackageName(filter.resourceUrl);
else foreach(AbstractResource* r, m_resources) {
if(r->name().contains(filter.search, Qt::CaseInsensitive) || r->comment().contains(filter.search, Qt::CaseInsensitive))
ret += r;
}
......
......@@ -183,3 +183,8 @@ void DummyResource::invokeApplication() const
QDesktopServices d;
d.openUrl(QUrl(QStringLiteral("https://projects.kde.org/projects/extragear/sysadmin/muon")));
}
QUrl DummyResource::url() const
{
return QUrl(QLatin1String("dummy://") + packageName().replace(QLatin1Char(' '), QLatin1Char('.')));
}
......@@ -52,6 +52,7 @@ public:
void invokeApplication() const override;
void fetchChangelog() override;
void fetchScreenshots() override;
QUrl url() const override;
void setState(State state);
void setSize(int size) { m_size = size; }
void setAddons(const AddonList& addons);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment