on xenial help sign in
Merge see-all-expansion.
commit3132c962a29d41568388152cd92e402f1dae31ff authorMichał Sawicz <michal.sawicz@canonical.com> dateThu 24 Jul 2014, 15:48 (12 years ago) parent67b140db334d19
2 files changed+18−5
tests/autopilot/unity8/shell/emulators/dash.py+8−5 tests/autopilot/unity8/shell/tests/test_emulators.py+10
tests/autopilot/unity8/shell/emulators/dash.py+8−5
@@ -18,6 +18,7 @@
1818#
1919
2020import logging
21+import ubuntuuitoolkit
2122
2223from unity8.shell import emulators
2324
@@ -151,6 +152,10 @@ class Dash(emulators.UnityEmulatorBase):
151152 return None
152153
153154
155+class ListViewWithPageHeader(ubuntuuitoolkit.QQuickFlickable):
156+ pass
157+
158+
154159class GenericScopeView(emulators.UnityEmulatorBase):
155160 """Autopilot emulator for generic scopes."""
156161
@@ -196,17 +201,15 @@ class DashApps(GenericScopeView):
196201 category_element = self._get_category_element(category)
197202 application_cards = category_element.select_many('AbstractButton')
198203
199− # sort by y, x, filter those out of view
200− categoryBottom = category_element.globalRect.y \
201− + category_element.height
202204 application_cards = sorted(
203205 (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),
205208 key=lambda card: (card.globalRect.y, card.globalRect.x))
206209
207210 result = []
208211 for card in application_cards:
209− if card.objectName != 'cardToolCard':
212+ if card.objectName not in ('cardToolCard', 'seeAll'):
210213 result.append(card.title)
211214 return result
212215
tests/autopilot/unity8/shell/tests/test_emulators.py+10
@@ -16,6 +16,7 @@
1616# You should have received a copy of the GNU General Public License
1717# along with this program. If not, see <http://www.gnu.org/licenses/>.
1818#
19+from unity8.shell.emulators.dash import ListViewWithPageHeader
1920
2021"""Tests for the Dash autopilot emulators.
2122
@@ -182,9 +183,18 @@ class DashAppsEmulatorTestCase(DashBaseTestCase):
182183
183184 def test_get_applications_should_return_correct_applications(self):
184185 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)
185190 expected_apps_count = self._get_number_of_application_slots(category)
186191 expected_applications = self.available_applications[
187192 :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)
188198 applications = self.applications_scope.get_applications(category)
189199 self.assertEqual(expected_applications, applications)
190200