Exemplo n.º 1
0
    def pinch(marionette, locator, zoom, duration=200):
        """pinch method - works for gallery. Bug 1025167 is raised for the Browser pinch method.

        zoom = 'in' or 'out'
        level = level of zoom, 'low' or 'high'"""

        assert isinstance(marionette, object)
        screen = marionette.find_element(*locator)
        mid_x = screen.size['width'] / 2
        mid_y = screen.size['height'] / 2

        # default is zooming in
        init_index_x = mid_x
        init_index_y = mid_y
        init_thumb_x = mid_x
        init_thumb_y = mid_y
        disp_x = mid_x
        disp_y = mid_y

        if zoom == 'out':
            init_index_x = mid_x / 2
            init_index_y = mid_y / 2
            init_thumb_x = mid_x + mid_x / 2
            init_thumb_y = mid_y + mid_y / 2
            disp_x = -mid_x / 2
            disp_y = -mid_y / 2

        pinch(marionette, screen, init_index_x, init_index_y, init_thumb_x,
              init_thumb_y, -disp_x, -disp_y, disp_x, disp_y, duration)
        time.sleep(1)  # compensate for the time taken for pinch to complete
Exemplo n.º 2
0
    def pinch(self, locator, zoom, duration=200):
        """pinch method - works for gallery. Bug 1025167 is raised for the Browser pinch method.

        zoom = 'in' or 'out'
        level = level of zoom, 'low' or 'high'"""

        screen = self.marionette.find_element(*locator)
        mid_x = screen.size['width'] / 2
        mid_y = screen.size['height'] / 2

        # default is zooming in
        init_index_x = mid_x
        init_index_y = mid_y
        init_thumb_x = mid_x
        init_thumb_y = mid_y
        disp_x = mid_x
        disp_y = mid_y

        if zoom == 'out':
            init_index_x = mid_x / 2
            init_index_y = mid_y / 2
            init_thumb_x = mid_x + mid_x / 2
            init_thumb_y = mid_y + mid_y / 2
            disp_x = - mid_x / 2
            disp_y = - mid_y / 2

        pinch(self.marionette, screen, init_index_x, init_index_y, init_thumb_x, init_thumb_y,
              -disp_x, -disp_y, disp_x, disp_y, duration)
Exemplo n.º 3
0
    def pinch(marionette, locator, zoom, duration=200):
        """pinch method - works for gallery. Bug 1025167 is raised for the Browser pinch method.

        zoom = 'in' or 'out'
        level = level of zoom, 'low' or 'high'"""

        assert isinstance(marionette, object)
        screen = marionette.find_element(*locator)
        mid_x = screen.size['width'] / 2
        mid_y = screen.size['height'] / 2

        # default is zooming in
        init_index_x = mid_x
        init_index_y = mid_y
        init_thumb_x = mid_x
        init_thumb_y = mid_y
        disp_x = mid_x
        disp_y = mid_y

        if zoom == 'out':
            init_index_x = mid_x / 2
            init_index_y = mid_y / 2
            init_thumb_x = mid_x + mid_x / 2
            init_thumb_y = mid_y + mid_y / 2
            disp_x = - mid_x / 2
            disp_y = - mid_y / 2

        pinch(marionette, screen, init_index_x, init_index_y, init_thumb_x, init_thumb_y,
              -disp_x, -disp_y, disp_x, disp_y, duration)
        time.sleep(1)  # compensate for the time taken for pinch to complete
Exemplo n.º 4
0
    def pinch(self, locator, zoom, duration=200):
        """pinch method - works for gallery. Bug 1025167 is raised for the Browser pinch method.

        zoom = 'in' or 'out'
        level = level of zoom, 'low' or 'high'"""

        screen = self.marionette.find_element(*locator)
        mid_x = screen.size['width'] / 2
        mid_y = screen.size['height'] / 2

        # default is zooming in
        init_index_x = mid_x
        init_index_y = mid_y
        init_thumb_x = mid_x
        init_thumb_y = mid_y
        disp_x = mid_x
        disp_y = mid_y

        if zoom == 'out':
            init_index_x = mid_x / 2
            init_index_y = mid_y / 2
            init_thumb_x = mid_x + mid_x / 2
            init_thumb_y = mid_y + mid_y / 2
            disp_x = -mid_x / 2
            disp_y = -mid_y / 2

        pinch(self.marionette, screen, init_index_x, init_index_y,
              init_thumb_x, init_thumb_y, -disp_x, -disp_y, disp_x, disp_y,
              duration)