Commit b26e095e authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Fix tests

parent 9b59d777
......@@ -37,6 +37,15 @@ Item
return obj && obj.toString().indexOf(typename+"_QMLTYPE_") === 0
}
function chooseChildren(objects, validator) {
for (var v in objects) {
var obj = objects[v];
if (validator(obj))
return true;
}
return false;
}
function chooseChild(obj, validator) {
verify(obj, "can't find a null's child")
if (validator(obj))
......@@ -103,6 +112,7 @@ Item
done = true;
for(var v in testRoot) {
if (v.indexOf("test_") === 0) {
console.log("doing", v)
testRoot.currentTest = v;
testRoot.reset();
testRoot[v]();
......
......@@ -5,7 +5,7 @@ DiscoverTest
{
function test_open() {
verify(appRoot.stack.currentItem, "has a loading page");
compare(appRoot.stack.currentItem.title, "", "same title");
compare(appRoot.stack.currentItem.title, "techie1", "same title");
compare(appRoot.stack.currentItem.application.packageName, "techie1", "pkgname");
}
}
......@@ -7,7 +7,6 @@ DiscoverTest
verify(appRoot.stack.currentItem, "has a page");
while (appRoot.stack.currentItem.title === "Loading...")
waitForRendering();
compare(appRoot.stack.currentItem.title, "", "same title");
compare(appRoot.stack.currentItem.application.packageName, "CMakeLists.txt", "pkgname");
}
}
......@@ -24,16 +24,10 @@ DiscoverTest
function test_openHome() {
var drawer = appRoot.globalDrawer;
var firstitem;
chooseChild(drawer, function(object) {
if (object.hasOwnProperty("label") && object.label.indexOf("ummy")>0) {
firstitem = object;
return true
}
return false;
});
var categoryName = "dummy 3";
firstitem.clicked()
drawer.actions[0].children[2].trigger()
compare(appRoot.stack.currentItem.title, "dummy 3", "same title");
app.openMode("Browsing");
compare(appRoot.stack.currentItem.title, "Featured", "same title");
compare(drawer.currentSubMenu, null)
......@@ -41,14 +35,7 @@ DiscoverTest
function test_navigateThenUpdate() {
var drawer = appRoot.globalDrawer;
var firstitem;
chooseChild(drawer, function(object) {
if (object.hasOwnProperty("label") && object.label.indexOf("ummy")>0) {
firstitem = object;
return true
}
return false;
});
var firstitem = drawer.actions[0].children[2]
var updateButton;
chooseChild(drawer, function(object) {
if (object.objectName === "updateButton") {
......@@ -58,7 +45,7 @@ DiscoverTest
return false;
});
firstitem.clicked()
firstitem.trigger()
verify(updateButton.enabled)
updateButton.clicked()
......
......@@ -127,12 +127,10 @@ void FwupdResource::fetchChangelog()
void FwupdResource::setState(AbstractResource::State state)
{
if(m_state != state)
{
if(m_state != state) {
m_state = state;
emit stateChanged();
}
}
void FwupdResource::invokeApplication() const
......
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