on xenial help sign in
Remove dependencies on clickscope.

Approved by: Albert Astals Cid, Unity8 CI Bot

commit33c4228551367d2c51cc60d3cbf77fbd9add239f authorRodney Dawes <rodney.dawes@canonical.com> dateTue 31 Jan 2017, 14:40 (10 years ago) parent8a02dc22305fb3
11 files changed+16−172
debian/control−2 qml/Dash/CardGrid.qml+2−3 qml/Dash/CardTool.qml+2−26 qml/Dash/GenericScopeView.qml+1−1 qml/Dash/ScopesListCategory.qml+1−1 tests/autopilot/unity8/dash.py+1−17 tests/autopilot/unity8/shell/tests/test_helpers.py−49 tests/mocks/Unity/fake_scopes.cpp−1 tests/qmltests/Dash/tst_Dash.qml+1−48 tests/qmltests/Dash/tst_DashContent.qml+3−3 tests/qmltests/Dash/tst_GenericScopeView.qml+5−21
debian/control−2
@@ -141,7 +141,6 @@ Depends: dmz-cursor-theme,
141141Recommends: indicator-keyboard,
142142 indicator-session,
143143 unity-greeter-session-broadcast,
144− unity-scope-click,
145144Suggests: unity-scope-mediascanner2,
146145Breaks: indicator-network (<< 0.5.1+14.10.20141014),
147146 ubuntu-touch-session (<< 0.107),
@@ -191,7 +190,6 @@ Depends: autopilot-qt5 (>= 1.4),
191190 python3-gi,
192191 qttestability-autopilot (>= 1.4),
193192 ubuntu-ui-toolkit-autopilot (>= 1.3.2030),
194− unity-scope-click,
195193 unity8 (= ${source:Version}),
196194 unity8-tests (= ${source:Version}),
197195 url-dispatcher-tools,
qml/Dash/CardGrid.qml+2−3
@@ -25,8 +25,7 @@ DashRenderer {
2525 return cardTool.template["collapsed-rows"];
2626 }
2727
28− // ↓ This is the ubuntu store icon
29− readonly property string backgroundShapeStyle: cardTool.isAppLikeScope && !cardTool.isAppLikeScopeAppCategory ? "shadow" : "flat"
28+ readonly property string backgroundShapeStyle: "flat"
3029
3130 expandedHeight: grid.totalContentHeight
3231 collapsedHeight: Math.min(grid.contentHeightForRows(collapsedRows, grid.cellHeight), expandedHeight)
@@ -46,7 +45,7 @@ DashRenderer {
4645 ResponsiveGridView {
4746 id: grid
4847 anchors.fill: parent
49− minimumHorizontalSpacing: (cardTool.isAppLikeScopeAppCategory && cardTool.isWideView) ? units.gu(5) : units.gu(1)
48+ minimumHorizontalSpacing: cardTool.isWideView ? units.gu(5) : units.gu(1)
5049 delegateWidth: cardTool.cardWidth
5150 delegateHeight: cardTool.cardHeight
5251 verticalSpacing: units.gu(1)
qml/Dash/CardTool.qml+2−26
@@ -77,16 +77,8 @@ Item {
7777 return layout;
7878 }
7979
80− readonly property bool isAppLikeScope: scopeId === "clickscope" || scopeId === "libertine-scope.ubuntu_libertine-scope"
81− readonly property bool isAppLikeScopeAppCategory: ((scopeId === "clickscope" && (categoryId === "predefined" || categoryId === "local"))
82− || (scopeId === "libertine-scope.ubuntu_libertine-scope" && categoryId !== "hint"))
83−
8480 readonly property string artShapeStyle: {
85− if (isAppLikeScope) {
86− return isAppLikeScopeAppCategory ? "icon" : "flat";
87− } else {
88− return categoryLayout === "carousel" ? "shadow" : "flat"
89− }
81+ return categoryLayout === "carousel" ? "shadow" : "flat"
9082 }
9183
9284 // FIXME ? This seems like it should not be needed, but on Qt 5.4 + phone
@@ -121,18 +113,6 @@ Item {
121113 If -1, should use implicit width of the actual card.
122114 */
123115 readonly property real cardWidth: {
124− if (isAppLikeScopeAppCategory) {
125− if (!isNarrowView) {
126− if (isWideView) {
127− return units.gu(11);
128− } else {
129− return units.gu(10);
130− }
131− } else {
132− return units.gu(12);
133− }
134− }
135−
136116 switch (categoryLayout) {
137117 case "grid":
138118 case "vertical-journal":
@@ -191,11 +171,7 @@ Item {
191171 readonly property int headerHeight: cardLoader.item ? cardLoader.item.headerHeight : 0
192172
193173 readonly property size artShapeSize: {
194− if (isAppLikeScopeAppCategory) {
195− return Qt.size(units.gu(8), units.gu(7.5));
196− } else {
197− return cardLoader.item ? cardLoader.item.artShapeSize : Qt.size(0, 0)
198− }
174+ return cardLoader.item ? cardLoader.item.artShapeSize : Qt.size(0, 0)
199175 }
200176
201177 QtObject {
qml/Dash/GenericScopeView.qml+1−1
@@ -582,7 +582,7 @@ FocusScope {
582582 showSignatureLine: !showBackButton
583583 searchEntryEnabled: true
584584 settingsEnabled: scopeView.scope && scopeView.scope.settings && scopeView.scope.settings.count > 0 || false
585− favoriteEnabled: scopeView.scope && scopeView.scope.id !== "clickscope"
585+ favoriteEnabled: scopeView.scope
586586 favorite: scopeView.scope && scopeView.scope.favorite
587587 navigationTag: scopeView.scope ? scopeView.scope.primaryNavigationTag : ""
588588 scopeStyle: scopeView.scopeStyle
qml/Dash/ScopesListCategory.qml+1−1
@@ -89,7 +89,7 @@ Item {
8989 icon: model.art || model.mascot || ""
9090 text: model.title || ""
9191 subtext: model.subtitle || ""
92− showStar: model.scopeId !== "clickscope" && (root.isFavoritesFeed || root.isAlsoInstalled)
92+ showStar: root.isFavoritesFeed || root.isAlsoInstalled
9393 isFavorite: root.isFavoritesFeed
9494
9595 hideChildren: dragItem.loaderToShrink == loader
tests/autopilot/unity8/dash.py+1−17
@@ -48,23 +48,7 @@ class Dash(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
4848 self.dash_content_list = self.wait_select_single(
4949 'QQuickListView', objectName='dashContentList')
5050
51− def get_applications_grid(self):
52− get_grid = self.get_scope('clickscope').wait_select_single(
53− 'CardGrid', objectName='local')
54− return get_grid
55−
56− def get_application_icon(self, text):
57− """Returns a 'Tile' icon that has the text 'text' from the application
58− grid.
59−
60− :param text: String containing the text of the icon to search for.
61−
62− """
63− app_grid = self.get_applications_grid()
64− resp_grid = app_grid.wait_select_single('ResponsiveGridView')
65− return resp_grid.select_single('Tile', text=text)
66−
67− def get_scope(self, scope_name='clickscope'):
51+ def get_scope(self, scope_name):
6852 return self.dash_content_list.wait_select_single(
6953 'QQuickLoader', scopeId=scope_name)
7054
tests/autopilot/unity8/shell/tests/test_helpers.py−49
@@ -99,12 +99,6 @@ class DashHelperTestCase(tests.DashBaseTestCase):
9999 self._assert_scope_is_opened(scope, scope_id)
100100 self.assertIsInstance(scope, dash_helpers.GenericScopeView)
101101
102− def test_open_applications_scope(self):
103− scope_id = 'clickscope'
104− scope = self.dash.open_scope(scope_id)
105− self._assert_scope_is_opened(scope, scope_id)
106− self.assertIsInstance(scope, dash_helpers.GenericScopeView)
107−
108102
109103class GenericScopeViewHelperTestCase(tests.DashBaseTestCase):
110104
@@ -122,46 +116,3 @@ class GenericScopeViewHelperTestCase(tests.DashBaseTestCase):
122116 """Open an item that requires swiping to make it visible."""
123117 preview = self.generic_scope.open_preview('2', 'Title.2.0')
124118 self.assertIsInstance(preview, dash_helpers.Preview)
125−
126−
127−class DashAppsHelperTestCase(tests.DashBaseTestCase):
128−
129− available_applications = [
130− 'Title.2.0', 'Title.2.1', 'Title.2.2', 'Title.2.3', 'Title.2.4',
131− 'Title.2.5', 'Title.2.6', 'Title.2.7', 'Title.2.8', 'Title.2.9',
132− 'Title.2.10', 'Title.2.11', 'Title.2.12', 'Title.2.13', 'Title.2.14',
133− 'Title.2.15', 'Title.2.16', 'Title.2.17', 'Title.2.18']
134−
135− def setUp(self):
136− # Set up the fake scopes before launching unity.
137− self.useFixture(fixture_setup.FakeScopes())
138− super().setUp()
139− self.applications_scope = self.dash.open_scope('clickscope')
140−
141− def test_get_applications_should_return_correct_applications(self):
142− category = '2'
143− category_element = self.applications_scope._get_category_element(
144− category)
145− list_view = self.dash.get_scope('clickscope')\
146− .select_single(dash_helpers.ListViewWithPageHeader)
147− expected_apps_count = self._get_number_of_application_slots(category)
148− expected_applications = self.available_applications[
149− :expected_apps_count]
150− x_center = list_view.globalRect.x + list_view.width / 2
151− y_center = list_view.globalRect.y + list_view.height / 2
152− y_diff = (
153− category_element.y - list_view.height + category_element.height
154− )
155− list_view._slow_drag(x_center, x_center, y_center, y_center - y_diff)
156− applications = self.applications_scope.get_applications(category)
157− self.assertEqual(expected_applications, applications)
158−
159− def _get_number_of_application_slots(self, category):
160− category_element = self.applications_scope._get_category_element(
161− category)
162− cardgrid = category_element.select_single('CardGrid')
163− if (category_element.expanded):
164− return cardgrid.select_single('QQuickGridView').count
165− else:
166− return cardgrid.collapsedRows \
167− * cardgrid.select_single('ResponsiveGridView').columns
tests/mocks/Unity/fake_scopes.cpp−1
@@ -60,7 +60,6 @@ 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("libertine-scope.ubuntu_libertine-scope", "Libertine", true, this));
6463
6564 Scope *longNavigationScope = new Scope(
6665 "LongPrimaryNavigation", "LongPrimaryNavigation", true, this, 1, false,
tests/qmltests/Dash/tst_Dash.qml+1−48
@@ -58,7 +58,7 @@ Item {
5858 tryCompare(dashContentList, "count", 0);
5959 scopes.load();
6060 tryCompare(dashContentList, "currentIndex", 0);
61− tryCompare(dashContentList, "count", 28);
61+ tryCompare(dashContentList, "count", 27);
6262 tryCompare(scopes, "loaded", true);
6363 tryCompareFunction(function() {
6464 var mockScope1Loader = findChild(dash, "scopeLoader0");
@@ -192,24 +192,6 @@ Item {
192192 tryCompare(expandingItem, "visible", false)
193193 }
194194
195− function test_manage_dash_clickscope_unfavoritable() {
196− open_manage_dash();
197−
198− // Click scope star area is not visible (i.e. can't be unfavorited)
199− var favScopesListCategoryList = findChild(findChild(dash, "scopesListCategoryfavorites"), "scopesListCategoryInnerList");
200− var clickScope = findChild(favScopesListCategoryList, "delegateclickscope");
201− var starArea = findChild(clickScope, "starArea");
202− compare(starArea.visible, false);
203−
204− // Go back
205− var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
206− var scopesList = findChild(dash, "scopesList");
207− var scopesListPageHeader = findChild(scopesList, "pageHeader");
208− var backButton = findChild(scopesListPageHeader, "innerPageHeader").leadingActionBar;
209− mouseClick(backButton);
210− tryCompare(bottomEdgeController, "progress", 0);
211− }
212−
213195 function test_manage_dash_select_same_favorite() {
214196 open_manage_dash();
215197
@@ -627,35 +609,6 @@ Item {
627609 tryCompare(dashContent, "x", 0);
628610 }
629611
630− function test_cardIconStyle()
631− {
632− dash.setCurrentScope("clickscope");
633− var dashContent = findChild(dash, "dashContent");
634− tryCompare(dashContent.currentScope, "id", "clickscope");
635−
636− scrollToCategory("dashCategorypredefined");
637− tryCompareFunction(function() {
638− var tile = getCategoryDelegate("predefined", 2);
639− var proportionalShape = findChildsByType(tile, "UCProportionalShape");
640− return proportionalShape.length === 1;
641− },
642− true
643− );
644−
645− dash.setCurrentScope("libertine-scope.ubuntu_libertine-scope");
646− var dashContent = findChild(dash, "dashContent");
647− tryCompare(dashContent.currentScope, "id", "libertine-scope.ubuntu_libertine-scope");
648−
649− scrollToCategory("dashCategory2");
650− tryCompareFunction(function() {
651− var tile = getCategoryDelegate("2", 2);
652− var proportionalShape = findChildsByType(tile, "UCProportionalShape");
653− return proportionalShape.length === 1;
654− },
655− true
656− );
657− }
658−
659612 function test_tempScopeItemXOnResize()
660613 {
661614 // Go to a temp scope
tests/qmltests/Dash/tst_DashContent.qml+3−3
@@ -70,7 +70,7 @@ Item {
7070 function loadScopes() {
7171 scopeLoadedSpy.clear();
7272 scopesModel.load();
73− tryCompare(scopeLoadedSpy, "count", 28, 15000);
73+ tryCompare(scopeLoadedSpy, "count", 27, 15000);
7474 tryCompare(scopesModel, "loaded", true);
7575 tryCompareFunction(function() {
7676 var mockScope1Loader = findChild(shell, "scopeLoader0");
@@ -120,11 +120,11 @@ Item {
120120 scopesModel.clear();
121121 compare(dashContentList.count, 0, "DashContent should have 0 items after clearing");
122122 // pretend we're running after a model reset
123− dashContentList.currentIndex = 27;
123+ dashContentList.currentIndex = 26;
124124
125125 loadScopes();
126126
127− compare(dashContentList.count, 28);
127+ compare(dashContentList.count, 27);
128128 verify(dashContentList.currentIndex >= 0 && dashContentList.currentIndex < dashContentList.count);
129129 }
130130
tests/qmltests/Dash/tst_GenericScopeView.qml+5−21
@@ -84,6 +84,7 @@ Item {
8484 genericScopeView.scope = scopes.getScope(2);
8585 genericScopeView.isCurrent = true;
8686 shell.width = units.gu(120);
87+ shell.height = units.gu(100);
8788 genericScopeView.categoryView.positionAtBeginning();
8889 waitForRendering(genericScopeView.categoryView);
8990 }
@@ -195,6 +196,8 @@ Item {
195196 }
196197
197198 function test_expand_collapse() {
199+ shell.height = units.gu(120);
200+
198201 tryCompareFunction(function() { return findChild(genericScopeView, "dashSectionHeader0", 0 /* timeout */) != null; }, true);
199202
200203 var category = findChild(genericScopeView, "dashCategory0")
@@ -531,6 +534,8 @@ Item {
531534 }
532535
533536 function test_seeAllTwoCategoriesScenario2() {
537+ shell.height = units.gu(120);
538+
534539 mockScope.setId("mockScope");
535540 mockScope.setName("Mock Scope");
536541 mockScope.isActive = true;
@@ -587,7 +592,6 @@ Item {
587592 var innerHeader = findChild(header, "innerPageHeader");
588593 verify(innerHeader, "Could not find the inner header");
589594
590− expectFail("Apps", "Click scope should not have a favorite button");
591595 var favoriteAction = findChild(innerHeader, "favorite_button");
592596 verify(favoriteAction, "Could not find the favorite action.");
593597 mouseClick(favoriteAction);
@@ -697,26 +701,6 @@ Item {
697701 var shape = findChildsByType(artShapeLoader, "UCUbuntuShape");
698702 compare(shape.borderSource, undefined);
699703 }
700−
701− function test_clickScopeSizing() {
702− genericScopeView.scope = scopes.getScopeFromAll("clickscope");
703− waitForRendering(genericScopeView);
704−
705− var categoryListView = findChild(genericScopeView, "categoryListView");
706− waitForRendering(categoryListView);
707−
708− var categorypredefined = findChild(categoryListView, "dashCategorypredefined");
709− waitForRendering(categorypredefined);
710−
711− var cardTool = findChild(categorypredefined, "cardTool");
712−
713− compare(cardTool.cardWidth, units.gu(11));
714− shell.width = units.gu(46);
715− waitForRendering(genericScopeView);
716− compare(cardTool.cardWidth, units.gu(10));
717−
718− shell.width = units.gu(120)
719− }
720704 }
721705 }
722706}