on xenial help sign in
Add test for the processing indicator.
commitb9a61ed1e76fff8a861e5a9021d9897ab1ab431d authorMichał Sawicz <michal.sawicz@canonical.com> dateTue 29 Jul 2014, 15:24 (12 years ago) parent9339209
3 files changed+23−29
qml/Dash/Dash.qml+2 tests/qmltests/Components/tst_PageHeader.qml−23 tests/qmltests/Dash/tst_Dash.qml+21−6
qml/Dash/Dash.qml+2
@@ -129,6 +129,7 @@ Showable {
129129
130130 Rectangle {
131131 id: indicator
132+ objectName: "processingIndicator"
132133 anchors {
133134 left: parent.left
134135 right: parent.right
@@ -137,6 +138,7 @@ Showable {
137138 clip: true
138139 height: units.dp(3)
139140 color: scopeStyle.backgroundLuminance > 0.7 ? "#50000000" : "#50ffffff"
141+ opacity: 0
140142 visible: opacity > 0
141143
142144 readonly property bool processing: dashContent.processing || scopeItem.processing
tests/qmltests/Components/tst_PageHeader.qml−23
@@ -112,29 +112,6 @@ Item {
112112 compare(pageHeader.searchHistory.get(0).query, "humppa4")
113113 }
114114
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−
138115 function test_titleImage() {
139116
140117 var titleImage = findChild(pageHeader, "titleImage");
tests/qmltests/Dash/tst_Dash.qml+21−6
@@ -45,12 +45,8 @@ Item {
4545 name: "Dash"
4646 when: windowShown
4747
48− property var scopes
49−
50− Component.onCompleted: {
51− var dashContent = findChild(dash, "dashContent");
52− scopes = dashContent.scopes;
53− }
48+ readonly property Item dashContent: findChild(dash, "dashContent");
49+ readonly property var scopes: dashContent.scopes
5450
5551 function init() {
5652 // clear and reload the scopes.
@@ -91,5 +87,24 @@ Item {
9187 verify(dashContentList != undefined);
9288 tryCompare(dashContentList, "currentIndex", data.visualIndex);
9389 }
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+ }
94109 }
95110}