on xenial help sign in
Added test for persistent search history.
a4325c3Nicolas d'Offay
tests/qmltests/Dash/tst_DashContent.qml+15−2
@@ -26,8 +26,6 @@ Item {
26 width: units.gu(40)
26 width: units.gu(40)
27 height: units.gu(80)
27 height: units.gu(80)
28
28
29− property ListModel searchHistory: ListModel {}
30−
31 property var scopeStatus: {
29 property var scopeStatus: {
32 'MockScope1': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
30 'MockScope1': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
33 'MockScope2': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
31 'MockScope2': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
@@ -48,6 +46,7 @@ Item {
48 scopes : scopesModel
46 scopes : scopesModel
49
47
50 scopeMapper : scopeDelegateMapper
48 scopeMapper : scopeDelegateMapper
49+ searchHistory: ListModel {}
51 }
50 }
52
51
53 ScopeDelegateMapper {
52 ScopeDelegateMapper {
@@ -229,5 +228,19 @@ Item {
229 tryCompare(scopesModel.get(1), "isActive", data.active1);
228 tryCompare(scopesModel.get(1), "isActive", data.active1);
230 tryCompare(scopesModel.get(2), "isActive", data.active2);
229 tryCompare(scopesModel.get(2), "isActive", data.active2);
231 }
230 }
231+
232+ function test_persistant_search_history() {
233+ dashContent.setCurrentScopeAtIndex(0, true, false);
234+
235+ dashContent.searchHistory.append({"test": "test0"});
236+ dashContent.searchHistory.append({"test": "test1"});
237+ dashContent.searchHistory.append({"test": "test2"});
238+
239+ dashContent.setCurrentScopeAtIndex(0, true, false);
240+
241+ compare(dashContent.searchHistory.get(0).test, "test0", "First search entry differs.");
242+ compare(dashContent.searchHistory.get(1).test, "test1", "Second search entry differs.");
243+ compare(dashContent.searchHistory.get(2).test, "test2", "Third search entry differs.");
244+ }
232 }
245 }
233}
246}