@@ -108,44 +108,47 @@ class Dash(emulators.UnityEmulatorBase):
108108 @autopilot_logging.log_action(logger.info)
109109 def _scroll_to_left_scope(self):
110110 original_index = self.dash_content_list.currentIndex
111− # Scroll on the border of the page header, because some scopes have
112− # contents that can be scrolled horizontally.
113− page_header = self._get_page_header()
114− border = page_header.select_single('QQuickBorderImage')
115− start_x = border.width / 3
116− stop_x = border.width / 3 * 2
117− start_y = stop_y = border.globalRect.y + border.height / 2
111+ dashContent = self.select_single(objectName="dashContent")
112+ start_x = dashContent.width / 3
113+ stop_x = dashContent.width / 3 * 2
114+ start_y = stop_y = dashContent.globalRect.y + 1
118115 self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
119116 self.dash_content_list.currentIndex.wait_for(original_index - 1)
120117
121− def _get_page_header(self):
122− return self.select_single('PageHeader', objectName='pageHeader')
123−
124118 @autopilot_logging.log_action(logger.info)
125119 def _scroll_to_right_scope(self):
126120 original_index = self.dash_content_list.currentIndex
127− # Scroll on the border of the page header, because some scopes have
128− # contents that can be scrolled horizontally.
129− page_header = self._get_page_header()
130− border = page_header.select_single('QQuickBorderImage')
131− start_x = border.width / 3 * 2
132− stop_x = border.width / 3
133− start_y = stop_y = border.globalRect.y + border.height / 2
121+ dashContent = self.select_single(objectName="dashContent")
122+ start_x = dashContent.width / 3 * 2
123+ stop_x = dashContent.width / 3
124+ start_y = stop_y = dashContent.globalRect.y + 1
134125 self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
135126 self.dash_content_list.currentIndex.wait_for(original_index + 1)
136127
137128 def enter_search_query(self, query):
129+ current_header = self._get_current_page_header()
130+ self.pointing_device.move(current_header.globalRect.x +
131+ current_header.width - current_header.height / 2,
132+ current_header.globalRect.y +
133+ current_header.height / 2)
134+ self.pointing_device.click()
135+ headerContainer = current_header.select_single(objectName="headerContainer")
136+ headerContainer.contentY.wait_for(0)
138137 search_text_field = self._get_search_text_field()
139138 search_text_field.write(query)
140− search_text_field.state.wait_for('idle')
139+ current_header.select_single(objectName="searchIndicator").running.wait_for(False)
141140
142141 def _get_search_text_field(self):
143− page_header = self._get_page_header()
144− search_container = page_header.select_single(
145− 'QQuickItem', objectName='searchContainer')
146− search_container.state.wait_for(
147− MatchesAny(Equals('narrowActive'), Equals('active')))
148− return search_container.select_single(toolkit_emulators.TextField)
142+ page_header = self._get_current_page_header()
143+ return page_header.select_single(objectName='searchTextField')
144+
145+ def _get_current_page_header(self):
146+ dashContentList = self.select_single(objectName="dashContentList")
147+ all_headers = dashContentList.select_many("QQuickLoader")
148+ for i in all_headers:
149+ if i.isCurrent:
150+ return i.select_single(objectName="pageHeader")
151+ return None
149152
150153
151154class GenericScopeView(emulators.UnityEmulatorBase):