on xenial help sign in
Add test for the processing indicator.
b9a61edMichał Sawicz
qml/Dash/Dash.qml+2
@@ -129,6 +129,7 @@ Showable {
129
129
130 Rectangle {
130 Rectangle {
131 id: indicator
131 id: indicator
132+ objectName: "processingIndicator"
132 anchors {
133 anchors {
133 left: parent.left
134 left: parent.left
134 right: parent.right
135 right: parent.right
@@ -137,6 +138,7 @@ Showable {
137 clip: true
138 clip: true
138 height: units.dp(3)
139 height: units.dp(3)
139 color: scopeStyle.backgroundLuminance > 0.7 ? "#50000000" : "#50ffffff"
140 color: scopeStyle.backgroundLuminance > 0.7 ? "#50000000" : "#50ffffff"
141+ opacity: 0
140 visible: opacity > 0
142 visible: opacity > 0
141
143
142 readonly property bool processing: dashContent.processing || scopeItem.processing
144 readonly property bool processing: dashContent.processing || scopeItem.processing
tests/qmltests/Components/tst_PageHeader.qml−23
@@ -112,29 +112,6 @@ Item {
112 compare(pageHeader.searchHistory.get(0).query, "humppa4")
112 compare(pageHeader.searchHistory.get(0).query, "humppa4")
113 }
113 }
114
114
115− function test_search_indicator() {
116− var searchIndicator = findChild(pageHeader, "searchIndicator")
117− var clearIcon = findChild(pageHeader, "clearIcon")
118−
119− pageHeader.triggerSearch()
120−
121− tryCompare(clearIcon, "visible", false)
122− pageHeader.searchQuery = "ubuntu"
123− tryCompare(clearIcon, "visible", true)
124−
125− pageHeader.searchInProgress = false
126− compare(searchIndicator.running, false, "Search indicator is running.")
127− tryCompare(clearIcon, "visible", true)
128−
129− pageHeader.searchInProgress = true
130− compare(searchIndicator.running, true, "Search indicator isn't running.")
131− tryCompare(clearIcon, "visible", false)
132−
133− pageHeader.searchInProgress = false;
134− compare(searchIndicator.running, false, "Search indicator is running.")
135− tryCompare(clearIcon, "visible", true)
136− }
137−
138 function test_titleImage() {
115 function test_titleImage() {
139
116
140 var titleImage = findChild(pageHeader, "titleImage");
117 var titleImage = findChild(pageHeader, "titleImage");
tests/qmltests/Dash/tst_Dash.qml+21−6
@@ -45,12 +45,8 @@ Item {
45 name: "Dash"
45 name: "Dash"
46 when: windowShown
46 when: windowShown
47
47
48− property var scopes
49−
50− Component.onCompleted: {
51− var dashContent = findChild(dash, "dashContent");
48+ readonly property Item dashContent: findChild(dash, "dashContent");
52− scopes = dashContent.scopes;
49+ readonly property var scopes: dashContent.scopes
53− }
54
50
55 function init() {
51 function init() {
56 // clear and reload the scopes.
52 // clear and reload the scopes.
@@ -91,5 +87,24 @@ Item {
91 verify(dashContentList != undefined);
87 verify(dashContentList != undefined);
92 tryCompare(dashContentList, "currentIndex", data.visualIndex);
88 tryCompare(dashContentList, "currentIndex", data.visualIndex);
93 }
89 }
90+
91+ function test_processing_indicator() {
92+ tryCompare(scopes, "loaded", true);
93+
94+ var processingIndicator = findChild(dash, "processingIndicator");
95+ verify(processingIndicator, "Can't find the processing indicator.");
96+
97+ verify(!processingIndicator.visible, "Processing indicator should be visible.");
98+
99+ tryCompareFunction(function() {
100+ return scopes.getScope(dashContent.currentIndex) != null;
101+ }, true);
102+ var currentScope = scopes.getScope(dashContent.currentIndex);
103+ verify(currentScope, "Can't find the current scope.");
104+
105+ currentScope.setSearchInProgress(true);
106+
107+ tryCompare(processingIndicator, "visible", true);
108+ }
94 }
109 }
95}
110}