on xenial help sign in
Updated DashEmulatorTestCase.
40453edLeo Arias
tests/autopilot/unity8/shell/emulators/dash.py+3−4
@@ -59,14 +59,13 @@ class Dash(emulators.UnityEmulatorBase):
59 'QQuickLoader', scopeId=scope_name)
59 'QQuickLoader', scopeId=scope_name)
60
60
61 @autopilot_logging.log_action(logger.info)
61 @autopilot_logging.log_action(logger.info)
62− def open_scope(self, scope_name):
62+ def open_scope(self, scope_id):
63 """Open a dash scope.
63 """Open a dash scope.
64
64
65− :parameter scope_name: The name of the scope.
65+ :parameter scope_id: The id of the scope.
66 :return: The scope.
66 :return: The scope.
67
67
68 """
68 """
69− scope_id = "%s.scope" % scope_name
70 scope_loader = self._get_scope_loader(scope_id)
69 scope_loader = self._get_scope_loader(scope_id)
71 if scope_loader.isCurrent:
70 if scope_loader.isCurrent:
72 logger.info('The scope is already open.')
71 logger.info('The scope is already open.')
@@ -83,7 +82,7 @@ class Dash(emulators.UnityEmulatorBase):
83 'No scope found with id {0}'.format(scope_id))
82 'No scope found with id {0}'.format(scope_id))
84
83
85 def _get_scope_from_loader(self, loader):
84 def _get_scope_from_loader(self, loader):
86− if loader.scopeId == 'applications.scope':
85+ if loader.scopeId == 'clickscope':
87 return loader.select_single(DashApps)
86 return loader.select_single(DashApps)
88 else:
87 else:
89 return loader.select_single(GenericScopeView)
88 return loader.select_single(GenericScopeView)
tests/autopilot/unity8/shell/tests/test_emulators.py+8−14
@@ -63,8 +63,7 @@ class DashEmulatorTestCase(DashBaseTestCase):
63 def test_open_already_opened_scope(self):
63 def test_open_already_opened_scope(self):
64 scope_id = self._get_current_scope_id()
64 scope_id = self._get_current_scope_id()
65 with mock.patch.object(self.dash, 'pointing_device') as mock_pointer:
65 with mock.patch.object(self.dash, 'pointing_device') as mock_pointer:
66− scope = self.dash.open_scope(self._get_scope_name_from_id(
66+ scope = self.dash.open_scope(scope_id)
67− scope_id))
68
67
69 self.assertFalse(mock_pointer.called)
68 self.assertFalse(mock_pointer.called)
70 self._assert_scope_is_opened(scope, scope_id)
69 self._assert_scope_is_opened(scope, scope_id)
@@ -85,7 +84,7 @@ class DashEmulatorTestCase(DashBaseTestCase):
85 self.dash.open_scope(leftmost_scope)
84 self.dash.open_scope(leftmost_scope)
86
85
87 scope_id = self._get_rightmost_scope_id()
86 scope_id = self._get_rightmost_scope_id()
88− scope = self.dash.open_scope(self._get_scope_name_from_id(scope_id))
87+ scope = self.dash.open_scope(scope_id)
89 self._assert_scope_is_opened(scope, scope_id)
88 self._assert_scope_is_opened(scope, scope_id)
90
89
91 def _get_leftmost_scope_id(self):
90 def _get_leftmost_scope_id(self):
@@ -101,10 +100,6 @@ class DashEmulatorTestCase(DashBaseTestCase):
101 'QQuickItem')[0]
100 'QQuickItem')[0]
102 return item.get_children_by_type('QQuickLoader')
101 return item.get_children_by_type('QQuickLoader')
103
102
104− def _get_scope_name_from_id(self, scope_id):
105− if scope_id.endswith('.scope'):
106− return scope_id[:-6]
107−
108 def _get_rightmost_scope_id(self):
103 def _get_rightmost_scope_id(self):
109 scope_loaders = self._get_scope_loaders()
104 scope_loaders = self._get_scope_loaders()
110 rightmost_scope_loader = scope_loaders[0]
105 rightmost_scope_loader = scope_loaders[0]
@@ -114,23 +109,22 @@ class DashEmulatorTestCase(DashBaseTestCase):
114 return rightmost_scope_loader.scopeId
109 return rightmost_scope_loader.scopeId
115
110
116 def test_open_scope_to_the_left(self):
111 def test_open_scope_to_the_left(self):
117− rightmost_scope = self._get_scope_name_from_id(
118− self._get_rightmost_scope_id())
112+ rightmost_scope = self._get_rightmost_scope_id()
119 self.dash.open_scope(rightmost_scope)
113 self.dash.open_scope(rightmost_scope)
120
114
121 scope_id = self._get_leftmost_scope_id()
115 scope_id = self._get_leftmost_scope_id()
122− scope = self.dash.open_scope(self._get_scope_name_from_id(scope_id))
116+ scope = self.dash.open_scope(scope_id)
123 self._assert_scope_is_opened(scope, scope_id)
117 self._assert_scope_is_opened(scope, scope_id)
124
118
125 def test_open_generic_scope(self):
119 def test_open_generic_scope(self):
126− scope_id = 'home.scope'
120+ scope_id = 'scopes'
127− scope = self.dash.open_scope(self._get_scope_name_from_id(scope_id))
121+ scope = self.dash.open_scope(scope_id)
128 self._assert_scope_is_opened(scope, scope_id)
122 self._assert_scope_is_opened(scope, scope_id)
129 self.assertIsInstance(scope, dash_emulators.GenericScopeView)
123 self.assertIsInstance(scope, dash_emulators.GenericScopeView)
130
124
131 def test_open_applications_scope(self):
125 def test_open_applications_scope(self):
132− scope_id = 'applications.scope'
126+ scope_id = 'clickscope'
133− scope = self.dash.open_scope(self._get_scope_name_from_id(scope_id))
127+ scope = self.dash.open_scope(scope_id)
134 self._assert_scope_is_opened(scope, scope_id)
128 self._assert_scope_is_opened(scope, scope_id)
135 self.assertIsInstance(scope, dash_emulators.DashApps)
129 self.assertIsInstance(scope, dash_emulators.DashApps)
136
130