Warning, /plasma/discover/discover/autotests/toplevels.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick 2.0 0002 import org.kde.discover.app 1.0 0003 import QtTest 1.1 0004 0005 DiscoverTest 0006 { 0007 onReset: { 0008 appRoot.currentTopLevel = appRoot.topBrowsingComp 0009 } 0010 0011 function test_openCategory() { 0012 var categoryName = "dummy 3"; 0013 app.openCategory(categoryName); 0014 verify(appRoot.stack.currentItem, "has a page"); 0015 compare(appRoot.stack.currentItem.title, categoryName, "same title"); 0016 verify(waitForRendering()) 0017 0018 categoryName = "dummy 4"; 0019 app.openCategory(categoryName); 0020 verify(appRoot.stack.currentItem, "has a page"); 0021 compare(appRoot.stack.currentItem.title, categoryName, "same title"); 0022 verify(waitForRendering()) 0023 } 0024 0025 function test_openHome() { 0026 var drawer = appRoot.globalDrawer; 0027 drawer.actions[0].children[2].trigger() 0028 compare(appRoot.stack.currentItem.title, "dummy 3", "same title"); 0029 0030 app.openMode("Browsing"); 0031 0032 compare(appRoot.stack.currentItem.title, "Featured", "same title"); 0033 compare(drawer.currentSubMenu, null) 0034 } 0035 0036 function test_navigateThenUpdate() { 0037 var drawer = appRoot.globalDrawer; 0038 var firstitem = drawer.actions[0].children[2] 0039 var updateButton; 0040 chooseChild(drawer, function(object) { 0041 if (object.objectName === "updateButton") { 0042 updateButton = object; 0043 return true 0044 } 0045 return false; 0046 }); 0047 0048 firstitem.trigger() 0049 verify(updateButton.enabled) 0050 updateButton.clicked() 0051 0052 compare(appRoot.currentTopLevel, appRoot.topUpdateComp, "correct component, updates"); 0053 } 0054 0055 function test_update() { 0056 app.openMode("Update"); 0057 0058 var updatePage = appRoot.stack.currentItem; 0059 compare(typeName(updatePage), "UpdatesPage") 0060 compare(updatePage.state, "has-updates", "to update") 0061 var action = updatePage.actions.main 0062 verify(action); 0063 action.triggered(updatePage); 0064 compare(updatePage.state, "progressing", "updating") 0065 0066 //make sure the window doesn't close while updating 0067 verify(appRoot.visible); 0068 verify(waitForRendering()) 0069 appRoot.close() 0070 verify(appRoot.visible); 0071 0072 while(updatePage.state !== "now-uptodate") 0073 waitForSignal(updatePage, "stateChanged") 0074 compare(ResourcesModel.updatesCount, 0, "should be up to date") 0075 } 0076 0077 function test_search() { 0078 app.openMode("Browsing"); 0079 app.openSearch("cocacola") 0080 while(!isType(appRoot.stack.currentItem, "ApplicationsListPage")) 0081 verify(waitForSignal(appRoot.stack, "currentItemChanged")) 0082 var listPage = appRoot.stack.currentItem 0083 while(listPage.count>0) 0084 verify(waitForSignal(listPage, "countChanged")) 0085 compare(listPage.count, 0) 0086 compare(listPage.search, "cocacola") 0087 app.openSearch("dummy") 0088 listPage = appRoot.stack.currentItem 0089 compare(listPage.search, "dummy") 0090 // compare(listPage.count, ResourcesModel.rowCount()/2) 0091 } 0092 0093 function test_modes() { 0094 app.openMode("Browsing"); 0095 compare(appRoot.currentTopLevel, appRoot.topBrowsingComp, "correct component, browsing"); 0096 verify(waitForRendering()) 0097 0098 app.openMode("Installed"); 0099 compare(appRoot.currentTopLevel, appRoot.topInstalledComp, "correct component, installed"); 0100 verify(waitForRendering()) 0101 0102 app.openMode("Update"); 0103 compare(appRoot.currentTopLevel, appRoot.topUpdateComp, "correct component, updates"); 0104 verify(waitForRendering()) 0105 0106 app.openMode("Sources"); 0107 compare(appRoot.currentTopLevel, appRoot.topSourcesComp, "correct component, sources"); 0108 verify(waitForRendering()) 0109 } 0110 }