on xenial help sign in
Merge drop-filtergrid.
b334d19Michał Sawicz
tests/autopilot/unity8/shell/emulators/dash.py+7−4
@@ -18,6 +18,7 @@
18#
18#
19
19
20import logging
20import logging
21+import ubuntuuitoolkit
21
22
22from unity8.shell import emulators
23from unity8.shell import emulators
23
24
@@ -151,6 +152,10 @@ class Dash(emulators.UnityEmulatorBase):
151 return None
152 return None
152
153
153
154
155+class ListViewWithPageHeader(ubuntuuitoolkit.QQuickFlickable):
156+ pass
157+
158+
154class GenericScopeView(emulators.UnityEmulatorBase):
159class GenericScopeView(emulators.UnityEmulatorBase):
155 """Autopilot emulator for generic scopes."""
160 """Autopilot emulator for generic scopes."""
156
161
@@ -196,12 +201,10 @@ class DashApps(GenericScopeView):
196 category_element = self._get_category_element(category)
201 category_element = self._get_category_element(category)
197 application_cards = category_element.select_many('AbstractButton')
202 application_cards = category_element.select_many('AbstractButton')
198
203
199− # sort by y, x, filter those out of view
200− categoryBottom = category_element.globalRect.y \
201− + category_element.height
202 application_cards = sorted(
204 application_cards = sorted(
203 (card for card in application_cards
205 (card for card in application_cards
204− if card.globalRect.y < categoryBottom),
206+ if card.globalRect.y
207+ < category_element.globalRect.y + category_element.height),
205 key=lambda card: (card.globalRect.y, card.globalRect.x))
208 key=lambda card: (card.globalRect.y, card.globalRect.x))
206
209
207 result = []
210 result = []
tests/autopilot/unity8/shell/tests/test_emulators.py+10
@@ -16,6 +16,7 @@
16# You should have received a copy of the GNU General Public License
16# You should have received a copy of the GNU General Public License
17# along with this program. If not, see <http://www.gnu.org/licenses/>.
17# along with this program. If not, see <http://www.gnu.org/licenses/>.
18#
18#
19+from unity8.shell.emulators.dash import ListViewWithPageHeader
19
20
20"""Tests for the Dash autopilot emulators.
21"""Tests for the Dash autopilot emulators.
21
22
@@ -182,9 +183,18 @@ class DashAppsEmulatorTestCase(DashBaseTestCase):
182
183
183 def test_get_applications_should_return_correct_applications(self):
184 def test_get_applications_should_return_correct_applications(self):
184 category = '2'
185 category = '2'
186+ category_element = self.applications_scope._get_category_element(
187+ category)
188+ list_view = self.dash.get_scope('clickscope')\
189+ .select_single(ListViewWithPageHeader)
185 expected_apps_count = self._get_number_of_application_slots(category)
190 expected_apps_count = self._get_number_of_application_slots(category)
186 expected_applications = self.available_applications[
191 expected_applications = self.available_applications[
187 :expected_apps_count]
192 :expected_apps_count]
193+ x_center = list_view.globalRect.x + list_view.width / 2
194+ y_center = list_view.globalRect.y + list_view.height / 2
195+ y_diff = category_element.y - list_view.height + category_element.height
196+ list_view._slow_drag(x_center, x_center,
197+ y_center, y_center - y_diff)
188 applications = self.applications_scope.get_applications(category)
198 applications = self.applications_scope.get_applications(category)
189 self.assertEqual(expected_applications, applications)
199 self.assertEqual(expected_applications, applications)
190
200