on xenial help sign in
Add a test
commit1715f7eefd86245289ae77bfed766e822c217c34 authorJosh Arenson <joshua.arenson@canonical.com> dateThu 28 Apr 2016, 11:58 (10 years ago) parent0f6da63
3 files changed+49−3
qml/Dash/PageHeaderExtraPanel.qml+3 tests/mocks/Unity/fake_scopes.cpp+6−2 tests/qmltests/Dash/tst_Dash.qml+40−1
qml/Dash/PageHeaderExtraPanel.qml+3
@@ -147,6 +147,7 @@ Item {
147147
148148 Flickable {
149149 id: primaryFilterContainer
150+ objectName: "primaryFilterContainer"
150151
151152 readonly property alias active: primaryFilter.active
152153
@@ -173,6 +174,8 @@ Item {
173174
174175 Filters.FilterWidgetFactory {
175176 id: primaryFilter
177+ objectName: "primaryFilter"
178+
176179 active: scope && !scope.hasNavigation
177180
178181 anchors.fill: parent
tests/mocks/Unity/fake_scopes.cpp+6−2
@@ -60,8 +60,12 @@ void Scopes::updateScopes()
6060 addScope(new Scope("MockScope7", "MS7", false, this));
6161 addScope(new Scope("MockScope8", "MS8", false, this));
6262 addScope(new Scope("MockScope9", "MS9", false, this));
63− addScope(new Scope("MockScope10", "MS10", true, this, 1, false,
64− QStringList() << "Meat" << "Vegetables" << "BBQ" << "Burritos" << "Pasta" << "Pancakes" << "Seafood" << "Soup" << "Bugs" << "Pudding" << "Chocolate" << "Gluten-Free" << "Hamburgers" << "Pho" << "Panang Curry" << "Lumpia" << "Sushi"));
63+ addScope(new Scope("LongPrimaryNavigation", "LongPrimaryNavigation",
64+ true, this, 1, false, QStringList() << "Meat" << "Vegetables" << "BBQ"
65+ << "Burritos" << "Pasta" << "Pancakes" << "Seafood" << "Soup"
66+ << "Bugs" << "Pudding" << "Chocolate" << "Gluten-Free" << "Hamburgers"
67+ << "Pho" << "Panang Curry" << "Lumpia" << "Sushi"));
68+
6569 addScope(new Scope("NullPreviewScope", "NPS", false, this, 1, true));
6670 m_scopesOverview = new ScopesOverview(this);
6771
tests/qmltests/Dash/tst_Dash.qml+40−1
@@ -18,6 +18,7 @@ import QtQuick 2.4
1818import QtTest 1.0
1919import "../../../qml/Dash"
2020import Ubuntu.Components 1.3
21+import Unity 0.2 // Access the Filters enum
2122import Unity.Test 0.1 as UT
2223
2324Item {
@@ -57,7 +58,7 @@ Item {
5758 tryCompare(dashContentList, "count", 0);
5859 scopes.load();
5960 tryCompare(dashContentList, "currentIndex", 0);
60− tryCompare(dashContentList, "count", 6);
61+ tryCompare(dashContentList, "count", 7);
6162 tryCompare(scopes, "loaded", true);
6263 tryCompareFunction(function() {
6364 var mockScope1Loader = findChild(dash, "scopeLoader0");
@@ -106,6 +107,44 @@ Item {
106107 mouseClick(tile);
107108 }
108109
110+ function test_longNavigationFilterList() {
111+ // Select the scope with long navigation
112+ dash.setCurrentScope("LongPrimaryNavigation")
113+ var dashContent = findChild(dash, "dashContent")
114+ tryCompare(dashContent.currentScope, "id", "LongPrimaryNavigation")
115+
116+ var dashContentList = findChild(dashContent, "dashContentList")
117+ var searchButton = findChild(dashContentList.currentItem, "search_button")
118+ var extraPanel = findChild(dashContentList.currentItem, "peExtraPanel")
119+ tryCompare(extraPanel, "visible", false)
120+
121+ // Open the primaryNavigationFilter
122+ dashContent.currentScope.setHasNavigation(false)
123+ mouseClick(searchButton)
124+ tryCompare(extraPanel, "visible", true)
125+
126+ var primaryFilterContainer = findChild(extraPanel, "primaryFilterContainer")
127+ verify(primaryFilterContainer)
128+
129+ var primaryFilter = findChild(extraPanel, "primaryFilter")
130+ verify(primaryFilter)
131+ tryCompare(primaryFilter, "widgetType", Filters.OptionSelectorFilter)
132+
133+ var genericScopeView = dashContentList.currentItem;
134+ var categoryListView = findChild(genericScopeView, "categoryListView")
135+ verify(categoryListView)
136+ tryCompare(categoryListView, "atYBeginning", true)
137+
138+ var expandingItem = findChild(primaryFilter, "expandingItem")
139+ verify(expandingItem)
140+ expandingItem.expanded = true
141+
142+ wait(250) // FIXME: Wait for the expanding animation to complete
143+ flickToYEnd(primaryFilterContainer)
144+
145+ tryCompare(categoryListView, "atYBeginning", true)
146+ }
147+
109148 function test_manage_dash_clickscope_unfavoritable() {
110149 // Show the manage dash
111150 touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, units.gu(2));